feat(pulse): alternate mobile interface at /m - #2
Closed
elhoim wants to merge 1 commit into
Closed
Conversation
Pulse's dashboard is built for a 1600-1920px canvas. On a phone the header
collapses to a hamburger but the content keeps desktop density, and the only
navigation is one long drop-down. This adds a phone interface at /m that shows
the same information with the same structure — because it renders the same
components.
How it avoids becoming a second copy of Pulse:
- Every mobile route is a generated file that re-exports the desktop page
(`export { default } from "@/app/health/page"`). There is no markup on the
mobile side that could drift from the desktop, because there is no markup.
`scripts/gen-mobile-routes.ts` discovers desktop routes from the filesystem,
so an install with more pages simply generates more routes.
- Density is a React context, not a media query. The shared chrome primitives
(PageShell/Panel/PanelHeader/StatTile/TabBar/Pill/EmptyState) read it and
tighten themselves. Desktop routes render with no provider above them, so
they take the default branch and are unchanged.
- Navigation derives from the existing nav-manifest. Adding a page there puts
it in the mobile menu with no mobile-side edit.
TELOS is the one exception, and it is bounded. The desktop stacks twelve
sections into a single scroll, which is the wrong structure on a phone rather
than a wrong amount of detail — so /m/telos is a section index and each section
gets its own route. Both surfaces render from one shared section manifest +
registry, so neither can hold a section the other lacks. Routes that earn a
hand-written mobile treatment must be named in HAND_WRITTEN in the generator.
Rollback is first-class:
- Any visitor: tap the monitor icon to pin the desktop UI for that browser.
The desktop header carries the reverse toggle.
- Whole layer: `bun LIFEOS/PULSE/Tools/MobileUi.ts disable` — no phone is ever
redirected, and /m sends visitors to the desktop route. `status` prints the
exact paths to delete for total removal.
- Desktop is untouched: zero route pages under src/app/<page>/page.tsx are
modified. The four touched files each take a guarded early-return, a single
added element, or a mechanical extraction.
Sizes: the hand-written mobile layer is ~1000 lines presenting ~11,300 lines of
desktop pages, and each mobile page costs ~10 kB more JS than its desktop twin
(the shell) rather than bundling every page.
Verified in real Chrome at a 390x844 viewport: no horizontal page scroll and no
element wider than the viewport outside a scroll container across the tier-1
routes; thumb bar fixed at the viewport bottom; all twelve TELOS sections
rendering; the burger sheet listing every page; the redirect and both toggle
directions surviving reload. Desktop re-checked at 1600px — computed padding,
gap, and type sizes equal the untouched source literals.
Includes tests/mobile-registry.test.ts (17 assertions) covering route coverage,
re-export purity, manifest-derived navigation, section/renderer parity, layer
size, and a regression guard against the dynamic [section] route that built
fine and died on hydration.
Owner
Author
|
Superseded by the upstream PR: danielmiessler#1697 Same branch ( |
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.
Pulse's dashboard is built for a 1600–1920px canvas. On a phone the header collapses to a hamburger but the content keeps desktop density, and the only navigation is one long drop-down. This adds a phone interface at
/mthat shows the same information with the same structure — because it renders the same components.The idea
/m/healthisn't a mirror of/health. It is/health:There is no markup on the mobile side that could drift from the desktop, because there is no markup.
scripts/gen-mobile-routes.tsdiscovers desktop routes from the filesystem, so an install with more pages generates more routes automatically.What's actually mobile is the layer around it:
PageShell/Panel/PanelHeader/StatTile/TabBar/Pill/EmptyState) read it and tighten themselves. Desktop routes render with no provider above them, so they take the default branch and are unchanged. Measured at an identical 390px viewport: panel padding 15px → 11.25px, shell gap 22.5px → 13.125px, stat value 28px → 21px.nav-manifest. Add a page there and it appears in the mobile menu with no mobile-side edit.TELOS is the one exception, and it's bounded
The desktop stacks twelve sections into a single scroll. That's the wrong structure on a phone rather than a wrong amount of detail — so
/m/telosis a section index and each section gets its own route. Both surfaces render from one shared section manifest + registry, so neither can hold a section the other lacks. A route earns a hand-written mobile treatment only by being named inHAND_WRITTENin the generator.Rollback is first-class
bun LIFEOS/PULSE/Tools/MobileUi.ts disable— no phone is redirected, and/msends visitors to the desktop route.MobileUi.ts statusprints the exact paths to delete and files to revert.Desktop is untouched: zero route pages under
src/app/<page>/page.tsxare modified. The four touched files each take a guarded early-return, a single added element, or a mechanical extraction.Cost
/m/healthagainst 605 kB for/health; per-route files fixed it.Verification
Real Chrome at a 390×844 viewport:
position: fixedwith its bottom edge exactly at the viewport bottom.tests/mobile-registry.test.tsadds 17 assertions covering route coverage, re-export purity, manifest-derived navigation, section/renderer parity, layer size, and a regression guard against a dynamic[section]route that built fine and died on hydration.Note for reviewers
This branch is built against the repo's page set. The repo's
nav-manifestlists/projectsand/security, but neithersrc/app/projects/page.tsxnorsrc/app/security/page.tsxis present here — those are already dead links on desktop in this repo. The mobile tree correctly declines to fabricate pages that don't exist, and the coverage test is gated on the desktop page existing. On an install that has them, the generator produces their mobile routes automatically. Worth a separate look, but out of scope for this PR.