Skip to content

feat(mobile): match the web ui kit - #287

Merged
nixuuu merged 1 commit into
devfrom
feat/mobile-ui-kit
Nov 6, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/mobile-ui-kit

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 6, 2026

Copy link
Copy Markdown
Member

Brings the mobile building blocks (apps/mobile/src/ui, shared settings and navigation pieces) in line with the web kit (apps/web/src/lib/shared/ui), and replaces the large connection-lost box and full-width "Reconnect now" button with the web's connection model.

Connection notices

Where Before After (web parity)
Sidebar footer ● Reconnecting (amber for any non-live state) ● Connected / ● Reconnecting… (pulsing) / ● Gateway unavailable / ● Offline, like ConnectionStatus.svelte. A tap opens a status sheet: one sentence, Last error: <native code>, and a small secondary Reconnect now
Sidebar, Settings Grey box "Connection lost. Reconnecting automatically… (timeout, POSIX 50)" plus a full-width Reconnect now Nothing for a short drop. If the stream stays down for 12 s (live-source.ts threshold), a warning banner under the header reads "The gateway is not responding. Showing the last known state; retrying automatically." (the web AppShell text), with a ghost Details button that opens the status sheet. Without network: "You’re offline…"
Thread, bot chat Box only for offline/error; bot chat box on every reconnect Info banner "Reconnecting to live updates…" while this screen’s stream is down and the gateway still answers (web thread page). Real errors ("This conversation is no longer available…") show as an error banner with Retry. The quiet Syncing… line stays

useStream now returns unavailable after 12 s down and keeps the native code in detail, apart from user-facing text.

Inventory (mobile vs web kit)

Legend: same = matched before this PR; fixed = was different, now matches; different = still differs (reason below); missing = no mobile counterpart.

Block Web Mobile before Now
Button primary bg-action, text-on-accent, medium 16/24, 40 dp, radius 8 default style, 44 dp, regular weight, opacity 0.75 on press fixed: variant="primary", 40 dp (44 dp in Settings like density.css), medium, action-hover when pressed
Button secondary white / white-5 with zinc-950/10 ring and shadow-xs inset fill and line border fixed: web colours, ring and shadow; default variant, as on web
Button ghost transparent, zinc-700/300 text missing fixed: added
Button danger secondary look with rose text secondary look with danger text fixed: web ring, rose-50 / rose-500/10 when pressed
Button sizes md 40/36, sm 32/28 (text 14, gap 4, radius 6) 44 dp only; one SmallButton fixed: `size="md"
Button disabled/busy opacity 0.5; spinner replaces the icon, label stays opacity 0.45, spinner added beside label fixed
Button leading icon 16, muted on secondary/ghost missing fixed: icon prop
IconButton ghost, icon-muted → icon-emphasis, 40/36, radius 8; sm 32 44 dp, inset when pressed, icon muted fixed: 40 dp md, 32 dp sm, web pressed fill, icon darkens when pressed, busy, variants
Touch targets invisible 48 px TouchTarget sizes inflated to 44 fixed: visible sizes match web, hitSlop reaches 44–48 dp (phone adaptation)
Text field (Field) label medium 16/24, gap 6; 40/36 field, divider outline, 2 px accent focus, disabled panel + muted label regular 15, gap 8; 44 dp; no focus or disabled state fixed (44 dp in Settings)
Text area same as field, multiline Field multiline same
Search field ringed SearchField; sidebar uses a frameless variant sidebar raw TextInput, Settings used a labelled Field, thread search a Field fixed: shared ui/SearchField (bare for the sidebar), brand focus ring, clear button inside
Select trigger (SelectField) control look, chevron-up-down zinc-500, label like Field radius 10, label regular 15, disabled by opacity fixed
Picker sheet rows listbox option: radius 8, px 8, text zinc-800, check brand, no selected fill, heading text-sm medium zinc-500, separator zinc-950/5 radius 10, selected accent fill + bold label, faint headings, icon 18 fixed
Switch 44×24, zinc-200 / white-5 track with inset ring, brand-600/500 when on, white thumb with shadow, animated on --duration-fast action/inset track, border line, thumb jumps fixed: ui/Switch, animated (still under reduced motion)
Segmented control track zinc-950/5, item medium 14, active white + ring + shadow (dark white/10), 32 dp inset track, regular 13, active surface + border, 36 dp fixed (hit area grows to 44 dp)
Checkbox 20, radius 4, zinc-300 border, brand when checked one-off in Side thread sheet (radius 6, accent) fixed: ui/Checkbox, used there
Radio / option tiles OptionTile, ChoiceCard Appearance tiles different: kept as they are (already tiles with accent border; not in scope)
Alert info/warning/danger/error tinted box, ring, icon, title/body tones, banner strip grey Notice box; red text for errors fixed: ui/Alert with all tones and banner; Notice error renders an error Alert
Neutral note muted paragraph grey padded box fixed: Notice is a muted paragraph
Connection status / notices see above big box + full-width button fixed
Badge ring, medium text, tones same same
StatusDot 6 px, active ping 6 dp, no ping fixed: active ping
Avatars (project, bot) ProjectMark, bot avatar same components same
Settings card rounded-xl (settings), ring zinc-950/10, divider zinc-950/5 border line, 0.5 dp line dividers, padding 12 fixed: ring and hairline dividers, rows 10/12
Settings row title medium 15, description 13 title regular 15 fixed
Settings group heading semibold 16 semibold 14 fixed
Section headings in lists text-sm muted same same
Dividers / Rule zinc-950/5 same same
Sheet / dialog header title lg semibold, small close button, no rule 48 dp header bar with border, regular 16 title, 44 close fixed (native page sheet kept as the phone presentation)
Confirmations Dialog: question title, consequence, danger action, Cancel native Alert.alert fixed: one confirm() dialog in the kit (actions stacked like DialogActions on phones)
Menus DropdownMenu PickerSheet without check same (bottom sheet is the documented phone form)
Empty states EmptyState (dashed, icon, title, description, action) or a SettingsRow inside a group muted grey boxes; empty sidebar list never rendered (SectionList bug) fixed: ui/EmptyState, settings use SettingsRow like web, sidebar empty text shows again
Skeletons zinc-950/5, white/10, radius 6, pulse same same
Toasts dark pill at the top, one action bordered card under the header fixed: pill with Open
Composer controls own composer kit own composer kit different: not touched (separate feature, matched in earlier PRs)

What else changed

  • theme.ts: tokens for the web kit (ring, pressed, recess, control, track, brand, icon, iconStrong, actionPressed, dangerPressed) and useTypography().small.
  • ui/density.ts: Settings density (44 dp controls) and compact header actions.
  • Every Button moved from secondary/danger flags to variant; screens with two primaries were reduced to one (Agent environment headers, Update all, Preview marketplace once previewed, Generate new token).
  • Restore device defaults is an inline secondary button with an icon, as on web.
  • Thread search uses SearchField.
  • docs/mobile.md: connection states and the kit.

Still different, and why

  • Native page-sheet presentation for Sheet, bottom sheets for pickers and menus: the documented phone form (docs/ui-scale.md, docs/mobile.md).
  • No focus rings or hover states: no hardware-keyboard focus model in this app.
  • Confirm dialog does not move focus to Cancel (no programmatic focus on RN buttons); the danger action sits above Cancel as in web DialogActions on phones.
  • Appearance tiles, composer and timeline rows: own components, not part of this kit pass.
  • Theme tone colours are plain palette steps; web mixes them with the theme tint (color-mix), which RN cannot parse.

Checks

  • Web references in a real browser at phone width (430 px), light and dark: sidebar connected / reconnecting / unavailable, Settings → General, pairing dialog.
  • iOS Simulator (iPhone 17 Pro Max, iOS 26, existing EAS dev-client build, JS from this branch), paired with a throwaway gateway: sidebar connected, reconnecting, gateway unavailable (banner + footer), status sheet with Last error: POSIX 61, timeout, Settings → General light/dark (Switch, Select, Button, cards), confirm dialog dark; before/after for the connection box and Settings.
  • Not checked on a device: thread and bot chat banners (no worker or bot on the throwaway gateway), Android, Fold width (every Android emulator was in use by other sessions), long texts in the status sheet.
  • Gates: bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, bunx expo lint, bun run check:tmp.

Copy audit (docs/copy.md §8)

Before After Reason
"Connection lost. Reconnecting automatically… (timeout, POSIX 50)" + "Reconnect now" button Footer Reconnecting…; banner "Reconnecting to live updates…" (screen streams) web wording; code moved to details (§4.4, §5)
— "The gateway is not responding. Showing the last known state; retrying automatically." web AppShell text verbatim, one string across apps
"You’re offline. Your conversation will reconnect when the network returns." "You’re offline. Canopy reconnects when the network returns." present tense, no "will" (§2.3)
"Reconnecting" "Reconnecting…" / "Gateway unavailable" / "Offline" web labels; ellipsis for an ongoing action
— Status sheet: "Live updates are on.", "The connection dropped. Canopy reconnects automatically.", "The gateway is not responding. Canopy shows the last known state and keeps retrying.", "This phone has no network. Canopy reconnects when it returns.", "Last error: …", "Reconnect now" one idea per sentence, ≤ 15 words, details on demand
"Updates paused while Canopy is in the background.", "Connecting to your Canopy…" removed (states read as status, not notices) §5 no extra notices
"No threads yet. Start one with the pencil above." "No threads yet. Select New thread above to start one." no pointing at an icon shape (§7); web text
"No threads in the selected projects" "No threads in the selected projects." + Clear filters web text and action
"No bots yet. Create a bot in Canopy on the web." (box) EmptyState "No bots yet" — "Create a bot in Canopy on the web." §4.3 title + description
"No projects yet. Add a directory or clone a repository on a worker." "No projects yet" — "A project groups threads. Its workspaces are directories on your workers." web text
"No {tab} schedules. Add a schedule to send a message later." "Nothing scheduled" / "No finished tasks" + web descriptions web text
"No worktrees yet. …", "No workers yet. …", "No marketplaces yet. …", "No instances for this agent yet." same words as title + description rows §4.3 shape
Native alert "Delete bot" — "Delete “X” and its conversation? This cannot be undone." "Delete bot?" — "This deletes “X” and its conversation. You cannot undo this." question title, consequence in the body (§4.5)
Native alert "Archive thread?" — button "Archive" button "Archive thread" button repeats the title’s verb and object (§4.1)
"Settings → Mobile devices" (4 places) "Settings → Devices" the web section is named Devices
In-app alert card "{title} · {status}" toast "{title} · {status}" + Open §4.7 one action

No "soul" sentences added. Wrapping was checked with the long Settings descriptions and the banner text at phone width; long thread and bot names were not on the test gateway.

Buttons, icon buttons, fields, search, select, picker rows, switch,
segmented control, checkbox, alerts, empty states, settings cards,
sheets, confirmations and toasts now follow apps/web/src/lib/shared/ui.

The connection-lost box and full-width retry button are gone: the
sidebar footer shows the web's Connected / Reconnecting… / Gateway
unavailable status with a details sheet (native error code, small
Reconnect now), and screens show the web's compact banners.
@nixuuu
nixuuu merged commit 6fe72a8 into dev Nov 6, 2026
9 checks passed
@nixuuu
nixuuu deleted the feat/mobile-ui-kit branch November 6, 2026 19:02
nixuuu added a commit that referenced this pull request Nov 6, 2026
Mobile conversations used a solid composer block that shortened the
timeline. Composers now float above the feed and fold while reading
history; the main screens also extend their backgrounds and scroll
viewports behind the system bars while keeping controls inside safe
areas.

Rebased onto `dev` after the mobile UI kit landed (Related: #287). Its
shared buttons, notices, search/form controls, confirmation host and
sheet title/close controls are preserved. Connection banners now
participate in the floating header measurement on threads, bot chats,
sidebar and Settings. The extracted sidebar footer uses #287's
interactive connection status with details and retry; Settings retains
its density provider. Full sheets keep the kit's 20 dp content spacing
inside the inset-aware modal frame.

The final rebase also includes the bot-history changes that landed
meanwhile (Related: #288, #289, #290). Bot chats retain the snapshot
cache, incremental updates, cached bot names, loading header/avatar,
syncing subtitle and live-only approval/send/stop guards beneath the
floating layout.

## Composer behavior

- Match web `ComposerCompaction`: fold after 96 dp of travel toward
older messages, at least 192 dp from the end; expand within 8 dp of the
end or on tap, focus, or typing. Only reader gestures fold it; streaming
and layout changes do not. Synchronous questions keep it expanded.
- Match `VirtualFeed.reservedFooter`: measure the full overlay, retain
its largest reserve while reading history, and follow its height at the
latest end. The changing spacer is excluded from the visible-message
anchor. The latest-message action remains above the composer with an
actual Android touch area.
- Reuse the web surface, border, light-theme shadow and 32 dp canvas
fade. Animate folding with shared 400/350 ms tokens and `smoothOut`;
reduced motion uses zero duration. Inputs and folded controls stay
mounted.
- Mobile additionally keeps any draft, attachment or mention picker
expanded, so compaction cannot hide unfinished input. Bot chats retain
their native inline pill. This is a deliberate difference from web's
ability to fold a draft to one line.

## Insets by screen

| Screen | Layout and control insets |
| --- | --- |
| Thread and existing side thread | Full-window inverted feed under a
translucent floating header and composer. Oldest end reserves the
measured header plus top inset; latest end reserves the measured
composer including bottom inset. Composer controls have side/bottom
padding. |
| Bot chat | Same overlay, compaction, reserve and safe-area rules as
threads, with the inline bot composer. |
| Sidebar and thread/bot lists | Full-height list under measured
floating header/footer. Content padding makes first/last rows reachable.
Footer controls sit above the home indicator. Only the outside edge of
each split pane consumes a horizontal inset. |
| New thread and side-thread creation | Expanded forms because there is
no conversation history to compact. New thread scrolls under its
floating header; side-thread creation uses the modal frame. Form content
gets safe-area padding. |
| Settings | Both columns scroll behind the floating header. Navigation
consumes the left outside inset, details the right; a single column
consumes both. Forms retain keyboard-overlap handling. |
| Pairing and empty home pane | Full-window background and scroll
viewport, with content padding protecting controls at both ends and
sides. |
| Full sheets and compact pickers | Full sheets measure their own modal
safe area and scroll under the header. Bottom pickers extend their
surface behind the home indicator and inset actions; centered
landscape/Fold cards fit the safe rectangle. |

`KeyboardArea` keeps its existing keyboard `screenY` calculation.
Closed-keyboard safe-area padding now belongs to scroll content and
composer controls instead of the viewport. Status-bar icons continue to
follow the selected light/dark theme; translucent header surfaces
maintain contrast above scrolling content. No new native dependency or
native configuration change.

## Verification

Reran after the final rebase onto `cf9f6be2`: `bun install`, `bun run
gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check`,
`bunx expo lint` from `apps/mobile`, and the web build. All passed. Expo
refreshed the ignored generated route list for the newly merged exchange
screen before the passing typecheck. Final `bun run check:tmp`: **1534
passed, 158 skipped, 0 failed**, 1692 tests across 274 files; no test
temp directories left behind.

The full test run uses a private `TMPDIR` inside the ignored worktree
temp directory, with `GIT_CEILING_DIRECTORIES` set to that directory.
This prevents deliberately non-Git fixture folders from discovering the
checkout above them. Live/provider tests remain opt-in. Self-review and
`git diff --check` are clean.

Android Fold device observations before the final edge-to-edge
expansion: light/dark surfaces, long history, content passing below the
composer, folding on scroll, expanding on tap/focus and return to
latest, functioning latest-message action, and a visible multiline
draft. Screenshots are kept outside the checkout. The recording exporter
failed after its documented debug retry.

After the UI-kit rebase, the source launched in the free Android Fold
emulator using the existing development client. Smoke-checked the
edge-to-edge shell in light and dark, readable status icons, inset
sidebar footer, the offline connection banner and its details/retry
overlay, plus Settings search with the real keyboard open and closed.
After the final bot-cache rebase, the bot-chat screen also rendered its
loading header and floating composer. The old fixture gateway was
offline, so live conversation behavior was not rechecked. Multiline
entry could not be verified: Android's `system_server` aborted during
the fill attempt, and the tool's debug retry could not find the field
after the reset. No new native build or download was needed; the owned
emulator and Metro session were shut down afterwards.

Device QA remains incomplete: the earlier iOS development-client launch
timed out twice, and its notch/Dynamic Island layouts remain unverified.
Phone width, conversation keyboard handling, drafts with attachments and
mention suggestions, bot/side-thread flows, reaching the bottom during
streaming, reduced motion, landscape and Android three-button navigation
still need device coverage. The rebase smoke check does not replace
those checks.

Copy audit (`docs/copy.md` §8): no new user-facing copy; existing
English action labels and form text are preserved. No web UI tests or
permanent verification artifacts were added. Shared mobile buttons,
notices and form controls retain #287's implementation; only the shared
sheet's layout delegates to the new modal frame.
nixuuu added a commit that referenced this pull request Nov 6, 2026
Stage 2 of 2 (stack: #297 → this PR). Merge the stack together.

Applies the motion layer from #297 to the screens. Rebased onto #287 (UI
kit) and #292 (floating composer). The composer's compact/expand is
untouched.

## Transitions per screen

- **Thread timeline** (inverted list held by the fold anchor): a new
turn (sent or queued message) fades in; rows that arrive later inside a
turn fade in (work rows, notices, the answer when it leaves the fold);
an opened fold's rail fades in; fold, group, reasoning, code,
file-change and failure chevrons turn; pending steers fade in and out.
No height animation in the feed, so anchoring and following still hold.
- **Bottom of a conversation:** approval/question cards pop in and out;
"Show latest messages" pops in and out (in `FloatingComposer`,
appearance only).
- **Bot chat:** new messages fade in; the approval card fades its answer
block out on expiry and swaps the actions for the expiry note.
- **Sidebar:** the Threads/Bots lists cross-fade while the pill slides.
Thread rows glide on reorder (`GlidingCell`) and fade in when new, and
the row status (Working → Completed …) swaps. The "Working" section and
"Archived" get chevrons, and "Archived" expands as an accordion. In the
bot list, rows glide on reorder (`itemLayoutAnimation`), new bots fade
in, and unread counts pop and swap. The connection label swaps and its
dot eases.
- **Wide layout:** the sidebar slides in from the edge and fades
(`slow`) and slides out (`medium`). The column takes its width before
the slide in and gives it up after the slide out, so the screen beside
it lays out once, not on every frame. Rotation, folding, sign-in and
Settings switch at once. Screens keep the in-place swap from #234.
Screen transitions stay the native stack defaults.
- **Settings:** disclosures expand and collapse; connector error details
expand. The kit's `Switch` already animates its thumb.
- **Lists:** composer attachment chips pop in and out and their
neighbours glide. Bot approval rules resolve in when loaded, and a
removed rule fades out while the rest glide up.
- **In-app alert:** comes down from the top edge and leaves the same
way; a newer alert replaces it.
- A screen's first render and its removal do not animate
(`LayoutAnimationConfig` in the Stack's `screenLayout`, sheets and
overlays).

## Reduced motion

Fades only (rows, sheets, alerts, cards). Slides, pill, chevrons, text
swaps, layout glides and the sidebar are instant. Checked on iOS (Reduce
Motion) and Android ("Remove animations").

## Performance

- Every animation runs on the UI thread (Reanimated shared values,
layout animations).
- Long lists: virtual lists animate only real arrivals (`useArrivals`).
Rows that remount while scrolling appear at once, and virtualized rows
have no exit animations. The timeline animates opacity only, never
height.
- The sidebar no longer animates the column width. A width animation
re-laid out a 40-turn thread on every frame on the iPad and dropped the
motion; the column now changes width once, outside the motion.
- Checked with a 40-turn seeded thread on the iPhone 17 Pro simulator
(dev and production JS bundles), the iPad Pro 13" simulator and a Pixel
7 class Android 16 emulator.

## Verification

- Gates: `bun install`, `bun run gen:check`, `bun run typecheck`, `bun
run lint`, `bun run format:check`, `bunx expo lint`, `bun run check:tmp`
(1548 pass, 0 fail, nothing left in temp) and the web build are all
clean on the rebased stack.
- EAS dev builds (iOS simulator, Android APK) with the new native
modules were installed. The app was paired with a throwaway local
gateway that had seeded threads.
- iOS (iPhone simulator), light and dark, reduced motion on and off:
segmented pill, sheet open/close, live turn (rows arriving, fold
closing, answer out), fold toggle with the header anchored, "Show
latest", settings segments. After the rebase onto #292, a smoke test of
a live turn with the floating composer passed.
- iPad (wide layout): sidebar close and reopen end states, and pill.
- Android emulator: pill, live turn, dark mode, reduced motion (sheet
and scrim fade only).

## Unverified / known

- Frame-level timing on the iPad: simulator recordings at that
resolution drop frames, and frame stats need a physical device. The
sidebar design avoids per-frame layout, but it was not measured on
hardware.
- Not checked on a physical phone or a mid-range physical Android
device.
- Pre-existing and not changed here: on Android, after sending in a long
thread the feed stops just above the bottom and shows "Show latest
messages" instead of following. It reproduces with every animation
disabled, so `maintainVisibleContentPosition` on Android is the likely
cause.

## Copy audit

No UI text changed.
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