Skip to content

feat(mobile): right-align folded steps, generic tool glyph, pinch-zoom image previews - #659

Merged
huichen merged 2 commits into
mainfrom
claude/mobile-step-align
Sep 16, 2026
Merged

huichen merged 2 commits into
mainfrom
claude/mobile-step-align

Conversation

@huichen

@huichen huichen commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Second round of feedback on the folded step line (#656, #657), plus a preview improvement.

Folded step line

Everything a run owns now hangs off the right edge — the summary line, the rows it opens, and the detail those rows open in turn — so the left edge of the transcript belongs to the prose alone. That was the point of folding the apparatus away.

                         🖥×5 · 🧠×3  ⌄     ← summary: glyph × count, nothing else
                              🧠 已思考  ⌄   ← icon + words once expanded
                             🖥 运行 3 次  ⌄
              rg -n "contextWindow" agent/src
                              📄 已读取  ⌄

The summary carries no wording — a glyph and a count per bucket — because the line has to survive in a phone's margin. The wording is not lost: it is the row's accessibility label (Tool calls 5× · Thought 3×), which is also where a failure is named, since the alert glyph is told apart by shape and never by colour.

One tool bucket. Run/read/write/edit all count as "tool calls": at this altitude the question is how much work happened, and four separate counts read as a list of numbers nobody parses (the original Chinese feedback: "已运行5次已思考三次,已写入一次,这种文案太啰嗦,合并一下"). Which tool it was is what the expanded rows are for.

The tool glyph is a wrench, not a terminal — the count stopped being about shell commands the moment it covered read/write/edit too.

The glyph sits flush against its count (🖥×5 is one token); only the kinds are spaced apart, around their ·.

Failed and still-running calls keep the behaviour from #657: a failure folds and counts as a tool call while the summary flags it; a call still in flight stays on screen, since folding live progress would hide it.

Image previews pinch to zoom

PreviewModal's image branch now renders a ZoomableImage: pinch to zoom (1×–6×), drag to pan while zoomed.

  • Built on RN's own PanResponder/Animated. The app ships no gesture stack, and adding react-native-gesture-handler + reanimated (and their native build config) is a lot of dependency for one interaction.
  • Panning is clamped to the overhang the zoom created — (scale-1)/2 frames per side — so the picture can never be dragged out of view and lost.
  • Releasing below 1.05× springs back to fit, so there is no separate reset control to find.
  • Zoom is computed from the gesture's start distance rather than multiplied per frame, so there is no compounding drift and the return-to-fit is exactly reversible.
  • A plain tap is never claimed (onStartShouldSetPanResponder is false), so the surrounding UI keeps its touches.

The arithmetic that carries the behaviour (zoom bounds, pan limits, pinch distance) lives in exported helpers and is unit-tested directly rather than by synthesizing native touch histories.

Tests

  • TimelineCard.test.ts (16 cases): folds into one icon/count line; the spoken form stays complete; expanded rows keep icon + words; four tool kinds merge into one count; zero buckets are omitted; a failure folds, counts and is flagged without colour; glyph flush against count; every level right-aligned; streaming tail never folded.
  • zoomableImage.test.ts (3 cases): pinch distance, zoom clamping, pan clamping to the overhang.

Local (mobile-scoped, after merging origin/main): npm run typecheck ✅ · npm run lint ✅ · npm test — 97 suites / 1355 tests ✅

…-zoom previews

Three follow-ups on the folded step line, plus zoomable image previews.

Folded step line:
- The tool count is a wrench, not the terminal it started as: the count now
  covers every tool kind (run/read/write/edit), and a shell prompt claimed
  they were all commands.
- The glyph sits flush against its count — "wrench x5" reads as one token —
  while the kinds stay spaced apart around their separator.

Preview:
- Image previews pinch to zoom (up to 6x) and drag to pan, built on RN's own
  PanResponder/Animated: the app ships no gesture stack, and adding one plus
  its native build config is a lot of dependency for one interaction. Panning
  is limited to the overhang the zoom created, so the picture cannot be
  dragged out of view; releasing below 1.05x springs back to fit.
@huichen
huichen enabled auto-merge (squash) September 16, 2026 08:11
@huichen
huichen merged commit 4f150b7 into main Sep 16, 2026
12 checks passed
@huichen
huichen deleted the claude/mobile-step-align branch September 16, 2026 08:14
huichen added a commit that referenced this pull request Sep 16, 2026
… their own line (#671)

Two things had to be true at once, and the last change bought the second by
giving up the first: a revealed file name needs the row's leftover width, and a
row that shrinks to a right-rail badge has no leftover width to claim. Inline,
the target's `flex: 1` therefore resolved to zero inside the badge — the file
name was invisible — so #668 parked every row in the left reading column and
left the revealed target inline.

Put the target on its own line below the header and the conflict disappears. The
header goes back to a one-liner with nothing to wrap, so the row can shrink-wrap
again, and the target gets the full width at its own indent: names wrap instead
of being clipped, and the chevron stops landing mid-sentence between the label
and the path. Shell commands already worked this way; file targets now use the
same line, which also removes the separate `inlineToolTarget` style.

With the geometry free again, the rails from #659/#660 come back: a row is a
badge on the right rail while nothing of it is revealed, and falls into the
reading column once it — or the run around it — is open. The run summary keeps
its rail when it opens, so the line under the user's finger does not move while
the rows it revealed appear below it on the left. `opened` is a required prop
again, so no call site can pick a rail by accident.

Tests: the rail assertions from #660 are restored (folded summary and lone rows
on the rail; opened rows and their detail off it), together with #668's
no-truncation assertions, plus a check that the revealed target is a line of its
own rather than a cell beside the label.
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