feat(mobile): swipe between Recent and My Space - #24
Merged
Conversation
The tabs were the only way to change what the feed shows, and they sit at the top of the screen — the one place a thumb cannot comfortably reach. A horizontal drag anywhere across the list now moves between them. The gesture follows the finger rather than waiting for the release: the pill sits between the two tabs as the drag crosses, and the list gives way with a damped offset that resists harder once there is no further tab to reveal. Releasing commits on distance or on velocity, so a short confident flick works as well as a long deliberate drag. None of it goes through React state. Both the pill's position and the list's offset are CSS custom properties written straight to the DOM on every pointer move — the same approach the aside's resize handle takes — because a render per frame would re-render every card in the feed to move a pill. React still owns the resting values, so pressing a tab animates through the very same property a swipe drives: one animation, two ways to ask for it. Vertical drags are left alone. The surface keeps `touch-action: pan-y`, so the browser scrolls the list natively and cancels our pointer, and the recogniser locks to whichever axis the finger commits to first. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkPLWajNT3W8tgVoyBiUq9
`postinstall` runs `wrangler types`, which drops `update-check/wrangler-latest.json` — a machine-local record of the last version check. Every contributor gets one on their first install, and none of them should be committing it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkPLWajNT3W8tgVoyBiUq9
Contributor
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
klipcode | 2f9017a | Commit Preview URL Branch Preview URL |
Aug 20 2026, 09:28 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the touch layout, the tab pill was the only way to change what the feed shows — and it sits at the top of the screen, the one place a thumb cannot comfortably reach. A horizontal drag anywhere across the list now moves between Recent and My Space. The buttons keep working exactly as before.
How it behaves
touch-action: pan-y, so the browser scrolls the list natively and cancels our pointer; the recogniser locks to whichever axis the finger commits to first, with ties going to the scroll.How it's built
Nothing goes through React state. Both the pill's position (
--tab-progress, a fractional tab index) and the list's offset (--tab-shift, px) are CSS custom properties written straight to the DOM on every pointer move — the same approachAsideResizeHandlealready takes for the aside's width — because a render per frame would re-render every card in the feed to move a pill. They're inherited from a shared ancestor, so the switcher and the list read the same two numbers without knowing about each other.React still owns their resting values, so pressing a tab animates through the very same property a swipe drives:
FeedTabsno longer positions its pill fromactiveat all. One animation, two ways to ask for it — they can't drift.src/lib/tabSwipe.ts— the maths (axis detection, progress, damping, commit thresholds), the two custom properties, and the shared transition. Pure and framework-free.src/hooks/useSwipeTabs.ts— the pointer-event recogniser, generic over a list of tab ids.src/components/MobileHome/{FeedTabs,MobileHome}.tsx— wiring.Tests
src/__tests__/tabSwipe.test.ts— 20 unit tests over the gesture maths: the axis slop and its tie-break, progress clamping at the ends, edge resistance and the follow cap, and each way a release can or cannot commit (distance, velocity, sub-slop noise, degenerate widths).e2e/mobile.spec.ts— 8 Playwright tests at 390×844: swiping both ways, the pill tracking mid-drag (asserted on the live custom property), a short swipe springing back, a short flick committing, the end of the range holding, a vertical drag scrolling instead, a swipe off a card not opening it, and the tab buttons still working on their own.Full suite green locally: 192 unit tests, 16 e2e tests, plus typecheck, lint and build.
Generated by Claude Code