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

Migrated from github.com/Trevato/SO-ARM100

Mobile first: the arm is fantastic on a phone - watch, queue, drive, chat and moderate with one thumb #39

Merged opened this in answer to

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

The arm's page is now laid out for a phone held in one hand. I couldn't run playwright here, so there are no screenshots in this pull, and Lighthouse and the "first view under 2 s on 4G" target are unmeasured. Chromium won't start in this sandbox because it blocks unix sockets.

Notes

shipped merged

opened this

The arm's page is now laid out for a phone held in one hand. I couldn't run playwright here, so there are no screenshots in this pull, and Lighthouse and the "first view under 2 s on 4G" target are unmeasured. Chromium won't start in this sandbox because it blocks unix sockets. Instead, a DOM emulator (happy-dom) ran the page against the fake server three ways: local, anonymous visitor and signed-in owner. The page booted with no errors each time, the right tabs appeared, and taking a turn and posting chat worked. bun test passes (139) and the type check is clean.

Layout (src/viewer.html)

  • Phone upright: the camera or 3D view on top at full width. Under it a status strip: who drives, your place and time left, the turn's one button ("Sign in to drive", "Take control", "Join line", "Hand back"), and a large red Stop. Stop shows whenever you drive, and always for the owner. A phone shows one view at a time.
  • The sheet below: tabs at the bottom edge for Chat · Queue · Controls · Admin. Controls appears only on your turn and opens by itself when it starts; Admin is the owner's.
  • Phone on its side: the view fills the screen, and the strip and sheet float over it; Hide clears them away. A wide screen puts the sheet in a column beside the view.
  • Everywhere: tap targets are at least 44 px and the safe-area insets are respected. Light and dark follow the system, and reduced motion is honoured.
  • Forge pill: the tab bar keeps the bottom-right corner empty for it and is taller than the pill, so it never sits on a control.

Controls tab: a touch joystick moves the gripper. Up reaches out, sideways swings around the base, and ▲/▼ raise and lower it; Open/Close work the gripper. The page converts this into pan, shoulder and elbow angles using the arm's model (src/ui/reach.js), and the server checks every frame against the safe zone as usual. Below it are the joint sliders with hold-to-jog −/+, the poses, and record/play.

  • The joystick only appears once the 3D model has loaded.
  • The wrist keeps its angle while the joystick is used, so the gripper's tilt changes as the arm reaches.

Chat: the page follows the visible area of the screen, so the keyboard shrinks the view and the sheet instead of covering the input or the last message. Long-press a message (or right-click it, or Enter on it) to delete it or mute its author.

Admin tab: end the current driver's turn, unmute people, the safe zone and the trims, plus Metrics and 3D calibration. The zone and trims can only be changed by whoever is driving, so the owner changes them on their own turn; the tab says so.

Mobile data

  • three.js is now loaded after the first view, so status, queue, chat and the camera work before it arrives.
  • The relay now gzips the page, three.js, the URDF and the meshes (src/compress.ts). This only applies behind the relay, not to a bare so101 serve.
  • The page's own modules are cached for good under a name that changes with their content.
  • On a slow link the camera drops from the full stream to one snapshot at a time, 0.5 to 4 frames a second, and goes back when the link recovers (src/ui/camera-plan.js). "Slow" means the /status round trips are slow, or the browser reports Save-Data or a 2G/3G connection.
  • A hidden tab polls the arm every 2 s instead of every 200 ms.

Other changes worth a look

  • tsconfig.json gains allowJs so the tests can import the two browser modules.
  • The zone badge and the Hide-the-controls-on-camera-tap behaviour are gone: the zone now shows in the Controls readout and the mode is in Admin.
  • No dependencies added, and no existing test was changed.
  • README: a new "On a phone" section.

To try it: open the preview on a phone (or a 390×844 window), sign in, and press Take control. Controls opens: drag the joystick, hold ▲/▼, and press Stop. Then open Chat, type with the keyboard up, and long-press a message as the owner. Turn the phone sideways and use Hide.

🤖 Generated with Claude Code

Closes #32

1 earlier comment · 2 events
commented

The arm's page is now laid out for a phone held in one hand. I couldn't run playwright here, so there are no screenshots in this pull, and Lighthouse and the "first view under 2 s on 4G" target are unmeasured. Chromium won't start in this sandbox because it blocks unix sockets. Instead, a DOM emulator (happy-dom) ran the page against the fake server three ways: local, anonymous visitor and signed-in owner. The page booted with no errors each time, the right tabs appeared, and taking a turn and posting chat worked. bun test passes (139) and the type check is clean.

Layout (src/viewer.html)

  • Phone upright: the camera or 3D view on top at full width. Under it a status strip: who drives, your place and time left, the turn's one button ("Sign in to drive", "Take control", "Join line", "Hand back"), and a large red Stop. Stop shows whenever you drive, and always for the owner. A phone shows one view at a time.
  • The sheet below: tabs at the bottom edge for Chat · Queue · Controls · Admin. Controls appears only on your turn and opens by itself when it starts; Admin is the owner's.
  • Phone on its side: the view fills the screen, and the strip and sheet float over it; Hide clears them away. A wide screen puts the sheet in a column beside the view.
  • Everywhere: tap targets are at least 44 px and the safe-area insets are respected. Light and dark follow the system, and reduced motion is honoured.
  • Forge pill: the tab bar keeps the bottom-right corner empty for it and is taller than the pill, so it never sits on a control.

Controls tab: a touch joystick moves the gripper. Up reaches out, sideways swings around the base, and ▲/▼ raise and lower it; Open/Close work the gripper. The page converts this into pan, shoulder and elbow angles using the arm's model (src/ui/reach.js), and the server checks every frame against the safe zone as usual. Below it are the joint sliders with hold-to-jog −/+, the poses, and record/play.

  • The joystick only appears once the 3D model has loaded.
  • The wrist keeps its angle while the joystick is used, so the gripper's tilt changes as the arm reaches.

Chat: the page follows the visible area of the screen, so the keyboard shrinks the view and the sheet instead of covering the input or the last message. Long-press a message (or right-click it, or Enter on it) to delete it or mute its author.

Admin tab: end the current driver's turn, unmute people, the safe zone and the trims, plus Metrics and 3D calibration. The zone and trims can only be changed by whoever is driving, so the owner changes them on their own turn; the tab says so.

Mobile data

  • three.js is now loaded after the first view, so status, queue, chat and the camera work before it arrives.
  • The relay now gzips the page, three.js, the URDF and the meshes (src/compress.ts). This only applies behind the relay, not to a bare so101 serve.
  • The page's own modules are cached for good under a name that changes with their content.
  • On a slow link the camera drops from the full stream to one snapshot at a time, 0.5 to 4 frames a second, and goes back when the link recovers (src/ui/camera-plan.js). "Slow" means the /status round trips are slow, or the browser reports Save-Data or a 2G/3G connection.
  • A hidden tab polls the arm every 2 s instead of every 200 ms.

Other changes worth a look

  • tsconfig.json gains allowJs so the tests can import the two browser modules.
  • The zone badge and the Hide-the-controls-on-camera-tap behaviour are gone: the zone now shows in the Controls readout and the mode is in Admin.
  • No dependencies added, and no existing test was changed.
  • README: a new "On a phone" section.

To try it: open the preview on a phone (or a 390×844 window), sign in, and press Take control. Controls opens: drag the joystick, hold ▲/▼, and press Stop. Then open Chat, type with the keyboard up, and long-press a message as the owner. Turn the phone sideways and use Hide.

🤖 Generated with Claude Code

the crew's run was interrupted: restart, resumes on the next pass — cancelled
Approved — before the latest push

Approved from the diff. My sandbox could not reach the preview (403), so I did not use it on a phone and have not seen it work. The new modules are sound: reach.js, camera-plan.js, the gzip cache, and the content-versioned /ui/<hash>/ route that serves only [a-z0-9-]+.js. Server-side security is unchanged: no new write path, no new input, and the security headers are kept on the gzipped answers (relay.test checks nosniff).

The two things I would do next:

  1. Take aria-live off the whole #strip. It is <section id="strip" aria-live="polite"> and contains #clock, which counts down every second, so a screen reader would announce the clock constantly. Put the live region on #driverLine alone, or announce only turn changes and the last 10 s.
  2. Test the page wiring, not just the arithmetic. The tabs, long-press moderation, visualViewport sizing and the snapshot fallback are covered only by string-presence asserts in server.test.ts, which would still pass if the handlers broke. A happy-dom test covering long-press-to-mute and the stream-to-snapshot switch would pin them.

Smaller points: the / handler calls uiVersion() on every request and reads and hashes every file in src/ui synchronously, so compute it once and recompute only when mtimes change. The gzip cache key includes the query string, which can fill the 16 MB cap with junk keys; key on pathname.

commented

This pull makes the page phone-first: the view sits on top, under it a status strip shows who drives, the time left, the turn's one button and a red Stop, and below that is a sheet of tabs (Chat, Queue, Controls, Admin). Controls has a joystick that moves the gripper; a phone on its side gets the view full-screen with the strip and sheet floating over it. The pages, three.js and the arm model are gzipped, and the camera drops to one snapshot at a time on a slow link.

main has now been merged in and the four conflicts resolved. bun test passes (233), the type check is clean, and the app boots locally: /, /ui/<version>/*.js, /leader-map.js, /app/leader-arm.ts, /cameras and /link all return 200, and / is gzipped. I have not tried the merged page on a real phone or through the preview yet.

How the conflicts were resolved:

  • viewer.html: the phone layout keeps its shape, and the features main added are placed in it:

- Cameras: main's owner-managed list now sits inside this layout's view logic. A phone shows one view at a time, a wider screen shows them side by side, a slow link gets snapshots, and the viewer's choice is remembered. - Joining: the name form is in the Queue tab. In the strip, Join to drive opens that tab and puts the cursor in the field. - Leader arm: Connect leader arm and Calibrate leader are in the Queue tab, so you can connect while you wait. Drive with leader is in Controls. The calibration card sits at the bottom on a phone and at the top left on a wide screen. It switches on the 3D view, so the pose to copy is visible. - Room: the announcement shows above the tabs, and the speed-cap line sits under the clock in the strip. Pausing changes the strip's wording. - Admin tab: pause, the room settings form, the crew moderator and the ban list. Ban was added to the long-press dialog on a chat line, which replaces main's hover buttons.

  • relay.ts: keeps both sides' imports and handlers. Requests for /ui/ and /app/ are served by the app itself, the static files are gzipped, and main's speed cap still applies to request bodies. The arm server's camera list replaces the fixed two-camera route.
  • server.ts: serves both /ui/<hash>/ (cached for good) and main's /app/ modules and /leader-map.js.
  • README.md: main's text, with the controls described where they now are (status strip, tabs, long-press).

One change outside the conflicts: main turned on type-checking for JavaScript, which made src/ui/reach.js fail the type check. I added JSDoc types and rewrote its 3×3 determinant without indexing past checked bounds; the maths is the same. I also removed the duplicate allowJs that the merge left in tsconfig.json.

To try it, open the preview at a phone width:

  • Without a name: join from the strip.
  • As the owner: open Admin and long-press a chat line.
  • On your turn: Controls should open by itself.

🤖 Generated with Claude Code

Approved

Approved on the diff. I could not load the preview from my sandbox (host blocked), and my clone is the base, so I did not see the head viewer.html past the cut, and I measured nothing on a 360px screen. The phone-first layout, tabs, always-present Stop, 44px targets, safe-area, visual-viewport keyboard handling, content-hashed immutable modules, gzip, and the snapshot fallback are all sound in the parts I read. reach.js and camera-plan.js are pure and tested. Gzip applies only to GET of static paths, the module route is whitelisted by regex, no dependency is added, the writes still go through the existing server checks, and the README has the new section.

Two things I would do next:

  1. Cache the ui version. uiVersion() reads and hashes every file in src/ui on every GET /, which is the common request. Compute it once per start, or on mtime change.
  2. Add a keyboard path to the joystick, and a no-JS note. #pad is pointer-only, and the jog buttons use touch-action none with pointer-hold. Confirm that Enter or Space on the jog buttons and the up/down lift buttons works, and add arrow keys on #pad. Separately, a short <noscript> line would help, since the page is blank without JS. Also check the layout on a real 360px phone, since the layout test only asserts strings.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs