From 33e2101d2791bc34f7c45f684756cede7c40c81c Mon Sep 17 00:00:00 2001 From: CRT Date: Sat, 10 Oct 2026 19:34:47 +0000 Subject: [PATCH] Desktop D2 UI: design system, portfolio, release timeline, catalog parity, listings, health, reviews, TestFlight, checks, command palette, toasts, first-run guide, en + tr with i18n check, 7:1 theme check, dev fixture mode and screenshot harness --- .gitignore | 1 + apps/desktop/index.html | 1 + apps/desktop/scripts/screens.ts | 62 ++ apps/desktop/src/App.tsx | 293 ++++---- apps/desktop/src/api.ts | 65 +- apps/desktop/src/dev/fixtures.ts | 384 ++++++++++ apps/desktop/src/dev/switches.ts | 10 + apps/desktop/src/i18n/en.ts | 560 ++++++++++++++ apps/desktop/src/i18n/index.ts | 33 + apps/desktop/src/i18n/tr.ts | 562 ++++++++++++++ apps/desktop/src/lib/format.ts | 49 ++ apps/desktop/src/lib/model.ts | 239 ++++++ apps/desktop/src/main.tsx | 39 +- apps/desktop/src/nav.ts | 33 + apps/desktop/src/prefs-ctx.ts | 10 + apps/desktop/src/prefs.ts | 21 +- apps/desktop/src/screens/Accounts.tsx | 118 +-- apps/desktop/src/screens/AppFolders.tsx | 183 +++-- apps/desktop/src/screens/AppView.tsx | 161 ++-- apps/desktop/src/screens/Dependencies.tsx | 174 +++-- apps/desktop/src/screens/Onboarding.tsx | 204 +++++ apps/desktop/src/screens/Portfolio.tsx | 267 +++++-- apps/desktop/src/screens/Settings.tsx | 105 +-- apps/desktop/src/screens/tabs/Catalog.tsx | 84 +++ apps/desktop/src/screens/tabs/Checks.tsx | 58 ++ apps/desktop/src/screens/tabs/Health.tsx | 151 ++++ apps/desktop/src/screens/tabs/Listings.tsx | 93 +++ apps/desktop/src/screens/tabs/Releases.tsx | 116 +++ apps/desktop/src/screens/tabs/Reviews.tsx | 152 ++++ apps/desktop/src/screens/tabs/TestFlight.tsx | 80 ++ apps/desktop/src/store.tsx | 234 ++++++ apps/desktop/src/styles.css | 753 +++++++++++++++---- apps/desktop/src/ui/Palette.tsx | 73 ++ apps/desktop/src/ui/Toasts.tsx | 40 + apps/desktop/src/ui/icons.tsx | 92 +++ apps/desktop/src/ui/illustrations.tsx | 103 +++ apps/desktop/src/ui/kit.tsx | 160 ++++ apps/desktop/tests/model.test.ts | 146 ++++ apps/desktop/tests/prefs.test.ts | 68 +- apps/desktop/tests/theme.test.ts | 66 ++ apps/desktop/tests/webview.test.ts | 70 ++ docs/desktop.md | 56 +- tools/ci.ts | 6 +- tools/i18n-check.ts | 42 ++ 44 files changed, 5475 insertions(+), 742 deletions(-) create mode 100644 apps/desktop/scripts/screens.ts create mode 100644 apps/desktop/src/dev/fixtures.ts create mode 100644 apps/desktop/src/dev/switches.ts create mode 100644 apps/desktop/src/i18n/en.ts create mode 100644 apps/desktop/src/i18n/index.ts create mode 100644 apps/desktop/src/i18n/tr.ts create mode 100644 apps/desktop/src/lib/format.ts create mode 100644 apps/desktop/src/lib/model.ts create mode 100644 apps/desktop/src/nav.ts create mode 100644 apps/desktop/src/prefs-ctx.ts create mode 100644 apps/desktop/src/screens/Onboarding.tsx create mode 100644 apps/desktop/src/screens/tabs/Catalog.tsx create mode 100644 apps/desktop/src/screens/tabs/Checks.tsx create mode 100644 apps/desktop/src/screens/tabs/Health.tsx create mode 100644 apps/desktop/src/screens/tabs/Listings.tsx create mode 100644 apps/desktop/src/screens/tabs/Releases.tsx create mode 100644 apps/desktop/src/screens/tabs/Reviews.tsx create mode 100644 apps/desktop/src/screens/tabs/TestFlight.tsx create mode 100644 apps/desktop/src/store.tsx create mode 100644 apps/desktop/src/ui/Palette.tsx create mode 100644 apps/desktop/src/ui/Toasts.tsx create mode 100644 apps/desktop/src/ui/icons.tsx create mode 100644 apps/desktop/src/ui/illustrations.tsx create mode 100644 apps/desktop/src/ui/kit.tsx create mode 100644 apps/desktop/tests/model.test.ts create mode 100644 apps/desktop/tests/theme.test.ts create mode 100644 apps/desktop/tests/webview.test.ts create mode 100644 tools/i18n-check.ts diff --git a/.gitignore b/.gitignore index ed7d4a3d..3995e6c0 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ apps/desktop/dist/ apps/desktop/src-tauri/target/ apps/desktop/src-tauri/binaries/ apps/desktop/src-tauri/gen/ +apps/desktop/.screens/ .scratch/ diff --git a/apps/desktop/index.html b/apps/desktop/index.html index 573ef216..3036910d 100644 --- a/apps/desktop/index.html +++ b/apps/desktop/index.html @@ -4,6 +4,7 @@ + storebound diff --git a/apps/desktop/scripts/screens.ts b/apps/desktop/scripts/screens.ts new file mode 100644 index 00000000..157489b8 --- /dev/null +++ b/apps/desktop/scripts/screens.ts @@ -0,0 +1,62 @@ +#!/usr/bin/env bun +// Screenshots of every desktop screen in light and dark, from the Vite dev server in fixture mode (no Tauri, no store +// accounts), plus a few interaction checks (command palette, toast progress, keyboard focus). Dev tool only. +// cd apps/desktop && VITE_FIXTURES=1 bunx vite --port 1431 & +// bun scripts/screens.ts --base http://127.0.0.1:1431 --out [--only portfolio,app:health] [--themes light,dark] +// Uses playwright (root devDependency) with the installed Google Chrome (channel "chrome"). +import { mkdirSync } from 'node:fs'; +import { join } from 'node:path'; +import { chromium, type Page } from 'playwright'; + +const arg = (k: string, d: string) => { const i = process.argv.indexOf(`--${k}`); return i >= 0 ? process.argv[i + 1] ?? d : d; }; +const base = arg('base', 'http://127.0.0.1:1431'); +const out = arg('out', join(import.meta.dir, '..', '.screens')); +const only = arg('only', '').split(',').filter(Boolean); +const themes = arg('themes', 'light,dark').split(','); +const lang = arg('lang', 'en'); +const suffix = arg('suffix', ''); + +export const SCREENS: [string, string][] = [ + ['portfolio', 'portfolio'], ['releases', 'app:releases'], ['releases-2', 'app:releases:2'], ['catalog', 'app:catalog'], ['listings', 'app:listings'], + ['health', 'app:health'], ['reviews', 'app:reviews'], ['testflight', 'app:testflight'], ['checks', 'app:checks'], + ['apps', 'apps'], ['accounts', 'accounts'], ['dependencies', 'dependencies'], ['settings', 'settings'], + ['palette', 'palette'], ['welcome-1', 'welcome:1'], ['welcome-2', 'welcome:2'], ['welcome-3', 'welcome:3'], ['welcome-4', 'welcome:4'], ['welcome-5', 'welcome:5'], +]; + +async function settle(page: Page) { + await page.waitForLoadState('networkidle'); + await page.waitForTimeout(900); +} + +mkdirSync(out, { recursive: true }); +const browser = await chromium.launch({ channel: 'chrome', headless: true }); +const files: string[] = []; +for (const theme of themes) { + const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 1, colorScheme: theme === 'dark' ? 'dark' : 'light', reducedMotion: 'reduce' }); + const page = await ctx.newPage(); + const errors: string[] = []; + page.on('pageerror', e => errors.push(String(e))); + page.on('console', m => { if (m.type() === 'error') errors.push(m.text()); }); + for (const [name, start] of SCREENS) { + if (only.length && !only.includes(name)) continue; + await page.goto(`${base}/?start=${encodeURIComponent(start)}&theme=${theme}&lang=${lang}`); + await settle(page); + const f = join(out, `d2-${name}${suffix}-${theme}${lang === 'en' ? '' : `-${lang}`}.png`); + await page.screenshot({ path: f }); + files.push(f); + } + if (!only.length || only.includes('toast')) { + // a background job: Read the stores, caught mid-way with its progress toast + await page.goto(`${base}/?start=portfolio&theme=${theme}&lang=${lang}`); + await settle(page); + await page.getByRole('button', { name: /Read the stores|Mağazaları oku/ }).first().click(); + await page.waitForTimeout(900); + const f = join(out, `d2-toast${suffix}-${theme}${lang === 'en' ? '' : `-${lang}`}.png`); + await page.screenshot({ path: f }); + files.push(f); + } + if (errors.length) console.error(`${theme}: page errors:\n ${[...new Set(errors)].join('\n ')}`); + await ctx.close(); +} +await browser.close(); +console.log(files.join('\n')); diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index 7ebfccb9..f424edbe 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -1,156 +1,187 @@ -import { useCallback, useEffect, useState } from 'react'; -import { type Account, api, type AppStatus, errorText, onDeepLink, onProgress, type PortfolioResult, type Project, type SidecarStatus } from './api'; +// Shell: sidebar (apps with their icons, workspace), top bar (breadcrumbs, last read, refresh), the screen, the +// command palette (Cmd/Ctrl+K), toasts and the first-run welcome guide. +import { useCallback, useEffect, useMemo, useState } from 'react'; +import { FIXTURES, onDeepLink } from './api'; +import { devSwitch } from './dev/switches'; +import { type Key, t } from './i18n'; +import { ago } from './lib/format'; +import { APP_TABS, NavCtx, parseStart, type Route, sameRoute, TAB_ICON, TAB_KEY, WORKSPACE, type WorkspaceScreen } from './nav'; +import { usePrefs } from './prefs-ctx'; import { Accounts } from './screens/Accounts'; import { AppFolders } from './screens/AppFolders'; -import { AppView, type AppTab } from './screens/AppView'; +import { AppView } from './screens/AppView'; import { Dependencies } from './screens/Dependencies'; +import { Onboarding } from './screens/Onboarding'; import { Portfolio } from './screens/Portfolio'; import { Settings } from './screens/Settings'; +import { useData } from './store'; +import { Icon, type IconName, Mark } from './ui/icons'; +import { AppIcon, Kbd, MOD } from './ui/kit'; +import { type Command, Palette } from './ui/Palette'; +import { Toasts } from './ui/Toasts'; -/** - * App-centric navigation: Portfolio (every app) -> one App (Releases, Catalog, Listings, Health, Reviews, TestFlight), - * plus the workspace screens (app folders, store accounts, settings). - */ -export type Route = - | { screen: 'portfolio' } - | { screen: 'app'; appId: string; tab: AppTab } - | { screen: 'apps' } - | { screen: 'accounts' } - | { screen: 'dependencies' } - | { screen: 'settings' }; +const WS_ICON: Record = { apps: 'folder', accounts: 'key', dependencies: 'package', settings: 'settings' }; +const WS_KEY: Record = { apps: 'nav.apps', accounts: 'nav.accounts', dependencies: 'nav.dependencies', settings: 'nav.settings' }; -const WORKSPACE = [['apps', 'App folders'], ['accounts', 'Accounts'], ['dependencies', 'Dependencies'], ['settings', 'Settings']] as const; -const DEEP = ['portfolio', 'apps', 'accounts', 'dependencies', 'settings']; - -const ICON = { - portfolio: 'M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z', - app: 'M7 3h10a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM11 18h2', - apps: 'M3 6.5A1.5 1.5 0 0 1 4.5 5H9l2 2h8.5A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5z', - accounts: 'M15 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0zM3 21a8 8 0 0 1 16 0M17 11h4m-2-2v4', - dependencies: 'M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4a2 2 0 0 0 1-1.7zM3.3 7 12 12l8.7-5M12 22V12', - settings: 'M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z', -} as const; - -export function Icon({ d }: { d: string }) { - return ; -} - -function Mark() { - return ( - - ); -} - -/** Shared app data: app folders, accounts, sidecar state and the last portfolio read. */ -export interface Data { - projects: Project[]; - accounts: Account[]; - sidecar: SidecarStatus | null; - sidecarError: string | null; - portfolio: PortfolioResult | null; - portfolioBusy: string | null; - portfolioError: string | null; - refreshPortfolio: (live?: boolean) => Promise; - reload: () => Promise; - /** Home folder, for showing paths as ~/... */ - home: string | null; - /** The portfolio entry of an app folder (by project id). */ - statusOf: (p: Project) => AppStatus | undefined; -} - -/** Dev builds only (import.meta.env.DEV is false in release builds, so this is dropped): VITE_START=accounts, - * VITE_START=app:catalog ... opens that screen first, for screenshots and manual checks. */ -function startRoute(projects: Project[]): Route | null { - const v = import.meta.env.DEV ? String(import.meta.env.VITE_START ?? '') : ''; - const [screen, tab] = v.split(':'); - if (screen === 'app' && projects[0]) return { screen: 'app', appId: projects[0].id, tab: (tab as AppTab) || 'releases' }; - return DEEP.includes(screen ?? '') ? { screen: screen as 'portfolio' } : null; -} - -export function App() { +export function App({ onTheme }: { onTheme: () => void }) { + const d = useData(); + const { prefs, update } = usePrefs(); const [route, setRoute] = useState({ screen: 'portfolio' }); - const [projects, setProjects] = useState([]); - const [accounts, setAccounts] = useState([]); - const [sidecar, setSidecar] = useState(null); - const [sidecarError, setSidecarError] = useState(null); - const [portfolio, setPortfolio] = useState(null); - const [portfolioBusy, setPortfolioBusy] = useState(null); - const [portfolioError, setPortfolioError] = useState(null); - const [home, setHome] = useState(null); + const [palette, setPalette] = useState(false); + const [welcome, setWelcome] = useState(false); + const [started, setStarted] = useState(false); - const reload = useCallback(async () => { - const [p, a] = await Promise.all([api.projects(), api.accounts()]); - setProjects(prev => { if (!prev.length) { const r = startRoute(p); if (r) setRoute(r); } return p; }); - setAccounts(a); - }, []); + const go = useCallback((r: Route) => { setRoute(r); document.getElementById('content')?.scrollTo({ top: 0 }); }, []); - const refreshPortfolio = useCallback(async (live = false) => { - setPortfolioBusy(live ? 'Reading the stores' : 'Checking'); setPortfolioError(null); - try { setPortfolio(await api.portfolio(live)); } catch (e) { setPortfolioError(errorText(e)); } finally { setPortfolioBusy(null); } - }, []); + // first screen: dev switch (VITE_START), else the welcome guide on a first run + useEffect(() => { + if (!d.ready || started) return; + setStarted(true); + const v = devSwitch('start'); + if (v === 'welcome' || v.startsWith('welcome:')) { setWelcome(true); return; } + if (v === 'palette') setPalette(true); + const r = parseStart(v, d.projects.map(p => p.id)); + if (r) { go(r); return; } + if (!d.projects.length && !prefs.onboarded) setWelcome(true); + }, [d.ready, d.projects, started, go, prefs.onboarded]); useEffect(() => { - reload().catch(() => {}); - api.appInfo().then(i => setHome(i.home), () => {}); - api.sidecarStatus().then(s => { setSidecar(s); setSidecarError(null); }, e => setSidecarError(errorText(e))); - const un = onDeepLink(s => { if (DEEP.includes(s)) setRoute({ screen: s as 'portfolio' }); }); - const unP = onProgress(p => { if (p.total) setPortfolioBusy(b => (b ? `${b.replace(/ \d+\/\d+$/, '')} ${p.n}/${p.total}` : b)); }); - return () => { un.then(f => f()); unP.then(f => f()); }; - }, [reload]); - useEffect(() => { if (projects.length) refreshPortfolio(false); }, [projects.length, refreshPortfolio]); + const un = onDeepLink(s => { const r = parseStart(s, []); if (r) go(r); }); + return () => { un.then(f => f()); }; + }, [d.projects, go]); - // Keyboard: Cmd/Ctrl+1 portfolio, 2-4 workspace screens. + // keyboard: Cmd/Ctrl+K palette, Cmd/Ctrl+1 portfolio, 2-5 workspace, Cmd/Ctrl+Shift+[ ] app tabs useEffect(() => { const onKey = (e: KeyboardEvent) => { - if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey) return; - const order = ['portfolio', 'apps', 'accounts', 'dependencies', 'settings'] as const; - const s = order[Number(e.key) - 1]; - if (s) { e.preventDefault(); setRoute({ screen: s }); } + const mod = e.metaKey || e.ctrlKey; + if (mod && !e.shiftKey && !e.altKey && e.key.toLowerCase() === 'k') { e.preventDefault(); setPalette(p => !p); return; } + if (palette || welcome) return; + if (mod && !e.shiftKey && !e.altKey && /^[1-5]$/.test(e.key)) { + e.preventDefault(); + const n = Number(e.key); + go(n === 1 ? { screen: 'portfolio' } : { screen: WORKSPACE[n - 2]! }); + return; + } + if (mod && e.shiftKey && (e.key === '[' || e.key === ']' || e.key === '{' || e.key === '}') && route.screen === 'app') { + e.preventDefault(); + const i = APP_TABS.indexOf(route.tab) + (e.key === ']' || e.key === '}' ? 1 : -1); + go({ ...route, tab: APP_TABS[(i + APP_TABS.length) % APP_TABS.length]! }); + } }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); - }, []); + }, [palette, welcome, route, go]); - const statusOf = (p: Project) => portfolio?.apps.find(a => a.project === p.path || a.app?.id === p.path); - const data: Data = { projects, accounts, sidecar, sidecarError, portfolio, portfolioBusy, portfolioError, refreshPortfolio, reload, statusOf, home }; - const current = (r: Route) => (JSON.stringify(r) === JSON.stringify(route) || (r.screen === 'app' && route.screen === 'app' && r.appId === route.appId) ? 'page' : undefined); - const openApp = (p: Project) => setRoute({ screen: 'app', appId: p.id, tab: route.screen === 'app' ? route.tab : 'releases' }); - const app = route.screen === 'app' ? projects.find(p => p.id === route.appId) : undefined; + const closeWelcome = useCallback(() => { + setWelcome(false); + if (!prefs.onboarded) update({ ...prefs, onboarded: true }); + }, [prefs, update]); + + const app = route.screen === 'app' ? d.projects.find(p => p.id === route.appId) : undefined; + useEffect(() => { if (route.screen === 'app' && d.ready && !app) go({ screen: 'portfolio' }); }, [route, app, d.ready, go]); + + const commands = useMemo(() => { + const c: Command[] = []; + const G = { apps: t('palette.gApps'), go: t('palette.gGo'), tabs: t('palette.gTabs'), act: t('palette.gActions') }; + for (const p of d.projects) c.push({ id: `app-${p.id}`, group: G.apps, title: d.statusOf(p)?.app?.name ?? p.name, hint: t('palette.openApp'), app: { name: p.name, icon: d.icons[p.id] }, run: () => go({ screen: 'app', appId: p.id, tab: route.screen === 'app' ? route.tab : 'releases' }) }); + c.push({ id: 'go-portfolio', group: G.go, title: t('nav.portfolio'), icon: 'portfolio', hint: `${MOD} 1`, run: () => go({ screen: 'portfolio' }) }); + WORKSPACE.forEach((s, i) => c.push({ id: `go-${s}`, group: G.go, title: t(WS_KEY[s]), icon: WS_ICON[s], hint: `${MOD} ${i + 2}`, run: () => go({ screen: s }) })); + if (app) for (const tab of APP_TABS) c.push({ id: `tab-${tab}`, group: G.tabs, title: `${app.name} · ${t(TAB_KEY[tab])}`, icon: TAB_ICON[tab], run: () => go({ screen: 'app', appId: app.id, tab }) }); + else if (d.projects[0]) for (const p of d.projects) for (const tab of APP_TABS) c.push({ id: `tab-${p.id}-${tab}`, group: G.tabs, title: `${p.name} · ${t(TAB_KEY[tab])}`, icon: TAB_ICON[tab], keywords: 'tab', run: () => go({ screen: 'app', appId: p.id, tab }) }); + c.push({ id: 'act-live', group: G.act, title: t('action.readStores'), icon: 'refresh', keywords: 'refresh sync', run: () => { d.refreshPortfolio(true); } }); + c.push({ id: 'act-check', group: G.act, title: t('action.checkConfigs'), icon: 'shield', run: () => { d.refreshPortfolio(false); } }); + c.push({ id: 'act-add', group: G.act, title: t('action.addFolder'), icon: 'folderPlus', run: () => go({ screen: 'apps' }) }); + c.push({ id: 'act-account', group: G.act, title: t('action.addAccount'), icon: 'key', run: () => go({ screen: 'accounts' }) }); + c.push({ id: 'act-theme', group: G.act, title: t('action.toggleTheme'), icon: 'moon', keywords: 'dark light', run: onTheme }); + c.push({ id: 'act-welcome', group: G.act, title: t('action.welcome'), icon: 'sparkle', keywords: 'onboarding start guide', run: () => setWelcome(true) }); + return c; + }, [d, app, route, go, onTheme]); + + const crumbs: { label: string; to?: Route }[] = route.screen === 'portfolio' ? [{ label: t('nav.portfolio') }] + : route.screen === 'app' ? [{ label: t('nav.portfolio'), to: { screen: 'portfolio' } }, { label: app?.name ?? '', to: app ? { screen: 'app', appId: app.id, tab: 'releases' } : undefined }, { label: t(TAB_KEY[route.tab]) }] + : [{ label: t('nav.workspace') }, { label: t(WS_KEY[route.screen]) }]; + const lastRead = d.live?.at ?? null; + const nav = useMemo(() => ({ route, go, openPalette: () => setPalette(true), openWelcome: () => setWelcome(true) }), [route, go]); + const current = (r: Route) => (sameRoute(r, route) || (r.screen === 'app' && route.screen === 'app' && r.appId === route.appId) ? 'page' : undefined); return ( -
- +
+
+
+ {crumbs.map((c, i) => ( + + {i > 0 && } + {c.to && i < crumbs.length - 1 ? : {c.label}} + + ))} +
+ + {FIXTURES && {t('dev.fixtures')}} + {lastRead ? t('top.storesRead', { when: ago(lastRead) }) : t('top.storesNotRead')} + +
+
+ {route.screen === 'portfolio' && } + {route.screen === 'app' && app && } + {route.screen === 'apps' && } + {route.screen === 'accounts' && } + {route.screen === 'dependencies' && } + {route.screen === 'settings' && } +
-
Workspace
- {WORKSPACE.map(([s, label], i) => ( - - ))} -
- {sidecar?.running ? `CLI ${sidecar.version}` : sidecarError ? 'CLI not running' : 'Starting CLI'} - {projects.length} app{projects.length === 1 ? '' : 's'} · {accounts.length} account{accounts.length === 1 ? '' : 's'} -
- -
- {route.screen === 'portfolio' && setRoute({ screen: s })} />} - {route.screen === 'app' && app && setRoute({ screen: 'app', appId: app.id, tab })} />} - {route.screen === 'apps' && } - {route.screen === 'accounts' && } - {route.screen === 'dependencies' && } - {route.screen === 'settings' && } -
-
+ + {palette && setPalette(false)} />} + {welcome && } + + ); } diff --git a/apps/desktop/src/api.ts b/apps/desktop/src/api.ts index d5cb015f..881cc953 100644 --- a/apps/desktop/src/api.ts +++ b/apps/desktop/src/api.ts @@ -1,10 +1,13 @@ // The webview's only way out: the app commands of src-tauri/src/commands.rs. No plugin API is used from here. -import { invoke } from '@tauri-apps/api/core'; -import { listen, type UnlistenFn } from '@tauri-apps/api/event'; -import type { MethodDescriptor, PortfolioResult, ProgressParams, ToolResult } from '../../../cli/lib/desktop-protocol'; +// Dev builds can run on fixture data instead (VITE_FIXTURES=1, src/dev/fixtures.ts): import.meta.env.DEV is false in +// release builds, so that branch and the fixture module are dropped from them (tests/webview.test.ts checks dist/). +import { invoke as tauriInvoke } from '@tauri-apps/api/core'; +import { listen as tauriListen, type UnlistenFn } from '@tauri-apps/api/event'; +import type { DraftsResult, IconResult, ListingsResult, MethodDescriptor, PortfolioResult, ProgressParams, ToolResult } from '../../../cli/lib/desktop-protocol'; export type { - AppIdentity, AppStatus, CatalogParity, MethodDescriptor, PortfolioResult, ProgressParams, ReleaseTrain, StoreRelease, ToolResult, + AppIdentity, AppStatus, CatalogParity, DraftsResult, IconResult, ListingField, ListingLocale, ListingsResult, MethodDescriptor, PortfolioResult, + ProgressParams, ProjectSummary, ReleasePhase, ReleaseTrain, ReplyDraft, StoreRelease, ToolResult, } from '../../../cli/lib/desktop-protocol'; export interface AppInfo { version: string; identifier: string; platform: string; debug: boolean; home: string | null } @@ -16,6 +19,10 @@ export interface Project { id: string; path: string; name: string; playAccount: export type AccountKind = 'play' | 'apple'; export interface Account { id: string; label: string; kind: AccountKind; created: string } export interface WriteOutcome { confirmed: boolean; stage: 'dry-run' | 'dialog' | 'done'; dryRun: ToolResult; result?: ToolResult } +export interface CacheEntry { value: T; at: string } +export interface DownloadInfo { tool: 'ffmpeg' | 'chrome'; available: boolean; version: string | null; size: number | null; license: string; licenseUrl: string; source: string; installed: boolean; folder: string } +export interface DownloadEvent { job: string; tool: string; stage: 'resolve' | 'download' | 'verify' | 'unpack' | 'install' | 'done' | 'error' | 'cancelled'; received: number; total: number | null; message?: string } +export type { IconResult as Icon }; /** What a failed command rejects with (sidecar.rs `Fail`). */ export interface Fail { code: number; message: string; data?: unknown } @@ -26,28 +33,62 @@ export function errorText(e: unknown): string { return 'Something went wrong'; } +/** Dev-only fixture mode (VITE_FIXTURES=1): every command answered from src/dev/fixtures.ts. */ +export const FIXTURES: boolean = import.meta.env.DEV && !!import.meta.env.VITE_FIXTURES; + +async function invoke(cmd: string, args?: Record): Promise { + if (import.meta.env.DEV && import.meta.env.VITE_FIXTURES) return (await import('./dev/fixtures')).mockInvoke(cmd, args ?? {}); + return tauriInvoke(cmd, args); +} + +async function listen(event: string, cb: (payload: T) => void): Promise { + if (import.meta.env.DEV && import.meta.env.VITE_FIXTURES) return (await import('./dev/fixtures')).mockListen(event, cb as (p: unknown) => void); + return tauriListen(event, e => cb(e.payload)); +} + +let jobSeq = 0; +/** A fresh job id for one background run (progress events and cancel refer to it). */ +export const newJob = (kind: string): string => `${kind.replace(/[^A-Za-z0-9_.-]/g, '-').slice(0, 40)}-${Date.now().toString(36)}-${++jobSeq}`; + export const api = { appInfo: () => invoke('app_info'), sidecarStatus: () => invoke('sidecar_status'), /** Reads, or dry runs of writes (the host forces dryRun for writes coming from here). */ - call: (method: string, projectId?: string, params?: { args?: Record }) => - invoke('sidecar_call', { method, projectId: projectId ?? null, params: params ?? null }), + call: (method: string, projectId?: string, params?: { args?: Record }, job?: string) => + invoke('sidecar_call', { method, projectId: projectId ?? null, params: params ?? null, job: job ?? null }), + /** Last cached read (projectId "*" = the whole live portfolio); null when never read. */ + cached: (method: string, projectId: string, args: Record = {}) => + invoke | null>('cache_get', { method, projectId, args }), + clearCache: () => invoke('cache_clear'), + cancel: (job: string) => invoke('job_cancel', { job }), /** Dry run, native confirm dialog with that dry run, then the real run with a host-minted token. */ - writeWithConfirm: (method: string, projectId: string, args: Record = {}) => - invoke('write_with_confirm', { method, projectId, args }), + writeWithConfirm: (method: string, projectId: string, args: Record = {}, job?: string) => + invoke('write_with_confirm', { method, projectId, args, job: job ?? null }), projects: () => invoke('projects_list'), addProject: () => invoke('project_add'), + initProject: (profile: 'app' | 'game' | 'subscription-app') => invoke('project_init', { profile }), removeProject: (id: string) => invoke('project_remove', { id }), setProjectAccounts: (id: string, play: string | null, apple: string | null) => invoke('project_set_accounts', { id, play, apple }), accounts: () => invoke('accounts_list'), addPlayAccount: (label: string) => invoke('account_add_play', { label }), addAppleAccount: (label: string, keyId: string, issuerId: string) => invoke('account_add_apple', { label, keyId, issuerId }), removeAccount: (id: string) => invoke('account_remove', { id }), - portfolio: (live = false) => invoke('portfolio_status', { live }), + portfolio: (live = false, job?: string) => invoke('portfolio_status', { live, job: job ?? null }), openExternal: (url: string) => invoke('open_external', { url }), + toolsInfo: () => invoke('tools_info'), + installTool: (tool: 'ffmpeg' | 'chrome', job: string) => invoke('tools_install', { tool, job }), + uninstallTool: (tool: 'ffmpeg' | 'chrome') => invoke('tools_uninstall', { tool }), }; -export const onProgress = (cb: (p: ProgressParams) => void): Promise => - listen<{ params: ProgressParams }>('sidecar-progress', e => cb(e.payload.params)); +/** Typed reads of the project files (offline) and the stores (network). */ +export const reads = { + icon: (projectId: string) => api.call('project.icon', projectId), + listings: (projectId: string) => api.call('project.listings', projectId), + drafts: (projectId: string) => api.call('reviews.drafts', projectId), +}; -export const onDeepLink = (cb: (screen: string) => void): Promise => listen('deep-link', e => cb(e.payload)); +export interface ProgressEvent extends ProgressParams { job?: string } +export const onProgress = (cb: (p: ProgressEvent) => void): Promise => + listen<{ params: ProgressParams; job?: string }>('sidecar-progress', e => cb({ ...e.params, job: e.job })); +export const onDownload = (cb: (e: DownloadEvent) => void): Promise => listen('tool-download', cb); +export const onDeepLink = (cb: (screen: string) => void): Promise => listen('deep-link', cb); diff --git a/apps/desktop/src/dev/fixtures.ts b/apps/desktop/src/dev/fixtures.ts new file mode 100644 index 00000000..06c9226a --- /dev/null +++ b/apps/desktop/src/dev/fixtures.ts @@ -0,0 +1,384 @@ +// DEV-ONLY FIXTURE MODE (VITE_FIXTURES=1). Answers every app command with made-up data built around the two demo apps +// of this repo (examples/demo-game "Prism Puddle", examples/demo-app "Tidy Lists"), so every screen can be shown and +// screenshotted without store accounts, in a browser or in `tauri dev`. Nothing here is real store data; the window +// shows a "DEV FIXTURES" badge. src/api.ts only imports this module behind import.meta.env.DEV, so release builds do +// not contain it (tests/webview.test.ts checks the built files for FIXTURE_MARKER). +import type { Account, AppStatus, CacheEntry, DownloadEvent, DraftsResult, ListingField, ListingsResult, PortfolioResult, Project, ProjectSummary, StoreRelease, ToolResult } from '../api'; +import type { CatalogDiff, HealthSnapshot, MetricRow, Review, TestFlightStatus, ValidateResult } from '../lib/model'; + +export const FIXTURE_MARKER = 'storebound-dev-fixtures'; + +const HOME = '/home/you'; +const NOW = Date.now(); +const iso = (minutesAgo: number) => new Date(NOW - minutesAgo * 60_000).toISOString(); +const day = (daysAgo: number) => new Date(NOW - daysAgo * 86_400_000).toISOString().slice(0, 10); +const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)); + +// ---- events ---- +type Cb = (p: unknown) => void; +const listeners = new Map>(); +export async function mockListen(event: string, cb: Cb): Promise<() => void> { + if (!listeners.has(event)) listeners.set(event, new Set()); + listeners.get(event)!.add(cb); + return () => { listeners.get(event)?.delete(cb); }; +} +const emit = (event: string, payload: unknown) => { for (const cb of listeners.get(event) ?? []) cb(payload); }; +const cancelled = new Set(); + +// ---- icons (fixture art, drawn for the demo apps) ---- +const svg = (s: string) => `data:image/svg+xml;base64,${btoa(s)}`; +const ICONS: Record = { + 'p-prism': svg(``), + 'p-tidy': svg(``), +}; + +// ---- workspace ---- +let projects: Project[] = [ + { id: 'p-prism', path: `${HOME}/apps/prism-puddle`, name: 'Prism Puddle', playAccount: 'a-play', appleAccount: 'a-apple', added: iso(60 * 24 * 12) }, + { id: 'p-tidy', path: `${HOME}/apps/tidy-lists`, name: 'Tidy Lists', playAccount: 'a-play', appleAccount: 'a-apple', added: iso(60 * 24 * 5) }, +]; +let accounts: Account[] = [ + { id: 'a-play', label: 'Example Studio · Play', kind: 'play', created: iso(60 * 24 * 12) }, + { id: 'a-apple', label: 'Example Studio · App Store', kind: 'apple', created: iso(60 * 24 * 12) }, +]; +if (import.meta.env.VITE_FIXTURES === 'empty') { projects = []; accounts = []; } + +const SUMMARY: Record = { + 'p-prism': { + dir: `${HOME}/apps/prism-puddle`, config: `${HOME}/apps/prism-puddle/storebound.config.ts`, name: 'Prism Puddle', languages: ['en', 'tr', 'ja', 'ar'], + play: { packageName: 'com.example.prismpuddle' }, apple: { bundleId: 'com.example.prismpuddle', appId: '6400000001' }, platforms: ['ios', 'android'], + products: 4, productIds: ['coins_small', 'coins_large', 'no_ads', 'starter_pack'], subscriptions: 1, subscriptionIds: ['vip_pass_monthly'], + catalog: { ios: ['coins_small', 'coins_large', 'no_ads', 'starter_pack', 'vip_pass_monthly'], android: ['coins_small', 'coins_large', 'no_ads', 'starter_pack', 'vip_pass_monthly'] }, + shots: true, testflightGroups: 3, profile: 'game', icon: `${HOME}/apps/prism-puddle/store/icons/app-store-1024.png`, + }, + 'p-tidy': { + dir: `${HOME}/apps/tidy-lists`, config: `${HOME}/apps/tidy-lists/storebound.config.ts`, name: 'Tidy Lists', languages: ['en', 'tr'], + play: { packageName: 'com.example.tidylists' }, apple: { bundleId: 'com.example.tidylists', appId: '6400000002' }, platforms: ['ios', 'android'], + products: 1, productIds: ['tip_jar'], subscriptions: 2, subscriptionIds: ['pro_monthly', 'pro_yearly'], + catalog: { ios: ['tip_jar', 'pro_monthly', 'pro_yearly'], android: ['tip_jar', 'pro_monthly', 'pro_yearly'] }, + shots: true, testflightGroups: 2, profile: 'app', icon: `${HOME}/apps/tidy-lists/store/icons/app-store-1024.png`, + }, +}; + +const rel = (store: 'ios' | 'android', version: string, phase: StoreRelease['phase'], o: Partial = {}): StoreRelease => + ({ store, version, build: null, state: phase.toUpperCase(), phase, fraction: null, track: store === 'android' ? 'production' : null, ...o }); + +const RELEASES: Record = { + 'p-prism': [ + rel('ios', '2.4.0', 'review', { build: '52', state: 'WAITING_FOR_REVIEW', date: iso(60 * 26) }), + rel('ios', '2.3.0', 'rollout', { build: '48', state: 'READY_FOR_SALE', fraction: 0.2, phased: { state: 'ACTIVE', day: 5 }, date: iso(60 * 24 * 9) }), + rel('ios', '2.2.1', 'other', { build: '44', state: 'REPLACED_WITH_NEW_VERSION', date: iso(60 * 24 * 30) }), + rel('android', '2.4.0', 'testing', { build: '240', state: 'completed', track: 'internal' }), + rel('android', '2.3.0', 'rollout', { build: '231', state: 'inProgress', fraction: 0.2 }), + rel('android', '2.2.1', 'live', { build: '221', state: 'completed' }), + ], + 'p-tidy': [ + rel('ios', '1.5.0', 'draft', { build: '31', state: 'PREPARE_FOR_SUBMISSION', date: iso(60 * 20) }), + rel('ios', '1.4.2', 'live', { build: '29', state: 'READY_FOR_SALE', fraction: 1, phased: { state: 'COMPLETE', day: 7 }, date: iso(60 * 24 * 21) }), + rel('android', '1.5.0', 'testing', { build: '150', state: 'completed', track: 'beta' }), + rel('android', '1.4.2', 'live', { build: '142', state: 'completed' }), + ], +}; + +const train = (all: StoreRelease[], v: string) => ({ version: v, ios: all.find(r => r.store === 'ios' && r.version === v) ?? null, android: all.find(r => r.store === 'android' && r.version === v) ?? null }); + +function status(id: string, live: boolean): AppStatus { + const s = SUMMARY[id]!; + const all = RELEASES[id]!; + const prism = id === 'p-prism'; + return { + project: s.dir, ok: !prism, summary: s, + app: { id: s.dir, name: s.name, platforms: { ios: { bundleId: s.apple!.bundleId, ascAppId: s.apple!.appId }, android: { packageName: s.play!.packageName } } }, + check: prism ? { ok: true, problems: [], warnings: ['store/listing.md: ja-JP "what\'s new" is empty', 'store/appstore.md: ar-SA subtitle is 31 characters (limit 30)'] } : { ok: true, problems: [], warnings: [] }, + release: live ? (prism ? { source: 'live', current: train(all, '2.3.0'), next: train(all, '2.4.0'), all } : { source: 'live', current: train(all, '1.4.2'), next: train(all, '1.5.0'), all }) : { source: 'none', current: null, next: null }, + catalog: live + ? (prism ? { checked: 'live', products: 4, subscriptions: 1, onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: ['starter_pack'], ok: false } + : { checked: 'live', products: 1, subscriptions: 2, onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: [], ok: true }) + : { checked: 'config', products: s.products, subscriptions: s.subscriptions, onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: [], ok: true }, + storeErrors: {}, errors: [], + }; +} +const portfolio = (live: boolean): PortfolioResult => ({ apps: projects.map(p => status(p.id, live)), at: live ? iso(14) : iso(0) }); + +// ---- per-app store reads ---- +const series = (n: number, base: number, drift: number, seed: number): number[] => + Array.from({ length: n }, (_, i) => Math.max(0.0001, base + drift * (i / n) + Math.sin(i * 1.7 + seed) * base * 0.09 + Math.cos(i * 0.6 + seed) * base * 0.05)); +function rows(metric: 'Crash' | 'Anr', vals: number[], w28: number): MetricRow[] { + return vals.map((v, i) => ({ date: day(vals.length - i), dims: {}, values: { + [`userPerceived${metric}Rate`]: v, [`${metric === 'Crash' ? 'crash' : 'anr'}Rate`]: v * 1.4, distinctUsers: 18_000 + i * 140, + ...(i === vals.length - 1 ? { [`userPerceived${metric}Rate28dUserWeighted`]: w28 } : {}), + } })); +} +const HEALTH: Record = { + 'p-prism': { + date: day(0), + play: { + window: { start: day(28), end: day(1), days: 28 }, + crash: rows('Crash', series(28, 0.0068, 0.0032, 1), 0.0091), + anr: rows('Anr', series(28, 0.0024, 0.0004, 2), 0.0027), + devices: [{ model: 'Galaxy A12', crash: 0.061, users: 1900 }, { model: 'Redmi 9A', crash: 0.042, users: 1400 }, { model: 'Moto G Power (2021)', crash: 0.019, users: 900 }, { model: 'Pixel 6a', crash: 0.008, users: 2100 }, { model: 'Galaxy S23', crash: 0.004, users: 2600 }], + issues: [ + { type: 'CRASH', cause: 'java.lang.IllegalStateException', location: 'com.example.prismpuddle.combo.ComboMeter.update', reports: 412, users: 268, lastVersion: '231' }, + { type: 'ANR', cause: 'Input dispatching timed out', location: 'com.example.prismpuddle.MainActivity', reports: 133, users: 120, lastVersion: '231' }, + { type: 'CRASH', cause: 'java.lang.OutOfMemoryError', location: 'android.graphics.Bitmap.createBitmap', reports: 74, users: 61, lastVersion: '221' }, + ], + }, + apple: { + metrics: [ + { category: 'Hangs', metric: 'Hang rate', unit: 's/h', version: '2.3.0', value: 1.9, goal: 'fair' }, + { category: 'Launch', metric: 'Launch time', unit: 's', version: '2.3.0', value: 1.21, goal: 'good' }, + { category: 'Memory', metric: 'Peak memory', unit: 'MB', version: '2.3.0', value: 412, goal: 'fair' }, + { category: 'Disk', metric: 'Disk writes', unit: 'MB', version: '2.3.0', value: 38, goal: 'good' }, + { category: 'Battery', metric: 'Foreground energy', unit: '%/h', version: '2.3.0', value: 9.4, goal: 'poor' }, + ], + signatures: [ + { build: '48', type: 'HANGS', signature: 'ComboMeter.update(delta:) + 212', weight: 0.31 }, + { build: '48', type: 'DISK_WRITES', signature: 'SaveStore.flush() + 88', weight: 0.12 }, + { build: '47', type: 'LAUNCHES', signature: 'AssetCache.warmUp() + 64', weight: 0.07 }, + ], + betaCrashes: [{ build: '52', count: 3 }, { build: '51', count: 9 }, { build: '50', count: 5 }], + }, + }, + 'p-tidy': { + date: day(0), + play: { window: { start: day(28), end: day(1), days: 28 }, crash: rows('Crash', series(28, 0.0021, -0.0004, 3), 0.0019), anr: rows('Anr', series(28, 0.0009, 0.0001, 4), 0.001), devices: [{ model: 'Pixel 7', crash: 0.004, users: 800 }, { model: 'Galaxy A54', crash: 0.003, users: 1100 }], issues: [{ type: 'CRASH', cause: 'kotlin.UninitializedPropertyAccessException', location: 'com.example.tidylists.share.ShareSheet', reports: 21, users: 19, lastVersion: '142' }] }, + apple: { metrics: [{ category: 'Launch', metric: 'Launch time', unit: 's', version: '1.4.2', value: 0.62, goal: 'good' }, { category: 'Hangs', metric: 'Hang rate', unit: 's/h', version: '1.4.2', value: 0.2, goal: 'good' }], signatures: [], betaCrashes: [{ build: '31', count: 1 }] }, + }, +}; + +const R = (store: 'apple' | 'play', id: string, rating: number, title: string, body: string, where: string, daysAgo: number, reply?: string): Review => + ({ store, id, rating, title: title || undefined, body, where, date: new Date(NOW - daysAgo * 86_400_000 - id.length * 3_600_000).toISOString(), appVersion: store === 'play' ? '2.3.0' : undefined, ...(reply ? { reply: { text: reply, date: new Date(NOW - (daysAgo - 1) * 86_400_000).toISOString() } } : {}) }); +const REVIEWS: Record = { + 'p-prism': [ + R('apple', 'r-a1', 5, 'Calm and clever', 'The color puzzles are so relaxing. Love that it works offline on the train.', 'USA', 1), + R('play', 'r-p1', 2, 'Crashes after combo', 'Game closes when I reach a 20x combo on level 31. Lost my streak twice.', 'en', 1), + R('apple', 'r-a2', 4, 'Great, but ads', 'Really pretty game. The ad after every level is a bit much, I bought no ads.', 'GBR', 2, 'Thank you! Remove Ads turns them off for good, and you can restore it on a new device from Settings.'), + R('play', 'r-p2', 5, '', 'Çok güzel bir oyun, renkler harika ve müzik çok sakin.', 'tr', 2), + R('apple', 'r-a3', 1, 'Lost progress', 'Updated and my map progress is gone. Please fix.', 'DEU', 3), + R('play', 'r-p3', 3, 'Okay', 'Nice idea, later levels get repetitive. More star challenges please.', 'en', 4), + R('apple', 'r-a4', 5, '最高', '色がきれいで、毎日少しずつ遊んでいます。', 'JPN', 5), + R('play', 'r-p4', 4, 'Fun', 'Good time killer. Would love a dark mode for night play.', 'en', 5), + R('apple', 'r-a5', 5, 'Perfect puzzle game', 'No timers, no pressure. Exactly what I wanted.', 'CAN', 8, 'Thank you for playing! More calm levels arrive in 2.4.'), + R('apple', 'r-a6', 2, 'Hard to read', 'Text on the star map is tiny on my iPad.', 'AUS', 11), + R('play', 'r-p5', 5, '', 'Beautiful and offline. Five stars from me.', 'en', 6), + R('apple', 'r-a7', 4, 'Very nice', 'I like the new combo meter. Starter pack price feels high in Turkey.', 'TUR', 13), + ], + 'p-tidy': [ + R('apple', 't-a1', 5, 'Finally simple', 'Shared groceries list with my partner in seconds. No clutter.', 'USA', 1), + R('play', 't-p1', 4, 'Good', 'Works well. Widgets would be great.', 'en', 2), + R('apple', 't-a2', 5, 'Harika', 'Ailecek ortak listeleri burada tutuyoruz, çok pratik.', 'TUR', 3, 'Teşekkürler! Widget\'lar 1.5 ile geliyor.'), + R('play', 't-p2', 3, 'Sync delay', 'Sometimes the shared list takes a minute to update.', 'en', 4), + R('apple', 't-a3', 5, 'Pro is worth it', 'Unlimited lists and themes. Happy to support a small studio.', 'GBR', 9), + ], +}; + +const draft = (store: 'apple' | 'play', reviewId: string, reply: string, approved: boolean, issues: DraftsResult['drafts'][number]['issues'] = []) => + ({ file: `${HOME}/apps/prism-puddle/.storebound/replies/${store}-${reviewId}.md`, store, reviewId, approved, sent: null, reply, rating: null, title: null, body: null, date: null, issues }); +const DRAFTS: Record = { + 'p-prism': { + dir: `${HOME}/apps/prism-puddle/.storebound/replies`, problems: [], drafts: [ + draft('play', 'r-p1', 'Sorry about the lost streak! A fix for the crash at high combos is in 2.4.0, now in review. Thank you for the level number, it helped.', true), + draft('apple', 'r-a3', 'We are sorry! Your progress is saved in iCloud: open Settings > Restore progress. If it is still missing, write to support@example.com.', false, + [{ level: 'warn', msg: 'contains an email address: only your public support address, never a user\'s' }]), + draft('play', 'r-p3', '', false), + draft('apple', 'r-a6', 'Thanks! Change your rating to 5 stars and we will add bigger text with free coins.', false, + [{ level: 'error', msg: 'offers something for a rating or asks to change / give stars: not allowed (no incentives, no rating manipulation)' }]), + ], + }, + 'p-tidy': { dir: `${HOME}/apps/tidy-lists/.storebound/replies`, problems: [], drafts: [] }, +}; + +const TF: Record = { + 'p-prism': { + groups: [ + { id: 'g1', name: 'Studio team', internal: true, testers: 6, builds: 'all', publicLink: false }, + { id: 'g2', name: 'Friends and family', internal: false, testers: 42, builds: 3, publicLink: true }, + { id: 'g3', name: 'Press', internal: false, testers: 8, builds: 1, publicLink: false }, + ], + builds: [ + { version: '2.4.0', build: '52', processing: 'VALID', internal: 'IN_BETA_TESTING', external: 'WAITING_FOR_BETA_REVIEW', uploaded: iso(60 * 28) }, + { version: '2.4.0', build: '51', processing: 'VALID', internal: 'IN_BETA_TESTING', external: 'BETA_APPROVED', uploaded: iso(60 * 50) }, + { version: '2.3.0', build: '48', processing: 'VALID', internal: 'IN_BETA_TESTING', external: 'BETA_APPROVED', uploaded: iso(60 * 24 * 10) }, + { version: '2.3.0', build: '47', processing: 'VALID', internal: 'EXPIRED', external: 'EXPIRED', uploaded: iso(60 * 24 * 12) }, + { version: '2.2.1', build: '44', processing: 'VALID', internal: 'EXPIRED', external: 'EXPIRED', uploaded: iso(60 * 24 * 31) }, + ], + missingGroups: [], + }, + 'p-tidy': { + groups: [{ id: 'g4', name: 'Studio team', internal: true, testers: 4, builds: 'all', publicLink: false }, { id: 'g5', name: 'Beta club', internal: false, testers: 118, builds: 2, publicLink: true }], + builds: [{ version: '1.5.0', build: '31', processing: 'VALID', internal: 'IN_BETA_TESTING', external: 'IN_BETA_TESTING', uploaded: iso(60 * 22) }, { version: '1.4.2', build: '29', processing: 'VALID', internal: 'EXPIRED', external: 'EXPIRED', uploaded: iso(60 * 24 * 22) }], + missingGroups: ['Accessibility testers'], + }, +}; + +const CATALOG: Record = { + 'p-prism': { + errors: 1, + rows: [ + { id: 'starter_pack', store: 'play', level: 'error', code: 'missing', msg: 'not on Google Play (storebound play products)' }, + { id: 'vip_pass_monthly', store: 'apple', level: 'warn', code: 'locale', msg: 'no localization for ar-SA' }, + { id: 'coins_large', store: 'apple', level: 'warn', code: 'price', msg: 'no US price on the store' }, + { id: 'coins_small', store: 'apple', level: 'ok', code: 'ok', msg: 'consumable, 175 region prices' }, + { id: 'coins_small', store: 'play', level: 'ok', code: 'ok', msg: 'one_time, 173 region prices' }, + { id: 'coins_large', store: 'play', level: 'ok', code: 'ok', msg: 'one_time, 173 region prices' }, + { id: 'no_ads', store: 'apple', level: 'ok', code: 'ok', msg: 'non_consumable, 175 region prices' }, + { id: 'no_ads', store: 'play', level: 'ok', code: 'ok', msg: 'one_time, 173 region prices' }, + { id: 'starter_pack', store: 'apple', level: 'ok', code: 'ok', msg: 'consumable, 175 region prices' }, + { id: 'vip_pass_monthly', store: 'play', level: 'ok', code: 'ok', msg: 'subscription P1M, 173 region prices' }, + { id: 'legacy_hint_pack', store: 'apple', level: 'warn', code: 'extra', msg: 'on the store but not in the config (consumable, REMOVED_FROM_SALE)' }, + ], + parity: [ + { id: 'starter_pack', region: 'TR', currency: 'TRY', apple: 149.99, play: 99.99, diffPct: 33.3 }, + { id: 'no_ads', region: 'BR', currency: 'BRL', apple: 24.9, play: 19.99, diffPct: 19.7 }, + { id: 'coins_large', region: 'IN', currency: 'INR', apple: 899, play: 780, diffPct: 13.2 }, + ], + }, + 'p-tidy': { errors: 0, rows: ['tip_jar', 'pro_monthly', 'pro_yearly'].flatMap(id => (['apple', 'play'] as const).map(store => ({ id, store, level: 'ok' as const, code: 'ok', msg: 'matches' }))), parity: [] }, +}; + +const VALIDATE: Record = { + 'p-prism': { + blockers: 1, findings: [ + { store: 'play', level: 'blocker', code: 'product-missing', msg: 'starter_pack is in the config but not on Google Play', fix: 'storebound play products --only starter_pack (dry run first)' }, + { store: 'apple', level: 'warn', code: 'screenshots-ipad', msg: 'ar-SA has no 13" iPad screenshots', fix: 'storebound shots render --lang ar, then storebound apple screenshots --only ar-SA' }, + { store: 'apple', level: 'warn', code: 'whats-new', msg: '2.4.0 has no "What\'s New" for ja', fix: 'storebound whats-new --since v2.3.0' }, + ], + }, + 'p-tidy': { blockers: 0, findings: [] }, +}; + +function field(f: string, length: number, limit: number, required = true): ListingField { + return { field: f, length, limit, required, state: !length ? (required ? 'missing' : 'empty-optional') : length > limit ? 'over' : 'ok' }; +} +const LISTINGS: Record = { + 'p-prism': { + files: { play: `${HOME}/apps/prism-puddle/store/listing.md`, apple: `${HOME}/apps/prism-puddle/store/appstore.md` }, problems: [], + locales: [ + { lang: 'en', rtl: false, screenshots: 24, complete: 1, play: { code: 'en-US', fields: [field('title', 12, 30), field('short', 74, 80), field('full', 2210, 4000), field('whatsNew', 182, 500, false)] }, apple: { code: 'en-US', fields: [field('name', 12, 30), field('subtitle', 28, 30), field('promotionalText', 141, 170), field('keywords', 97, 100), field('description', 2380, 4000), field('whatsNew', 210, 4000, false)] } }, + { lang: 'tr', rtl: false, screenshots: 24, complete: 1, play: { code: 'tr-TR', fields: [field('title', 12, 30), field('short', 79, 80), field('full', 2390, 4000), field('whatsNew', 170, 500, false)] }, apple: { code: 'tr', fields: [field('name', 12, 30), field('subtitle', 26, 30), field('promotionalText', 150, 170), field('keywords', 99, 100), field('description', 2511, 4000), field('whatsNew', 190, 4000, false)] } }, + { lang: 'ja', rtl: false, screenshots: 24, complete: 0.89, play: { code: 'ja-JP', fields: [field('title', 9, 30), field('short', 41, 80), field('full', 1310, 4000), field('whatsNew', 0, 500, false)] }, apple: { code: 'ja', fields: [field('name', 9, 30), field('subtitle', 16, 30), field('promotionalText', 0, 170), field('keywords', 88, 100), field('description', 1402, 4000), field('whatsNew', 0, 4000, false)] } }, + { lang: 'ar', rtl: true, screenshots: 16, complete: 0.89, play: { code: 'ar', fields: [field('title', 11, 30), field('short', 66, 80), field('full', 1980, 4000), field('whatsNew', 150, 500, false)] }, apple: { code: 'ar-SA', fields: [field('name', 11, 30), field('subtitle', 31, 30), field('promotionalText', 120, 170), field('keywords', 93, 100), field('description', 2005, 4000), field('whatsNew', 160, 4000, false)] } }, + ], + }, + 'p-tidy': { + files: { play: `${HOME}/apps/tidy-lists/store/listing.md`, apple: `${HOME}/apps/tidy-lists/store/appstore.md` }, problems: [], + locales: [ + { lang: 'en', rtl: false, screenshots: 16, complete: 1, play: { code: 'en-US', fields: [field('title', 10, 30), field('short', 70, 80), field('full', 1500, 4000), field('whatsNew', 120, 500, false)] }, apple: { code: 'en-US', fields: [field('name', 10, 30), field('subtitle', 24, 30), field('promotionalText', 120, 170), field('keywords', 92, 100), field('description', 1610, 4000), field('whatsNew', 130, 4000, false)] } }, + { lang: 'tr', rtl: false, screenshots: 16, complete: 1, play: { code: 'tr-TR', fields: [field('title', 11, 30), field('short', 77, 80), field('full', 1620, 4000), field('whatsNew', 118, 500, false)] }, apple: { code: 'tr', fields: [field('name', 11, 30), field('subtitle', 27, 30), field('promotionalText', 133, 170), field('keywords', 96, 100), field('description', 1700, 4000), field('whatsNew', 128, 4000, false)] } }, + ], + }, +}; + +const TOOLS = [ + { id: 'ffmpeg', name: 'ffmpeg', found: true, path: `${HOME}/Library/Application Support/dev.storebound.desktop/tools/bin/ffmpeg`, version: '9.0.2', source: 'app', usedFor: 'icons, screenshot renders, app preview videos, frame crops', install: { kind: 'download', url: 'https://ffmpeg.org/download.html', note: '' } }, + { id: 'ffprobe', name: 'ffprobe', found: true, path: `${HOME}/Library/Application Support/dev.storebound.desktop/tools/bin/ffprobe`, version: '9.0.2', source: 'app', usedFor: 'checks of app preview videos and clips', install: { kind: 'download', url: 'https://ffmpeg.org/download.html', note: '' } }, + { id: 'chrome', name: 'Google Chrome', found: false, path: null, version: null, source: null, usedFor: 'screenshot renders, captions, web captures and recordings', install: { kind: 'download', url: 'https://googlechromelabs.github.io/chrome-for-testing/', note: '' } }, + { id: 'xcode', name: 'Xcode command line tools', found: true, path: '/Applications/Xcode.app/Contents/Developer', version: '27.0', source: 'system', usedFor: 'iOS builds, the iOS Simulator (simctl)', install: { kind: 'link', url: 'https://developer.apple.com/xcode/', note: '' } }, + { id: 'simctl', name: 'simctl (iOS Simulator)', found: true, path: '/Applications/Xcode.app/Contents/Developer/usr/bin/simctl', version: null, source: 'system', usedFor: 'iOS Simulator screenshots and recordings', install: { kind: 'link', url: 'https://developer.apple.com/xcode/', note: '' } }, + { id: 'adb', name: 'adb (Android platform tools)', found: false, path: null, version: null, source: null, usedFor: 'Android emulator / device screenshots and recordings', install: { kind: 'link', url: 'https://developer.android.com/tools/releases/platform-tools', note: '' } }, + { id: 'git', name: 'git', found: true, path: '/usr/bin/git', version: '2.55.0', source: 'system', usedFor: 'release notes from history, analytics compare', install: { kind: 'link', url: 'https://git-scm.com/downloads', note: '' } }, +]; +let chromeInstalled = false; + +const ok = (method: string, data: unknown): ToolResult => ({ method, ok: true, exitCode: 0, dryRun: false, command: `storebound ${method.replace('.', ' ')} --json`, output: '', data }); + +function read(method: string, id: string): ToolResult { + switch (method) { + case 'project.icon': return ok(method, { path: SUMMARY[id]?.icon ?? null, dataUrl: ICONS[id] ?? null }); + case 'project.listings': return ok(method, LISTINGS[id]); + case 'reviews.drafts': return ok(method, DRAFTS[id]); + case 'health': return ok(method, HEALTH[id]); + case 'reviews.list': return ok(method, REVIEWS[id]); + case 'apple.testflight_status': return ok(method, TF[id]); + case 'catalog.diff': return ok(method, CATALOG[id]); + case 'validate': return ok(method, VALIDATE[id]); + case 'check': return { method, ok: true, exitCode: 0, dryRun: false, command: 'storebound check', output: '12:00:01 [check] config ok: storebound.config.ts\n12:00:01 [check] listing: 4 languages\n12:00:01 [check] 0 problems, 2 warnings' }; + default: return { method, ok: false, exitCode: 1, dryRun: false, command: `storebound ${method}`, output: `fixture: no data for ${method}` }; + } +} + +const CACHED_AGO: Record = { health: 60 * 3, 'reviews.list': 45, 'apple.testflight_status': 60 * 5, 'catalog.diff': 60 * 26, validate: 60 * 2 }; +const NETWORK = new Set(['health', 'reviews.list', 'apple.testflight_status', 'catalog.diff', 'validate']); + +async function progressLines(job: string | null, lines: string[]) { + for (const line of lines) { await sleep(260); if (job) emit('sidecar-progress', { params: { requestId: 1, line, stream: 'stderr' }, job }); } +} + +export async function mockInvoke(cmd: string, a: Record): Promise { + const r = await answer(cmd, a); + return r as T; +} + +async function answer(cmd: string, a: Record): Promise { + const job = (a.job as string | null) ?? null; + switch (cmd) { + case 'app_info': return { version: '0.1.0', identifier: 'dev.storebound.desktop', platform: 'macos', debug: true, home: HOME }; + case 'sidecar_status': return { running: true, version: '0.5.0', protocol: 'storebound-desktop/1', methods: Array.from({ length: 64 }, (_, i) => ({ method: `m${i}` })), tools: { tools: TOOLS.map(x => (x.id === 'chrome' && chromeInstalled ? { ...x, found: true, name: 'Chrome for Testing', version: '141.0.7390.54', source: 'app' } : x)) } }; + case 'projects_list': return projects; + case 'accounts_list': return accounts; + case 'portfolio_status': { + if (a.live) { + for (let n = 1; n <= projects.length; n++) { + await sleep(700); + if (job && cancelled.has(job)) throw { code: -32800, message: 'Request cancelled' }; + emit('sidecar-progress', { params: { requestId: 0, n, total: projects.length, project: projects[n - 1]!.path }, job }); + } + return portfolio(true); + } + await sleep(120); + return portfolio(false); + } + case 'cache_get': { + const method = a.method as string, id = a.projectId as string; + if (id === '*' && method === 'portfolio.status') return projects.length ? { value: portfolio(true), at: iso(14) } satisfies CacheEntry : null; + if (method === 'project.icon') return ICONS[id] ? { value: read(method, id), at: iso(60) } : null; + if (CACHED_AGO[method] !== undefined && import.meta.env.VITE_FIXTURES !== 'cold') return { value: read(method, id), at: iso(CACHED_AGO[method]!) }; + return null; + } + case 'cache_clear': return null; + case 'sidecar_call': { + const method = a.method as string; + if (method === 'system.tools') return { tools: (await answer('sidecar_status', {}) as { tools: { tools: unknown[] } }).tools.tools }; + const id = a.projectId as string; + if (NETWORK.has(method)) await progressLines(job, [`[${method}] reading App Store Connect`, `[${method}] reading Google Play`, `[${method}] done`]); + else await sleep(150); + if (job && cancelled.has(job)) throw { code: -32800, message: 'Request cancelled' }; + return read(method, id); + } + case 'job_cancel': cancelled.add(a.job as string); return true; + case 'write_with_confirm': { + await sleep(500); + const method = a.method as string, args = (a.args ?? {}) as Record; + if (method === 'reviews.approve') { + const d = DRAFTS[a.projectId as string]?.drafts.find(x => x.file.endsWith(`/${String(args.file)}`)); + if (d) d.approved = !args.undo; + } + const res: ToolResult = { method, ok: true, exitCode: 0, dryRun: false, command: `storebound ${method.replace('.', ' ')}`, output: `[${method}] done (fixture)` }; + return { confirmed: true, stage: 'done', dryRun: { ...res, dryRun: true }, result: res }; + } + case 'project_add': case 'project_init': await sleep(300); return null; + case 'project_remove': projects = projects.filter(p => p.id !== a.id); return null; + case 'project_set_accounts': { const p = projects.find(x => x.id === a.id)!; p.playAccount = (a.play as string | null) ?? null; p.appleAccount = (a.apple as string | null) ?? null; return p; } + case 'account_add_play': case 'account_add_apple': return null; + case 'account_remove': accounts = accounts.filter(x => x.id !== a.id); return null; + case 'open_external': return null; + case 'tools_info': return [ + { tool: 'ffmpeg', available: true, version: '9.0.2', size: 56_713_400, license: 'GPL-3.0-or-later (ffmpeg built with GPL components)', licenseUrl: 'https://ffmpeg.org/legal.html', source: 'https://ffmpeg.martin-riedl.de/', installed: true, folder: 'tools/bin' }, + { tool: 'chrome', available: true, version: null, size: null, license: 'Chromium BSD-style license and third-party notices; Google Chrome for Testing terms', licenseUrl: 'https://github.com/GoogleChromeLabs/chrome-for-testing#readme', source: 'https://googlechromelabs.github.io/chrome-for-testing/', installed: chromeInstalled, folder: 'tools/chrome' }, + ]; + case 'tools_install': { + const total = 168_000_000; + const ev = (stage: DownloadEvent['stage'], received: number) => emit('tool-download', { job: String(a.job), tool: String(a.tool), stage, received, total } satisfies DownloadEvent); + ev('resolve', 0); await sleep(400); + for (let i = 1; i <= 20; i++) { + if (cancelled.has(a.job as string)) { ev('cancelled', 0); throw 'cancelled'; } + ev('download', (total * i) / 20); await sleep(140); + } + ev('unpack', total); await sleep(400); ev('verify', total); await sleep(400); ev('install', total); await sleep(200); + if (a.tool === 'chrome') chromeInstalled = true; + return a.tool === 'chrome' ? 'Chrome for Testing 141.0.7390.54' : 'ffmpeg version 9.0.2'; + } + case 'tools_uninstall': if (a.tool === 'chrome') chromeInstalled = false; return null; + default: throw { code: -1, message: `fixture: ${cmd} not mocked` }; + } +} diff --git a/apps/desktop/src/dev/switches.ts b/apps/desktop/src/dev/switches.ts new file mode 100644 index 00000000..6277b5ef --- /dev/null +++ b/apps/desktop/src/dev/switches.ts @@ -0,0 +1,10 @@ +// Dev-only switches for screenshots and manual checks: VITE_START / VITE_THEME / VITE_LANG / VITE_AUTORUN, or the same +// names as URL query parameters (?start=app:health&theme=dark&lang=tr) in the Vite dev server. Release builds compile +// import.meta.env.DEV to false, so this always answers "" there. +export type Switch = 'start' | 'theme' | 'lang' | 'autorun'; + +export function devSwitch(name: Switch): string { + if (!import.meta.env.DEV) return ''; + const q = typeof location !== 'undefined' ? new URLSearchParams(location.search).get(name) : null; + return q ?? String((import.meta.env as Record)[`VITE_${name.toUpperCase()}`] ?? ''); +} diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts new file mode 100644 index 00000000..372bf62d --- /dev/null +++ b/apps/desktop/src/i18n/en.ts @@ -0,0 +1,560 @@ +// English UI strings (the source catalog). Placeholders: {name}. Plural: a "_one" entry for a count of 1. +export const en = { + 'a11y.skip': 'Skip to content', + 'a11y.breadcrumbs': 'You are here', + + 'nav.sections': 'Sections', + 'nav.portfolio': 'Portfolio', + 'nav.appsLabel': 'Apps', + 'nav.workspace': 'Workspace', + 'nav.apps': 'App folders', + 'nav.accounts': 'Accounts', + 'nav.dependencies': 'Dependencies', + 'nav.settings': 'Settings', + 'nav.noApps': 'No apps yet', + 'nav.problems': '{count} problems', + 'nav.problems_one': '1 problem', + + 'tab.releases': 'Releases', + 'tab.catalog': 'Catalog', + 'tab.listings': 'Listings', + 'tab.health': 'Health', + 'tab.reviews': 'Reviews', + 'tab.testflight': 'TestFlight', + 'tab.checks': 'Checks', + + 'profile.app': 'App', + 'profile.game': 'Game', + 'profile.subscription-app': 'Subscription app', + + 'foot.cli': 'CLI {version} running', + 'foot.cliDown': 'CLI not running', + 'foot.cliStarting': 'Starting the CLI', + 'foot.lastRead': 'Stores read {when}', + 'foot.neverRead': 'Stores not read yet', + + 'top.storesRead': 'Stores read {when}', + 'top.storesNotRead': 'Stores not read', + 'dev.fixtures': 'DEV FIXTURES', + 'dev.fixturesHint': 'Development build on fixture data: nothing here comes from a store. Release builds have no fixture mode.', + + 'action.readStores': 'Read the stores', + 'action.reading': 'Reading', + 'action.readStoresHint': 'Read-only: App Store Connect and Google Play status of every app, with each app\'s own accounts', + 'action.checkConfigs': 'Check configs', + 'action.addFolder': 'Add app folder', + 'action.addAccount': 'Add a store account', + 'action.toggleTheme': 'Switch light / dark', + 'action.welcome': 'Open the welcome guide', + 'action.refresh': 'Refresh', + + 'palette.title': 'Command palette', + 'palette.button': 'Search or jump to', + 'palette.placeholder': 'Jump to an app, a tab or a screen, or run an action', + 'palette.results': 'Results', + 'palette.none': 'Nothing matches "{q}"', + 'palette.move': 'move', + 'palette.open': 'open', + 'palette.toggle': 'open / close', + 'palette.gApps': 'Apps', + 'palette.gGo': 'Go to', + 'palette.gTabs': 'App tabs', + 'palette.gActions': 'Actions', + 'palette.openApp': 'Open', + + 'common.loading': 'Loading', + 'common.unknown': 'Unknown', + 'common.cancel': 'Cancel', + 'common.close': 'Close', + 'common.exit': 'Exit code {code}', + 'common.cachedFrom': 'Last read {when} (saved copy)', + 'common.readWhen': 'Read {when}', + 'common.readFailedKeep': 'The last read failed, so this shows the previous one: {error}', + + 'time.justNow': 'just now', + 'time.never': 'never', + + 'toast.readingStores': 'Reading the stores', + 'toast.readingStoresDetail': 'App Store Connect and Google Play, read-only', + 'toast.readDone': 'Stores read', + 'toast.readDoneDetail': '{count} apps up to date', + 'toast.readDoneDetail_one': '1 app up to date', + 'toast.readDonePartial': 'Stores read, with gaps', + 'toast.readDonePartialDetail': '{count} apps could not be read on a store; they show as unknown', + 'toast.readDonePartialDetail_one': '1 app could not be read on a store; it shows as unknown', + 'toast.readFailed': 'Reading the stores failed', + 'toast.cancelled': 'Cancelled', + 'toast.reading': 'Reading', + 'toast.readingDetail': 'Read-only', + 'toast.readOk': '{what} read', + 'toast.readFailedWhat': 'Reading {what} failed', + + 'write.dryFailed': 'The dry run failed, nothing was written', + 'write.failed': 'Not applied', + + 'phase.none': 'Not on this store', + 'phase.live': 'Live', + 'phase.rollout': 'Rollout', + 'phase.phased': 'Phased', + 'phase.halted': 'Halted', + 'phase.paused': 'Paused', + 'phase.approved': 'Approved', + 'phase.review': 'In review', + 'phase.rejected': 'Rejected', + 'phase.testing': 'Testing', + 'phase.draft': 'Draft', + 'phase.other': 'Other', + + 'stage.build': 'Build', + 'stage.testing': 'Testing', + 'stage.review': 'Review', + 'stage.live': 'Live', + 'stage.rollout': 'Rollout', + + 'check.notChecked': 'Not checked', + 'check.notLoaded': 'Config not loaded', + 'check.problems': '{count} problems', + 'check.problems_one': '1 problem', + 'check.warnings': '{count} warnings', + 'check.warnings_one': '1 warning', + 'check.ok': 'Config OK', + + 'app.notSetUp': 'not set up', + 'app.notOnStore': 'Not on this store', + 'app.sections': '{name} sections', + 'app.consoleHint': 'Submit, release and publish happen in the store console', + + 'portfolio.lead': 'Every app in this workspace on the App Store and Google Play.', + 'portfolio.sub': '{count} apps · {stores} store listings', + 'portfolio.sub_one': '1 app · {stores} store listings', + 'portfolio.emptyTitle': 'Add your first app', + 'portfolio.emptyText': 'storebound works on app folders: one storebound.config.ts per app, for iOS and Android. Add a folder that has one, or start a new one from the templates.', + 'portfolio.notReadNotice': 'Releases, rollouts and catalog parity need one read of the stores. It is read-only and uses each app\'s own accounts.', + 'portfolio.apps': 'Apps', + 'portfolio.appsSub': 'Release state from the stores, read {when}', + 'portfolio.appsSubOffline': 'Config only: read the stores for releases', + 'portfolio.unreadable': 'Unreadable', + 'portfolio.noVersion': 'No version yet', + 'portfolio.noNext': 'Nothing in flight', + 'portfolio.thenNext': 'next {version} · {phase}', + 'portfolio.products': '{count} products', + 'portfolio.products_one': '1 product', + 'portfolio.subs': '{count} subs', + 'portfolio.subs_one': '1 sub', + 'portfolio.inParity': 'In parity', + 'portfolio.differs': '{count} differ', + 'portfolio.differs_one': '1 differs', + 'portfolio.configOnly': 'Not compared yet', + 'portfolio.attention': 'Needs attention', + 'portfolio.attentionSub': 'Problems first, then warnings', + 'portfolio.allClear': 'Nothing needs attention', + 'portfolio.allClearText': 'Configs check out and no store reported a problem in the last read.', + 'portfolio.workspace': 'Workspace', + 'portfolio.healthNotRead': 'Not read', + 'portfolio.healthNoPlay': 'iOS only', + 'portfolio.healthTitle': 'Last 14 days, user-perceived, read {when}', + 'portfolio.accounts': '{play} Google Play · {apple} App Store Connect', + 'portfolio.storesRead': 'Stores read', + 'portfolio.tools': 'Local tools', + 'portfolio.toolsFound': '{found} of {total} found', + + 'kpi.apps': 'Apps', + 'kpi.appsSub': '{ios} on iOS · {android} on Android', + 'kpi.live': 'Live versions', + 'kpi.liveSub': 'across {count} store listings', + 'kpi.rolling': 'Rolling out', + 'kpi.review': 'In review', + 'kpi.attention': 'Needs attention', + 'kpi.blockers': '{count} blockers', + 'kpi.blockers_one': '1 blocker', + 'kpi.noBlockers': 'No blockers', + 'kpi.none': 'None', + 'kpi.notRead': 'Read the stores to see this', + + 'legend.done': 'done', + 'legend.stages': 'Build · Testing · Review · Live · Rollout', + + 'col.app': 'App', + 'col.next': 'Next version', + 'col.catalog': 'Catalog', + 'col.crash': 'Crash rate', + 'col.config': 'Config', + 'col.version': 'Version', + 'col.build': 'Build', + 'col.versionCode': 'Version code', + 'col.track': 'Track', + 'col.item': 'Item', + 'col.type': 'Type', + 'col.priceGap': 'Price gap', + 'col.region': 'Region', + 'col.diff': 'Difference', + 'col.language': 'Language', + 'col.issue': 'Issue', + 'col.reports': 'Reports', + 'col.users': 'Users', + 'col.metric': 'Metric', + 'col.value': 'Value', + 'col.goal': 'Goal', + 'col.name': 'Name', + 'col.store': 'Store', + 'col.usedBy': 'Used by', + 'col.added': 'Added', + 'col.actions': 'Actions', + + 'att.storeError': '{store} could not be read: {error}', + 'att.rejected': '{store} {version} was rejected', + 'att.halted': '{store} {version}: rollout halted', + 'att.catalog': '{count} catalog items differ between the stores', + 'att.catalog_one': '1 catalog item differs between the stores', + 'att.crash': 'Crash rate near or over the Google Play threshold', + 'att.anr': 'ANR rate near or over the Google Play threshold', + + 'tl.next': 'Next', + 'tl.live': 'Live', + 'tl.store': 'Store', + 'tl.created': 'Created {date}', + 'tl.notOnStore': 'Not on this store', + 'tl.noVersion': '{version} is not on {store} yet', + 'tl.everyone': 'Everyone', + 'tl.day': 'day {day} of 7', + 'tl.rolloutAria': 'Share of users with this version', + + 'releases.notReadTitle': 'Release state is not read yet', + 'releases.notReadText': 'The timeline shows each version on both stores: build, TestFlight or internal testing, review, live and the rollout share. Read the stores once to fill it.', + 'releases.noAccounts': 'Tip: map store accounts to this app in App folders first.', + 'releases.storeUnreadable': '{store} could not be read, so its lane shows as unknown: {error}', + 'releases.noVersions': 'No versions on the stores yet', + 'releases.noVersionsText': 'When the first build is uploaded it shows here.', + 'releases.history': 'Versions on the stores', + 'releases.historySub': 'Read {when}', + 'releases.consoleNote': 'storebound never submits for review, releases or completes a rollout. Do those in the store console.', + + 'cat.products': 'One-time products', + 'cat.productsSub': 'In the config', + 'cat.subscriptions': 'Subscriptions', + 'cat.subsSub': 'All groups', + 'cat.parity': 'In parity', + 'cat.parityRead': 'Compared {when}', + 'cat.gaps': 'Price gaps', + 'cat.gapsSub': 'Same currency, over 10 %', + 'cat.matrix': 'Parity matrix', + 'cat.configOnly': 'From the config only: compare with both stores to fill the store columns', + 'cat.compare': 'Compare with the stores', + 'cat.ok': 'Matches', + 'cat.warn': 'Differs', + 'cat.error': 'Missing or wrong', + 'cat.na': 'Not sold here', + 'cat.unknown': 'Not compared', + 'cat.extra': 'Store only', + 'cat.sub': 'Subscription', + 'cat.product': 'Product', + 'cat.notInConfig': 'Not in the config', + 'cat.noGap': 'None', + 'cat.gapsTitle': 'Price gaps between the stores', + 'cat.gapsTitleSub': 'Stores round to their own price tiers, so small gaps are normal', + 'cat.emptyTitle': 'No in-app products or subscriptions', + 'cat.emptyText': 'Products and subscriptions are defined once in storebound.config.ts and created on both stores. This app has none in its config.', + + 'lst.languages': 'Languages', + 'lst.completeKpi': 'Complete', + 'lst.completeSub': 'Required fields, both stores', + 'lst.toFix': 'To fix', + 'lst.toFixSub': 'Missing or over the limit', + 'lst.screenshots': 'Screenshots', + 'lst.screenshotsSub': 'Rendered, all languages', + 'lst.noRenders': 'No renders folder yet', + 'lst.playSub': 'store/listing.md', + 'lst.appleSub': 'store/appstore.md', + 'lst.complete': 'Complete', + 'lst.completeAria': '{pct} % complete', + 'lst.missing': 'Missing', + 'lst.optional': 'Optional', + 'lst.over': '{n} over', + 'lst.title': 'Title', + 'lst.short': 'Short', + 'lst.full': 'Full', + 'lst.whatsNew': 'What\'s new', + 'lst.name': 'Name', + 'lst.subtitle': 'Subtitle', + 'lst.promo': 'Promo text', + 'lst.keywords': 'Keywords', + 'lst.description': 'Description', + 'lst.noFilesTitle': 'No listing files yet', + 'lst.noFilesText': 'Listing text lives in store/listing.md (Google Play) and store/appstore.md (App Store) in the app folder, one section per language.', + 'lst.noFilesHint': 'writes both templates into the app folder', + 'lst.foot': 'From the app folder\'s files, read {when}. Nothing is uploaded from here.', + + 'health.read': 'Read health', + 'health.emptyTitle': 'Health is not read yet', + 'health.emptyText': 'Crash and ANR rates against the Google Play thresholds, worst devices and top issues, plus App Store diagnostics. Read-only.', + 'health.crash': 'User-perceived crash rate', + 'health.anr': 'User-perceived ANR rate', + 'health.window': '{from} to {to}', + 'health.over': 'Over threshold', + 'health.near': 'Near threshold', + 'health.under': 'Under threshold', + 'health.current28': '28-day average, as Google Play counts it', + 'health.daily': 'Daily', + 'health.threshold': 'Bad behavior threshold {value}', + 'health.chartAria': '{metric}: {value}', + 'health.devices': 'Worst devices', + 'health.devicesSub': 'Per-device threshold {value}', + 'health.noDevices': 'No device has enough users to compare.', + 'health.issues': 'Top issues', + 'health.issuesSub': 'Most reports first', + 'health.noIssues': 'No issues reported', + 'health.crashShort': 'Crash', + 'health.appleMetrics': 'Performance metrics', + 'health.appleMetricsSub': 'Latest values per metric', + 'health.noMetrics': 'No metrics yet', + 'health.signatures': 'Diagnostic signatures', + 'health.signaturesSub': 'Heaviest first, latest builds', + 'health.noSignatures': 'No diagnostic signatures', + 'health.betaCrashes': 'TestFlight crashes', + 'health.noBetaCrashes': 'No TestFlight crash reports in the window.', + 'health.build': 'build {build}', + 'health.noPlay': 'This app is not on Google Play.', + 'health.noApple': 'This app is not on the App Store.', + 'health.unreadable': '{store} could not be read, shown as unknown: {error}', + + 'reviews.read': 'Read reviews', + 'reviews.emptyTitle': 'Reviews are not read yet', + 'reviews.emptyText': 'The last 30 days on the App Store, the last 7 on Google Play (its API keeps no more), with your local reply drafts. Read-only.', + 'reviews.ratings': 'Ratings', + 'reviews.count': '{count} reviews', + 'reviews.count_one': '1 review', + 'reviews.unansweredN': '{count} without a reply', + 'reviews.unansweredN_one': '1 without a reply', + 'reviews.filter': 'Filter', + 'reviews.store': 'Store', + 'reviews.all': 'All', + 'reviews.onlyUnanswered': 'Only without a reply', + 'reviews.search': 'Search reviews', + 'reviews.inbox': 'Inbox', + 'reviews.shown': '{count} shown', + 'reviews.noMatch': 'No review matches the filter', + 'reviews.pick': 'Pick a review', + 'reviews.answered': 'Answered', + 'reviews.drafted': 'Draft', + 'reviews.approved': 'Approved', + 'reviews.notApproved': 'Not approved', + 'reviews.noTitle': 'No title', + 'reviews.noText': 'No text', + 'reviews.version': 'version {v}', + 'reviews.currentReply': 'Reply on the store', + 'reviews.draft': 'Your reply draft', + 'reviews.noDraft': 'No draft for this review. "Make drafts" writes one file per unanswered review into .storebound/replies.', + 'reviews.emptyDraft': 'The draft {file} has no reply yet: write it under "## Reply".', + 'reviews.chars': '{n} of {limit} characters', + 'reviews.approve': 'Approve', + 'reviews.unapprove': 'Remove approval', + 'reviews.approveHint': 'Marks the draft approved (local file, confirmed in a dialog). Nothing is sent.', + 'reviews.fixFirst': 'Fix the errors first', + 'reviews.sentOn': 'Sent {date}', + 'reviews.sendNote': 'Replies are public, so they go out from a terminal:', + 'reviews.makeDrafts': 'Make drafts', + 'reviews.makeDraftsHint': 'One local draft per unanswered review (dry run first, then a confirmation)', + 'reviews.draftsMade': 'Reply drafts written', + 'reviews.approvedToast': 'Draft approved', + 'reviews.unapproved': 'Approval removed', + 'reviews.starsAria': '{count} of 5 stars', + 'reviews.starsAria_one': '1 of 5 stars', + + 'tf.read': 'Read TestFlight', + 'tf.emptyTitle': 'TestFlight is not read yet', + 'tf.emptyText': 'Beta groups, testers and recent builds with their processing and beta review states. Read-only.', + 'tf.noIos': 'This app is not on iOS', + 'tf.noIosText': 'TestFlight is for apps with an App Store record. Add the apple section to the config to use it.', + 'tf.internal': 'Internal', + 'tf.external': 'External', + 'tf.testers': 'testers', + 'tf.builds': 'builds', + 'tf.all': 'All', + 'tf.publicOn': 'Public link on', + 'tf.publicOff': 'Invite only', + 'tf.noGroups': 'No beta groups', + 'tf.buildsTitle': 'Recent builds', + 'tf.buildsSub': 'Newest first', + 'tf.processing': 'Processing', + 'tf.internalTesting': 'Internal testing', + 'tf.externalTesting': 'External testing', + 'tf.uploaded': 'Uploaded', + 'tf.noBuilds': 'No builds uploaded yet', + 'tf.missingGroups': 'In the config but not on App Store Connect: {groups}', + + 'checks.offline': 'Config check', + 'checks.offlineSub': 'Offline: config, listing files, copy, declarations, products', + 'checks.again': 'Check again', + 'checks.clean': 'The config checks out', + 'checks.cleanText': 'No problems or warnings in the app folder.', + 'checks.problem': 'Problem', + 'checks.warning': 'Warning', + 'checks.validate': 'Store readiness', + 'checks.validateSub': 'Read-only report from both stores, blockers in order', + 'checks.run': 'Run the report', + 'checks.validateEmpty': 'Readiness not checked yet', + 'checks.validateEmptyText': 'What is still missing on the App Store and Google Play before a submission, in the order to fix it.', + 'checks.ready': 'No blockers', + 'checks.readyText': 'Both stores have what a submission needs.', + + 'folders.lead': 'One folder per app with its storebound.config.ts (iOS and Android in one config). Pick the store accounts each app uses; the keys stay in the keychain.', + 'folders.list': 'App folders', + 'folders.listSub': '{count} folders', + 'folders.listSub_one': '1 folder', + 'folders.emptyTitle': 'No app folders yet', + 'folders.emptyText': 'Add a folder that has a storebound.config.ts, or start a new one below.', + 'folders.added': '{name} added', + 'folders.started': '{name} started', + 'folders.startedDetail': 'Templates written. Edit storebound.config.ts and the store files next.', + 'folders.playFor': 'Google Play account for {name}', + 'folders.appleFor': 'App Store Connect account for {name}', + 'folders.noPlay': 'No Google Play account', + 'folders.noApple': 'No App Store account', + 'folders.check': 'Check', + 'folders.gallery': 'Gallery', + 'folders.galleryHint': 'Writes the local screenshot review page (dry run first, then a confirmation)', + 'folders.remove': 'Remove {name} from the list (the folder stays)', + 'folders.checkTitle': 'Config check', + 'folders.galleryTitle': 'Screenshot review page', + 'folders.newTitle': 'Start a new app folder', + 'folders.newSub': 'storebound init: config, listing, screenshot copy, declarations and privacy policy templates', + 'folders.profile': 'Profile', + 'folders.profileHint.app': 'Utility or productivity app: optional account and analytics, no ads.', + 'folders.profileHint.game': 'Free-to-play game with ads and in-app purchases.', + 'folders.profileHint.subscription-app': 'App with accounts and auto-renewable subscriptions.', + 'folders.chooseAndStart': 'Choose a folder and start', + + 'run.failed': 'Failed', + 'run.running': 'Running', + 'run.applied': 'Applied after your confirmation', + 'run.cancelled': 'Cancelled in the dialog: nothing was written', + 'run.dryFailed': 'The dry run failed: nothing was written', + 'run.done': 'Done', + + 'accounts.lead': 'Store API keys live in the system keychain (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux). They are never shown again, never written to your app folders, and reach storebound in memory for one call.', + 'accounts.list': 'Store accounts', + 'accounts.listSub': 'Labels only: the keys are in the keychain', + 'accounts.emptyTitle': 'No store accounts yet', + 'accounts.emptyText': 'Add a Google Play service account or an App Store Connect API key below. Store reads need them; app folders work without.', + 'accounts.unused': 'Not used', + 'accounts.remove': 'Remove', + 'accounts.removeAria': 'Remove {label} and delete its key from the keychain', + 'accounts.saved': '"{label}" saved', + 'accounts.savedDetail': 'The key is in the system keychain.', + 'accounts.playSub': 'Service account JSON key', + 'accounts.appleSub': 'Team API key (.p8) from Users and Access, Integrations', + 'accounts.label': 'Name', + 'accounts.playPlaceholder': 'Studio Play account', + 'accounts.applePlaceholder': 'Studio App Store key', + 'accounts.playHow': 'A service account with access to your apps in Play Console (Users and permissions).', + 'accounts.keyId': 'Key ID', + 'accounts.issuerId': 'Issuer ID', + 'accounts.choosePlay': 'Choose the JSON key', + 'accounts.chooseApple': 'Choose the .p8 key', + 'accounts.safety': 'Keys are picked in the system file dialog and go straight to the keychain. The window never sees them.', + + 'deps.lead': 'Local tools for screenshots, app previews, icons and simulator or emulator captures. Store work (listings, products, releases, reviews) needs none of them.', + 'deps.checkAgain': 'Check again', + 'deps.tools': 'Tools on this computer', + 'deps.found': '{found} of {total} found', + 'deps.missing': 'Missing', + 'deps.appCopy': 'App copy', + 'deps.installed': 'Installed', + 'deps.download': 'Download', + 'deps.remove': 'Remove', + 'deps.getIt': 'Get it', + 'deps.unavailable': 'Not for this platform', + 'deps.downloading': 'Downloading {tool}', + 'deps.installedToast': '{tool} installed', + 'deps.failed': 'Download failed', + 'deps.cancelledDetail': 'The partial download was deleted.', + 'deps.removed': 'Removed from the app data folder', + 'deps.inAppData': 'In the app data folder ({folder})', + 'deps.notDownloaded': 'Not downloaded', + 'deps.source': 'Source', + 'deps.license': 'License', + 'deps.verify': 'Verified by', + 'deps.verifyFfmpeg': 'SHA-256 of the exact archive, pinned in this app version', + 'deps.verifyChrome': 'Google\'s code signature (macOS, Windows) or the version banner (Linux)', + 'deps.licenseLink': 'License and source', + 'deps.terminal': 'From a terminal', + 'deps.terminalSub': 'The same check, and the usual install commands', + 'deps.copy': 'Copy "{cmd}"', + 'deps.copied': 'Copied', + + 'dl.resolve': 'Finding the download', + 'dl.download': 'Downloading', + 'dl.verify': 'Verifying', + 'dl.unpack': 'Unpacking', + 'dl.install': 'Installing', + 'dl.done': 'Done', + 'dl.error': 'Failed', + 'dl.cancelled': 'Cancelled', + + 'settings.lead': 'Appearance, language, shortcuts and what this app runs on.', + 'settings.appearance': 'Appearance', + 'settings.theme': 'Theme', + 'settings.system': 'System', + 'settings.light': 'Light', + 'settings.dark': 'Dark', + 'settings.motion': 'Motion', + 'settings.followSystem': 'Follow the system', + 'settings.reduce': 'Reduce', + 'settings.language': 'Language', + 'settings.shortcuts': 'Keyboard shortcuts', + 'settings.scPalette': 'Command palette', + 'settings.scWorkspace': 'App folders, Accounts, Dependencies, Settings', + 'settings.scTabs': 'Previous / next app tab', + 'settings.scTabArrows': 'Move between tabs (tab list focused)', + 'settings.scClose': 'Close a dialog', + 'settings.data': 'Saved reads', + 'settings.dataText': 'The last store reads are kept in the app data folder so screens open with them offline, always marked with their time. No keys are kept there.', + 'settings.clearCache': 'Clear saved reads', + 'settings.cacheCleared': 'Saved reads cleared', + 'settings.about': 'About', + 'settings.app': 'App', + 'settings.debug': 'debug build', + 'settings.methods': '{count} methods', + 'settings.tools': 'Local tools', + 'settings.telemetry': 'Telemetry', + 'settings.telemetryNone': 'None. The app only talks to the store APIs through storebound, with your keys.', + + 'wz.s1': 'Welcome', + 'wz.s2': 'Your apps', + 'wz.s3': 'Store keys', + 'wz.s4': 'Local tools', + 'wz.s5': 'First read', + 'wz.footer': 'You can open this guide again from Settings or the command palette.', + 'wz.footerSafe': 'Nothing is submitted or released from here.', + 'wz.welcomeTitle': 'Every app, both stores, one window', + 'wz.welcomeLead': 'storebound desktop shows where each of your apps stands on the App Store and Google Play, and runs the storebound CLI for you. Five short steps get you there.', + 'wz.p1t': 'One portfolio', + 'wz.p1s': 'Releases, rollouts, catalog parity, health and reviews of every app.', + 'wz.p2t': 'Safe by design', + 'wz.p2s': 'Reads are read-only. Every change shows a dry run and a native confirmation first.', + 'wz.p3t': 'Your keys stay yours', + 'wz.p3s': 'Store keys live in the system keychain. No account, no telemetry.', + 'wz.appsTitle': 'Add your apps', + 'wz.appsLead': 'Each app is a folder with a storebound.config.ts that describes it on both stores.', + 'wz.addTitle': 'Add an existing folder', + 'wz.addText': 'The folder already has a storebound.config.ts (from storebound init or the CLI).', + 'wz.initTitle': 'Start a new app folder', + 'wz.initText': 'Writes the templates for a profile into a folder you choose. Existing files are kept.', + 'wz.added': 'Added', + 'wz.ready': 'Ready', + 'wz.keysTitle': 'Add your store keys', + 'wz.keysLead': 'Store reads need an API key per store. You can skip this and add them later in Accounts.', + 'wz.mapHint': 'Which accounts this app uses', + 'wz.toolsTitle': 'Check the local tools', + 'wz.toolsLead': 'Screenshots, previews and icons use ffmpeg and Chrome. The app can download its own copies; store work needs none of them.', + 'wz.toolsNote': 'The same check in a terminal:', + 'wz.readTitle': 'Read the stores', + 'wz.readLead': 'One read-only pass over App Store Connect and Google Play fills the portfolio: versions, review state, rollouts and catalog parity.', + 'wz.readNow': 'Read the stores now', + 'wz.readDone': '{count} apps read {when}', + 'wz.needApp': 'Add an app folder first (step 2).', + 'wz.skip': 'Skip for now', + 'wz.back': 'Back', + 'wz.next': 'Next', + 'wz.finish': 'Finish', +} as const; diff --git a/apps/desktop/src/i18n/index.ts b/apps/desktop/src/i18n/index.ts new file mode 100644 index 00000000..67ef10b1 --- /dev/null +++ b/apps/desktop/src/i18n/index.ts @@ -0,0 +1,33 @@ +// UI strings: English and Turkish catalogs with the same keys (tr.ts is typed against en.ts; tools/i18n-check.ts also +// checks empty strings and placeholder parity in CI). `t(key, vars)`: "{name}" placeholders; with a numeric `count`, +// a "_one" entry is used for 1 when the catalog has one. +import { en } from './en'; +import { tr } from './tr'; + +export type Key = keyof typeof en; +export type Vars = Record; +export type UiLang = 'en' | 'tr'; + +export const CATALOGS: Record> = { en, tr }; +let current: UiLang = 'en'; + +export function setLang(l: UiLang): void { current = l; } +export function lang(): UiLang { return current; } + +export function format(s: string, vars?: Vars): string { + if (!vars) return s; + return s.replace(/\{(\w+)\}/g, (m, k: string) => (vars[k] === undefined ? m : String(vars[k]))); +} + +export function t(key: Key, vars?: Vars): string { + const cat = CATALOGS[current]; + let k: Key = key; + if (vars && vars.count === 1) { + const one = `${key}_one` as Key; + if (one in cat) k = one; + } + return format(cat[k] ?? en[k] ?? key, vars); +} + +/** Placeholders of a message ("{count} apps" -> ["count"]), sorted, for the parity check. */ +export const placeholders = (s: string): string[] => [...s.matchAll(/\{(\w+)\}/g)].map(m => m[1]!).sort(); diff --git a/apps/desktop/src/i18n/tr.ts b/apps/desktop/src/i18n/tr.ts new file mode 100644 index 00000000..3d71e9d2 --- /dev/null +++ b/apps/desktop/src/i18n/tr.ts @@ -0,0 +1,562 @@ +// Türkçe arayüz metinleri. Anahtarlar en.ts ile aynı (tip kontrolü); yer tutucular aynı kalmalı (tools/i18n-check.ts). +import type { en } from './en'; + +export const tr: Record = { + 'a11y.skip': 'İçeriğe geç', + 'a11y.breadcrumbs': 'Buradasınız', + + 'nav.sections': 'Bölümler', + 'nav.portfolio': 'Portföy', + 'nav.appsLabel': 'Uygulamalar', + 'nav.workspace': 'Çalışma alanı', + 'nav.apps': 'Uygulama klasörleri', + 'nav.accounts': 'Hesaplar', + 'nav.dependencies': 'Bağımlılıklar', + 'nav.settings': 'Ayarlar', + 'nav.noApps': 'Henüz uygulama yok', + 'nav.problems': '{count} sorun', + 'nav.problems_one': '1 sorun', + + 'tab.releases': 'Sürümler', + 'tab.catalog': 'Katalog', + 'tab.listings': 'Mağaza metinleri', + 'tab.health': 'Sağlık', + 'tab.reviews': 'Yorumlar', + 'tab.testflight': 'TestFlight', + 'tab.checks': 'Kontroller', + + 'profile.app': 'Uygulama', + 'profile.game': 'Oyun', + 'profile.subscription-app': 'Abonelikli uygulama', + + 'foot.cli': 'CLI {version} çalışıyor', + 'foot.cliDown': 'CLI çalışmıyor', + 'foot.cliStarting': 'CLI başlatılıyor', + 'foot.lastRead': 'Mağazalar {when} okundu', + 'foot.neverRead': 'Mağazalar henüz okunmadı', + + 'top.storesRead': 'Mağazalar {when} okundu', + 'top.storesNotRead': 'Mağazalar okunmadı', + 'dev.fixtures': 'GELİŞTİRME VERİSİ', + 'dev.fixturesHint': 'Geliştirme sürümü örnek verilerle çalışıyor: buradaki hiçbir şey bir mağazadan gelmiyor. Yayın sürümlerinde bu mod yok.', + + 'action.readStores': 'Mağazaları oku', + 'action.reading': 'Okunuyor', + 'action.readStoresHint': 'Salt okunur: her uygulamanın App Store Connect ve Google Play durumu, kendi hesaplarıyla', + 'action.checkConfigs': 'Ayarları kontrol et', + 'action.addFolder': 'Uygulama klasörü ekle', + 'action.addAccount': 'Mağaza hesabı ekle', + 'action.toggleTheme': 'Açık / koyu tema', + 'action.welcome': 'Karşılama rehberini aç', + 'action.refresh': 'Yenile', + + 'palette.title': 'Komut paleti', + 'palette.button': 'Ara veya git', + 'palette.placeholder': 'Bir uygulamaya, sekmeye veya ekrana git ya da bir işlem çalıştır', + 'palette.results': 'Sonuçlar', + 'palette.none': '"{q}" ile eşleşen bir şey yok', + 'palette.move': 'gezin', + 'palette.open': 'aç', + 'palette.toggle': 'aç / kapat', + 'palette.gApps': 'Uygulamalar', + 'palette.gGo': 'Git', + 'palette.gTabs': 'Uygulama sekmeleri', + 'palette.gActions': 'İşlemler', + 'palette.openApp': 'Aç', + + 'common.loading': 'Yükleniyor', + 'common.unknown': 'Bilinmiyor', + 'common.cancel': 'İptal', + 'common.close': 'Kapat', + 'common.exit': 'Çıkış kodu {code}', + 'common.cachedFrom': 'Son okuma {when} (kayıtlı kopya)', + 'common.readWhen': '{when} okundu', + 'common.readFailedKeep': 'Son okuma başarısız oldu, bu yüzden bir öncekini gösteriyor: {error}', + + 'time.justNow': 'az önce', + 'time.never': 'hiç', + + 'toast.readingStores': 'Mağazalar okunuyor', + 'toast.readingStoresDetail': 'App Store Connect ve Google Play, salt okunur', + 'toast.readDone': 'Mağazalar okundu', + 'toast.readDoneDetail': '{count} uygulama güncel', + 'toast.readDoneDetail_one': '1 uygulama güncel', + 'toast.readDonePartial': 'Mağazalar eksik okundu', + 'toast.readDonePartialDetail': '{count} uygulama bir mağazada okunamadı; bilinmiyor olarak gösteriliyor', + 'toast.readDonePartialDetail_one': '1 uygulama bir mağazada okunamadı; bilinmiyor olarak gösteriliyor', + 'toast.readFailed': 'Mağazalar okunamadı', + 'toast.cancelled': 'İptal edildi', + 'toast.reading': 'Okunuyor', + 'toast.readingDetail': 'Salt okunur', + 'toast.readOk': '{what} okundu', + 'toast.readFailedWhat': '{what} okunamadı', + + 'write.dryFailed': 'Deneme çalıştırması başarısız, hiçbir şey yazılmadı', + 'write.failed': 'Uygulanmadı', + + 'phase.none': 'Bu mağazada yok', + 'phase.live': 'Yayında', + 'phase.rollout': 'Kademeli', + 'phase.phased': 'Aşamalı', + 'phase.halted': 'Durduruldu', + 'phase.paused': 'Duraklatıldı', + 'phase.approved': 'Onaylandı', + 'phase.review': 'İncelemede', + 'phase.rejected': 'Reddedildi', + 'phase.testing': 'Testte', + 'phase.draft': 'Taslak', + 'phase.other': 'Diğer', + + 'stage.build': 'Derleme', + 'stage.testing': 'Test', + 'stage.review': 'İnceleme', + 'stage.live': 'Yayın', + 'stage.rollout': 'Dağıtım', + + 'check.notChecked': 'Kontrol edilmedi', + 'check.notLoaded': 'Ayar yüklenemedi', + 'check.problems': '{count} sorun', + 'check.problems_one': '1 sorun', + 'check.warnings': '{count} uyarı', + 'check.warnings_one': '1 uyarı', + 'check.ok': 'Ayar tamam', + + 'app.notSetUp': 'kurulmadı', + 'app.notOnStore': 'Bu mağazada yok', + 'app.sections': '{name} bölümleri', + 'app.consoleHint': 'İncelemeye gönderme, yayınlama ve dağıtım mağaza konsolunda yapılır', + + 'portfolio.lead': 'Bu çalışma alanındaki her uygulama, App Store ve Google Play\'de.', + 'portfolio.sub': '{count} uygulama · {stores} mağaza kaydı', + 'portfolio.sub_one': '1 uygulama · {stores} mağaza kaydı', + 'portfolio.emptyTitle': 'İlk uygulamanızı ekleyin', + 'portfolio.emptyText': 'storebound uygulama klasörleriyle çalışır: her uygulama için iOS ve Android\'i anlatan bir storebound.config.ts. Bu dosyası olan bir klasör ekleyin ya da şablonlardan yenisini başlatın.', + 'portfolio.notReadNotice': 'Sürümler, kademeli dağıtımlar ve katalog eşleşmesi için mağazaların bir kez okunması gerekir. Salt okunurdur ve her uygulamanın kendi hesaplarını kullanır.', + 'portfolio.apps': 'Uygulamalar', + 'portfolio.appsSub': 'Mağazalardan sürüm durumu, {when} okundu', + 'portfolio.appsSubOffline': 'Yalnızca ayar: sürümler için mağazaları okuyun', + 'portfolio.unreadable': 'Okunamadı', + 'portfolio.noVersion': 'Henüz sürüm yok', + 'portfolio.noNext': 'Bekleyen sürüm yok', + 'portfolio.thenNext': 'sonra {version} · {phase}', + 'portfolio.products': '{count} ürün', + 'portfolio.products_one': '1 ürün', + 'portfolio.subs': '{count} abonelik', + 'portfolio.subs_one': '1 abonelik', + 'portfolio.inParity': 'Eşleşiyor', + 'portfolio.differs': '{count} fark', + 'portfolio.differs_one': '1 fark', + 'portfolio.configOnly': 'Henüz karşılaştırılmadı', + 'portfolio.attention': 'İlgilenilmesi gerekenler', + 'portfolio.attentionSub': 'Önce sorunlar, sonra uyarılar', + 'portfolio.allClear': 'İlgilenilecek bir şey yok', + 'portfolio.allClearText': 'Ayarlar sorunsuz ve son okumada hiçbir mağaza sorun bildirmedi.', + 'portfolio.workspace': 'Çalışma alanı', + 'portfolio.healthNotRead': 'Okunmadı', + 'portfolio.healthNoPlay': 'Yalnız iOS', + 'portfolio.healthTitle': 'Son 14 gün, kullanıcının fark ettiği, {when} okundu', + 'portfolio.accounts': '{play} Google Play · {apple} App Store Connect', + 'portfolio.storesRead': 'Mağaza okuması', + 'portfolio.tools': 'Yerel araçlar', + 'portfolio.toolsFound': '{total} araçtan {found} tanesi var', + + 'kpi.apps': 'Uygulamalar', + 'kpi.appsSub': '{ios} iOS · {android} Android', + 'kpi.live': 'Yayındaki sürümler', + 'kpi.liveSub': '{count} mağaza kaydında', + 'kpi.rolling': 'Dağıtımda', + 'kpi.review': 'İncelemede', + 'kpi.attention': 'İlgi bekleyen', + 'kpi.blockers': '{count} engel', + 'kpi.blockers_one': '1 engel', + 'kpi.noBlockers': 'Engel yok', + 'kpi.none': 'Yok', + 'kpi.notRead': 'Görmek için mağazaları okuyun', + + 'legend.done': 'tamam', + 'legend.stages': 'Derleme · Test · İnceleme · Yayın · Dağıtım', + + 'col.app': 'Uygulama', + 'col.next': 'Sonraki sürüm', + 'col.catalog': 'Katalog', + 'col.crash': 'Çökme oranı', + 'col.config': 'Ayar', + 'col.version': 'Sürüm', + 'col.build': 'Derleme', + 'col.versionCode': 'Sürüm kodu', + 'col.track': 'Kanal', + 'col.item': 'Öğe', + 'col.type': 'Tür', + 'col.priceGap': 'Fiyat farkı', + 'col.region': 'Bölge', + 'col.diff': 'Fark', + 'col.language': 'Dil', + 'col.issue': 'Sorun', + 'col.reports': 'Rapor', + 'col.users': 'Kullanıcı', + 'col.metric': 'Ölçüm', + 'col.value': 'Değer', + 'col.goal': 'Hedef', + 'col.name': 'Ad', + 'col.store': 'Mağaza', + 'col.usedBy': 'Kullanan', + 'col.added': 'Eklendi', + 'col.actions': 'İşlemler', + + 'att.storeError': '{store} okunamadı: {error}', + 'att.rejected': '{store} {version} reddedildi', + 'att.halted': '{store} {version}: dağıtım durduruldu', + 'att.catalog': '{count} katalog öğesi mağazalar arasında farklı', + 'att.catalog_one': '1 katalog öğesi mağazalar arasında farklı', + 'att.crash': 'Çökme oranı Google Play eşiğine yakın veya üstünde', + 'att.anr': 'ANR oranı Google Play eşiğine yakın veya üstünde', + + 'tl.next': 'Sonraki', + 'tl.live': 'Yayında', + 'tl.store': 'Mağaza', + 'tl.created': 'Oluşturma: {date}', + 'tl.notOnStore': 'Bu mağazada yok', + 'tl.noVersion': '{version} henüz {store} mağazasında yok', + 'tl.everyone': 'Herkes', + 'tl.day': '7 günün {day}. günü', + 'tl.rolloutAria': 'Bu sürümü alan kullanıcı payı', + + 'releases.notReadTitle': 'Sürüm durumu henüz okunmadı', + 'releases.notReadText': 'Zaman çizelgesi her sürümü iki mağazada birlikte gösterir: derleme, TestFlight ya da dahili test, inceleme, yayın ve dağıtım payı. Doldurmak için mağazaları bir kez okuyun.', + 'releases.noAccounts': 'İpucu: önce Uygulama klasörleri ekranında bu uygulamaya mağaza hesaplarını bağlayın.', + 'releases.storeUnreadable': '{store} okunamadı, bu yüzden şeridi bilinmiyor olarak gösteriliyor: {error}', + 'releases.noVersions': 'Mağazalarda henüz sürüm yok', + 'releases.noVersionsText': 'İlk derleme yüklendiğinde burada görünür.', + 'releases.history': 'Mağazalardaki sürümler', + 'releases.historySub': '{when} okundu', + 'releases.consoleNote': 'storebound hiçbir zaman incelemeye göndermez, yayınlamaz veya dağıtımı tamamlamaz. Bunları mağaza konsolunda yapın.', + + 'cat.products': 'Tek seferlik ürünler', + 'cat.productsSub': 'Ayar dosyasında', + 'cat.subscriptions': 'Abonelikler', + 'cat.subsSub': 'Tüm gruplar', + 'cat.parity': 'Eşleşen', + 'cat.parityRead': '{when} karşılaştırıldı', + 'cat.gaps': 'Fiyat farkları', + 'cat.gapsSub': 'Aynı para birimi, %10 üstü', + 'cat.matrix': 'Eşleşme tablosu', + 'cat.configOnly': 'Yalnızca ayar dosyasından: mağaza sütunları için iki mağazayla karşılaştırın', + 'cat.compare': 'Mağazalarla karşılaştır', + 'cat.ok': 'Eşleşiyor', + 'cat.warn': 'Farklı', + 'cat.error': 'Eksik veya hatalı', + 'cat.na': 'Burada satılmıyor', + 'cat.unknown': 'Karşılaştırılmadı', + 'cat.extra': 'Yalnız mağazada', + 'cat.sub': 'Abonelik', + 'cat.product': 'Ürün', + 'cat.notInConfig': 'Ayar dosyasında yok', + 'cat.noGap': 'Yok', + 'cat.gapsTitle': 'Mağazalar arası fiyat farkları', + 'cat.gapsTitleSub': 'Mağazalar kendi fiyat basamaklarına yuvarlar, küçük farklar normaldir', + 'cat.emptyTitle': 'Uygulama içi ürün veya abonelik yok', + 'cat.emptyText': 'Ürünler ve abonelikler storebound.config.ts içinde bir kez tanımlanır ve iki mağazada oluşturulur. Bu uygulamanın ayarında hiç yok.', + + 'lst.languages': 'Diller', + 'lst.completeKpi': 'Tamamlanan', + 'lst.completeSub': 'Zorunlu alanlar, iki mağaza', + 'lst.toFix': 'Düzeltilecek', + 'lst.toFixSub': 'Eksik veya sınırı aşan', + 'lst.screenshots': 'Ekran görüntüleri', + 'lst.screenshotsSub': 'Üretilmiş, tüm diller', + 'lst.noRenders': 'Henüz görsel klasörü yok', + 'lst.playSub': 'store/listing.md', + 'lst.appleSub': 'store/appstore.md', + 'lst.complete': 'Tamamlanan', + 'lst.completeAria': '%{pct} tamamlandı', + 'lst.missing': 'Eksik', + 'lst.optional': 'İsteğe bağlı', + 'lst.over': '{n} fazla', + 'lst.title': 'Başlık', + 'lst.short': 'Kısa', + 'lst.full': 'Uzun', + 'lst.whatsNew': 'Yenilikler', + 'lst.name': 'Ad', + 'lst.subtitle': 'Alt başlık', + 'lst.promo': 'Tanıtım metni', + 'lst.keywords': 'Anahtar kelimeler', + 'lst.description': 'Açıklama', + 'lst.noFilesTitle': 'Henüz mağaza metni dosyası yok', + 'lst.noFilesText': 'Mağaza metinleri uygulama klasöründe store/listing.md (Google Play) ve store/appstore.md (App Store) dosyalarında, her dil için bir bölüm olarak durur.', + 'lst.noFilesHint': 'iki şablonu da uygulama klasörüne yazar', + 'lst.foot': 'Uygulama klasöründeki dosyalardan, {when} okundu. Buradan hiçbir şey yüklenmez.', + + 'health.read': 'Sağlığı oku', + 'health.emptyTitle': 'Sağlık henüz okunmadı', + 'health.emptyText': 'Google Play eşiklerine göre çökme ve ANR oranları, en kötü cihazlar ve öne çıkan sorunlar, ayrıca App Store tanılamaları. Salt okunur.', + 'health.crash': 'Kullanıcının fark ettiği çökme oranı', + 'health.anr': 'Kullanıcının fark ettiği ANR oranı', + 'health.window': '{from} ile {to} arası', + 'health.over': 'Eşiğin üstünde', + 'health.near': 'Eşiğe yakın', + 'health.under': 'Eşiğin altında', + 'health.current28': '28 günlük ortalama, Google Play\'in saydığı gibi', + 'health.daily': 'Günlük', + 'health.threshold': 'Kötü davranış eşiği {value}', + 'health.chartAria': '{metric}: {value}', + 'health.devices': 'En kötü cihazlar', + 'health.devicesSub': 'Cihaz başına eşik {value}', + 'health.noDevices': 'Karşılaştırmaya yetecek kullanıcısı olan cihaz yok.', + 'health.issues': 'Öne çıkan sorunlar', + 'health.issuesSub': 'En çok rapor önce', + 'health.noIssues': 'Bildirilen sorun yok', + 'health.crashShort': 'Çökme', + 'health.appleMetrics': 'Performans ölçümleri', + 'health.appleMetricsSub': 'Her ölçümün son değeri', + 'health.noMetrics': 'Henüz ölçüm yok', + 'health.signatures': 'Tanılama imzaları', + 'health.signaturesSub': 'En ağır önce, son derlemeler', + 'health.noSignatures': 'Tanılama imzası yok', + 'health.betaCrashes': 'TestFlight çökmeleri', + 'health.noBetaCrashes': 'Bu aralıkta TestFlight çökme raporu yok.', + 'health.build': 'derleme {build}', + 'health.noPlay': 'Bu uygulama Google Play\'de değil.', + 'health.noApple': 'Bu uygulama App Store\'da değil.', + 'health.unreadable': '{store} okunamadı, bilinmiyor olarak gösteriliyor: {error}', + + 'reviews.read': 'Yorumları oku', + 'reviews.emptyTitle': 'Yorumlar henüz okunmadı', + 'reviews.emptyText': 'App Store\'da son 30 gün, Google Play\'de son 7 gün (API\'si fazlasını tutmuyor), yerel yanıt taslaklarınızla birlikte. Salt okunur.', + 'reviews.ratings': 'Puanlar', + 'reviews.count': '{count} yorum', + 'reviews.count_one': '1 yorum', + 'reviews.unansweredN': '{count} yanıtsız', + 'reviews.unansweredN_one': '1 yanıtsız', + 'reviews.filter': 'Süzgeç', + 'reviews.store': 'Mağaza', + 'reviews.all': 'Tümü', + 'reviews.onlyUnanswered': 'Yalnızca yanıtsız olanlar', + 'reviews.search': 'Yorumlarda ara', + 'reviews.inbox': 'Gelen kutusu', + 'reviews.shown': '{count} gösteriliyor', + 'reviews.noMatch': 'Süzgece uyan yorum yok', + 'reviews.pick': 'Bir yorum seçin', + 'reviews.answered': 'Yanıtlandı', + 'reviews.drafted': 'Taslak', + 'reviews.approved': 'Onaylı', + 'reviews.notApproved': 'Onaylanmadı', + 'reviews.noTitle': 'Başlık yok', + 'reviews.noText': 'Metin yok', + 'reviews.version': 'sürüm {v}', + 'reviews.currentReply': 'Mağazadaki yanıt', + 'reviews.draft': 'Yanıt taslağınız', + 'reviews.noDraft': 'Bu yorum için taslak yok. "Taslak oluştur" her yanıtsız yorum için .storebound/replies içine bir dosya yazar.', + 'reviews.emptyDraft': '{file} taslağında henüz yanıt yok: "## Reply" altına yazın.', + 'reviews.chars': '{limit} karakterden {n}', + 'reviews.approve': 'Onayla', + 'reviews.unapprove': 'Onayı kaldır', + 'reviews.approveHint': 'Taslağı onaylı olarak işaretler (yerel dosya, bir pencerede onaylanır). Hiçbir şey gönderilmez.', + 'reviews.fixFirst': 'Önce hataları düzeltin', + 'reviews.sentOn': '{date} gönderildi', + 'reviews.sendNote': 'Yanıtlar herkese açıktır, bu yüzden terminalden gönderilir:', + 'reviews.makeDrafts': 'Taslak oluştur', + 'reviews.makeDraftsHint': 'Her yanıtsız yorum için bir yerel taslak (önce deneme, sonra onay)', + 'reviews.draftsMade': 'Yanıt taslakları yazıldı', + 'reviews.approvedToast': 'Taslak onaylandı', + 'reviews.unapproved': 'Onay kaldırıldı', + 'reviews.starsAria': '5 üzerinden {count} yıldız', + 'reviews.starsAria_one': '5 üzerinden 1 yıldız', + + 'tf.read': 'TestFlight\'ı oku', + 'tf.emptyTitle': 'TestFlight henüz okunmadı', + 'tf.emptyText': 'Beta grupları, test kullanıcıları ve son derlemeler, işlenme ve beta inceleme durumlarıyla. Salt okunur.', + 'tf.noIos': 'Bu uygulama iOS\'ta değil', + 'tf.noIosText': 'TestFlight, App Store kaydı olan uygulamalar içindir. Kullanmak için ayar dosyasına apple bölümünü ekleyin.', + 'tf.internal': 'Dahili', + 'tf.external': 'Harici', + 'tf.testers': 'test kullanıcısı', + 'tf.builds': 'derleme', + 'tf.all': 'Tümü', + 'tf.publicOn': 'Herkese açık bağlantı açık', + 'tf.publicOff': 'Yalnızca davetle', + 'tf.noGroups': 'Beta grubu yok', + 'tf.buildsTitle': 'Son derlemeler', + 'tf.buildsSub': 'En yeni önce', + 'tf.processing': 'İşlenme', + 'tf.internalTesting': 'Dahili test', + 'tf.externalTesting': 'Harici test', + 'tf.uploaded': 'Yüklendi', + 'tf.noBuilds': 'Henüz derleme yüklenmedi', + 'tf.missingGroups': 'Ayar dosyasında var ama App Store Connect\'te yok: {groups}', + + 'checks.offline': 'Ayar kontrolü', + 'checks.offlineSub': 'Çevrimdışı: ayar, metin dosyaları, metinler, beyanlar, ürünler', + 'checks.again': 'Yeniden kontrol et', + 'checks.clean': 'Ayar sorunsuz', + 'checks.cleanText': 'Uygulama klasöründe sorun veya uyarı yok.', + 'checks.problem': 'Sorun', + 'checks.warning': 'Uyarı', + 'checks.validate': 'Mağaza hazırlığı', + 'checks.validateSub': 'İki mağazadan salt okunur rapor, engeller sırayla', + 'checks.run': 'Raporu çalıştır', + 'checks.validateEmpty': 'Hazırlık henüz kontrol edilmedi', + 'checks.validateEmptyText': 'Göndermeden önce App Store ve Google Play\'de hâlâ eksik olanlar, düzeltme sırasıyla.', + 'checks.ready': 'Engel yok', + 'checks.readyText': 'İki mağazada da gönderim için gerekenler tamam.', + + 'folders.lead': 'Her uygulama için storebound.config.ts dosyası olan bir klasör (iOS ve Android tek ayarda). Her uygulamanın kullandığı mağaza hesaplarını seçin; anahtarlar anahtar zincirinde kalır.', + 'folders.list': 'Uygulama klasörleri', + 'folders.listSub': '{count} klasör', + 'folders.listSub_one': '1 klasör', + 'folders.emptyTitle': 'Henüz uygulama klasörü yok', + 'folders.emptyText': 'storebound.config.ts dosyası olan bir klasör ekleyin ya da aşağıdan yenisini başlatın.', + 'folders.added': '{name} eklendi', + 'folders.started': '{name} başlatıldı', + 'folders.startedDetail': 'Şablonlar yazıldı. Sırada storebound.config.ts ve mağaza dosyalarını düzenlemek var.', + 'folders.playFor': '{name} için Google Play hesabı', + 'folders.appleFor': '{name} için App Store Connect hesabı', + 'folders.noPlay': 'Google Play hesabı yok', + 'folders.noApple': 'App Store hesabı yok', + 'folders.check': 'Kontrol et', + 'folders.gallery': 'Galeri', + 'folders.galleryHint': 'Yerel ekran görüntüsü inceleme sayfasını yazar (önce deneme, sonra onay)', + 'folders.remove': '{name} listeden kaldır (klasör yerinde kalır)', + 'folders.checkTitle': 'Ayar kontrolü', + 'folders.galleryTitle': 'Ekran görüntüsü inceleme sayfası', + 'folders.newTitle': 'Yeni uygulama klasörü başlat', + 'folders.newSub': 'storebound init: ayar, mağaza metni, ekran görüntüsü metni, beyan ve gizlilik politikası şablonları', + 'folders.profile': 'Profil', + 'folders.profileHint.app': 'Araç veya verimlilik uygulaması: isteğe bağlı hesap ve analiz, reklam yok.', + 'folders.profileHint.game': 'Reklamlı ve uygulama içi satın almalı ücretsiz oyun.', + 'folders.profileHint.subscription-app': 'Hesaplı ve otomatik yenilenen abonelikli uygulama.', + 'folders.chooseAndStart': 'Klasör seç ve başlat', + + 'run.failed': 'Başarısız', + 'run.running': 'Çalışıyor', + 'run.applied': 'Onayınızdan sonra uygulandı', + 'run.cancelled': 'Pencerede iptal edildi: hiçbir şey yazılmadı', + 'run.dryFailed': 'Deneme çalıştırması başarısız: hiçbir şey yazılmadı', + 'run.done': 'Bitti', + + 'accounts.lead': 'Mağaza API anahtarları sistemin anahtar zincirinde durur (macOS\'ta Anahtar Zinciri, Windows\'ta Kimlik Bilgisi Yöneticisi, Linux\'ta Secret Service). Bir daha gösterilmez, uygulama klasörlerinize yazılmaz ve storebound\'a yalnızca bir çağrı için bellekte verilir.', + 'accounts.list': 'Mağaza hesapları', + 'accounts.listSub': 'Yalnızca etiketler: anahtarlar anahtar zincirinde', + 'accounts.emptyTitle': 'Henüz mağaza hesabı yok', + 'accounts.emptyText': 'Aşağıdan bir Google Play hizmet hesabı veya App Store Connect API anahtarı ekleyin. Mağaza okumaları bunlara ihtiyaç duyar; uygulama klasörleri onlarsız da çalışır.', + 'accounts.unused': 'Kullanılmıyor', + 'accounts.remove': 'Kaldır', + 'accounts.removeAria': '{label} hesabını kaldır ve anahtarını anahtar zincirinden sil', + 'accounts.saved': '"{label}" kaydedildi', + 'accounts.savedDetail': 'Anahtar sistemin anahtar zincirinde.', + 'accounts.playSub': 'Hizmet hesabı JSON anahtarı', + 'accounts.appleSub': 'Kullanıcılar ve Erişim, Entegrasyonlar altındaki ekip API anahtarı (.p8)', + 'accounts.label': 'Ad', + 'accounts.playPlaceholder': 'Stüdyo Play hesabı', + 'accounts.applePlaceholder': 'Stüdyo App Store anahtarı', + 'accounts.playHow': 'Play Console\'da uygulamalarınıza erişimi olan bir hizmet hesabı (Kullanıcılar ve izinler).', + 'accounts.keyId': 'Anahtar kimliği', + 'accounts.issuerId': 'Veren kimliği', + 'accounts.choosePlay': 'JSON anahtarını seç', + 'accounts.chooseApple': '.p8 anahtarını seç', + 'accounts.safety': 'Anahtarlar sistemin dosya penceresinde seçilir ve doğrudan anahtar zincirine gider. Uygulama penceresi onları hiç görmez.', + + 'deps.lead': 'Ekran görüntüleri, uygulama önizlemeleri, simgeler ve simülatör ya da emülatör kayıtları için yerel araçlar. Mağaza işleri (metinler, ürünler, sürümler, yorumlar) hiçbirine ihtiyaç duymaz.', + 'deps.checkAgain': 'Yeniden kontrol et', + 'deps.tools': 'Bu bilgisayardaki araçlar', + 'deps.found': '{total} araçtan {found} tanesi var', + 'deps.missing': 'Eksik', + 'deps.appCopy': 'Uygulamanın kopyası', + 'deps.installed': 'Kurulu', + 'deps.download': 'İndir', + 'deps.remove': 'Kaldır', + 'deps.getIt': 'Edin', + 'deps.unavailable': 'Bu platform için yok', + 'deps.downloading': '{tool} indiriliyor', + 'deps.installedToast': '{tool} kuruldu', + 'deps.failed': 'İndirme başarısız', + 'deps.cancelledDetail': 'Yarım kalan indirme silindi.', + 'deps.removed': 'Uygulama veri klasöründen kaldırıldı', + 'deps.inAppData': 'Uygulama veri klasöründe ({folder})', + 'deps.notDownloaded': 'İndirilmedi', + 'deps.source': 'Kaynak', + 'deps.license': 'Lisans', + 'deps.verify': 'Doğrulama', + 'deps.verifyFfmpeg': 'Bu uygulama sürümüne sabitlenmiş arşivin SHA-256 özeti', + 'deps.verifyChrome': 'Google\'ın kod imzası (macOS, Windows) veya sürüm satırı (Linux)', + 'deps.licenseLink': 'Lisans ve kaynak', + 'deps.terminal': 'Terminalden', + 'deps.terminalSub': 'Aynı kontrol ve alışılmış kurulum komutları', + 'deps.copy': '"{cmd}" komutunu kopyala', + 'deps.copied': 'Kopyalandı', + + 'dl.resolve': 'İndirme aranıyor', + 'dl.download': 'İndiriliyor', + 'dl.verify': 'Doğrulanıyor', + 'dl.unpack': 'Açılıyor', + 'dl.install': 'Kuruluyor', + 'dl.done': 'Bitti', + 'dl.error': 'Başarısız', + 'dl.cancelled': 'İptal edildi', + + 'settings.lead': 'Görünüm, dil, kısayollar ve bu uygulamanın üzerinde çalıştığı şeyler.', + 'settings.appearance': 'Görünüm', + 'settings.theme': 'Tema', + 'settings.system': 'Sistem', + 'settings.light': 'Açık', + 'settings.dark': 'Koyu', + 'settings.motion': 'Hareket', + 'settings.followSystem': 'Sistemi izle', + 'settings.reduce': 'Azalt', + 'settings.language': 'Dil', + 'settings.shortcuts': 'Klavye kısayolları', + 'settings.scPalette': 'Komut paleti', + 'settings.scWorkspace': 'Uygulama klasörleri, Hesaplar, Bağımlılıklar, Ayarlar', + 'settings.scTabs': 'Önceki / sonraki uygulama sekmesi', + 'settings.scTabArrows': 'Sekmeler arasında gezin (sekme listesi odaktayken)', + 'settings.scClose': 'Pencereyi kapat', + 'settings.data': 'Kayıtlı okumalar', + 'settings.dataText': 'Son mağaza okumaları uygulama veri klasöründe saklanır; böylece ekranlar çevrimdışıyken de açılır, her zaman okuma zamanıyla işaretli. Orada anahtar tutulmaz.', + 'settings.clearCache': 'Kayıtlı okumaları temizle', + 'settings.cacheCleared': 'Kayıtlı okumalar temizlendi', + 'settings.about': 'Hakkında', + 'settings.app': 'Uygulama', + 'settings.debug': 'hata ayıklama sürümü', + 'settings.methods': '{count} yöntem', + 'settings.tools': 'Yerel araçlar', + 'settings.telemetry': 'Telemetri', + 'settings.telemetryNone': 'Yok. Uygulama mağaza API\'leriyle yalnızca storebound üzerinden, sizin anahtarlarınızla konuşur.', + + 'wz.s1': 'Hoş geldiniz', + 'wz.s2': 'Uygulamalarınız', + 'wz.s3': 'Mağaza anahtarları', + 'wz.s4': 'Yerel araçlar', + 'wz.s5': 'İlk okuma', + 'wz.footer': 'Bu rehberi Ayarlar\'dan veya komut paletinden yeniden açabilirsiniz.', + 'wz.footerSafe': 'Buradan hiçbir şey gönderilmez veya yayınlanmaz.', + 'wz.welcomeTitle': 'Her uygulama, iki mağaza, tek pencere', + 'wz.welcomeLead': 'storebound desktop her uygulamanızın App Store ve Google Play\'deki durumunu gösterir ve storebound CLI\'yi sizin için çalıştırır. Beş kısa adımda hazır.', + 'wz.p1t': 'Tek portföy', + 'wz.p1s': 'Her uygulamanın sürümleri, dağıtımları, katalog eşleşmesi, sağlığı ve yorumları.', + 'wz.p2t': 'Tasarımı gereği güvenli', + 'wz.p2s': 'Okumalar salt okunurdur. Her değişiklik önce bir deneme çalıştırması ve sistem onayı gösterir.', + 'wz.p3t': 'Anahtarlarınız sizde kalır', + 'wz.p3s': 'Mağaza anahtarları sistemin anahtar zincirinde durur. Hesap yok, telemetri yok.', + 'wz.appsTitle': 'Uygulamalarınızı ekleyin', + 'wz.appsLead': 'Her uygulama, onu iki mağazada anlatan bir storebound.config.ts dosyası olan bir klasördür.', + 'wz.addTitle': 'Var olan klasörü ekle', + 'wz.addText': 'Klasörde zaten bir storebound.config.ts var (storebound init veya CLI ile).', + 'wz.initTitle': 'Yeni uygulama klasörü başlat', + 'wz.initText': 'Seçtiğiniz klasöre bir profilin şablonlarını yazar. Var olan dosyalar korunur.', + 'wz.added': 'Eklendi', + 'wz.ready': 'Hazır', + 'wz.keysTitle': 'Mağaza anahtarlarınızı ekleyin', + 'wz.keysLead': 'Mağaza okumaları her mağaza için bir API anahtarı ister. Bu adımı atlayıp daha sonra Hesaplar\'dan ekleyebilirsiniz.', + 'wz.mapHint': 'Bu uygulamanın kullandığı hesaplar', + 'wz.toolsTitle': 'Yerel araçları kontrol edin', + 'wz.toolsLead': 'Ekran görüntüleri, önizlemeler ve simgeler ffmpeg ve Chrome kullanır. Uygulama kendi kopyalarını indirebilir; mağaza işleri hiçbirine ihtiyaç duymaz.', + 'wz.toolsNote': 'Aynı kontrol terminalde:', + 'wz.readTitle': 'Mağazaları okuyun', + 'wz.readLead': 'App Store Connect ve Google Play üzerinde salt okunur bir tur portföyü doldurur: sürümler, inceleme durumu, dağıtımlar ve katalog eşleşmesi.', + 'wz.readNow': 'Mağazaları şimdi oku', + 'wz.readDone': '{count} uygulama {when} okundu', + 'wz.needApp': 'Önce bir uygulama klasörü ekleyin (2. adım).', + 'wz.skip': 'Şimdilik geç', + 'wz.back': 'Geri', + 'wz.next': 'İleri', + 'wz.finish': 'Bitir', +}; diff --git a/apps/desktop/src/lib/format.ts b/apps/desktop/src/lib/format.ts new file mode 100644 index 00000000..f8f0f27a --- /dev/null +++ b/apps/desktop/src/lib/format.ts @@ -0,0 +1,49 @@ +// Locale-aware formatting for the UI (numbers, percentages, dates, "3 min ago"). Pure apart from Intl. +import { lang, t } from '../i18n'; + +const loc = (): string => (lang() === 'tr' ? 'tr-TR' : 'en-US'); + +/** 0.0109 -> "1.09%" (Turkish: "%1,09"). */ +export function pct(x: number | null | undefined, digits = 2): string { + if (x === null || x === undefined || Number.isNaN(x)) return '–'; + return new Intl.NumberFormat(loc(), { style: 'percent', minimumFractionDigits: digits, maximumFractionDigits: digits }).format(x); +} + +/** Rollout share: 0.2 -> "20%", 0.05 -> "5%". */ +export function share(x: number): string { + return new Intl.NumberFormat(loc(), { style: 'percent', maximumFractionDigits: x < 0.1 ? 1 : 0 }).format(x); +} + +export const num = (n: number, digits = 0): string => new Intl.NumberFormat(loc(), { maximumFractionDigits: digits, minimumFractionDigits: digits }).format(n); + +export function bytes(n: number | null | undefined): string { + if (!n) return '–'; + const mb = n / 1e6; + return mb >= 1 ? `${num(mb, mb < 10 ? 1 : 0)} MB` : `${num(n / 1e3, 0)} KB`; +} + +export function date(iso: string | null | undefined): string { + if (!iso) return '–'; + const d = new Date(iso); + if (Number.isNaN(d.getTime())) return '–'; + return d.toLocaleDateString(loc(), { day: 'numeric', month: 'short', year: d.getFullYear() === new Date().getFullYear() ? undefined : 'numeric' }); +} + +export function dateTime(iso: string | null | undefined): string { + if (!iso) return '–'; + const d = new Date(iso); + return Number.isNaN(d.getTime()) ? '–' : d.toLocaleString(loc(), { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit' }); +} + +/** "just now", "4 min ago", "3 h ago", "2 d ago" (and the Turkish forms). */ +export function ago(iso: string | null | undefined, now: number = Date.now()): string { + if (!iso) return t('time.never'); + const s = Math.round((now - new Date(iso).getTime()) / 1000); + if (!Number.isFinite(s)) return t('time.never'); + if (s < 45) return t('time.justNow'); + const rtf = new Intl.RelativeTimeFormat(loc(), { numeric: 'auto', style: 'short' }); + if (s < 3600) return rtf.format(-Math.round(s / 60), 'minute'); + if (s < 86_400) return rtf.format(-Math.round(s / 3600), 'hour'); + if (s < 86_400 * 30) return rtf.format(-Math.round(s / 86_400), 'day'); + return date(iso); +} diff --git a/apps/desktop/src/lib/model.ts b/apps/desktop/src/lib/model.ts new file mode 100644 index 00000000..52e8b402 --- /dev/null +++ b/apps/desktop/src/lib/model.ts @@ -0,0 +1,239 @@ +// Pure view models for the screens: release timeline stages, health series against the store thresholds, review +// inbox stats, catalog parity matrix, the portfolio's "needs attention" list, and the command palette matcher. +// "Unknown, never false": every derivation keeps "not read" apart from "none" / "ok". +import type { AppStatus, ProjectSummary, ReleaseTrain, StoreRelease } from '../api'; +import { t } from '../i18n'; + +export type Tone = 'ok' | 'warn' | 'bad' | 'info' | 'neutral' | 'accent'; + +// ---- CLI JSON shapes the screens read (the commands' --json output) ---- + +export interface MetricRow { date: string; dims: Record; values: Record } +export interface PlayHealth { + window: { start: string; end: string; days: number }; + crash: MetricRow[]; + anr: MetricRow[]; + devices?: { model: string; crash?: number; anr?: number; users?: number }[]; + issues: { type: string; cause: string; location: string; reports: number; users: number; lastVersion?: string }[]; +} +export interface AppleHealth { + metrics: { category: string; metric: string; unit: string; version: string; value: number; goal?: string }[]; + signatures: { build: string; type: string; signature: string; weight: number }[]; + betaCrashes: { build: string; count: number }[]; +} +export interface HealthSnapshot { date: string; play?: PlayHealth | { error: string }; apple?: AppleHealth | { error: string } } +export interface Review { store: 'apple' | 'play'; id: string; rating: number; title?: string; body: string; where?: string; date: string; appVersion?: string; reply?: { text: string; date?: string; state?: string } } +export interface TfGroup { id: string; name: string; internal: boolean; testers: number; builds: number | 'all'; publicLink: boolean } +export interface TfBuild { version: string | null; build: string | null; processing: string | null; internal: string | null; external: string | null; uploaded: string | null } +export interface TestFlightStatus { groups: TfGroup[]; builds: TfBuild[]; missingGroups: string[] } +export interface CatalogRow { id: string; store: 'apple' | 'play'; level: 'error' | 'warn' | 'ok'; code: string; msg: string } +export interface ParityRow { id: string; region: string; currency: string; apple: number; play: number; diffPct: number } +export interface CatalogDiff { errors: number; rows: CatalogRow[]; parity: ParityRow[] } +export interface Finding { store: 'apple' | 'play'; level: 'blocker' | 'warn' | 'ok'; code: string; msg: string; fix?: string } +export interface ValidateResult { blockers: number; findings: Finding[] } + +export const isError = (x: unknown): x is { error: string } => !!x && typeof x === 'object' && typeof (x as { error?: unknown }).error === 'string'; + +// ---- Release timeline ---- + +/** Stages of one version on one store, left to right. */ +export const STAGES = ['build', 'testing', 'review', 'live', 'rollout'] as const; +export type Stage = (typeof STAGES)[number]; + +export interface Lane { + store: 'ios' | 'android'; + release: StoreRelease | null; + /** Index of the stage it is at (-1: not on this store). */ + at: number; + tone: Tone; + /** Rollout share 0-1 when live or rolling out (1 = everyone). */ + share: number | null; + /** The store's state word, for a tooltip. */ + state: string; +} + +/** Where a store release is on the track. Rollout counts as the last stage; a full release fills it. */ +export function laneOf(store: 'ios' | 'android', r: StoreRelease | null, testflightReached = false): Lane { + if (!r) return { store, release: null, at: -1, tone: 'neutral', share: null, state: '' }; + const base = { store, release: r, state: r.state }; + switch (r.phase) { + case 'draft': return { ...base, at: testflightReached ? 1 : 0, tone: testflightReached ? 'info' : 'neutral', share: null }; + case 'testing': return { ...base, at: 1, tone: 'info', share: null }; + case 'review': return { ...base, at: 2, tone: 'warn', share: null }; + case 'approved': return { ...base, at: 2, tone: 'ok', share: null }; + case 'rejected': return { ...base, at: 2, tone: 'bad', share: null }; + case 'live': return { ...base, at: 4, tone: 'ok', share: 1 }; + case 'rollout': return { ...base, at: 4, tone: 'accent', share: r.fraction ?? null }; + case 'halted': return { ...base, at: 4, tone: 'bad', share: r.fraction ?? null }; + default: return { ...base, at: 0, tone: 'neutral', share: null }; + } +} + +/** Both lanes of a train; iOS counts TestFlight as reached when a build of that version is in beta testing. */ +export function trainLanes(t: ReleaseTrain, tf?: TestFlightStatus | null): Lane[] { + const inBeta = !!tf?.builds.some(b => b.version === t.version && /IN_BETA_TESTING|BETA_APPROVED|READY_FOR_BETA_TESTING/.test(`${b.internal ?? ''} ${b.external ?? ''}`)); + return [laneOf('ios', t.ios, inBeta), laneOf('android', t.android)]; +} + +/** Every distinct version of the store releases, newest first, with both stores' release (best phase per store). */ +export function versionHistory(all: StoreRelease[]): ReleaseTrain[] { + const rank: Record = { live: 0, rollout: 1, halted: 2, approved: 3, review: 4, rejected: 5, testing: 6, draft: 7, other: 8 }; + const versions = [...new Set(all.map(r => r.version).filter((v): v is string => !!v))].sort(cmpVersion).reverse(); + const best = (store: 'ios' | 'android', v: string) => all.filter(r => r.store === store && r.version === v).sort((a, b) => (rank[a.phase] ?? 9) - (rank[b.phase] ?? 9))[0] ?? null; + return versions.map(v => ({ version: v, ios: best('ios', v), android: best('android', v) })); +} + +/** On one store: the highest version reaching users (live or rolling out) and the highest version above it. */ +export function storeNow(all: StoreRelease[], store: 'ios' | 'android'): { now: StoreRelease | null; next: StoreRelease | null } { + const rs = all.filter((r): r is StoreRelease & { version: string } => r.store === store && !!r.version); + const desc = (a: { version: string }, b: { version: string }) => cmpVersion(b.version, a.version); + const now = rs.filter(r => r.phase === 'live' || r.phase === 'rollout' || r.phase === 'halted').sort(desc)[0] ?? null; + const next = rs.filter(r => !now || cmpVersion(r.version, now.version) > 0).sort(desc)[0] ?? null; + return { now, next }; +} + +export function cmpVersion(a: string, b: string): number { + const pa = a.split('.').map(x => parseInt(x, 10) || 0), pb = b.split('.').map(x => parseInt(x, 10) || 0); + for (let i = 0; i < Math.max(pa.length, pb.length); i++) { const d = (pa[i] ?? 0) - (pb[i] ?? 0); if (d) return d; } + return 0; +} + +// ---- Health ---- + +export const PLAY_THRESHOLDS = { crash: 0.0109, anr: 0.0047, perDevice: 0.08 } as const; + +export interface Series { dates: string[]; values: number[]; current: number | null; threshold: number; tone: Tone } + +/** Daily user-perceived rates (fractions) and the current 28-day value against the bad behavior threshold. */ +export function healthSeries(rows: MetricRow[], metric: 'userPerceivedCrashRate' | 'userPerceivedAnrRate', threshold: number): Series { + const pts = rows.filter(r => typeof r.values[metric] === 'number' && !r.dims.deviceModel).sort((a, b) => a.date.localeCompare(b.date)); + const w28 = metric === 'userPerceivedCrashRate' ? 'userPerceivedCrashRate28dUserWeighted' : 'userPerceivedAnrRate28dUserWeighted'; + let current: number | null = null; + for (let i = pts.length - 1; i >= 0 && current === null; i--) { const v = pts[i]!.values[w28]; if (typeof v === 'number') current = v; } + if (current === null && pts.length) current = pts.at(-1)!.values[metric]!; + return { dates: pts.map(p => p.date), values: pts.map(p => p.values[metric]!), current, threshold, tone: toneFor(current, threshold) }; +} + +/** Over the threshold: bad; from 80 % of it: warn; unknown: neutral. */ +export function toneFor(v: number | null, threshold: number): Tone { + if (v === null) return 'neutral'; + return v >= threshold ? 'bad' : v >= threshold * 0.8 ? 'warn' : 'ok'; +} + +// ---- Reviews ---- + +export interface StarStats { count: number; average: number | null; byStar: [number, number, number, number, number]; unanswered: number } + +export function starStats(rs: Review[]): StarStats { + const byStar: [number, number, number, number, number] = [0, 0, 0, 0, 0]; + let sum = 0, n = 0; + for (const r of rs) if (r.rating >= 1 && r.rating <= 5) { byStar[r.rating - 1]!++; sum += r.rating; n++; } + return { count: rs.length, average: n ? sum / n : null, byStar, unanswered: rs.filter(r => !r.reply).length }; +} + +export interface ReviewFilter { store: 'all' | 'apple' | 'play'; stars: number[]; unanswered: boolean; query: string } + +export function filterReviews(rs: Review[], f: ReviewFilter): Review[] { + const q = f.query.trim().toLowerCase(); + return rs.filter(r => (f.store === 'all' || r.store === f.store) && (!f.stars.length || f.stars.includes(r.rating)) && (!f.unanswered || !r.reply) + && (!q || `${r.title ?? ''} ${r.body}`.toLowerCase().includes(q))).sort((a, b) => b.date.localeCompare(a.date)); +} + +/** Draft file name of a review (cli/lib/reviews.ts draftName). */ +export const draftName = (r: Pick): string => `${r.store}-${r.id.replace(/[^A-Za-z0-9._-]/g, '_').slice(0, 120)}.md`; + +// ---- Catalog parity matrix ---- + +export type CellState = 'ok' | 'warn' | 'error' | 'na' | 'unknown'; +export interface MatrixRow { id: string; kind: 'product' | 'subscription' | 'extra'; config: boolean; ios: { state: CellState; notes: string[] }; android: { state: CellState; notes: string[] }; maxDiff: number | null } + +export function parityMatrix(s: ProjectSummary | null, diff: CatalogDiff | null): MatrixRow[] { + const ids = new Map(); + for (const id of s?.productIds ?? []) ids.set(id, 'product'); + for (const id of s?.subscriptionIds ?? []) ids.set(id, 'subscription'); + for (const r of diff?.rows ?? []) if (!ids.has(r.id)) ids.set(r.id, 'extra'); + const cell = (id: string, store: 'apple' | 'play', sold: boolean): MatrixRow['ios'] => { + const rs = (diff?.rows ?? []).filter(r => r.id === id && r.store === store); + if (!diff) return { state: sold ? 'unknown' : 'na', notes: [] }; + if (!rs.length) return { state: sold ? 'unknown' : 'na', notes: [] }; + const state: CellState = rs.some(r => r.level === 'error') ? 'error' : rs.some(r => r.level === 'warn') ? 'warn' : 'ok'; + return { state, notes: rs.filter(r => r.level !== 'ok').map(r => r.msg) }; + }; + return [...ids].map(([id, kind]) => { + const diffs = (diff?.parity ?? []).filter(p => p.id === id).map(p => p.diffPct); + return { + id, kind, config: kind !== 'extra', + ios: cell(id, 'apple', kind === 'extra' ? (diff?.rows ?? []).some(r => r.id === id && r.store === 'apple') : !!s?.catalog.ios.includes(id)), + android: cell(id, 'play', kind === 'extra' ? (diff?.rows ?? []).some(r => r.id === id && r.store === 'play') : !!s?.catalog.android.includes(id)), + maxDiff: diffs.length ? Math.max(...diffs) : null, + }; + }); +} + +// ---- Portfolio: needs attention ---- + +export interface Attention { app: string; projectId: string; tone: Tone; text: string; hint?: string; tab?: 'releases' | 'catalog' | 'listings' | 'health' | 'reviews' | 'testflight' | 'checks' } + +export function attention(projectId: string, name: string, e: AppStatus | undefined, live: AppStatus | undefined, health?: HealthSnapshot | null): Attention[] { + const out: Attention[] = []; + if (!e) return out; + const base = { app: name, projectId }; + for (const x of e.errors) out.push({ ...base, tone: 'bad', text: x, tab: 'checks' }); + for (const p of e.check?.problems ?? []) out.push({ ...base, tone: 'bad', text: p, tab: 'checks' }); + for (const w of (e.check?.warnings ?? []).slice(0, 3)) out.push({ ...base, tone: 'warn', text: w, tab: 'checks' }); + const l = live ?? (e.release.source === 'live' ? e : undefined); + if (l) { + if (l.storeErrors.ios) out.push({ ...base, tone: 'warn', text: t('att.storeError', { store: 'App Store', error: l.storeErrors.ios }), tab: 'releases' }); + if (l.storeErrors.android) out.push({ ...base, tone: 'warn', text: t('att.storeError', { store: 'Google Play', error: l.storeErrors.android }), tab: 'releases' }); + for (const r of l.release.all ?? []) { + if (r.phase === 'rejected') out.push({ ...base, tone: 'bad', text: t('att.rejected', { store: r.store === 'ios' ? 'App Store' : 'Google Play', version: r.version ?? '' }), tab: 'releases' }); + if (r.phase === 'halted') out.push({ ...base, tone: 'bad', text: t('att.halted', { store: r.store === 'ios' ? 'App Store' : 'Google Play', version: r.version ?? '' }), tab: 'releases' }); + } + const c = l.catalog; + if (c && c.checked === 'live' && !c.ok) { + const n = c.missingIos.length + c.missingAndroid.length + c.onlyIos.length + c.onlyAndroid.length; + out.push({ ...base, tone: 'warn', text: t('att.catalog', { count: n }), tab: 'catalog' }); + } + } + if (health && health.play && !isError(health.play)) { + const c = healthSeries(health.play.crash, 'userPerceivedCrashRate', PLAY_THRESHOLDS.crash); + const a = healthSeries(health.play.anr, 'userPerceivedAnrRate', PLAY_THRESHOLDS.anr); + if (c.tone === 'bad' || c.tone === 'warn') out.push({ ...base, tone: c.tone, text: t('att.crash'), tab: 'health' }); + if (a.tone === 'bad' || a.tone === 'warn') out.push({ ...base, tone: a.tone, text: t('att.anr'), tab: 'health' }); + } + return out; +} + +// ---- Command palette ---- + +/** Subsequence match score (higher is better), or -1. Word starts and consecutive letters score more. */ +export function fuzzy(query: string, text: string): number { + const q = query.trim().toLowerCase(); + if (!q) return 0; + const s = text.toLowerCase(); + let score = 0, at = -1, run = 0; + for (const ch of q) { + const i = s.indexOf(ch, at + 1); + if (i < 0) return -1; + run = i === at + 1 ? run + 1 : 0; + score += 1 + run * 2 + (i === 0 || /[\s/·.-]/.test(s[i - 1] ?? '') ? 3 : 0); + at = i; + } + return score - s.length * 0.01; +} + +// ---- Identity ---- + +/** Two letters for a monogram ("Prism Puddle" -> "PP", "tidy" -> "TI"). */ +export function monogram(name: string): string { + const words = name.trim().split(/[\s_-]+/).filter(Boolean); + const m = words.length >= 2 ? words[0]![0]! + words[1]![0]! : (words[0] ?? '?').slice(0, 2); + return m.toUpperCase(); +} + +/** Stable hue (0-359) from a name, for the monogram gradient. */ +export function hueOf(name: string): number { + let h = 0; + for (const c of name) h = (h * 31 + c.charCodeAt(0)) >>> 0; + return h % 360; +} diff --git a/apps/desktop/src/main.tsx b/apps/desktop/src/main.tsx index 6ba611db..556428a4 100644 --- a/apps/desktop/src/main.tsx +++ b/apps/desktop/src/main.tsx @@ -1,11 +1,36 @@ -import { StrictMode } from 'react'; +import { StrictMode, useCallback, useEffect, useState } from 'react'; import { createRoot } from 'react-dom/client'; import { App } from './App'; -import { applyPrefs, loadPrefs } from './prefs'; +import { devSwitch } from './dev/switches'; +import { setLang } from './i18n'; +import { applyPrefs, loadPrefs, type Prefs, resolveLang, savePrefs } from './prefs'; +import { PrefsContext } from './prefs-ctx'; +import { DataProvider } from './store'; import './styles.css'; -const prefs = loadPrefs(); -// Dev builds only: VITE_THEME=light|dark forces the theme (screenshots of both themes without clicking). -if (import.meta.env.DEV && (import.meta.env.VITE_THEME === 'light' || import.meta.env.VITE_THEME === 'dark')) prefs.theme = import.meta.env.VITE_THEME; -applyPrefs(prefs); -createRoot(document.getElementById('root')!).render(); +const systemLang = (): string => (typeof navigator !== 'undefined' ? navigator.language : 'en'); + + +function Root() { + const [prefs, setPrefs] = useState(() => { + const p = loadPrefs(); + // Dev builds only: theme=light|dark and lang=en|tr force them (screenshots without clicking). + const th = devSwitch('theme'), lg = devSwitch('lang'); + if (th === 'light' || th === 'dark') p.theme = th; + if (lg === 'en' || lg === 'tr') p.lang = lg; + if (devSwitch('start')) p.onboarded = true; + return p; + }); + const lang = resolveLang(prefs.lang, systemLang()); + setLang(lang); + useEffect(() => { applyPrefs(prefs, document.documentElement, systemLang()); }, [prefs]); + const update = useCallback((p: Prefs) => { setPrefs(p); savePrefs(p); }, []); + const onTheme = useCallback(() => { + const dark = prefs.theme === 'dark' || (prefs.theme === 'system' && matchMedia('(prefers-color-scheme: dark)').matches); + update({ ...prefs, theme: dark ? 'light' : 'dark' }); + }, [prefs, update]); + // a language change re-renders the whole tree in the new language + return ; +} + +createRoot(document.getElementById('root')!).render(); diff --git a/apps/desktop/src/nav.ts b/apps/desktop/src/nav.ts new file mode 100644 index 00000000..ede44b22 --- /dev/null +++ b/apps/desktop/src/nav.ts @@ -0,0 +1,33 @@ +// Routes: Portfolio -> one App (tabs) plus the workspace screens. Pure, so tests can check the deep links. +import { createContext, useContext } from 'react'; +import type { Key } from './i18n'; +import type { IconName } from './ui/icons'; + +export const APP_TABS = ['releases', 'catalog', 'listings', 'health', 'reviews', 'testflight', 'checks'] as const; +export type AppTab = (typeof APP_TABS)[number]; +export const TAB_KEY: Record = { releases: 'tab.releases', catalog: 'tab.catalog', listings: 'tab.listings', health: 'tab.health', reviews: 'tab.reviews', testflight: 'tab.testflight', checks: 'tab.checks' }; +export const TAB_ICON: Record = { releases: 'rocket', catalog: 'tag', listings: 'text', health: 'activity', reviews: 'message', testflight: 'plane', checks: 'shield' }; +export const WORKSPACE = ['apps', 'accounts', 'dependencies', 'settings'] as const; +export type WorkspaceScreen = (typeof WORKSPACE)[number]; + +export type Route = { screen: 'portfolio' } | { screen: 'app'; appId: string; tab: AppTab } | { screen: WorkspaceScreen }; + +/** storebound:// deep links and the dev-only start switch ("app:health" = first app, Health tab; + * "app:health:2" = second app). `apps` are the project ids 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 === 'portfolio') return { screen: 'portfolio' }; + return (WORKSPACE as readonly string[]).includes(screen ?? '') ? { screen: screen as WorkspaceScreen } : null; +} + +export const sameRoute = (a: Route, b: Route): boolean => JSON.stringify(a) === JSON.stringify(b); + +export interface Nav { route: Route; go: (r: Route) => void; openPalette: () => void; openWelcome: () => void } +export const NavCtx = createContext