Desktop v2 screens: releases (store cards, stage stepper, rollout ring), submit checklist, TestFlight cards; listings as store pages with completeness, framed screenshots with issue badges, product cards, price matrix with gap shading; health tiles and issue cards, store-style review feed with rating distribution, growth funnel, readiness score with fix-first, tools grid, store-info sheet; settings, accounts, folders, dependencies and onboarding in the v2 language

This commit is contained in:
CRTkafa 2026-10-22 23:31:22 +08:00
parent ce939ee063
commit f131de9df2
47 changed files with 2309 additions and 927 deletions

View file

@ -3,6 +3,8 @@
// local tools, the CLI sidecar, privacy, keyboard shortcuts, updates and reset. A section list on the left jumps.
import { useEffect, useState } from 'react';
import { useScrollSpy } from '../ui/useScrollSpy';
import { PageHeader, Section } from '../ui/ds';
import '../styles/settings.css';
import { api, type CacheInfo, errorText, onUpdateProgress, type Settings as S, type UpdateInfo } from '../api';
import { type Key, t } from '../i18n';
import { ago, bytes, date, num } from '../lib/format';
@ -11,7 +13,7 @@ import { useNav } from '../nav';
import { usePrefs } from '../prefs-ctx';
import { useData } from '../store';
import { Icon, type IconName, StoreGlyph } from '../ui/icons';
import { AppIcon, Card, Chip, Kbd, MOD, Notice, Seg, StudioMark } from '../ui/kit';
import { AppIcon, Chip, Kbd, MOD, Notice, Seg, StudioMark } from '../ui/kit';
export const SECTIONS: [string, IconName, Key][] = [
['studios', 'building', 'set.studios'], ['pairing', 'link', 'set.pairing'], ['refresh', 'refresh', 'set.refresh'], ['cache', 'database', 'set.cache'],
@ -83,8 +85,8 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
const singles = storeOnly.filter(a => !(a.ios && a.android));
return (
<div className="page">
<div className="ph"><div><h1>{t('nav.settings')}</h1><p>{t('set.lead')}</p></div></div>
<div className="page scr-settings">
<PageHeader icon="settings" eyebrow={t('v2cfg.workspace')} title={t('nav.settings')} subtitle={t('set.lead')} />
{error && <Notice tone="bad">{error}</Notice>}
<div className="set-layout">
<nav className="set-nav" aria-label={t('set.sections')}>
@ -93,7 +95,7 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
))}
</nav>
<div className="stack set-body" style={{ gap: 16 }}>
<Card id="set-studios" title={t('set.studios')} icon="building" sub={t('set.studiosSub')} className="set-card" actions={<button className="btn btn-sm" onClick={() => nav.go({ screen: 'accounts' })}>{t('set.manage')}<Icon name="arrowRight" /></button>}>
<Section id="set-studios" title={t('set.studios')} icon="building" sub={t('set.studiosSub')} className="set-card" actions={<button className="btn btn-sm" onClick={() => nav.go({ screen: 'accounts' })}>{t('set.manage')}<Icon name="arrowRight" /></button>}>
{d.studios.length ? (
<div className="studio-sum">
{d.studios.map(st => {
@ -107,20 +109,20 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
})}
</div>
) : <p className="small muted">{t('set.noStudios')}</p>}
</Card>
</Section>
<Card id="set-pairing" title={t('set.pairing')} icon="link" sub={t('set.pairingSub')} pad={false} className="set-card">
<Section id="set-pairing" title={t('set.pairing')} icon="link" sub={t('set.pairingSub')} pad={false} className="set-card">
{storeOnly.length ? (
<table className="table">
<table className="table v2">
<thead><tr><th>{t('col.app')}</th><th>{t('set.pairedHow')}</th><th className="right"><span className="sr">{t('col.actions')}</span></th></tr></thead>
<tbody>{[...paired, ...singles].map(a => <PairRow key={a.key} app={a} all={d.apps} />)}</tbody>
</table>
) : <div className="card-body"><p className="small muted">{t('set.noStoreOnly')}</p></div>}
<div className="card-foot"><Icon name="eyeOff" />{t('set.ignoredLine', { count: d.apps.filter(a => a.ignored).length, accounts: d.overrides.ignored.filter(i => i.startsWith('account:')).length })}
<button className="link" onClick={() => nav.go({ screen: 'ignored' })}>{t('set.openIgnored')}</button></div>
</Card>
</Section>
<Card id="set-refresh" title={t('set.refresh')} icon="refresh" sub={t('set.refreshSub')} className="set-card">
<Section id="set-refresh" title={t('set.refresh')} icon="refresh" sub={t('set.refreshSub')} className="set-card">
<div className="form">
<Toggle id="auto-read" label={t('set.autoRead')} hint={t('set.autoReadHint')} checked={s.refresh.autoRead} onChange={v => set(x => ({ ...x, refresh: { ...x.refresh, autoRead: v } }))} />
<div className="field"><span className="legend">{t('set.everyMinutes')}</span>
@ -138,9 +140,9 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
<span className="small muted">{d.live ? t('foot.lastRead', { when: ago(d.live.at) }) : t('foot.neverRead')}</span>
</div>
</div>
</Card>
</Section>
<Card id="set-cache" title={t('set.cache')} icon="database" sub={t('set.cacheSub')} className="set-card">
<Section id="set-cache" title={t('set.cache')} icon="database" sub={t('set.cacheSub')} className="set-card">
<div className="form">
<dl className="kv">
<dt>{t('set.cacheSize')}</dt><dd>{cache ? `${bytes(cache.file_bytes)} · ${t('set.cacheRows', { count: cache.rows })}` : '–'}</dd>
@ -152,9 +154,9 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
<div className="actions"><button className="btn btn-sm" onClick={clear}><Icon name="trash" />{t('settings.clearCache')}</button></div>
<p className="small muted">{t('settings.dataText')}</p>
</div>
</Card>
</Section>
<Card id="set-appearance" title={t('settings.appearance')} icon="sun" className="set-card">
<Section id="set-appearance" title={t('settings.appearance')} icon="sun" className="set-card">
<div className="form">
<div className="field" role="group" aria-label={t('settings.language')}><span className="legend">{t('settings.language')}</span>
<Seg value={prefs.lang} onChange={lang => update({ ...prefs, lang })} label={t('settings.language')} options={[['system', t('settings.system')], ['en', 'English'], ['tr', 'Türkçe']]} /></div>
@ -163,9 +165,9 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
<div className="field" role="group" aria-label={t('settings.motion')}><span className="legend">{t('settings.motion')}</span>
<Seg value={prefs.motion} onChange={motion => update({ ...prefs, motion })} label={t('settings.motion')} options={[['system', t('settings.followSystem')], ['reduce', t('settings.reduce')]]} /></div>
</div>
</Card>
</Section>
<Card id="set-notifications" title={t('set.notifications')} icon="bell" sub={t('set.notificationsSub')} className="set-card">
<Section id="set-notifications" title={t('set.notifications')} icon="bell" sub={t('set.notificationsSub')} className="set-card">
<div className="form">
<Toggle id="n-rejected" label={t('set.nRejected')} hint={t('set.nRejectedHint')} checked={s.notify.rejected} onChange={v => set(x => ({ ...x, notify: { ...x.notify, rejected: v } }))} />
<Toggle id="n-approved" label={t('set.nApproved')} hint={t('set.nApprovedHint')} checked={s.notify.approved} onChange={v => set(x => ({ ...x, notify: { ...x.notify, approved: v } }))} />
@ -183,18 +185,18 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
<div className="actions"><button className="btn btn-sm" onClick={() => d.setMute(d.muteUntil > Date.now() ? 0 : 60)}><Icon name="bell" />{d.muteUntil > Date.now() ? t('set.unmute', { until: new Date(d.muteUntil).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) }) : t('set.muteHour')}</button></div>
<div className="actions"><button className="btn btn-sm" onClick={() => api.notify(t('set.testTitle'), t('set.testBody')).catch(e => setError(errorText(e)))}><Icon name="bell" />{t('set.testNotify')}</button></div>
</div>
</Card>
</Section>
<Card id="set-dependencies" title={t('nav.dependencies')} icon="package" className="set-card" actions={<button className="btn btn-sm" onClick={() => nav.go({ screen: 'dependencies' })}>{t('set.manage')}<Icon name="arrowRight" /></button>}>
<Section id="set-dependencies" title={t('nav.dependencies')} icon="package" className="set-card" actions={<button className="btn btn-sm" onClick={() => nav.go({ screen: 'dependencies' })}>{t('set.manage')}<Icon name="arrowRight" /></button>}>
{tools ? (
<div className="dep-sum">
{tools.tools.map(x => <span key={x.id} className="row small" style={{ gap: 6 }}><i className={`dot ${x.found ? 'ok' : ''}`} />{x.name}{x.version ? <span className="muted num">{x.version}</span> : null}{x.source === 'app' && <Chip tone="outline">{t('set.appCopy')}</Chip>}</span>)}
</div>
) : <p className="small muted">–</p>}
<p className="small muted" style={{ marginTop: 10 }}>{t('set.depsText')}</p>
</Card>
</Section>
<Card id="set-cli" title={t('set.cli')} icon="terminal" className="set-card">
<Section id="set-cli" title={t('set.cli')} icon="terminal" className="set-card">
<dl className="kv">
<dt>{t('settings.app')}</dt><dd>{d.info ? `storebound desktop ${d.info.version}${d.info.debug ? ` (${t('settings.debug')})` : ''} · ${d.info.platform}` : '–'}</dd>
<dt>CLI</dt><dd>{d.sidecar ? `storebound ${d.sidecar.version}` : d.sidecarError ?? t('foot.cliStarting')}</dd>
@ -202,9 +204,9 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
<dt>{t('set.state')}</dt><dd><span className="row" style={{ gap: 6 }}><i className={`dot ${d.sidecar?.running ? 'ok' : d.sidecarError ? 'bad' : ''}`} />{d.sidecar?.running ? t('set.running') : d.sidecarError ? t('foot.cliDown') : t('foot.cliStarting')}</span></dd>
<dt>{t('set.writes')}</dt><dd>{t('set.writesText')}</dd>
</dl>
</Card>
</Section>
<Card id="set-privacy" title={t('set.privacy')} icon="shield" className="set-card">
<Section id="set-privacy" title={t('set.privacy')} icon="shield" className="set-card">
<ul className="plain-list">
<li><Icon name="check" />{t('set.p1')}</li>
<li><Icon name="check" />{t('set.p2')}</li>
@ -215,9 +217,9 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
<button className="btn btn-sm" onClick={() => api.revealData().catch(e => setError(errorText(e)))}><Icon name="folder" />{t('set.reveal')}</button>
<button className="btn btn-sm btn-ghost" onClick={() => api.openExternal('https://storebound.dev/').catch(e => setError(errorText(e)))}><Icon name="external" />storebound.dev</button>
</div>
</Card>
</Section>
<Card id="set-shortcuts" title={t('settings.shortcuts')} icon="keyboard" className="set-card">
<Section id="set-shortcuts" title={t('settings.shortcuts')} icon="keyboard" className="set-card">
<dl className="shortcuts">
<dt>{t('settings.scPalette')}</dt><dd><Kbd keys={[MOD, 'K']} /></dd>
<dt>{t('nav.portfolio')}</dt><dd><Kbd keys={[MOD, '1']} /></dd>
@ -227,18 +229,18 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
<dt>{t('settings.scClose')}</dt><dd><Kbd keys={['Esc']} /></dd>
<dt>{t('set.scQuit')}</dt><dd><Kbd keys={[MOD, 'Q']} /></dd>
</dl>
</Card>
</Section>
<Card id="set-updates" title={t('set.updates')} icon="download" className="set-card">
<Section id="set-updates" title={t('set.updates')} icon="download" className="set-card">
<div className="form">
<div className="field"><span className="legend">{t('set.channel')}</span>
<Seg value={s.channel} label={t('set.channel')} onChange={channel => set(x => ({ ...x, channel }))} options={[['stable', t('set.stable')], ['beta', t('set.beta')]]} /></div>
<Updates />
<p className="small muted">{t('set.updatesText')}</p>
</div>
</Card>
</Section>
<Card id="set-reset" title={t('set.reset')} icon="rotate" className="set-card danger-card">
<Section id="set-reset" title={t('set.reset')} icon="rotate" className="set-card danger-card">
<div className="stack">
<p className="small muted">{t('set.resetText', { accounts: d.accounts.length, studios: d.studios.length, folders: d.projects.length })}</p>
<div className="actions">
@ -246,7 +248,7 @@ export function Settings({ onTheme: _onTheme, section }: { onTheme: () => void;
<button className="btn btn-sm btn-danger" onClick={reset}><Icon name="rotate" />{t('set.resetButton')}</button>
</div>
</div>
</Card>
</Section>
<p className="small muted">{t('set.footer', { n: num(d.apps.length) })}</p>
</div>
</div>