# Phone app

On a touch phone, in the store app or a phone's browser, the UI is a phone app's screens instead of the desktop window. [`AppShell`](https://github.com/Fzkuji/OpenProgram/blob/main/apps/web/components/app-shell.tsx) renders [`PhoneApp`](https://github.com/Fzkuji/OpenProgram/blob/main/apps/web/components/phone/phone-app.tsx) in place of the sidebar, tab strip and right panel when `useTouchPhone()` holds. A narrow desktop window keeps the [phone layout](https://openprogram.io/docs/reference/design/ui/phone-layout.html) of the desktop shell.

1. **Projects** `/chats`
2. **A project's chats** `/chats?project=<id>`
3. **A conversation** `/s/<id>`, a new one at `/chat`
4. **Details** `?details`
5. **Changes, Files, Activity, Resources** `?details=files` …

## Screens

| Screen | What it holds |
| --- | --- |
| Look | iOS 26's own apps, drawn by [Framework7](https://framework7.io)'s iOS theme as it ships: its navigation bars, large titles, lists, searchbar, toolbar, action sheet, popup and dialogs, at its own colours and sizes, in the system font (SF, with PingFang for Chinese). Nothing common is drawn by the app itself. |
| Motion | Framework7's own: the push and Back between pages, the swipe back from the left edge, a popup rising and the page under it pushed back, the computer button growing into its menu, swipeouts, switches and segmented controls. |
| Projects | A bar with the computer shown (a laptop, its dot green while connected), the title centred and a settings button, then a searchbar and the projects in inset lists. No new-chat bar: a chat starts inside a project. Search finds chats in every project. |
| Project order | Projects with chats waiting for the user first, then pinned ones (the home folder starts pinned), then by recency. |
| Project row | A coloured square with its initial, its name, the time of its latest chat or a badge counting the chats waiting, and the chat count with the latest title. |
| Bottom pieces | A project ends in Framework7's bottom toolbar, each piece on its own glass: the new chat's settings (the settings popup opens over the list, for the chat the toolbar then starts), New chat, and voice (a new chat with its mic on). |
| Computers | The laptop button's menu lists the computers paired with the phone (each its own connection, switched by the app) and the computers the shown one is linked to (Settings → Machines, marked “Through …”), whose projects it already lists, then Pair and Manage. The shown one is checked on the right; one computer is shown at a time (`phone-computer-switcher.tsx`). |
| Computer menu shape | As iOS 26's bar buttons do: one piece of the bar's glass keeps the button's top-left corner and curve (half its height) while it widens and lengthens, the laptop fading out as the rows fade in, and shrinks back on close. Framework7's popover is a second shape beside the button, so the app draws this one piece with Framework7's glass. |
| A project | ‹ Projects, the project's name centred in the bar and a … button, a searchbar, then its chats under In progress and Earlier, as Framework7's media list. A row has the title, the state word and last line under it (an image reads "Image"), and on the right the agent's mark next to the time, a spinner while it runs, or a "Waiting" badge. The toolbar reads "New chat"; the chat starts in this project. |
| Project menu | The … button opens iOS's own menu in the app and Framework7's action sheet in a browser: the project's computer and folder, then Pin, Rename and Archive chats, through the desktop project menu's requests. |
| Row actions | Framework7's swipeout: a swipe right shows Pin (Unpin when pinned), a swipe left Archive. A long press opens Pin, Rename, Copy link, Archive and Delete: iOS's own menu in the store app, Framework7's action sheet in a browser. Rename and Delete ask with Framework7's dialogs. |
| Conversation | As a Messages thread: Framework7's bar with ‹ Back, the title with its state under it, and ⓘ for the details. The transcript scrolls under the bar. |
| Composer | The composer is one box 10pt from the edges with 30pt corners: the text, then a row of buttons: Framework7's `+` link, one tonal button holding the model and effort, the permission's shield and a ▾, and the mic, which turns into a solid send button once there is text. The box is glass. Full access turns the shield red. |
| Composer button | The button stays blank until the chat's model is known, then fades in. Only a new chat shows the row over the field naming its computer, channel and project. |
| Messages | The user's message is a light bubble; each group of tool calls folds into one muted line, and a step tapped in it opens as a page. No buttons under messages: a long press lifts the pressed text or bubble and opens its actions. |
| Settings menu | The button opens every setting of the turn in one Framework7 popup, titled with Done: Harness, Model, Permissions and Agent as smart-select rows, each opening its choices as a page of the popup; Thinking as a segmented control (a row of choices when there are more than five); then toggles for Fast mode, Web search, Sandbox and Unattended (not Web search or Sandbox for an outside agent). |
| Details | Pushed over the conversation, laid out as Settings: the chat as the card at the top (the agent's mark, the title, "project · harness"); pin, rename, copy link and copy chat as tonal buttons; then lists: Changes (with +added −removed lines), Files, Activity and Resources, each opening a page (the desktop's right panel); a segmented control for how the transcript is shown; auto rename; archive and delete. Deleting returns to Projects. |
| Other pages | Settings, History and every other route open as a page under Framework7's bar, ‹ Projects; the page draws no bar of its own. A page with a list (Settings, Agents) opens on the list; a row opens its content, the bar then reading ‹ Settings, and Back returns to the list (`lib/layout/phone-route.ts`). |

## How it is built

| Part | How |
| --- | --- |
| Controls | Everything common comes from [Framework7](https://framework7.io) v9 (React), used as it ships. One app of Framework7's draws iOS now and Material for the Android app later. Only the transcript, the composer's box and the data stay the app's own. |
| Not chosen | Konsta UI draws the controls but has no pages, navigation or sheets, and each of those built by hand kept looking wrong. Ionic's iOS look predates iOS 26. Younger liquid-glass kits. |
| Framework7 and the app's styles | Framework7's stylesheet loads with the phone app only. Every rule is rewritten at build to reach only inside Framework7's root, since its class names (`.block`, `.grid`, `.card`) would otherwise land on Tailwind's (`apps/web/scripts/postcss-framework7-scope.cjs`). |
| Areas the app draws | `data-not-f7` keeps the rules out (the transcript, a panel, a Next page, an agent mark in a chat row); `data-f7` lets them in again inside such an area (the composer's controls). |
| Font and dark mode | Framework7's dark class follows the theme mode. The font is SF, with PingFang for Chinese. |
| Pages | Where the app is stays in the address, which Next's router, the chat's navigation and the phone's links all change. Framework7's View follows it (`phone-router.ts`): a push pushes the page, going back goes back to it, a replace changes the page's address in place (a new chat getting its id) or shows another kind of page there. |
| Back | Framework7's Back and its swipe from the left edge go back in the View, and the history goes one entry back after it. |
| No half-drawn page | A conversation not yet read opens once its messages arrive (at most 700ms), so it never slides in as an empty New chat first. |
| Data | Nothing is fetched twice: the list reads the session store, and the last list of chats and projects per computer shows at once, redrawing only what changed. |
| Reused views | The conversation is the split view's self-contained `PeerSessionPane`; the details pages mount the right panel's own panels. The chat page's shell stays mounted out of sight, since it owns the connection and the load of the conversation in the address. |
| Shared with the desktop | The model, agent and session-action menus were split into hooks and bodies (`useChatModel`, `useChatAgent`, `useSessionActions`), so the phone's sheet and details page and the desktop's chips and menus run the same code. |
| Chinese, Japanese, Korean | iOS WebKit draws a character the system font lacks as a boxed "?" instead of trying the next family, so every font stack names PingFang SC, Hiragino Sans and Apple SD Gothic Neo before `-apple-system` (`lib/prefs/appearance/font-stacks.ts`). |
| Menus | A choice is a Framework7 part: a smart-select page in the settings popup, the computer button's menu, an action sheet for a long press in a browser. iOS draws the long-press menus of chats and messages in the store app (`lib/mobile/native-menu.ts`, `NativeMenus.swift`): the page sends the items as soon as a finger lands, so the long press is ready; a pick comes back as an event. |
| Long press | A message's menu lists the buttons of its desktop action bar, which stays in the page hidden, and clicks them, so each action runs the same code (`phone-message-menu.tsx`). Text selection is off outside inputs. |
| Haptics | The store app's bridge plays a light, medium, selection or success tap (`haptic()` in `lib/mobile/bridge.ts`): long presses, switches and segments. |
| Permission card | Its choices stack as full-width 44pt buttons, the recommended one at the bottom near the thumb. |
| No zoom | Two quick taps on two controls would zoom the page: the screens use `touch-action: manipulation`, and the store app locks the viewport's scale. |

## Why a phone app, not the desktop restyled

The first phone version kept the desktop's structure (tab row, two drawers, chip rows) and restyled it; every fix still read as a computer squeezed onto a phone.

Three ways were drawn: restyle further (A), write the phone's screens inside the web UI (B), or write them natively (C). B was chosen: the screens follow phone conventions, while the data layer, the transcript renderers and the composer stay one codebase; C would mean a second UI to keep, which the [phone app](https://openprogram.io/docs/reference/design/distribution/mobile-app.html) ruled out.

| Peer | What it does on a phone | Taken |
| --- | --- | --- |
| Happy | Native list of sessions, a pushed session with its state under the title, an input card whose controls fold into one row, a long press on a message for its actions with a haptic | State under the title, one composer row, long-press menu, haptics |
| Paseo | Panels become pushed screens on a phone; the composer's agent controls collapse into one button that opens a sheet; tool calls fold into one line; rows swipe to archive | One settings button, pushed pages, folded tool lines, swipe to archive |
| Claude, ChatGPT | A docked new-chat field, a navigation bar with Back, settings as grouped lists | Docked field, grouped lists, ⓘ for details |
| GitHub | Changes, files and activity as rows of a details page | The details page's first group |

## Implementation status

Not built yet from the drawn design: the context graph row on the details page and a context gauge in the conversation.
