feat(mobile): group home by project and name the scope on screen

Merged
SA
3mo ago
+426-262

What & why

Opening the app never told you what you were looking at. The home list was scoped by
organization, host, project and sort at once, and only the organization appeared
anywhere on screen. Worse, two of the others resolved themselves:

  • useSelectedHost falls back to whichever machine happens to be online, so a sleeping
    laptop silently promotes another host and the app opens onto different work.
  • defaultProjectId was the project of whichever workspace was updated last, so an agent
    finishing overnight in another project moved your default there.

The filter icon carried no active state, and the only place a project was even implied was
the empty state: "No workspaces in this project yet."

Projects are now sections instead of a filter. Every project on the host is listed,
ordered by its liveliest workspace, collapsible with the state kept per host, with a count
so a shut section still says what's inside. The project filter and its defaultProjectId
guess are gone, along with the sheet row and route that set it. What remains of the scope —
host with its presence dot, and sort — sits in a chip row under the search field, each
chip opening the picker it names.

This is worth more than it sounds: on my account the host showed one project before.
It actually has seven — Boid Home, notion-clone, frontend-interview, evidence, presentations
and more were invisible behind a filter nobody set.

Date group headers give way to project headers; recency survives as the section ordering.

Design exploration: options ·
interactive mock of what shipped

Two corrections made while building

  • Search was never cross-host. useHostWorkspaces(host) only ever fetches the selected
    host's workspaces, so search escaped the project scope alone — the host predicate in the
    old code was a no-op. A cross-host "N more on " tail I'd planned was therefore dead
    code and was removed rather than shipped. Search now reports how far it reached
    ("N results on this host").
  • projectFilter is deleted, not orphaned. It was still read by useNewChatTargets as a
    fallback for the composer's default target; with it gone the composer falls back to the
    most recently updated workspace's project, which is what a null filter already did.

How I tested it

On the iOS simulator against a live host and real projects:

  • Sections render with counts; collapse toggles and survives a cold restart (terminate +
    relaunch), keyed per host
  • Both chips open their pickers (host picker listed five machines; sort picker toggles)
  • Host chip shows the live presence dot
  • Search returns "2 results on this host", grouped by project, auto-expanding collapsed
    sections; clearing restores the full list
  • A project with zero workspaces renders correctly (MASTRA-SUPERSET 0)
  • Caret renders in both states — the first attempt used a rotate transform, which doesn't
    reach the underlying SVG and silently rendered nothing

Three rounds of layout review against the real list: headers initially out-weighed their own
rows and duplicated the +; the fix re-weights rows as children, drops my header + in
favour of the pre-existing row one, and puts the project mark in the same 24pt icon box the
rows use so both columns share a grid.

Not exercised: the host-offline empty state.

Follow-ups (not in this PR)

  • Density: projects holding only main still cost a header plus a row. Default-collapsing
    dormant projects would open the list on what's alive.
  • useHostTerminals gates rows on host.isOnline, so a relay presence flap empties the
    tab strip while the terminal keeps streaming. Pre-existing, affects home too, worth its own PR.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs

Summary by cubic

Groups Home by project and makes the active scope visible. Previously, host fell back silently and a guessed project filter hid most work; now sections replace the project filter, and chips name host and sort.

  • Projects become sections: headers show avatar/name/count, collapse per host via collapsedProjectsStore (keyed machineId:projectId) and persist without flash on cold start.
  • Unknown/missing projects: workspaces whose project isn’t reported fall under a “No project” section; avoids disappearing during the projects-not-yet-loaded beat.
  • Scope bar: adds chips for host (with presence dot) and sort under search; chips open existing host/sort pickers.
  • List/order: pinned-first then by recent activity; replaces date headers with project headers.
  • Search: stays host-scoped and announces reach (“N results on this host”); empty copy is “No projects on this host yet.”
  • Removed project filter: drops /filter/project, the Filter screen’s project row, ProjectFilterScreen, and projectFilter from useWorkspacesFilterStore.
  • useNewChatTargets: stops reading the deleted projectFilter; defaults to the most recently updated workspace’s project.
  • UI polish: aligns project/row icons on one grid; lightens header and row weights; hides duplicate branch when it matches the workspace name.

Summary by CodeRabbit

  • New Features
    • Home workspaces are now grouped by project with collapsible sections and workspace counts.
    • Added host and sort controls, host-wide search, project-based sorting, and orphan workspace handling.
    • Collapse and expand states are saved between sessions.
  • Improvements
    • Updated workspace rows with clearer typography and less redundant branch information.
    • New chat targets prioritize recently updated workspaces.
  • Changes
    • Removed project selection from filtering screens and controls.