From e588fd004a4b0526c1738b4c0f3fd62110ae26f9 Mon Sep 17 00:00:00 2001 From: Dan Motpan <24751897+SirReaDy@users.noreply.github.com> Date: Wed, 21 Oct 2026 14:47:24 +0300 Subject: [PATCH 1/2] 7a: setup guide, tour of the pages, Settings in tabs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The setup guide opens by itself while no Apple ID is saved and takes the place of the pages: Welcome (language), This computer, Your iPhone and Apple ID with the team. Any step can be skipped or opened from the list; Finish later brings the pages back with a banner to continue it, and Settings runs it again. - engine.systemCheck(): the iPhone connection service (usbmuxd, Apple Devices on Windows), Apple's servers, the clock, and the anisette server sign-in would use. A missing service shows the fix for the system: the Microsoft Store on Windows, the usbmuxd command with Copy on Linux. - Your iPhone reuses the Devices page's notice (trust, unlock, Developer Mode); Apple ID signs in and picks the team. - The tour: 9 stops over the real shell, the page dimmed but for each element, with Next, Back, Skip tour and Escape. It starts whenever the guide closes, from the compass button in the top bar and from Settings. - Settings in two tabs: General as a settings list (colour mode, palette, language; the tour and the guide) and Anisette servers. Two more palettes, Violet and Mocha; every palette but Graphite tints its backgrounds so they tell apart, and Aurora's and Sunset's accents are a little darker so button text keeps 4.5:1. - The sidebar credit reads "Made with ❤️ and ☕"; the copyright line names the author. - Strings in all six languages; browser checks for the guide, the tour and both Settings tabs. --- AGENTS.md | 2 +- apps/desktop/src/main/constants.ts | 8 +- docs/design/roadmap.md | 3 + docs/roadmap.md | 2 +- docs/rpc.md | 2 +- docs/ui.md | 20 +- packages/installer/src/__tests__/fakes.ts | 11 + .../installer/src/application/system-check.ts | 36 +++ packages/installer/src/engine/queries.ts | 2 + .../installer/src/engine/system-check.test.ts | 45 +++ packages/installer/src/engine/types.ts | 19 ++ packages/installer/src/index.ts | 1 + packages/rpc/src/__tests__/fake-engine.ts | 6 + packages/rpc/src/application/client.ts | 1 + .../rpc/src/application/server/queries.ts | 1 + packages/rpc/src/domain/protocol/requests.ts | 2 + packages/ui/src/App.tsx | 30 +- packages/ui/src/__tests__/screen-table.ts | 17 + packages/ui/src/__tests__/screens.ts | 66 ++++ packages/ui/src/__tests__/test-services.tsx | 16 +- packages/ui/src/components/choice-group.tsx | 43 ++- .../ui/src/components/shell/app-credit.tsx | 2 +- .../src/components/shell/app-shell.test.tsx | 10 +- .../ui/src/components/shell/app-shell.tsx | 63 ++-- .../ui/src/components/shell/sidebar-link.tsx | 2 +- packages/ui/src/components/shell/top-bar.tsx | 10 +- .../features/guide/components/check-row.tsx | 37 +++ .../features/guide/components/copy-button.tsx | 25 ++ .../guide/components/guide-auto-open.tsx | 23 ++ .../guide/components/guide-banner.tsx | 31 ++ .../features/guide/components/guide-nav.tsx | 45 +++ .../guide/components/guide-step-link.tsx | 42 +++ .../guide/components/guide-steps-nav.tsx | 40 +++ .../features/guide/components/service-fix.tsx | 39 +++ .../features/guide/components/step-header.tsx | 20 ++ .../features/guide/components/team-choice.tsx | 43 +++ packages/ui/src/features/guide/constants.ts | 41 +++ .../features/guide/hooks/use-guide-step.ts | 29 ++ .../src/features/guide/setup-guide.test.tsx | 133 ++++++++ .../ui/src/features/guide/setup-guide.tsx | 25 ++ .../features/guide/steps/apple-id-step.tsx | 71 ++++ .../features/guide/steps/computer-step.tsx | 80 +++++ .../src/features/guide/steps/iphone-step.tsx | 59 ++++ .../ui/src/features/guide/steps/step-pages.ts | 15 + .../src/features/guide/steps/welcome-step.tsx | 36 +++ packages/ui/src/features/guide/types.ts | 8 + .../features/guide/utils/computer-checks.ts | 72 +++++ .../src/features/guide/utils/host-system.ts | 10 + .../ui/src/features/guide/utils/next-step.ts | 14 + .../anisette/anisette-settings.test.tsx | 7 + .../components/appearance-settings.tsx | 53 ++- .../settings/components/language-select.tsx | 66 ++++ .../settings/components/language-settings.tsx | 58 +--- .../settings/components/palette-chips.tsx | 17 - .../settings/components/palette-preview.tsx | 33 ++ .../settings/components/palette-swatches.tsx | 37 +-- .../settings/components/setting-row.tsx | 44 +++ .../components/setup-guide-settings.tsx | 53 +++ .../ui/src/features/settings/constants.ts | 13 +- .../settings/hooks/use-settings-tab.ts | 18 ++ .../src/features/settings/settings-page.tsx | 50 ++- packages/ui/src/features/settings/types.ts | 3 + .../features/settings/utils/swatch-class.ts | 2 +- .../features/tour/components/tour-button.tsx | 26 ++ .../features/tour/components/tour-coach.tsx | 96 ++++++ .../features/tour/components/tour-host.tsx | 16 + packages/ui/src/features/tour/constants.ts | 30 ++ .../src/features/tour/hooks/use-target-box.ts | 25 ++ packages/ui/src/features/tour/tour.test.tsx | 75 +++++ packages/ui/src/features/tour/types.ts | 7 + .../tour/utils/coach-position.test.ts | 26 ++ .../src/features/tour/utils/coach-position.ts | 31 ++ packages/ui/src/hooks/queries/query-keys.ts | 2 + .../ui/src/hooks/queries/use-system-check.ts | 16 + packages/ui/src/hooks/use-guide.ts | 15 + packages/ui/src/locales/ar.json | 150 ++++++++- packages/ui/src/locales/de.json | 150 ++++++++- packages/ui/src/locales/en.json | 150 ++++++++- packages/ui/src/locales/ja.json | 150 ++++++++- packages/ui/src/locales/ro.json | 150 ++++++++- packages/ui/src/locales/ru.json | 150 ++++++++- .../src/services/engine/fake/fake-engine.ts | 17 + .../services/engine/fake/fake-scenarios.ts | 1 + packages/ui/src/services/engine/types.ts | 1 + packages/ui/src/state/guide/constants.ts | 9 + packages/ui/src/state/guide/guide-context.ts | 5 + .../ui/src/state/guide/guide-store.test.ts | 46 +++ packages/ui/src/state/guide/guide-store.ts | 76 +++++ packages/ui/src/state/guide/types.ts | 38 +++ packages/ui/src/theme/constants.ts | 4 +- .../ui/src/theme/palettes/palettes.test.ts | 2 +- packages/ui/src/theme/palettes/palettes.ts | 302 +++++++++++------- 92 files changed, 3235 insertions(+), 343 deletions(-) create mode 100644 packages/installer/src/application/system-check.ts create mode 100644 packages/installer/src/engine/system-check.test.ts create mode 100644 packages/ui/src/features/guide/components/check-row.tsx create mode 100644 packages/ui/src/features/guide/components/copy-button.tsx create mode 100644 packages/ui/src/features/guide/components/guide-auto-open.tsx create mode 100644 packages/ui/src/features/guide/components/guide-banner.tsx create mode 100644 packages/ui/src/features/guide/components/guide-nav.tsx create mode 100644 packages/ui/src/features/guide/components/guide-step-link.tsx create mode 100644 packages/ui/src/features/guide/components/guide-steps-nav.tsx create mode 100644 packages/ui/src/features/guide/components/service-fix.tsx create mode 100644 packages/ui/src/features/guide/components/step-header.tsx create mode 100644 packages/ui/src/features/guide/components/team-choice.tsx create mode 100644 packages/ui/src/features/guide/constants.ts create mode 100644 packages/ui/src/features/guide/hooks/use-guide-step.ts create mode 100644 packages/ui/src/features/guide/setup-guide.test.tsx create mode 100644 packages/ui/src/features/guide/setup-guide.tsx create mode 100644 packages/ui/src/features/guide/steps/apple-id-step.tsx create mode 100644 packages/ui/src/features/guide/steps/computer-step.tsx create mode 100644 packages/ui/src/features/guide/steps/iphone-step.tsx create mode 100644 packages/ui/src/features/guide/steps/step-pages.ts create mode 100644 packages/ui/src/features/guide/steps/welcome-step.tsx create mode 100644 packages/ui/src/features/guide/types.ts create mode 100644 packages/ui/src/features/guide/utils/computer-checks.ts create mode 100644 packages/ui/src/features/guide/utils/host-system.ts create mode 100644 packages/ui/src/features/guide/utils/next-step.ts create mode 100644 packages/ui/src/features/settings/components/language-select.tsx delete mode 100644 packages/ui/src/features/settings/components/palette-chips.tsx create mode 100644 packages/ui/src/features/settings/components/palette-preview.tsx create mode 100644 packages/ui/src/features/settings/components/setting-row.tsx create mode 100644 packages/ui/src/features/settings/components/setup-guide-settings.tsx create mode 100644 packages/ui/src/features/settings/hooks/use-settings-tab.ts create mode 100644 packages/ui/src/features/settings/types.ts create mode 100644 packages/ui/src/features/tour/components/tour-button.tsx create mode 100644 packages/ui/src/features/tour/components/tour-coach.tsx create mode 100644 packages/ui/src/features/tour/components/tour-host.tsx create mode 100644 packages/ui/src/features/tour/constants.ts create mode 100644 packages/ui/src/features/tour/hooks/use-target-box.ts create mode 100644 packages/ui/src/features/tour/tour.test.tsx create mode 100644 packages/ui/src/features/tour/types.ts create mode 100644 packages/ui/src/features/tour/utils/coach-position.test.ts create mode 100644 packages/ui/src/features/tour/utils/coach-position.ts create mode 100644 packages/ui/src/hooks/queries/use-system-check.ts create mode 100644 packages/ui/src/hooks/use-guide.ts create mode 100644 packages/ui/src/state/guide/constants.ts create mode 100644 packages/ui/src/state/guide/guide-context.ts create mode 100644 packages/ui/src/state/guide/guide-store.test.ts create mode 100644 packages/ui/src/state/guide/guide-store.ts create mode 100644 packages/ui/src/state/guide/types.ts diff --git a/AGENTS.md b/AGENTS.md index d0281f2e..4e094d15 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,7 +15,7 @@ IPAForge is an open-source desktop tool (Windows, macOS, Linux) for installing S ## Project Structure -> Planned layout. Directories appear as roadmap milestones land. **Exists today:** `packages/kernel`, `packages/signer`, `packages/device`, `packages/apple`, `packages/catalog`, `packages/installer`, `packages/rpc`, `packages/ui` (palettes, top bar and sidebar shell, routes, i18n with six languages, Engine query hooks and the device feed, Apple ID sign-in and the Accounts page, the device picker and Devices page, the install home, the install run with its questions, step details and recovery box (`state/active-run`, `state/selection`), the log viewer (`features/logs`, `state/log-view`), the Preload page with Browse apps and the Sources tab (`features/preload`, `state/preload`), the Apps page with Refresh, Update and automatic refresh (`features/apps`, `state/auto-refresh`), the Developer Portal page with the team's certificates, App IDs, app groups, registered devices and the device's profiles (`features/developer`), in small tabs shared with Preload (`components/page-tabs.tsx`), and pairing files per app (the Pairing files dialog on Apps, Save pairing file on Devices), Repair SideStore (`features/repair`), the on-device checklist (`features/devices/checklist`), the update screen (`features/updates`), What's new and the changelog (`features/whats-new`); runs in a browser on a fake Engine via its own Vite config), `catalog/sources.json`, `apps/desktop` (Node adapters, `createDesktopEngine`, the RPC transport and IPA resolver, maintainer probes, the Electron shell: one hardened window rendering `@ipaforge/ui`, connected to the Engine in main over a MessagePort, and updating on launch (`main/updates`)), `fixtures/signer`, `scripts/`, `patches/`, `docs/releases/`, `.github/workflows/`. +> Planned layout. Directories appear as roadmap milestones land. **Exists today:** `packages/kernel`, `packages/signer`, `packages/device`, `packages/apple`, `packages/catalog`, `packages/installer`, `packages/rpc`, `packages/ui` (palettes, top bar and sidebar shell, routes, i18n with six languages, Engine query hooks and the device feed, Apple ID sign-in and the Accounts page, the device picker and Devices page, the install home, the install run with its questions, step details and recovery box (`state/active-run`, `state/selection`), the log viewer (`features/logs`, `state/log-view`), the Preload page with Browse apps and the Sources tab (`features/preload`, `state/preload`), the Apps page with Refresh, Update and automatic refresh (`features/apps`, `state/auto-refresh`), the Developer Portal page with the team's certificates, App IDs, app groups, registered devices and the device's profiles (`features/developer`), in small tabs shared with Preload (`components/page-tabs.tsx`), and pairing files per app (the Pairing files dialog on Apps, Save pairing file on Devices), Repair SideStore (`features/repair`), the on-device checklist (`features/devices/checklist`), the update screen (`features/updates`), What's new and the changelog (`features/whats-new`), the setup guide while no Apple ID is saved and the tour of the pages (`features/guide`, `features/tour`, `state/guide`); runs in a browser on a fake Engine via its own Vite config), `catalog/sources.json`, `apps/desktop` (Node adapters, `createDesktopEngine`, the RPC transport and IPA resolver, maintainer probes, the Electron shell: one hardened window rendering `@ipaforge/ui`, connected to the Engine in main over a MessagePort, and updating on launch (`main/updates`)), `fixtures/signer`, `scripts/`, `patches/`, `docs/releases/`, `.github/workflows/`. ``` ipaforge/ diff --git a/apps/desktop/src/main/constants.ts b/apps/desktop/src/main/constants.ts index e2488a1a..c8f322c9 100644 --- a/apps/desktop/src/main/constants.ts +++ b/apps/desktop/src/main/constants.ts @@ -1,13 +1,15 @@ /** * The only pages the UI may open, in the user's default browser: a new IPAForge issue (Report the problem), - * IPAForge's releases (an update to download by hand) and Apple's account and developer pages (fixes such as - * verifying the email or accepting the agreement). Each entry is an origin and the path the page must start with. + * IPAForge's releases (an update to download by hand), Apple's account and developer pages (fixes such as + * verifying the email or accepting the agreement) and Apple Devices in the Microsoft Store (the setup guide's fix + * for Windows). Each entry is an origin and the path the page must start with. */ export const allowedExternalLinks = [ { origin: 'https://github.com', path: '/IPAForge/ipaforge/issues/new' }, { origin: 'https://github.com', path: '/IPAForge/ipaforge/releases' }, { origin: 'https://account.apple.com', path: '/' }, - { origin: 'https://developer.apple.com', path: '/account' } + { origin: 'https://developer.apple.com', path: '/account' }, + { origin: 'https://apps.microsoft.com', path: '/detail/9np83lwlpz9k' } ] as const /** diff --git a/docs/design/roadmap.md b/docs/design/roadmap.md index 362587a2..1e1784c1 100644 --- a/docs/design/roadmap.md +++ b/docs/design/roadmap.md @@ -76,6 +76,9 @@ Every feature below maps to the phases that deliver it. "Automatic" means the us - [x] 6d: log buffer, log stream and log viewer: paged and searched in the Engine, a virtual list, live lines, Copy and Save, debug details, Show logs for a failed run, Ctrl+L (#56) - [x] 6e: screenshot and accessibility tests per locale: every main screen in five languages and dark mode, clipped-text, WCAG 2.2 AA and keyboard checks in a real Chromium, Linux references made in Docker; contrast fixes for muted, red and amber text (#58) - [ ] **7. Onboarding**: a first-run guided wizard with platform checks (usbmuxd / Apple Mobile Device driver, with copyable fixes per OS), network preflight (Apple, anisette, clock skew), connecting and trusting the device, Developer Mode, Apple ID sign-in with 2FA, team choice, and choosing what to install. It can be resumed and re-run from settings + - progress: + - [x] 7a: the setup guide on the first launch, in place of the pages: Welcome (language), This computer (`engine.systemCheck`: the iPhone connection service with the fix for this system, Apple's servers, the clock, the anisette servers), Your iPhone (connected, trusted, unlocked, Developer Mode), Apple ID (sign-in and the team); opening by itself while no Apple ID is saved; any step skipped or opened from the list, Finish later with a banner to continue, Settings › Setup guide to run it again; and the tour of the pages (9 stops), starting whenever the guide closes, from its compass button in the top bar and from Settings › Show me around; Settings in two tabs (General as a settings list: appearance and language, the setup guide; Anisette servers), and two more palettes, Violet and Mocha, with every palette tinting its backgrounds so they tell apart (#95) + - [ ] 7b: installing SideStore from the guide (or Not now) and the after-install steps on the iPhone - [x] **8. Install and preload experience**: one-click SideStore (stable/nightly), a preload picker (local IPAs, URLs, catalog apps), source deep links and a QR code for SideStore, a live pipeline view, dedicated recovery screens for every `ErrorCode` with "copy diagnostics", an on-device checklist per iOS version, a "Repair SideStore" wizard, and one-click switching to another Apple ID when one is banned - progress (most built during Phase 6c): - [x] one-click SideStore or LiveContainer + SideStore, Stable or Nightly (#46) diff --git a/docs/roadmap.md b/docs/roadmap.md index e8065696..94b98220 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -13,7 +13,7 @@ The detailed roadmap, with each phase's scope, is [design/roadmap.md](design/roa | 4 | Developer services ✓ | Teams, certificates, app IDs, groups, profiles | | 5 | Installer engine + catalog ✓ | Pipelines, flows, release catalog, error catalog | | 6 | UI foundation ✓ | HeroUI + Tailwind shell, colour palettes, i18n, Engine connection, accounts, devices, install run, its questions, recovery, step details, the log viewer, and screenshot and accessibility tests (#28–#58) | -| 7 | Onboarding | First-run guided wizard | +| 7 | Onboarding | First-run guided wizard: 7a the setup guide (computer, iPhone and Apple ID checks) and the tour ✓ (#95); 7b installing from the guide | | 8 | Install & preload UX ✓ | One-click SideStore ✓, live run view ✓, recovery screens ✓, Apple ID switch ✓, preload picker ✓ (#59), app sources ✓ (#66), detailed install progress ✓ (#67), the Apps section ✓ (#68), Repair SideStore ✓ (#70), SideStore QR codes ✓ (#71), on-device checklist ✓ (#72), the smaller notes ✓ (#73), anisette servers in Settings ✓ (#80), days left as SideStore counts them and SideStore refreshed with its own date ✓ (#81), installs that never hang on a locked device and Cancel refresh ✓ (#93) | | 9 | Desktop app ✓ (#61, #62, #63, #64, #65, #69, #74, #75, #77) | Electron packages for Windows, macOS, Linux ✓; the macOS app signed with IPAForge's own certificate ✓; auto-update and What's new ✓ (#74); Windows signing and notarisation moved to 1.0 | | 10 | Management tools ✓ | Developer Portal page (#86), pairing files per app (#87), saving signed IPAs (#90), `.p12` import and export (#93) | diff --git a/docs/rpc.md b/docs/rpc.md index bb811e77..d2fb1c95 100644 --- a/docs/rpc.md +++ b/docs/rpc.md @@ -57,7 +57,7 @@ UI to Engine, each with an `id` that its response echoes: | `type` | Fields | Engine call | |---|---|---| -| `query` | `call: { method, args }` | `listDevices`, `deviceStatus`, `deviceApps` (what the on-device checklist needs: LocalDevVPN installed), `revealDeveloperMode` (a one-shot call), `pairDevice` (waits for the Trust tap, within the request timeout), `listAccounts`, `listTeams`, `catalogApps`, `catalogReleases` (each channel's latest release of a catalog app, from GitHub), `recommendedChannel`, `appIdQuota`, `listCertificates`, `planInstall`, the app sources (`listSources`, `sourceApps`, `checkSource` and `addSource`, both https only, `removeSource`, `setSourceEnabled`, `refreshSources`), the installed apps (`installedApps`, `removeApp`, `refreshPlan`, which asks Apple for the team's certificates), `checkSideStore` (Repair SideStore's check), and `signOut` (a one-shot call answered the same way) | +| `query` | `call: { method, args }` | `listDevices`, `deviceStatus`, `deviceApps` (what the on-device checklist needs: LocalDevVPN installed), `revealDeveloperMode` (a one-shot call), `systemCheck` (the setup guide's computer check: the device service, Apple, the clock, the anisette servers), `pairDevice` (waits for the Trust tap, within the request timeout), `listAccounts`, `listTeams`, `catalogApps`, `catalogReleases` (each channel's latest release of a catalog app, from GitHub), `recommendedChannel`, `appIdQuota`, `listCertificates`, `planInstall`, the app sources (`listSources`, `sourceApps`, `checkSource` and `addSource`, both https only, `removeSource`, `setSourceEnabled`, `refreshSources`), the installed apps (`installedApps`, `removeApp`, `refreshPlan`, which asks Apple for the team's certificates), `checkSideStore` (Repair SideStore's check), and `signOut` (a one-shot call answered the same way) | | `start` | `runId`, `call: { command, input }`, `resume?` | `installSideStore`, `installApps`, `refreshApps` (its `apps` named like installApps', its `profiles` bundle ids), `repairSideStore`, `placePairing`, `signIn` | | `answer` | `runId`, `answer` | `handle.answer()` | | `decline` | `runId` | `handle.decline()` | diff --git a/docs/ui.md b/docs/ui.md index 37d88ad9..24612b63 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -45,10 +45,10 @@ packages/ui/ ├── index.ts # public API ├── components/ # the shell (app-shell, top-bar, sidebar, …) and shared pieces ├── features/ # one folder per section: install, preload, apps, devices, accounts, developer, logs, settings; - │ # and repair (Repair SideStore), updates (the update screen), whats-new (What's new, the changelog); + │ # and guide (the setup guide), repair (Repair SideStore), updates (the update screen), whats-new (What's new, the changelog); │ # the page at its root, then components/, hooks/, utils/, constants.ts, types.ts as needed ├── state/ # stores kept outside components: active-run/ (the install run), selection/ (device and Apple ID in use), - │ # log-view/ (the log viewer's filters), preload/ (the preload list), auto-refresh/ (automatic refresh) + │ # log-view/ (the log viewer's filters), preload/ (the preload list), auto-refresh/ (automatic refresh), guide/ (the setup guide's progress) ├── hooks/ # useTheme, useUiServices, useLanguage, useFormat, useEngine, useRun (use-run.ts), useSelection (use-selection.ts); queries/ (Engine query hooks) ├── services/ # what the UI gets from its host: preferences/, system/ (OS colour scheme, languages, clipboard, opening links), logging/, engine/ (request logging, the fake Engine) ├── theme/ # palettes/ (data + applying them), store/, provider/ @@ -93,18 +93,26 @@ The query client (`hooks/queries/query-client.ts`) sets these defaults for every ## Themes and palettes -There are six palettes: **Graphite** (the default), **Ocean**, **Aurora**, **Sunset**, **Forest** and **Rose**. Each has a light and a dark variant. They are TypeScript data in `src/theme/palettes/palettes.ts`: a fixed set of oklch tokens (`accent`, `background`, `surface`, `muted`, `border`, …), checked against `PaletteTokens` for every palette and both schemes. +There are eight palettes: **Graphite** (the default, neutral greys), **Ocean**, **Aurora**, **Sunset**, **Forest**, **Rose**, **Violet** and **Mocha**. Each has a light and a dark variant, and each but Graphite tints its backgrounds and surfaces with its own hue as well as the accent, so they tell apart at a glance. They are TypeScript data in `src/theme/palettes/palettes.ts`: a fixed set of oklch tokens (`accent`, `background`, `surface`, `muted`, `border`, …), checked against `PaletteTokens` for every palette and both schemes. `applyPalette` writes the tokens to `` as HeroUI's CSS variables (`--accent`, `--background`, `--surface-secondary`, …). It also sets the `light`/`dark` class and `data-theme`, so HeroUI's own dark defaults (shadows, `color-scheme`) follow. HeroUI derives hover, soft and secondary border shades from these with `color-mix()`, so a palette only defines base colours. -The colour mode is `system`, `light` or `dark`. In `system` mode the theme follows the OS and switches live when the OS does. Palette and mode are saved through `PreferencesStore` and can be changed under **Settings → Appearance**. Each change is logged at debug level under `ui.theme`. +The colour mode is `system`, `light` or `dark`. In `system` mode the theme follows the OS and switches live when the OS does. Palette and mode are saved through `PreferencesStore` and can be changed under **Settings → General → Appearance and language**, where each palette is a card with a tiny preview of the app in it (top bar, sidebar, a card, the accent). Each change is logged at debug level under `ui.theme`. -**Settings → Anisette servers** (`features/settings/anisette`) lists the Engine's anisette servers (`engine.anisetteServers`) in the order Automatic tries them, grouped as added by you, SideStore's list and backup, with **Automatic** or **Choose a server**, a test per server and **Test all** (results kept while the page is open), **Update list**, and a dialog to add or edit your own. Every change answers with the servers after it, which replace the cached query. The recovery action **Choose another anisette server** opens `/settings#anisette`, which scrolls to the card and outlines it a moment. +**Settings** has two tabs (`PageTabs`, as on Preload and the Developer Portal): **General**, a settings list of rows (`SettingRow`: the name and its hint on the start side, the control on the end side) in two cards, Appearance and language (colour mode, palette, language) and Setup guide (the tour, the guide again); and **Anisette servers**, with how many there are. **Settings → Anisette servers** (`features/settings/anisette`) lists the Engine's anisette servers (`engine.anisetteServers`) in the order Automatic tries them, grouped as added by you, SideStore's list and backup, with **Automatic** or **Choose a server**, a test per server and **Test all** (results kept while the page is open), **Update list**, and a dialog to add or edit your own. Every change answers with the servers after it, which replace the cached query. The recovery action **Choose another anisette server** opens `/settings#anisette`, which opens that tab, scrolls to the card and outlines it a moment. To add a palette, add its id to `paletteIds`, add its tokens to `palettes.ts` and add a label. The tests then check that it has every token in both schemes. ## The shell +- **The setup guide** (`features/guide/`, its progress in `state/guide/`): at launch while no Apple ID is saved (`GuideAutoOpen`, once the saved Apple IDs are read), and from Settings, it takes the place of the sidebar and the pages, the top bar staying. Its steps are listed on the start side, each can be opened, and the ones done are ticked: + - **Welcome**: the language (the Settings card) and what you need. + - **This computer**: `engine.systemCheck()` reads the iPhone connection service (usbmuxd, or Apple Devices on Windows), whether Apple's servers answer, the clock, and the first anisette server, in sign-in's order, that answers (it names it). The service has a row only once it's found missing (not while it's checked), and then shows the fix for this system: **Open the Microsoft Store** on Windows, the `usbmuxd` command with **Copy** on Linux. **Check again** reads them again; **Continue** waits until all four are fine. + - **Your iPhone**: the device in use with its state and the Devices page's notice (Ask again, unlock, Developer Mode with **Show the option**). + - **Apple ID**: what the Apple ID is for and where the password stays, the sign-in dialog, then the team when the Apple ID has more than one (kept as `guide.team` for the guide's install). + + **Skip this step** moves on without ticking it, **I know my way around** closes the guide, **Finish later** brings the pages back with a banner above them ("N of M steps done", **Continue the guide**, **Not now** until the next launch). Its status (`open`, `later`, `finished`), the step and the steps done are kept under `guide.*`. **Settings › Setup guide** runs it again. Tests start with it finished and not opening by itself (`renderApp`'s `guideOpensByItself`) unless they set them; the fake Engine's scenario `computer-not-ready` plays a missing service and a clock four minutes off. +- **The tour** (`features/tour/`): however the guide closes (Done, I know my way around, Finish later) the tour starts, and the compass button at the end of the top bar (**Show me around**) or **Settings › Setup guide › Show me around** starts it again. It shows 9 stops over the real shell, each element marked `data-tour`: Install, Preload, Apps, Devices, Developer Portal, the device and Apple ID pickers, the tour's own button, Logs and Settings. The page is dimmed but for the element, with a note beside it (or below it in the top bar): its title and what it's for, "n of 9", **Skip tour**, **Back** and **Next** (**Done** at the last). Escape closes it. The stop shown isn't saved. - **Updating on launch** (`features/updates/`): `UpdateGate`, around the shell, shows only the update screen while the host checks for, downloads and installs a new version, so an old version isn't used meanwhile. "Checking for updates…" appears only if the check takes more than 400 ms. Downloading shows a bar with the megabytes and the speed; installing says IPAForge reopens. A failed download has **Try again**, **Release page** and **Use this version for now**. A copy that can't update itself (.msi, .deb, .rpm) opens normally with a note naming the file to download, with **Download** and **Later**. - **What's new** (`features/whats-new/`): the notes for every version are in `constants.ts` (`RELEASE_NOTES`), in English only; the strings around them are translated. After an update the dialog opens once: the version in one sentence, then its notes in sections, New, Changed, Fixed and Removed, each a short list (a new feature leads with its name in bold). The version last shown is kept under `whatsNew.seen`; a new install's first launch (nothing picked in the top bar yet) only records it. **What's new** at the foot of the sidebar, on one line with the version, opens the changelog page (`/whats-new`), every version newest first with the running one marked. Add a version's notes with its release. - A **top bar** across the window (`header`): the app name on the start side, then two pickers on the end side, **Device** and **Apple ID**. Each is a menu button with a status dot, a label and the current value ("None", "Not signed in"). @@ -294,7 +302,7 @@ It then prints each language's completion: the share of `en.json`'s keys with a `LocaleSource` gives the OS's preferred languages; the browser implementation reads `navigator.languages`, and the Electron renderer can supply `app.getPreferredSystemLanguages()` through the same service. `matchLocale` picks the best shipped language: for each preferred tag in order, an exact match, then the same tag with fewer subtags (`ar-EG` → `ar`, `zh-Hant-HK` → `zh-Hant` → `zh`). With no match it falls back to English. -Under **Settings → Language** the user can follow the system (the option reads "System (Deutsch)", naming the detected language) or pick one. Each language is listed in its own name (Deutsch, العربية, 日本語). The choice is saved through `PreferencesStore` under `language` and overrides the system language. Changes apply as soon as the language has loaded, without a restart. +Under **Settings → General → Language** the user can follow the system (the option reads "System (Deutsch)", naming the detected language) or pick one. Each language is listed in its own name (Deutsch, العربية, 日本語). The choice is saved through `PreferencesStore` under `language` and overrides the system language. Changes apply as soon as the language has loaded, without a restart. ### Right-to-left languages diff --git a/packages/installer/src/__tests__/fakes.ts b/packages/installer/src/__tests__/fakes.ts index dada2031..e826a911 100644 --- a/packages/installer/src/__tests__/fakes.ts +++ b/packages/installer/src/__tests__/fakes.ts @@ -283,6 +283,8 @@ export const session: AppleSession = { export type FakeAppleOptions = { teams?: Team[] + /** What Apple's preflight finds (the setup guide's computer check); all well by default. */ + preflight?: Awaited> rememberedTeam?: string resume?: () => Promise>> signIn?: () => Promise>> @@ -483,6 +485,15 @@ export const fakeApple = (options: FakeAppleOptions = {}) => { } as unknown as DeveloperServices const apple = { + preflight: async () => + options.preflight ?? { + apple: { ok: true }, + clockOk: true, + clockSkewSeconds: 0, + anisette: [ + { server: { name: 'Fake', address: 'https://ani.example' }, ok: true } + ] + }, resume: async () => { calls.sessions++ return options.resume diff --git a/packages/installer/src/application/system-check.ts b/packages/installer/src/application/system-check.ts new file mode 100644 index 00000000..4d5493c7 --- /dev/null +++ b/packages/installer/src/application/system-check.ts @@ -0,0 +1,36 @@ +// What the setup guide checks on this computer before anything else: that the system service talking to iPhones +// (usbmuxd, Apple Devices on Windows) answers, that Apple's servers can be reached, that the clock is right (Apple +// refuses sign-in when it's far off), and which anisette server sign-in would use (the first, in order, that answers). +import type { SystemCheck } from '@installer/engine/types.ts' +import type { InstallerDeps } from '@installer/types.ts' +import { compact, ErrorCode, IPAForgeError } from '@ipaforge/kernel' + +const isServiceMissing = (error: unknown): boolean => + error instanceof IPAForgeError && error.code === ErrorCode.UsbmuxdUnavailable + +export const systemCheck = async ( + deps: InstallerDeps +): Promise => { + const [deviceService, preflight] = await Promise.all([ + deps.devices.listDevices().then( + () => 'ok' as const, + (error: unknown) => { + if (isServiceMissing(error)) return 'missing' as const + deps.logger.warn('device service check failed', { cause: error }) + return 'failed' as const + } + ), + deps.apple.preflight() + ]) + + return compact({ + deviceService, + apple: preflight.apple.ok, + clockOk: preflight.clockOk, + clockSkewSeconds: preflight.clockSkewSeconds, + anisette: compact({ + server: preflight.anisette.find((server) => server.ok)?.server.name, + tried: preflight.anisette.length + }) + }) +} diff --git a/packages/installer/src/engine/queries.ts b/packages/installer/src/engine/queries.ts index 5b8252cd..77111a35 100644 --- a/packages/installer/src/engine/queries.ts +++ b/packages/installer/src/engine/queries.ts @@ -31,6 +31,7 @@ import { withTeam } from '@installer/application/portal.ts' import { createFlowRuntime } from '@installer/application/runtime.ts' +import { systemCheck } from '@installer/application/system-check.ts' import { planInstall } from '@installer/engine/plan.ts' import type { EngineQueries } from '@installer/engine/types.ts' import type { InstallerDeps } from '@installer/types.ts' @@ -52,6 +53,7 @@ const deviceStatus = async ( export const createEngineQueries = (deps: InstallerDeps): EngineQueries => ({ listDevices: () => deps.devices.listDevices(), + systemCheck: () => systemCheck(deps), deviceStatus: (udid) => deviceStatus(deps, udid, false), pairDevice: (udid) => deviceStatus(deps, udid, true), listAccounts: () => deps.apple.accounts.list(), diff --git a/packages/installer/src/engine/system-check.test.ts b/packages/installer/src/engine/system-check.test.ts new file mode 100644 index 00000000..4bccd1d8 --- /dev/null +++ b/packages/installer/src/engine/system-check.test.ts @@ -0,0 +1,45 @@ +import { describe, expect, it } from 'vitest' + +import { createHarness } from '@installer/__tests__/harness.ts' +import { ErrorCode, IPAForgeError } from '@ipaforge/kernel' + +describe('the setup guide’s computer check', () => { + it('finds everything ready', async () => { + expect(await createHarness().engine.systemCheck()).toEqual({ + deviceService: 'ok', + apple: true, + clockOk: true, + clockSkewSeconds: 0, + anisette: { server: 'Fake', tried: 1 } + }) + }) + + it('tells a missing device service and a wrong clock apart, and names the first anisette server that answers', async () => { + const h = createHarness({ + apple: { + preflight: { + apple: { ok: true }, + clockOk: false, + clockSkewSeconds: -300, + anisette: [ + { server: { name: 'A', address: 'https://a.example' }, ok: false }, + { server: { name: 'B', address: 'https://b.example' }, ok: true } + ] + } + } + }) + Object.assign(h.devices.manager, { + listDevices: async () => { + throw new IPAForgeError(ErrorCode.UsbmuxdUnavailable) + } + }) + + expect(await h.engine.systemCheck()).toEqual({ + deviceService: 'missing', + apple: true, + clockOk: false, + clockSkewSeconds: -300, + anisette: { server: 'B', tried: 2 } + }) + }) +}) diff --git a/packages/installer/src/engine/types.ts b/packages/installer/src/engine/types.ts index 5cafa344..de5a7e09 100644 --- a/packages/installer/src/engine/types.ts +++ b/packages/installer/src/engine/types.ts @@ -110,6 +110,23 @@ export type AppIdUsage = { readonly quota: AppIdQuota } +/** The setup guide's check of this computer. */ +export type SystemCheck = { + /** The system service that talks to iPhones: answering, not installed or not running, or failing otherwise. */ + readonly deviceService: 'ok' | 'missing' | 'failed' + /** Apple's servers answer. */ + readonly apple: boolean + /** This computer's clock is close enough to Apple's for sign-in. */ + readonly clockOk: boolean + /** Apple's clock minus this computer's, when Apple answered. */ + readonly clockSkewSeconds?: number + /** + * The anisette servers sign-in tries first, in its order: the first that answered (the one sign-in would use) + * and how many were asked. + */ + readonly anisette: { readonly server?: string; readonly tried: number } +} + export type TeamCertificates = { readonly team: Team readonly certificates: readonly DevelopmentCertificate[] @@ -189,6 +206,8 @@ export type EngineQueries = { deviceApps(udid: string): Promise /** Makes the Developer Mode switch appear in the device's Settings. */ revealDeveloperMode(udid: string): Promise + /** The setup guide's check of this computer: the device service, Apple, the clock and anisette. */ + systemCheck(): Promise /** Revokes one of the team's certificates: every app it signed stops opening until it's signed again. */ revokeCertificate(query: TeamQuery, serialNumber: string): Promise /** Deletes one of the team's App IDs (by Apple's id); on a free team it still counts until it expires. */ diff --git a/packages/installer/src/index.ts b/packages/installer/src/index.ts index a1e8dd59..dc4c2513 100644 --- a/packages/installer/src/index.ts +++ b/packages/installer/src/index.ts @@ -68,6 +68,7 @@ export type { RemoveAppInput, RunEvent, RunHandle, + SystemCheck, TeamCertificates, TeamQuery } from '@installer/engine/types.ts' diff --git a/packages/rpc/src/__tests__/fake-engine.ts b/packages/rpc/src/__tests__/fake-engine.ts index ed26f9e8..c89d444f 100644 --- a/packages/rpc/src/__tests__/fake-engine.ts +++ b/packages/rpc/src/__tests__/fake-engine.ts @@ -167,6 +167,12 @@ export const createFakeEngine = () => { } const engine = { listDevices: async () => [{ udid: 'UDID1', connection: 'USB' }], + systemCheck: async () => ({ + deviceService: 'ok' as const, + apple: true, + clockOk: true, + anisette: { server: 'SideStore', tried: 3 } + }), deviceStatus: async (udid: string) => { throw new IPAForgeError(ErrorCode.DeviceLocked, { data: { udid }, diff --git a/packages/rpc/src/application/client.ts b/packages/rpc/src/application/client.ts index 67e65255..67820254 100644 --- a/packages/rpc/src/application/client.ts +++ b/packages/rpc/src/application/client.ts @@ -191,6 +191,7 @@ export const createEngineClient = ( deviceApps: (udid) => query({ method: 'deviceApps', args: [udid] }), revealDeveloperMode: (udid) => query({ method: 'revealDeveloperMode', args: [udid] }), + systemCheck: () => query({ method: 'systemCheck', args: [] }), pairDevice: (udid) => query({ method: 'pairDevice', args: [udid] }), listAccounts: () => query({ method: 'listAccounts', args: [] }), canSaveAccounts: () => query({ method: 'canSaveAccounts', args: [] }), diff --git a/packages/rpc/src/application/server/queries.ts b/packages/rpc/src/application/server/queries.ts index b93995c1..8f899224 100644 --- a/packages/rpc/src/application/server/queries.ts +++ b/packages/rpc/src/application/server/queries.ts @@ -14,6 +14,7 @@ const queryHandlers = ( deviceStatus: ([udid]) => engine.deviceStatus(udid), deviceApps: ([udid]) => engine.deviceApps(udid), revealDeveloperMode: ([udid]) => engine.revealDeveloperMode(udid), + systemCheck: () => engine.systemCheck(), pairDevice: ([udid]) => engine.pairDevice(udid), listAccounts: () => engine.listAccounts(), canSaveAccounts: () => engine.canSaveAccounts(), diff --git a/packages/rpc/src/domain/protocol/requests.ts b/packages/rpc/src/domain/protocol/requests.ts index 5a855da2..9252f144 100644 --- a/packages/rpc/src/domain/protocol/requests.ts +++ b/packages/rpc/src/domain/protocol/requests.ts @@ -53,6 +53,8 @@ export const queryCallSchema = z.discriminatedUnion('method', [ call('deviceApps', z.tuple([textSchema])), /** Not a read: makes the Developer Mode switch appear in the device's Settings. */ call('revealDeveloperMode', z.tuple([textSchema])), + /** Lists devices and asks Apple and the anisette servers: as slow as the slowest of them. */ + call('systemCheck', z.tuple([])), /** Waits for the Trust tap on the device, so it can take as long as the user does. */ call('pairDevice', z.tuple([textSchema])), call('listAccounts', z.tuple([])), diff --git a/packages/ui/src/App.tsx b/packages/ui/src/App.tsx index d2dba444..89a47847 100644 --- a/packages/ui/src/App.tsx +++ b/packages/ui/src/App.tsx @@ -14,6 +14,8 @@ import { ActiveRunContext } from '@ui/state/active-run/active-run-context.ts' import { createActiveRunStore } from '@ui/state/active-run/active-run-store.ts' import { AutoRefreshContext } from '@ui/state/auto-refresh/auto-refresh-context.ts' import { createAutoRefreshStore } from '@ui/state/auto-refresh/auto-refresh-store.ts' +import { GuideContext } from '@ui/state/guide/guide-context.ts' +import { createGuideStore } from '@ui/state/guide/guide-store.ts' import { LogViewContext } from '@ui/state/log-view/log-view-context.ts' import { createLogViewStore } from '@ui/state/log-view/log-view-store.ts' import { PreloadContext } from '@ui/state/preload/preload-context.ts' @@ -29,6 +31,8 @@ export type AppProps = { language: LanguageSetup /** Defaults to the browser history; tests pass a memory history, a `file://` renderer a hash history. */ history?: RouterHistory + /** The setup guide opens by itself while no Apple ID is saved; tests turn it off unless they check it. */ + guideOpensByItself?: boolean } /** @@ -37,7 +41,12 @@ export type AppProps = { * sections), the preload list, the log viewer's filters, the language, the theme, then the router (whose root route is the shell). Touches no browser global * at import time, so any host can mount it. HeroUI v3 itself needs no provider. */ -export const App = ({ services, language, history }: AppProps) => { +export const App = ({ + services, + language, + history, + guideOpensByItself = true +}: AppProps) => { const [scoped] = useState(() => scopeServices(services)) const [router] = useState(() => createAppRouter({ logger: scoped.logger, history }) @@ -64,6 +73,9 @@ export const App = ({ services, language, history }: AppProps) => { const [autoRefresh] = useState(() => createAutoRefreshStore(scoped.preferences) ) + const [guide] = useState(() => + createGuideStore(scoped.preferences, guideOpensByItself) + ) return ( @@ -72,13 +84,15 @@ export const App = ({ services, language, history }: AppProps) => { - - - - - - - + + + + + + + + + diff --git a/packages/ui/src/__tests__/screen-table.ts b/packages/ui/src/__tests__/screen-table.ts index 6458848b..2c2f66c5 100644 --- a/packages/ui/src/__tests__/screen-table.ts +++ b/packages/ui/src/__tests__/screen-table.ts @@ -1,5 +1,6 @@ // The main screens the browser tests show, each brought to the state worth checking (and photographing). import { + anisetteShown, appsShown, checklistShown, developerShown, @@ -11,7 +12,10 @@ import { pressInstall, recoveryShown, renderChangelog, + renderGuide, + renderGuideBanner, renderScreen, + renderTour, renderUpdateScreen, renderWhatsNew, repairShown, @@ -24,6 +28,15 @@ const NEXT = '0.1.0-alpha.99' const RELEASE = `https://github.com/IPAForge/ipaforge/releases/tag/v${NEXT}` export const screens = { + 'guide-welcome': (options: ScreenOptions) => renderGuide('welcome', options), + 'guide-computer': (options: ScreenOptions) => + renderGuide('computer', { ...options, scenario: 'computer-not-ready' }), + 'guide-iphone': (options: ScreenOptions) => renderGuide('iphone', options), + 'guide-appleid': (options: ScreenOptions) => + renderGuide('appleid', { ...options, scenario: 'two-teams' }), + 'guide-banner': (options: ScreenOptions) => renderGuideBanner(options), + 'tour-sidebar': (options: ScreenOptions) => renderTour(3, options), + 'tour-top-bar': (options: ScreenOptions) => renderTour(6, options), 'install-home': async (options: ScreenOptions) => { await renderScreen('/install', options) await planShown() @@ -83,6 +96,10 @@ export const screens = { settings: async (options: ScreenOptions) => { await renderScreen('/settings', options) }, + 'settings-anisette': async (options: ScreenOptions) => { + await renderScreen('/settings#anisette', options) + await anisetteShown() + }, 'whats-new': renderWhatsNew, changelog: renderChangelog, 'update-downloading': async (options: ScreenOptions) => { diff --git a/packages/ui/src/__tests__/screens.ts b/packages/ui/src/__tests__/screens.ts index 635aedd7..e7838e1e 100644 --- a/packages/ui/src/__tests__/screens.ts +++ b/packages/ui/src/__tests__/screens.ts @@ -14,6 +14,7 @@ import { import type { LanguageId } from '@ui/i18n/languages/types.ts' import type { FakeScenarioId } from '@ui/services/engine/fake/types.ts' import { createFixedUpdateSource } from '@ui/services/updates/fixed-update-source.ts' +import { GuideKey } from '@ui/state/guide/constants.ts' export type ScreenOptions = { readonly language?: LanguageId @@ -43,6 +44,67 @@ export const renderScreen = async ( return rendered } +/** The setup guide open at `step`, once its checks have answered (no mark still waiting). */ +export const renderGuide = async ( + step: string, + { language = 'en', mode = 'light', scenario }: ScreenOptions = {} +) => { + await renderApp( + '/install', + compact({ + scenario, + preferences: { + language, + 'theme.mode': mode, + [GuideKey.status]: 'open', + [GuideKey.step]: step, + [GuideKey.done]: '["welcome"]' + } + }) + ) + await waitFor(() => { + expect(all('main h1')).toHaveLength(1) + const marks = [...all('main li > span[aria-hidden="true"]')] + expect(marks.every((mark) => mark.textContent !== '…')).toBe(true) + }) +} + +/** Install after Finish later: the banner to continue the guide above the page. */ +export const renderGuideBanner = async (options: ScreenOptions = {}) => { + const { language = 'en', mode = 'light' } = options + await renderApp( + '/install', + compact({ + preferences: { + language, + 'theme.mode': mode, + [GuideKey.status]: 'later', + [GuideKey.done]: '["welcome","computer"]' + } + }) + ) + await planShown() +} + +/** Settings with the tour at `stop`: Show me around, then Next until there. */ +export const renderTour = async (stop: number, options: ScreenOptions = {}) => { + await renderScreen('/settings', options) + const press = async (selector: string) => { + const button = await waitFor(() => { + const found = document.querySelector(selector) + expect(found).not.toBeNull() + return found + }) + button?.click() + } + await press('[data-tour-action="start"]') + for (let index = 0; index < stop; index++) + await press('[data-tour-action="next"]') + await waitFor(() => + expect(all('[role="dialog"] [data-tour-action="back"]')).toHaveLength(1) + ) +} + /** The update screen (or, for a copy that can't update itself, the app with its note) in `state`. */ export const renderUpdateScreen = async ( state: UpdateState, @@ -102,6 +164,10 @@ export const renderChangelog = async ({ ) } +/** Settings › Anisette servers lists the servers. */ +export const anisetteShown = () => + waitFor(() => expect(all('main ul li').length).toBeGreaterThanOrEqual(4)) + /** The Install page has the Engine's plan (App IDs, free apps, certificate, team). */ export const planShown = () => waitFor(() => expect(all('main dl dd').length).toBeGreaterThanOrEqual(4)) diff --git a/packages/ui/src/__tests__/test-services.tsx b/packages/ui/src/__tests__/test-services.tsx index f82adf08..e3819f90 100644 --- a/packages/ui/src/__tests__/test-services.tsx +++ b/packages/ui/src/__tests__/test-services.tsx @@ -22,6 +22,7 @@ import type { } from '@ui/services/system/types.ts' import type { UiServices } from '@ui/services/ui-services.ts' import { createFixedUpdateSource } from '@ui/services/updates/fixed-update-source.ts' +import { GuideKey } from '@ui/state/guide/constants.ts' /** A colour-scheme source the test can flip, like the OS switching to dark. */ export const createControllableScheme = (initial: ColorScheme) => { @@ -51,6 +52,8 @@ export type TestServicesOptions = { readonly load?: LoadBundle /** What the fake Engine plays; the happy path by default. */ readonly scenario?: FakeScenarioId + /** The setup guide opens by itself while no Apple ID is saved (off by default in tests). */ + readonly guideOpensByItself?: boolean /** Another Engine client, e.g. one whose calls never settle. */ readonly engine?: EngineClient /** The fake Engine's connected devices, for a test that plugs devices in and out. */ @@ -86,7 +89,11 @@ export const createTestServices = ({ level: 'debug', sink: (record) => records.push(record) }), - preferences: createMemoryPreferencesStore(preferences), + // Tests start past the setup guide unless they set its status themselves. + preferences: createMemoryPreferencesStore({ + [GuideKey.status]: 'finished', + ...preferences + }), colorScheme: scheme.source, localeSource: createFixedLocaleSource(languages), engine: @@ -122,7 +129,12 @@ export const renderApp = async ( history, language, ...render( - + ) } } diff --git a/packages/ui/src/components/choice-group.tsx b/packages/ui/src/components/choice-group.tsx index abf1b74e..96aafdbb 100644 --- a/packages/ui/src/components/choice-group.tsx +++ b/packages/ui/src/components/choice-group.tsx @@ -1,27 +1,27 @@ import { ToggleButton, ToggleButtonGroup } from '@heroui/react' -import { type Key, useId } from 'react' +import type { Key } from 'react' import { useTranslation } from 'react-i18next' import type { TranslationKey } from '@ui/i18n/setup/types.ts' type ChoiceGroupProps = { - labelKey: TranslationKey + /** The id of what names the group (a setting row's title). */ + labelledBy: string options: readonly T[] optionLabelKey: (option: T) => TranslationKey value: T onChange: (value: T) => void } -/** A labelled single-choice row of toggle buttons; selecting the current choice again keeps it. */ +/** A single-choice row of toggle buttons; selecting the current choice again keeps it. */ export const ChoiceGroup = ({ - labelKey, + labelledBy, options, optionLabelKey, value, onChange }: ChoiceGroupProps) => { const { t } = useTranslation() - const labelId = useId() const onSelectionChange = (keys: Set) => { const [selected] = keys const option = options.find((candidate) => candidate === selected) @@ -29,24 +29,19 @@ export const ChoiceGroup = ({ } return ( -
- - {t(labelKey)} - - - {options.map((option) => ( - - {t(optionLabelKey(option))} - - ))} - -
+ + {options.map((option) => ( + + {t(optionLabelKey(option))} + + ))} + ) } diff --git a/packages/ui/src/components/shell/app-credit.tsx b/packages/ui/src/components/shell/app-credit.tsx index d6421a0e..d15fc20c 100644 --- a/packages/ui/src/components/shell/app-credit.tsx +++ b/packages/ui/src/components/shell/app-credit.tsx @@ -8,7 +8,7 @@ export const AppCredit = () => { return (