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

@ -4,31 +4,58 @@ import { createContext, useContext } from 'react';
import type { Key } from './i18n';
import type { IconName } from './ui/icons';
export const APP_TABS = ['releases', 'catalog', 'prices', 'listings', 'art', 'health', 'reviews', 'testflight', 'growth', 'appinfo', 'checks', 'tools'] as const;
export const APP_TABS = ['releases', 'testflight', 'listings', 'art', 'appinfo', 'catalog', 'prices', 'reviews', 'games', 'health', 'growth', 'checks', 'tools'] as const;
export type AppTab = (typeof APP_TABS)[number];
/** Tabs of a store-only app: store reads only (catalog, prices, app info and checks need the app folder; listings and
* store art are the live ones; Growth shows the Product Page Optimization tests only). */
export const STORE_TABS: readonly AppTab[] = ['releases', 'listings', 'art', 'health', 'reviews', 'testflight', 'growth'];
export const tabsFor = (hasFolder: boolean): readonly AppTab[] => (hasFolder ? APP_TABS : STORE_TABS);
/** The five sections of an app, by job (docs IA): each holds sub views (the old tabs). The route keeps the sub id. */
export const SECTIONS = ['release', 'store', 'revenue', 'players', 'health'] as const;
export type AppSection = (typeof SECTIONS)[number];
export const SECTION_TABS: Record<AppSection, readonly AppTab[]> = {
release: ['releases', 'testflight'], store: ['listings', 'art', 'appinfo'], revenue: ['catalog', 'prices'], players: ['reviews', 'games'], health: ['health', 'growth', 'checks', 'tools'],
};
export const sectionOf = (tab: AppTab): AppSection => SECTIONS.find(s => SECTION_TABS[s].includes(tab)) ?? 'release';
export const SECTION_KEY: Record<AppSection, Key> = { release: 'sec.release', store: 'sec.store', revenue: 'sec.revenue', players: 'sec.players', health: 'sec.health' };
export const SECTION_ICON: Record<AppSection, IconName> = { release: 'rocket', store: 'image', revenue: 'coins', players: 'users', health: 'activity' };
/** Sub views of a store-only app: store reads only (catalog, prices, app info, checks and tools need the app folder;
* listings and store art are the live ones; Growth shows the Product Page Optimization tests only). */
export const STORE_TABS: readonly AppTab[] = ['releases', 'testflight', 'listings', 'art', 'reviews', 'health', 'growth'];
/** The sub views an app has: the folder decides most; Game services only for games. */
export const tabsFor = (hasFolder: boolean, game = false): readonly AppTab[] => (hasFolder ? APP_TABS : STORE_TABS).filter(x => x !== 'games' || (game && hasFolder));
/** The sections an app has (a section with no sub view is left out: Revenue for a store-only app). */
export const sectionsFor = (hasFolder: boolean, game = false): AppSection[] => { const tabs = tabsFor(hasFolder, game); return SECTIONS.filter(s => SECTION_TABS[s].some(x => tabs.includes(x))); };
export const subsOf = (s: AppSection, hasFolder: boolean, game = false): AppTab[] => { const tabs = tabsFor(hasFolder, game); return SECTION_TABS[s].filter(x => tabs.includes(x)); };
export const TAB_KEY: Record<AppTab, Key> = {
releases: 'tab.releases', catalog: 'tab.catalog', prices: 'tab.prices', listings: 'tab.listings', art: 'tab.art', health: 'tab.health', reviews: 'tab.reviews',
testflight: 'tab.testflight', growth: 'tab.growth', appinfo: 'tab.appinfo', checks: 'tab.checks', tools: 'tab.tools',
testflight: 'tab.testflight', growth: 'tab.growth', appinfo: 'tab.appinfo', checks: 'tab.checks', tools: 'tab.tools', games: 'tab.games',
};
export const TAB_ICON: Record<AppTab, IconName> = {
releases: 'rocket', catalog: 'tag', prices: 'coins', listings: 'text', art: 'grid', health: 'activity', reviews: 'message', testflight: 'plane', growth: 'chart',
appinfo: 'clipboard', checks: 'shield', tools: 'sliders',
appinfo: 'clipboard', checks: 'shield', tools: 'sliders', games: 'sparkle',
};
/** A place in an app from a link: an old tab id ("prices"), a section ("revenue", its first sub view) or
* "section/sub" ("store/art"). Unknown: Release. */
export function placeOf(v: string | undefined | null): AppTab {
if (!v) return 'releases';
const [a, b] = v.split('/');
if (b && (SECTIONS as readonly string[]).includes(a!) && SECTION_TABS[a as AppSection].includes(b as AppTab)) return b as AppTab;
if (APP_TABS.includes(a as AppTab)) return a as AppTab;
if ((SECTIONS as readonly string[]).includes(a!)) return SECTION_TABS[a as AppSection][0]!;
return 'releases';
}
export const WORKSPACE = ['apps', 'accounts', 'ignored', 'dependencies', 'settings'] as const;
export type WorkspaceScreen = (typeof WORKSPACE)[number];
export type Route = { screen: 'portfolio' } | { screen: 'app'; appId: string; tab: AppTab } | { screen: WorkspaceScreen; section?: string };
/** storebound://<screen> deep links and the dev-only start switch ("app:health" = first app, Health tab;
* "app:health:2" = second app; "settings:refresh" = a Settings section). `apps` are the app keys in list order. */
/** storebound://<screen> deep links and the dev-only start switch ("app:health" = first app, Health section;
* "app:store/art" = a sub view; "app:prices" = an old tab id; "app:health:2" = second app; "settings:refresh" = a Settings section). `apps` are the app keys in list order. */
export function parseStart(v: string, apps: string[]): Route | null {
const [screen, tab, n] = v.split(':');
const app = apps[Math.max(0, (Number(n) || 1) - 1)];
if (screen === 'app' && app) return { screen: 'app', appId: app, tab: APP_TABS.includes(tab as AppTab) ? tab as AppTab : 'releases' };
if (screen === 'app' && app) return { screen: 'app', appId: app, tab: placeOf(tab) };
if (screen === 'portfolio') return { screen: 'portfolio' };
if (!(WORKSPACE as readonly string[]).includes(screen ?? '')) return null;
return tab ? { screen: screen as WorkspaceScreen, section: tab } : { screen: screen as WorkspaceScreen };
@ -41,7 +68,7 @@ export function parseRouteJson(v: string): Route | null {
if (!o || typeof o !== 'object') return null;
const r = o as Record<string, unknown>;
if (r.screen === 'portfolio') return { screen: 'portfolio' };
if (r.screen === 'app') return typeof r.appId === 'string' && r.appId ? { screen: 'app', appId: r.appId, tab: APP_TABS.includes(r.tab as AppTab) ? r.tab as AppTab : 'releases' } : null;
if (r.screen === 'app') return typeof r.appId === 'string' && r.appId ? { screen: 'app', appId: r.appId, tab: placeOf(typeof r.tab === 'string' ? r.tab : null) } : null;
if (typeof r.screen === 'string' && (WORKSPACE as readonly string[]).includes(r.screen)) return typeof r.section === 'string' ? { screen: r.screen as WorkspaceScreen, section: r.section } : { screen: r.screen as WorkspaceScreen };
return null;
}