feat(mobile): Storybook + ember theme tooling (Sprint 1 / PR 1 of 7)
Summary
Foundation PR of the chat-mobile sprint-1 stack. Pure tooling: scaffolds Storybook RN, rewrites the mobile app's color tokens to the desktop ember palette (Path A), and lands the Storybook config tweaks needed to make stories prep without crashing.
Storybook scaffold (`apps/mobile/.rnstorybook/`)
- `main.js` story globs, `preview.tsx` decorators, `index.tsx` UI shell
- on-device controls + actions addons
- Geist + Geist Mono fonts via `@expo-google-fonts/geist`
Ember theme tokens
- `apps/mobile/global.css` and `apps/mobile/lib/theme.ts` rewritten to the ember warm palette (`#e07850` accent, warm-neutral surface ramp #151110 / #1a1716 / #201e1c / #2a2827)
- `NAV_THEME` (expo-router) updated to mirror ember tokens
- State palette (live / warning / danger / success / neutral) for chat-domain status indicators
Storybook config fixes
- AsyncStorage adapter passed to `getStorybookUI`
- Node `tty` module stubbed for Metro (Storybook 9 RN compatibility)
- `screens/**/*.stories` excluded from the glob — they transitively import `useTheme` → `lib/theme.ts` → `expo-router/react-navigation` which crashes at prep time
- Decorator wrapped in `` from `expo-router/react-navigation` (mitigation attempt) then re-doubled-down on the screens exclusion when wrap proved insufficient
Stack position — 1 of 5
This PR must merge first; PRs 2–5 build on it.
| # | Branch | Status |
|---|---|---|
| PR 1 (this) | `chat-mobile-sprint-1-tooling` | foundation — Storybook + ember tokens |
| PR 2 | `chat-mobile-sprint-1-ported` | port vendor primitives + first-party app components to ember |
| PR 3 | `chat-mobile-sprint-1-atoms` | 10 chat-view atoms |
| PR 4 | `chat-mobile-sprint-1-molecules` | 19 chat-view molecules |
| PR 5 | `chat-mobile-sprint-1-organisms` | 10 chat-view organisms |
Each downstream branch contains this PR's commits plus its own (cross-fork stacks can't set non-`main` bases). After this PR merges, downstream branches rebase onto fresh `main` and shrink to their phase-specific diff.
Test plan
- `cd apps/mobile && bun storybook` — Storybook opens in Expo
- No expo-router crash at prep time
- Storybook UI shell renders with on-device controls + actions tabs
- `bun run typecheck` passes (28/28)
Summary by cubic
Added on-device Storybook for React Native, gated by EXPO_PUBLIC_STORYBOOK=true, to speed up mobile UI work. The app theme matches main (stock shadcn/ui zinc); token galleries and the HelloWorld scaffold were removed.
-
New Features
- Storybook scaffold under
apps/mobile/.rnstorybook; app boots Storybook whenEXPO_PUBLIC_STORYBOOK=true. - Integrated
@storybook/react-nativeviawithStorybookinmetro.config.jsfor env-gated builds. - Loaded Geist and Geist Mono via
@expo-google-fonts/geistand@expo-google-fonts/geist-mono, withexpo-splash-screengating and error-safe hide.
- Storybook scaffold under
-
Bug Fixes
- Fixed persisted-selection crash by passing
AsyncStoragetogetStorybookUI. - Avoided expo-router context errors with a
StorybookRouterProvider(setsPreviewRouteContext,LinkingContext,UnhandledLinkingContext) and removed a duplicateNavigationContainerso it passes SDK 56 checks. - Stubbed Node
ttyusing a Storybook module mock; added a defaultWelcomestory to prevent EmptyIndex crashes. - Ensured splash screen never stalls on font load errors.
- Fixed persisted-selection crash by passing
Summary by CodeRabbit
Release Notes
-
New Features
- Added Storybook integration for interactive component development and testing.
- New npm scripts:
storybookto launch the Storybook environment andstorybook-generatefor story generation.
-
Chores
- Updated application configuration and build system to enable conditional Storybook environment loading.
- Updated font handling dependencies.