Skip to content

feat(mobile): light/dark app chrome theme [CHE-1305] - #5

Merged
smk508 merged 1 commit into
mainfrom
smk508/che-1305-mobile-chrome-theme
Jun 28, 2026
Merged

smk508 merged 1 commit into
mainfrom
smk508/che-1305-mobile-chrome-theme

Conversation

@smk508

@smk508 smk508 commented Jun 28, 2026

Copy link
Copy Markdown
Owner

What changed

The Orca mobile app chrome was hardcoded to the dark palette. This adds a light theme and drives the app chrome from a theme context that resolves the effective scheme from a stored appearance preference plus the device's OS color scheme.

  • mobile-theme.ts — adds lightColors alongside darkColors, both typed against a shared ThemeColors contract (identical token keys). Syntax/terminal tokens stay dark-optimized (the terminal WebView and code surfaces remain dark regardless of app chrome). The existing colors export still points at the dark palette.
  • theme-context.tsx (new) — ThemeProvider + useThemeColors() / useTheme(). Resolves 'system' against React Native useColorScheme(), falling back to dark when the OS scheme is unavailable.
  • preferences.ts — appAppearance preference ('system' | 'light' | 'dark', default 'system') with load/save following the terminalLinkOpenMode precedent. Unit-tested.
  • _layout.tsx — wraps the tree in ThemeProvider; the root Stack screenOptions (header/content) and the StatusBar style now read the active palette.
  • index.tsx (home/pairing screen) and settings.tsx — migrated to useThemeColors() via a memoized StyleSheet factory. Settings gains a System / Light / Dark control that reads/writes the preference.

Migrated screens (themed; safe to screenshot in both modes)

  • app/index.tsx — home / "Connect your desktop" pairing screen (the default visible screen)
  • app/settings.tsx — settings, incl. the new appearance control
  • App chrome: root Stack header + content background + status bar

Dark fallback (AC-compliant)

The other ~10 screens still import the static colors (dark) export and render dark in all modes. The AC explicitly allows a clean dark fallback for unmigrated screens — they don't break, they just don't yet follow the light preference.

Verification

Mobile has its own gates (the root harness doesn't cover mobile/); all green from mobile/:

  • pnpm lint (oxlint) — clean
  • pnpm test (vitest) — 964 passed, 2 skipped (incl. new appAppearance preference tests)
  • pnpm exec tsc --noEmit — clean

Light/dark verification screenshots will be attached separately.

Note: the track-community-pr check will fail — that's stablyai-org bot-token automation, not a code gate. The real check is verify.

🤖 Generated with Claude Code

The mobile app chrome was hardcoded dark. Add a light palette and a theme
context that resolves the effective light/dark scheme from a stored
appearance preference plus the device's OS color scheme, then drive the app
chrome (root Stack screenOptions, home/pairing screen, settings) from it.

- mobile-theme.ts: add `lightColors` alongside `darkColors` with identical
  token keys; `colors` still points at the dark palette so unmigrated screens
  compile and render dark (the clean dark fallback the AC allows).
- theme-context.tsx: `ThemeProvider` + `useThemeColors()`; resolves 'system'
  against React Native `useColorScheme()`, falling back to dark.
- preferences.ts: `appAppearance` ('system' | 'light' | 'dark', default
  'system') load/save, following the terminalLinkOpenMode precedent.
- _layout.tsx: wrap the tree in ThemeProvider; Stack screenOptions and the
  StatusBar style now read the active palette.
- index.tsx, settings.tsx: consume `useThemeColors()` via a memoized
  StyleSheet factory; settings adds a System/Light/Dark control.

Other screens stay on the static dark `colors` fallback (AC-compliant).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@smk508

smk508 commented Jun 28, 2026

Copy link
Copy Markdown
Owner Author

Rung-2 verification — mobile chrome light/dark

Captured on the iPad Pro 11-inch simulator (real dev-client build), home/pairing screen. The app appearance preference defaults to System, so the chrome follows the device — and it switches live when the OS appearance toggles (no relaunch), confirming the useColorScheme-driven theme context.

Light Dark

Light: light background, dark text, inverted (dark) "Pair Desktop" button. Dark: black background, white text, light button. The unmigrated screens stay on the dark fallback (AC-compliant). The che-1305-verify-evidence prerelease is safe to delete once this PR lands.

@smk508
smk508 merged commit eacb19b into main Jun 28, 2026
2 of 3 checks passed
@smk508
smk508 deleted the smk508/che-1305-mobile-chrome-theme branch June 28, 2026 21:16
smk508 pushed a commit that referenced this pull request Jul 22, 2026
* Restructure mobile pairing setup into a clear stepped layout

* Rework mobile pairing UI: radio-style path selector with sign-in gate fo

* fix(mobile): resolve mobile-pairing review findings

Applies the code-review findings for the reworked pairing UI:

- Clear a displayed Relay QR on sign-out in both MobilePage and MobilePane
  (the rework dropped the wasSignedInRef watcher, leaving a stale Relay QR
  next to a "sign in required" prompt). Anywhere stays selected; the QR
  re-mints as local-only. [#1, #3]
- Extract useMobilePairingConnectionMode so both panes resolve the saved
  preference identically instead of duplicating the state + resync effect. [#6]
- Delete ~24 i18n keys the rework left unreferenced; sync locale catalogs
  to parity. [#4]
- Give the connection-path radiogroup roving tabindex + arrow-key nav and
  document why it diverges from SettingsSegmentedControl. [#7]
- Add MobilePane.test.tsx (previously untested safety logic) and a
  MobilePage saved-local-only restore test. [#2, #5]

Verified: 22 targeted tests pass, typecheck + oxlint clean, localization
catalog/coverage and max-lines ratchet green.

* fix(mobile): resolve adversarial-review findings for pairing UI

Address accepted findings from the mobile pairing UI rework:

- MobilePane: add a request-generation epoch so a late getPairingQR
  response can't paint a stale Relay QR after sign-out, a mode switch,
  or an address change; arm rotation when discarding a pending mint.
- MobilePage: on sign-in, upgrade a signed-out local-only fallback QR to
  Relay (invalidate + rotate-regenerate); handle null->connected too.
- Extract useMobilePairingQrInvalidation so both sign-in/out edges and
  cross-window preference syncs invalidate/re-mint the QR consistently.
- MobilePane: clear + rotate the QR when the selected address changes
  (manual pick or refresh-driven) so it can't encode the old endpoint.
- MobilePairingConnectionOptions: guard the Sign in CTA on configured;
  show an Unavailable panel on unconfigured builds instead of dead CTA.
- Drop the duplicate sign-in helper from MobilePairingSetupSection.
- Remove dead i18n keys (title, recommended, signInToGenerate) and add
  relayUnavailable across all locale catalogs.
- Add tests: deferred sign-out/mode-switch races, sign-in upgrade,
  cross-window sync, unconfigured build, arrow-key radiogroup.

TODO left for the relay-label-honesty finding: getPairingQR does not
expose the actually-encoded mode when an automatic offer degrades to
local-only, so the mismatch can't be surfaced without a new return field.

* fix(mobile): resolve relay-pairing deep-review regressions

- MobilePane: invalidatePairing now clears loading so a superseded
  mid-flight generate can't wedge Generate disabled forever
- MobilePage: stop auto-minting a local-only QR under the Relay label
  when signed out with Anywhere; gate Step 2 auto-generate and the
  Generate button on a shared canMintMobilePairingOffer helper, align
  with Settings, clear QR + loading on sign-out, mint Relay on sign-in
- qr-invalidation: clear pairQrDataUrl (and loading) on every
  invalidation path so a stale QR can't stay scannable during rotation
- Strengthen MobilePane/MobilePage tests for the aligned behavior and
  stuck-loading coverage
- Translate relayUnavailable in es/ja/ko/zh

Co-authored-by: Orca <[email protected]>

* fix(mobile): refuse to mint QR when signed-out with Anywhere selected

Replace silent degradation of Anywhere mode to local-only QR with explicit
refusal. Add canMintMobilePairingOffer guard across all mint paths (address
change, network invalidation, connection mode switch). This ensures the UI
honestly encodes the selected pairing path. Improve keyboard focus visibility
on the path selector by adding a persistent focus ring.

* fix(mobile): detect and flag Relay provisioning degradation

When Relay provisioning fails during automatic (Anywhere) pairing offer creation, the offer silently degrades to local-only. This confuses users who selected Anywhere expecting cellular capability.

Add connectionMode field to the pairing offer result to expose what the offer actually encodes. The UI now flags degradation when the offered mode mismatches the user's selection.

Also move credential rotation logic to the main process: rotate when requested mode differs from the pending token's encoded mode. This ensures QR codes displayed under an old policy can't pair under a new one, and windows reminting after preference sync converge on one token.

Rename MobileRelayBetaAvailability → MobileRelayBetaNotice.

* test(mobile): verify pairing codes don't flash during Relay mint

Assert that the pairing QR and URL remain hidden while the Relay mint is
pending, preventing confusing intermediate states when signing in unlocks
Relay.

---------

Co-authored-by: Orca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant