feat(mobile): mark a pull request's files viewed, and hide the viewed ones
DA
3h ago+359+359+012345678901234567890123456789-17-17-01234567890123456789
Stacked on #10551, which is stacked on #10549. The third step of the iOS code viewer (STAG-3904): viewed marks and Hide viewed, as Dean picked.
What
- Files screen: each file the member marked viewed on GitHub stands faded, with a muted ✓, and the bar's summary counts them ("8 files · +5009 −5 · 1 viewed"). Hide viewed in the ⋯ leaves them out; if every file is viewed, the list says so.
- A file's screen: Viewed in the ⋯ marks or unmarks the file on GitHub, as the desktop's box does. The mark draws at once, and the list behind shows it.
- Refusals: a mark GitHub won't take goes back, and the list's footer says why, in the pull request changes' words (
pullRequestWriteWords). - Data: the marks are the same live read the panel uses (
PULL_REQUEST_PART.VIEWED), followed while a screen is in focus. Writes areMARK_FILE_VIEWED/UNMARK_FILE_VIEWEDthroughPULL_REQUESTS_ACTION.
Standard first: TanStack Query's own mutations
- Reading:
usePullRequestViewed(key)gives the Files list the marks and the refusal note. It writes nothing. - Writing:
useFileViewed(key, path)belongs to the file's screen, which owns that file's oneuseMutation, scoped byhashKey([…key, path]).- A file's marks go to GitHub in the order pressed, and different files' marks go out side by side.
- Stepping to the next file changes the path, so the next press takes that file's scope.
- Shared view:
useMutationStateshows a press while it is in flight, on the list and the file's screen alike.- A mark GitHub took stays until the marks are read again, which the hook asks for.
- A refusal falls back to what the read holds, and the list says why.
- Panel: its own viewed-marks code is not touched. It is the same as
main.
Fixture and flow
The Inbox fixture holds docs/invitations.md of #128 as viewed. pull-request-files.yaml hides and shows it, then marks a file viewed from its screen.
Tests
- Ran:
fixture-pull-requests.test.ts. - Typechecked
@repo/mobile,@repo/panel,@repo/host; ran oxlint and Biome on the changed files. - Not run yet: the simulator pass, which goes with the Mac run for #10551. Left to CI: the rest.
🤖 Generated with Claude Code