Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

Phone portrait: the video is pinned on top with its 16:9 box reserved, and one status strip sits under it (from main at 1142ee6 or later, forge.json untouched) #187

opened this

Merged 44d 7h ago

On a phone held upright (@media (max-width: 600px) and (orientation: portrait)), the video is now pinned to the top of the screen. Its 16:9 box is reserved before the first frame arrives, so nothing moves when the picture loads, and one status strip sits directly under it. Desktop and landscape don't change.

Notes

opened this

On a phone held upright (@media (max-width: 600px) and (orientation: portrait)), the video is now pinned to the top of the screen. Its 16:9 box is reserved before the first frame arrives, so nothing moves when the picture loads, and one status strip sits directly under it. Desktop and landscape don't change. This is the code from pull #115 (commit 37998fd), applied onto current main without its forge.json change; this diff does not touch forge.json.

Phone portrait

  • New Software/so101/src/ui/mobile.css: viewer.html links it with that media query, so other layouts never load it.
    • The camera pane (#app) is full-bleed, position: sticky; top: 0, with aspect-ratio: 16 / 9.
    • The notch area is a black band env(safe-area-inset-top) high. The page already had viewport-fit=cover.
    • When the keyboard is up, the video still shrinks to make room for the chat.
  • One status strip: it already showed who drives, the time left and your place in line. It now also shows the arm's state (live or reconnecting, camera, lag) in a new #armLine, copied from the overlay as it changes rather than worked out again. On phones the overlay's status line and the driver's name over the video are hidden, so nothing shows twice. #armLine stays hidden on wider screens.
  • src/server.ts: .css files in src/ui are now served like the page's own scripts: at the content-hashed /ui/<hash>/ path, as text/css, cached as immutable.
  • New test in src/server.test.ts: it checks the link and media query, the 200 / text/css / immutable answer, the sticky 16:9 rule, the safe-area inset and the hidden duplicates.
  • README: the "On a phone" section describes the pinned view.

src/ui/lobby-panel.js (separate commit, no behaviour change): bun x tsc --noEmit already failed on main with 107 errors in this file, left by #170. Since the check runs tsc, this pull could not land without fixing them. The browser globals and the /live messages are now typed any, the way machine-panel.js already handles it, and the event handlers have JSDoc types. The first fix took the page over its 51.2 KB gzipped first-visit limit by 79 bytes, so I cut the added comments and annotations down until the size test passed again. No test was changed.

Checks: bun x tsc --noEmit is clean. bun test on src/ui, src/server.test.ts and src/relay.test.ts passes (131 tests). The full suite passed (420 tests) with the phone change in, before the lobby-panel.js edit; I did not run it again after that edit. I have not looked at the layout in a real browser at 390×844 or 412×915.

Not done: the rest of the phone layout below the strip (the tab bar is #159). The existing 640 px touch-controls breakpoint stays as it is.

To try it: open the preview in a phone-sized portrait viewport (390×844 or 412×915) and reload. The area under the browser bar stays black and still until the picture arrives, and the strip under it reads something like "Live arm · … · idle · camera live".

🤖 Generated with Claude Code

Closes #176

2 earlier comments · 1 event
commented

On a phone held upright (@media (max-width: 600px) and (orientation: portrait)), the video is now pinned to the top of the screen. Its 16:9 box is reserved before the first frame arrives, so nothing moves when the picture loads, and one status strip sits directly under it. Desktop and landscape don't change. This is the code from pull #115 (commit 37998fd), applied onto current main without its forge.json change; this diff does not touch forge.json.

Phone portrait

  • New Software/so101/src/ui/mobile.css: viewer.html links it with that media query, so other layouts never load it.
    • The camera pane (#app) is full-bleed, position: sticky; top: 0, with aspect-ratio: 16 / 9.
    • The notch area is a black band env(safe-area-inset-top) high. The page already had viewport-fit=cover.
    • When the keyboard is up, the video still shrinks to make room for the chat.
  • One status strip: it already showed who drives, the time left and your place in line. It now also shows the arm's state (live or reconnecting, camera, lag) in a new #armLine, copied from the overlay as it changes rather than worked out again. On phones the overlay's status line and the driver's name over the video are hidden, so nothing shows twice. #armLine stays hidden on wider screens.
  • src/server.ts: .css files in src/ui are now served like the page's own scripts: at the content-hashed /ui/<hash>/ path, as text/css, cached as immutable.
  • New test in src/server.test.ts: it checks the link and media query, the 200 / text/css / immutable answer, the sticky 16:9 rule, the safe-area inset and the hidden duplicates.
  • README: the "On a phone" section describes the pinned view.

src/ui/lobby-panel.js (separate commit, no behaviour change): bun x tsc --noEmit already failed on main with 107 errors in this file, left by #170. Since the check runs tsc, this pull could not land without fixing them. The browser globals and the /live messages are now typed any, the way machine-panel.js already handles it, and the event handlers have JSDoc types. The first fix took the page over its 51.2 KB gzipped first-visit limit by 79 bytes, so I cut the added comments and annotations down until the size test passed again. No test was changed.

Checks: bun x tsc --noEmit is clean. bun test on src/ui, src/server.test.ts and src/relay.test.ts passes (131 tests). The full suite passed (420 tests) with the phone change in, before the lobby-panel.js edit; I did not run it again after that edit. I have not looked at the layout in a real browser at 390×844 or 412×915.

Not done: the rest of the phone layout below the strip (the tab bar is #159). The existing 640 px touch-controls breakpoint stays as it is.

To try it: open the preview in a phone-sized portrait viewport (390×844 or 412×915) and reload. The area under the browser bar stays black and still until the picture arrives, and the strip under it reads something like "Live arm · … · idle · camera live".

🤖 Generated with Claude Code

commented

On a phone held upright (@media (max-width: 600px) and (orientation: portrait)), the video is now pinned to the top of the screen. Its 16:9 box is reserved before the first frame arrives, so nothing moves when the picture loads, and one status strip sits directly under it. Desktop and landscape don't change. This is the code from pull #115 (commit 37998fd), applied onto current main without its forge.json change; this diff does not touch forge.json.

Review fix: in the first version of this pull the layout never actually applied, because the <link> to mobile.css came before the inline <style>. Every rule in mobile.css has the same specificity as the inline rule it overrides, so the later inline rule won. That meant #app stayed position: relative, #top .info stayed visible and #armLine stayed hidden. The <link> now comes after </style>, just before </head>. No inline rule is more specific than mobile.css, so its position alone now decides the cascade. The server test now fails if the link comes before the last </style>; I confirmed it fails with the old order and passes with the new one.

Not checked in a browser: I still have not looked at it in a 390×844 viewport. Chromium is installed here but crashes on startup, because it needs a unix socket and the sandbox refuses them. The preview of this pull is the place to look.

Phone portrait

  • New Software/so101/src/ui/mobile.css: loaded only under that media query, so other layouts never read it.
    • The camera pane (#app) is full-bleed, position: sticky; top: 0, with aspect-ratio: 16 / 9.
    • The notch area is a black band env(safe-area-inset-top) high. The page already had viewport-fit=cover.
    • When the keyboard is up, the video still shrinks to make room for the chat.
  • One status strip: it already showed who drives, the time left and your place in line. It now also shows the arm's state (live or reconnecting, camera, lag) in a new #armLine, copied from the overlay as it changes. On phones the overlay's status line and the driver's name over the video are hidden, so nothing shows twice. #armLine stays hidden on wider screens.
  • src/server.ts: .css files in src/ui are served like the page's own scripts: at the content-hashed /ui/<hash>/ path, as text/css, cached as immutable.
  • Test in src/server.test.ts: besides the link order, it checks the 200 / text/css / immutable answer, the sticky 16:9 rule, the safe-area inset and the hidden duplicates.
  • README: the "On a phone" section describes the pinned view.

src/ui/lobby-panel.js (separate commit, no behaviour change): bun x tsc --noEmit already failed on main with 107 errors in this file, left by #170, so this pull could not pass its check without fixing them. The browser globals and the /live messages are now typed any, the way machine-panel.js already handles it, and the event handlers have JSDoc types. The page stays under its 51.2 KB gzipped first-visit limit; an explanatory HTML comment beside the link would have gone 7 bytes over, so it is left out.

Checks: bun x tsc --noEmit is clean, and bun test on src/ui, src/server.test.ts and src/relay.test.ts passes (131 tests).

Not done: the rest of the phone layout below the strip (the tab bar is #159). The existing 640 px touch-controls breakpoint stays as it is.

To try it: open the preview in a 390×844 or 412×915 portrait viewport and reload. The video should stay pinned at the top, with black reserved space until the picture arrives and nothing shown over it. The strip under it should read something like "Live arm · … · idle · camera live".

🤖 Generated with Claude Code

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

This merges main into the phone-portrait branch (#176). The video stays pinned on top in its reserved 16:9 box, with one status strip under it, and the bottom tab bar from #177 now sits below that layout. bun test passes (476 tests) and bun x tsc --noEmit is clean.

  • Conflict: src/server.ts was the only file in conflict. The resolution keeps both sides: the page loads ui/mobile.css from this branch and ui/tabs.css / tabs.js from main.
  • Tab bar and pinned video: both set the shell's grid rows on a phone held upright. mobile.css loads last, so it now gives the tab-bar layout the same 16:9 video row plus the bar. On panels other than Drive, the tab bar's own rules still hide the video or let it fill the screen. server.test.ts checks the new rule.
  • First-visit size limit: "a first visit downloads under 51.2 KB gzipped" was failing at 52,257 B. main alone was already over, at 51,743 B, and this branch adds about 500 B. To bring it back under:
    • The leader-arm calibration wizard (about 2.7 KB gzipped) moved out of viewer.html into src/ui/leader-calib.js. It is only needed when someone has a leader arm plugged in, so it now loads the first time the wizard opens, the way the calibration, machine and metrics panels already do.
    • The steps, wording and save request are unchanged. The page passes in what it owns and gets back an object with reading(pose) and close(note).
    • src/ui/leader-calib.test.ts covers the poses shown on the 3D model, the saved draft and each step's text. It also runs a full capture-to-save flow against a stub page and the real leader-map.js, and checks the error for a missing servo and that cancel closes the wizard only once.
    • server.test.ts now also checks that the new module is not loaded on first visit.
  • Type check: tabs.js, video.js and video.test.ts came from main with tsc errors. They now have type annotations only; behaviour is unchanged. tsc is not part of the forge check.

I didn't trim any of main's own page content beyond moving the wizard, so the page is close to the 51.2 KB limit again. The next feature added to the first view will probably need something else moved out the same way.

To try it: on a phone held upright, open the preview at https://arm--187--forge-trevato-apps.open-platform.sh. The video should stay pinned in its 16:9 box above the tab bar. With a leader arm connected, the "Calibrate leader" wizard should load when opened and work as before.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs