desktop: five sections by job (Release, Store page, Revenue, Players, Health), Game services view, sidebar by attention

- app view: 12 tabs become 5 sections, each with a header (what it is for, the one next step from state
  already read) and its sub views in a segmented control; 1-5 jump, Ctrl+Shift+[ ] cycle, Ctrl+K and the
  context menu list sections and sub views; old tab ids, section and section/sub links all resolve
- Players > Game services (games only): both stores, one row per leaderboard / achievement with its
  languages and each store's state, Game Center locale map, Play API-disabled state with the console plan
- games status --json: items, localeMap, playApiDisabled; inspect summary: games
- sidebar: apps grouped by attention / in progress / live / not on a store, one status line each, studio
  filter, workspace as a footer icon row
- boot check opens places like a person (section, then sub view)
This commit is contained in:
CRTkafa 2026-10-24 13:01:50 +08:00
parent 98cd1d3c92
commit 0ef27cf2e4
22 changed files with 918 additions and 115 deletions

View file

@ -1,16 +1,20 @@
// One app across both stores: header (icon, studio, ids, store state, pairing), then the tabs. A store-only app (no
// One app across both stores: header (icon, studio, ids, store state, pairing), then five sections by job (Release,
// Store page, Revenue, Players, Health; docs IA), each with a header (what it is for, the one next step) and its sub views. A store-only app (no
// app folder) shows its store reads (releases, health, reviews, TestFlight) read-only, with "Link a folder" and
// "Start an app folder here" to make it a full app.
import { useContextMenu, useMenuButton } from '../ui/ContextMenu';
import { appMenu, playUrlFor } from '../ui/app-menu';
import { useShowIgnored } from '../lib/show-ignored';
import { useState } from 'react';
import { GamesTab } from './tabs/Games';
import { SectionHead } from './SectionHead';
import { api, errorText } from '../api';
import { type Key, t } from '../i18n';
import { pairCandidates, type UnifiedApp, withLink, withPair, withStudio } from '../lib/identity';
import { attention, storeNow } from '../lib/model';
import { Hero, nextStep, Tabs } from '../ui/ds';
import { type AppTab, TAB_ICON, TAB_KEY, tabsFor, useNav } from '../nav';
import { isGameSummary } from '../lib/model';
import { type AppSection, type AppTab, SECTION_ICON, SECTION_KEY, SECTION_TABS, sectionOf, sectionsFor, subsOf, useNav } from '../nav';
import { useData } from '../store';
import { Icon } from '../ui/icons';
import { ErrorBoundary } from '../ui/ErrorBoundary';
@ -107,11 +111,15 @@ export function AppView({ app, tab }: { app: UnifiedApp; tab: AppTab }) {
const ios = e?.app?.platforms.ios ?? (app.ios ? { bundleId: app.ios.app.bundleId, ascAppId: app.ios.app.id } : null);
const android = e?.app?.platforms.android ?? (app.android ? { packageName: app.android.app.id } : null);
const name = (app.project && e?.app?.name) || app.name;
const tabs = tabsFor(!!app.project);
const game = isGameSummary(e?.summary);
const sections = sectionsFor(!!app.project, game);
const section = sectionOf(tab);
const ed = useEdits();
useUnsavedGuard();
const studio = d.studios.find(s => s.id === app.studio) ?? null;
const setTab = (x: AppTab) => nav.go({ screen: 'app', appId: app.key, tab: x });
const setSection = (x: AppSection) => setTab(subsOf(x, !!app.project, game)[0] ?? SECTION_TABS[x][0]!);
const editCount = (x: AppTab) => (EDIT_TABS[x] ? ed.count(app.project?.id ?? app.target, EDIT_TABS[x]) : 0);
const all = l?.release.all ?? [];
const iosNow = l ? storeNow(all, 'ios').now : null, androidNow = l ? storeNow(all, 'android').now : null;
const att = attention(app.key, app.name, e, l);
@ -137,19 +145,20 @@ export function AppView({ app, tab }: { app: UnifiedApp; tab: AppTab }) {
{android && <button className="btn btn-sm btn-ghost" onClick={() => open(playUrlFor(d, app))} title={t('app.consoleHint')}><Icon name="external" />Play Console</button>}
</>}
all={all} ios={!!ios} android={!!android} next={l?.release.next?.version ?? null}
compact={tab !== 'releases'}
compact={section !== 'release' || tab !== 'releases'}
cta={nextStep({ project: !!app.project, att, all, next: l?.release.next?.version ?? null })} onCta={setTab} />
<AppControls app={app} />
{!app.project && <StoreOnlyBanner app={app} />}
{app.project?.storeboundPin && <Notice tone="info" icon="info">{t('app.pinNotice', { pin: app.project.storeboundPin, app: d.info?.version ?? '' })}</Notice>}
{app.project?.missing ? <FolderMissing project={app.project} /> : <>
<div className="ds-app-sticky">
<Tabs label={t('app.sections', { name })} value={tab} onChange={setTab} items={tabs.map(x => {
const n = EDIT_TABS[x] ? ed.count(app.project?.id ?? app.target, EDIT_TABS[x]) : 0;
return { id: x, label: t(TAB_KEY[x]), icon: TAB_ICON[x], count: att.filter(a => a.tab === x && a.tone === 'bad').length, dot: n > 0, dotTitle: n ? t('ed.unsaved', { count: n }) : undefined };
<Tabs label={t('app.sections', { name })} value={section} onChange={setSection} items={sections.map((x, i) => {
const n = subsOf(x, !!app.project, game).reduce((a, s2) => a + editCount(s2), 0);
return { id: x, label: t(SECTION_KEY[x]), icon: SECTION_ICON[x], hint: String(i + 1), count: att.filter(a => a.tab && sectionOf(a.tab) === x && a.tone === 'bad').length, dot: n > 0, dotTitle: n ? t('ed.unsaved', { count: n }) : undefined };
})} />
</div>
<div role="tabpanel" id="tabpanel" aria-labelledby={`tab-${tab}`} className="stack" style={{ gap: 16 }}>
<SectionHead app={app} section={section} tab={tab} subs={subsOf(section, !!app.project, game)} att={att} all={all} next={l?.release.next?.version ?? null} unsaved={subsOf(section, !!app.project, game).reduce((a, s2) => a + editCount(s2), 0)} editCount={editCount} onTab={setTab} />
<div role="tabpanel" id="tabpanel" aria-labelledby={`tab-${section}`} className="stack" style={{ gap: 16 }}>
<ErrorBoundary key={tab} where={`tab ${tab}`}>
{tab === 'releases' && <ReleasesTab app={app} />}
{tab === 'catalog' && app.project && <CatalogTab project={app.project} />}
@ -160,6 +169,7 @@ export function AppView({ app, tab }: { app: UnifiedApp; tab: AppTab }) {
{tab === 'art' && !app.project && <LiveArt target={app.target} />}
{tab === 'health' && <HealthTab app={app} />}
{tab === 'reviews' && <ReviewsTab app={app} />}
{tab === 'games' && app.project && <GamesTab project={app.project} />}
{tab === 'testflight' && <TestFlightTab app={app} />}
{tab === 'growth' && <GrowthTab app={app} />}
{tab === 'appinfo' && app.project && <AppInfoTab project={app.project} />}

View file

@ -0,0 +1,60 @@
// The header of one app section (docs IA): the section's name, one line on what it is for, the single next step
// derived from state that is already read (lib/sections.ts), and the sub views as a segmented control (only when the
// section has more than one).
import type { ListingsResult, StoreRelease } from '../api';
import { t } from '../i18n';
import type { UnifiedApp } from '../lib/identity';
import type { Attention } from '../lib/model';
import { sectionNext } from '../lib/sections';
import { type AppSection, type AppTab, SECTION_ICON, SECTION_KEY, TAB_ICON, TAB_KEY } from '../nav';
import { useCachedRead, useData } from '../store';
import type { GameServicesStatus } from '../ui/GameServicesCard';
import { Icon } from '../ui/icons';
const PURPOSE: Record<AppSection, 'sec.release.for' | 'sec.store.for' | 'sec.revenue.for' | 'sec.players.for' | 'sec.health.for'> = {
release: 'sec.release.for', store: 'sec.store.for', revenue: 'sec.revenue.for', players: 'sec.players.for', health: 'sec.health.for',
};
export function SectionHead({ app, section, tab, subs, att, all, next, unsaved, editCount, onTab }: {
app: UnifiedApp; section: AppSection; tab: AppTab; subs: AppTab[]; att: Attention[]; all: StoreRelease[]; next: string | null; unsaved: number;
editCount: (t: AppTab) => number; onTab: (t: AppTab) => void;
}) {
const d = useData();
const e = d.statusFor(app);
const pid = app.project && !app.project.missing ? app.project.id : null;
// cached reads only: the header never starts a store call
const listings = useCachedRead<ListingsResult>(section === 'store' ? pid : null, 'project.listings');
const reviews = useCachedRead<{ reply?: unknown }[]>(section === 'players' ? app.target : null, 'reviews.list', { days: 30 });
const games = useCachedRead<GameServicesStatus>(section === 'players' && subs.includes('games') ? pid : null, 'games.status');
const validate = useCachedRead<{ findings?: { level: string }[] }>(section === 'health' || section === 'release' ? pid : null, 'validate');
const n = sectionNext(section, {
project: !!app.project, att, all, next, summary: e?.summary ?? null, catalog: (d.liveFor(app) ?? e)?.catalog ?? null, unsaved, listings,
reviews: Array.isArray(reviews) ? reviews : null, readiness: validate?.findings ? validate.findings.filter(f => f.level === 'blocker').length : null,
games: games ? { changes: (games.apple?.changes.length ?? 0) + (games.play?.changes.length ?? 0), blockers: games.findings.filter(f => f.level === 'error').length, apiOff: !!games.playApiDisabled } : null,
});
return (
<div className="sec-head" data-testid="section-head">
<div className="sec-head-t">
<h2 className="sec-head-name"><Icon name={SECTION_ICON[section]} />{t(SECTION_KEY[section])}</h2>
<p className="sec-head-for">{t(PURPOSE[section])}</p>
</div>
<div className={`sec-next tone-${n.tone}`} role="status" data-testid="section-next">
<Icon name={n.icon} />
<span className="sec-next-t">{n.text}</span>
{n.tab && n.tab !== tab && <button className="btn btn-sm" onClick={() => onTab(n.tab!)}>{t('next.open', { where: t(TAB_KEY[n.tab]) })}<Icon name="arrowRight" /></button>}
</div>
{subs.length > 1 && (
<div className="seg sec-subs" role="group" aria-label={t('sec.views', { section: t(SECTION_KEY[section]) })}>
{subs.map(x => {
const c = editCount(x);
return (
<button key={x} id={`sub-${x}`} type="button" aria-pressed={tab === x} aria-controls="tabpanel" onClick={() => onTab(x)}>
<Icon name={TAB_ICON[x]} />{t(TAB_KEY[x])}{c > 0 && <span className="ed-dot" title={t('ed.unsaved', { count: c })} />}
</button>
);
})}
</div>
)}
</div>
);
}

View file

@ -19,7 +19,6 @@ import { Bar, Chip, ErrorNotice, Notice, Skeleton } from '../../ui/kit';
import { EmptyState, Section } from '../../ui/ds';
import '../../styles/appinfo.css';
import { WriteButton } from '../../ui/WriteButton';
import { GameServicesCard } from '../../ui/GameServicesCard';
import { ascUrl } from '../AppView';
const AREA: Record<DeclAsk['area'], Key> = { dataSafety: 'ai.aDataSafety', appPrivacy: 'ai.aAppPrivacy', appInfo: 'ai.aAppInfo', encryption: 'ai.aEncryption', review: 'ai.aReview' };
@ -258,7 +257,6 @@ export function AppInfoTab({ project }: { project: Project }) {
</Section>
</div>
)}
<GameServicesCard project={project} />
<ConsoleSteps project={project} stores={d.stores} />
<p className="ai-foot">{t('ai.foot', { when: ago(r.at) })}</p>

View file

@ -0,0 +1,90 @@
// Players > Game services: Game Center (App Store) and Play Games Services (Google Play) for a game, from
// `games status --json` (cli/games-status.ts). The two store panels (switches, ids, counts, sync writes with dry run +
// confirm) are the GameServicesCard; below it one row per leaderboard / achievement with its languages and each
// store's state against the config, the Game Center locale map with suggestions, and the Play API-disabled state with
// the enable link and the console plan.
import { Fragment } from 'react';
import type { Project } from '../../api';
import { t } from '../../i18n';
import { useRead } from '../../store';
import { ConsolePlanButton } from '../../ui/ConsolePlan';
import { EmptyState, Section } from '../../ui/ds';
import { type GameAction, type GameItemRow, GameServicesCard, type GameServicesStatus } from '../../ui/GameServicesCard';
import { Icon, StoreGlyph } from '../../ui/icons';
import { Chip, Notice } from '../../ui/kit';
import { OpenLink } from '../../ui/OpenLink';
const ACTION_TONE: Record<GameAction, 'ok' | 'warn' | 'info'> = { keep: 'ok', update: 'warn', create: 'info' };
const ACTION_KEY = { keep: 'games.keep', update: 'games.update', create: 'games.create' } as const;
function StoreState({ on, plan, read }: { on: boolean; plan: { action: GameAction; changed: string[] } | null; read: boolean }) {
if (!on) return <span className="muted small">{t('games.notOnStore')}</span>;
if (!plan) return <span className="muted small">{read ? t('games.notListed') : t('games.notRead')}</span>;
return <Chip tone={ACTION_TONE[plan.action]} title={plan.changed.length && plan.action !== 'keep' ? plan.changed.join(', ') : undefined}>{t(ACTION_KEY[plan.action])}</Chip>;
}
function ItemsTable({ rows, appleRead, playRead }: { rows: GameItemRow[]; appleRead: boolean; playRead: boolean }) {
return (
<div className="table-wrap">
<table className="table">
<thead><tr>
<th>{t('games.item')}</th><th>{t('games.name')}</th><th className="num">{t('games.points')}</th><th>{t('games.languages')}</th>
<th><span className="row" style={{ gap: 4 }}><StoreGlyph store="ios" className="ic13" />{t('gs.gameCenter')}</span></th>
<th><span className="row" style={{ gap: 4 }}><StoreGlyph store="android" className="ic13" />{t('gs.playGames')}</span></th>
</tr></thead>
<tbody>
{rows.map(r => {
const locs = r.apple?.locales.filter(l => l.action !== 'keep') ?? [];
return (
<tr key={`${r.kind}:${r.id}`}>
<td><span className="row" style={{ gap: 6 }}><Icon name={r.kind === 'leaderboard' ? 'chart' : 'sparkle'} className="ic13" /><span className="mono-id small">{r.id}</span></span>
<div className="small muted">{t(r.kind === 'leaderboard' ? 'games.leaderboard' : 'games.achievement')}{r.hidden ? ` · ${t('games.hidden')}` : ''}</div></td>
<td>{r.name}</td>
<td className="num">{r.points ?? '–'}</td>
<td className="small">{r.locales.join(', ')}{locs.length > 0 && <div className="small muted">{t('games.localeChanges', { list: locs.map(l => `${l.locale} ${t(ACTION_KEY[l.action])}`).join(', ') })}</div>}</td>
<td><StoreState on={r.ios} plan={r.apple} read={appleRead} /></td>
<td><StoreState on={r.android} plan={r.play} read={playRead} /></td>
</tr>
);
})}
</tbody>
</table>
</div>
);
}
export function GamesTab({ project }: { project: Project }) {
const r = useRead<GameServicesStatus>(project.id, 'games.status', { network: true, title: t('gs.title') });
const s = r.data;
const rows = s?.items ?? [];
const appleRead = !!s?.apple && !s.apple.error, playRead = !!s?.play && !s.play.error;
const map = s?.localeMap;
return (
<>
{s?.playApiDisabled && (
<Notice tone="bad" icon="alertCircle" action={<div className="actions">
<button className="btn btn-sm btn-primary" onClick={() => r.refresh()} disabled={r.loading}><Icon name="refresh" className={r.loading ? 'spin' : undefined} />{t('games.checkAgain')}</button>
<ConsolePlanButton project={project} form="play-games-services" label={t('gs.setup')} />
</div>}>
<b>{t('games.apiOffTitle')}</b> {t('games.apiOffText', { api: s.playApiDisabled.title })} <OpenLink url={s.playApiDisabled.url} />
</Notice>
)}
<GameServicesCard project={project} read={r} />
<Section title={t('games.itemsTitle')} icon="chart" sub={t('games.itemsSub')}
actions={<button className="btn btn-sm" onClick={() => r.refresh()} disabled={r.loading} aria-busy={r.loading}><Icon name="refresh" className={r.loading ? 'spin' : undefined} />{t('games.refresh')}</button>}>
{rows.length ? <ItemsTable rows={rows} appleRead={appleRead} playRead={playRead} />
: <EmptyState icon="sparkle">{s ? t('games.noItems') : t('games.notReadYet')}</EmptyState>}
<p className="small muted" style={{ marginTop: 10 }}>{t('games.images')}</p>
</Section>
{map && (Object.keys(map.configured).length > 0 || map.suggested.length > 0) && (
<Section title={t('games.localeMap')} icon="globe" sub={t('games.localeMapSub')}>
<dl className="kv">
{Object.entries(map.configured).map(([k, v]) => <Fragment key={`k${k}`}><dt>{k}</dt><dd><span className="mono-id small">{v}</span> <Chip tone="ok">{t('games.mapSet')}</Chip></dd></Fragment>)}
{map.suggested.map(x => <Fragment key={`s${x.id}`}><dt>{x.id}</dt><dd><span className="mono-id small">{x.from} → {x.to}</span> <Chip tone="warn">{t('games.mapSuggested')}</Chip></dd></Fragment>)}
</dl>
{map.suggested.length > 0 && <p className="small muted" style={{ marginTop: 8 }}>{t('games.mapHint', { entries: map.suggested.map(x => `${x.id}: '${x.to}'`).join(', ') })}</p>}
</Section>
)}
</>
);
}