|
|
@@ -18,17 +18,20 @@ |
| 18 | 18 |
} } |
| 19 | 19 |
</script> |
| 20 | 20 |
<link rel="modulepreload" href="/ui/__VERSION__/camera-plan.js"> |
| 21 |
<link rel="modulepreload" href="/ui/__VERSION__/sheet.js"> |
| 21 | 22 |
<link rel="modulepreload" href="/leader-map.js"> |
| 22 | 23 |
<style> |
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 26 | 29 |
:root { |
| 27 | 30 |
color-scheme: dark; --bg: #0b0d10; --surface: #0d1117; --raised: #161b22; --fg: #e8eaed; --fg2: #c9d1d9; --dim: #9aa4ae; |
| 28 | 31 |
--line: #30363d; --btn: #21262d; --btn-hover: #30363d; --link: #58a6ff; --blue: #388bfd; --on-blue: #fff; |
| 29 | 32 |
--ok: #3fb950; --warn: #d29922; --bad: #f85149; --bad-soft: rgba(248,81,73,.18); --blue-soft: rgba(56,139,253,.18); |
| 30 | |
--tap: 44px; --pill: 68px; --view: min(42svh, 75vw); |
| 31 | |
--safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px); |
| 33 |
--tap: 44px; --pill: 68px; --stop: 56px; --peek: 96px; --drawer: min(380px, 48vw); |
| 34 |
--safe-t: env(safe-area-inset-top, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px); |
| 32 | 35 |
} |
| 33 | 36 |
@media (prefers-color-scheme: light) { |
| 34 | 37 |
:root { color-scheme: light; --bg: #f6f8fa; --surface: #fff; --raised: #fff; --fg: #1f2328; --fg2: #31363c; --dim: #59636e; |
|
|
@@ -52,16 +55,16 @@ |
| 52 | 55 |
[hidden] { display: none !important; } |
| 53 | 56 |
[inert] { opacity: .5; } |
| 54 | 57 |
|
| 55 | |
#shell { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100dvh); display: grid; grid-template-columns: 100%; grid-template-rows: minmax(0, var(--view)) auto minmax(0, 1fr); grid-template-areas: "view" "strip" "sheet"; } |
| 56 | |
#shell.typing { --view: 24%; } |
| 58 |
#shell { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100dvh); display: grid; grid-template-columns: 100%; grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "view" "strip" "sheet"; } |
| 57 | 59 |
|
| 58 | |
|
| 59 | |
#app { grid-area: view; position: relative; min-height: 0; background: #000; color: #e8eaed; overflow: hidden; } |
| 60 |
|
| 61 |
#app { grid-area: view; position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 42svh; min-height: 0; background: #000; color: #e8eaed; overflow: hidden; } |
| 62 |
#shell.typing #app { max-height: 18svh; } |
| 60 | 63 |
#stage { position: absolute; inset: 0; display: flex; gap: 2px; } |
| 61 | |
|
| 64 |
|
| 62 | 65 |
.estop:disabled { opacity: .5; cursor: not-allowed; } .estop.on { background: #7d1410; box-shadow: 0 0 0 3px var(--bad); } |
| 63 | |
#banner.stop { display: block; border: 2px solid var(--bad); background: rgba(80,10,8,.92); color: #fff; font-weight: 600; } |
| 64 | |
#banner button { margin-left: 10px; min-height: 32px; padding: 2px 10px; } |
| 66 |
.estop.armed { background: #9a6700; box-shadow: 0 0 0 3px var(--warn); } |
| 67 |
#banner.stop { display: block; left: 0; right: 0; top: 0; transform: none; width: auto; max-width: none; border-radius: 0; border: 0; border-bottom: 2px solid var(--bad); background: rgba(80,10,8,.94); color: #fff; font-weight: 600; text-align: center; padding: 10px calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l)); } |
| 65 | 68 |
.pane { flex: 1; min-width: 0; position: relative; background: #000; display: none; } |
| 66 | 69 |
.pane.on { display: block; } |
| 67 | 70 |
.pane img { width: 100%; height: 100%; object-fit: contain; display: block; } |
|
|
@@ -72,6 +75,7 @@ |
| 72 | 75 |
#top button { background: rgba(0,0,0,.6); border-color: rgba(255,255,255,.18); color: #e8eaed; min-height: 36px; padding: 0 10px; border-radius: 8px; font-size: 13px; } |
| 73 | 76 |
#top .seg { display: inline-flex; flex-wrap: wrap; gap: 2px; } #top .seg button { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } #top .seg button.on { background: #388bfd; border-color: #388bfd; color: #fff; } |
| 74 | 77 |
#top .info { display: inline-flex; gap: 6px; align-items: center; background: rgba(0,0,0,.6); padding: 0 10px; min-height: 36px; border-radius: 8px; max-width: 100%; } |
| 78 |
#top .info:not(:has(:not(:empty):not([hidden]))) { display: none; } |
| 75 | 79 |
#link { color: #9aa4ae; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(36ch, 46vw); } #link.on { color: #3fb950; } #link.warn { color: #d29922; } |
| 76 | 80 |
.dot { width: 8px; height: 8px; border-radius: 50%; background: #f85149; display: inline-block; flex: none; } .dot.on { background: #3fb950; } |
| 77 | 81 |
#banner { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); z-index: 5; width: max-content; max-width: min(640px, calc(100% - 16px)); padding: 8px 12px; border-radius: 8px; font-size: 13px; background: rgba(0,0,0,.8); border: 1px solid #30363d; display: none; } |
|
|
@@ -79,17 +83,20 @@ |
| 79 | 83 |
#msg { position: absolute; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: 8px; z-index: 6; margin: 0 auto; width: max-content; max-width: calc(100% - 16px); padding: 8px 12px; border-radius: 8px; font-size: 13px; background: rgba(13,17,23,.9); color: #e8eaed; border: 1px solid #30363d; } |
| 80 | 84 |
#msg:empty { display: none; } #msg.bad { border-color: #f85149; color: #ffb3ad; } |
| 81 | 85 |
|
| 82 | |
|
| 83 | |
#strip { grid-area: strip; display: flex; align-items: center; gap: 10px; padding: 8px calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l)); background: var(--surface); border-bottom: 1px solid var(--line); min-height: 64px; } |
| 86 |
|
| 87 |
#strip { grid-area: strip; display: flex; align-items: center; gap: 10px; padding: 6px calc(12px + var(--safe-r)) 6px calc(12px + var(--safe-l)); background: var(--surface); border-bottom: 1px solid var(--line); min-height: calc(var(--stop) + 12px); } |
| 84 | 88 |
#strip .who { flex: 1; min-width: 0; } |
| 89 |
#strip .l1, #strip .l2 { display: flex; align-items: center; gap: 6px; min-width: 0; } |
| 85 | 90 |
#driverLine { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #driverLine.none { color: var(--dim); font-weight: 500; } |
| 86 | |
#clock { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #clock.idle { color: var(--warn); } |
| 87 | |
#capLine { color: var(--dim); font-size: 12px; } #capLine:empty { display: none; } |
| 88 | 91 |
#driverLine.paused { color: var(--warn); } |
| 92 |
#conn { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); } #conn.warn { color: var(--warn); } #conn.bad { color: var(--bad); } |
| 93 |
#clock { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #clock.idle { color: var(--warn); } |
| 94 |
#capLine { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #capLine:empty { display: none; } |
| 89 | 95 |
#turnActions { display: flex; gap: 6px; } #turnActions:empty { display: none; } |
| 90 | |
.estop { flex: none; min-width: 72px; min-height: 52px; border: 0; border-radius: 12px; background: #d1242f; color: #fff; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 0 0 3px rgba(209,36,47,.25), 0 2px 8px rgba(0,0,0,.35); } |
| 96 |
#turnActions button { padding: 0 12px; } |
| 97 |
.estop { flex: none; min-width: 76px; min-height: var(--stop); padding: 0 12px; border: 0; border-radius: 14px; background: #d1242f; color: #fff; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 0 0 3px rgba(209,36,47,.25), 0 2px 8px rgba(0,0,0,.35); touch-action: manipulation; -webkit-user-select: none; user-select: none; } |
| 91 | 98 |
.estop:hover { background: #e5323d; } .estop:active { transform: scale(.97); } |
| 92 | |
#sheetToggle { flex: none; } |
| 99 |
.estop.on, .estop.armed { letter-spacing: .02em; font-size: 13px; max-width: 128px; line-height: 1.2; } |
| 93 | 100 |
|
| 94 | 101 |
|
| 95 | 102 |
#sheet { grid-area: sheet; min-height: 0; display: flex; flex-direction: column; background: var(--surface); } |
|
|
@@ -97,7 +104,7 @@ |
| 97 | 104 |
.tab h2 { margin: 4px 0 0; font-size: 13px; font-weight: 650; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; } |
| 98 | 105 |
.tab p.note { margin: 0; color: var(--dim); font-size: 13px; } |
| 99 | 106 |
#tabs { flex: none; display: flex; border-top: 1px solid var(--line); background: var(--raised); padding: 0 calc(var(--pill) + var(--safe-r)) var(--safe-b) var(--safe-l); } |
| 100 | |
#tabs button { flex: 1; min-width: 0; min-height: 56px; border: 0; border-radius: 0; background: none; color: var(--dim); font-size: 14px; font-weight: 600; position: relative; padding: 0 4px; } |
| 107 |
#tabs button { flex: 1; min-width: 0; min-height: 56px; border: 0; border-radius: 0; background: none; color: var(--dim); font-size: 14px; font-weight: 600; position: relative; padding: 0 4px; touch-action: manipulation; } |
| 101 | 108 |
#tabs button[aria-selected=true] { color: var(--fg); } |
| 102 | 109 |
#tabs button[aria-selected=true]::before { content: ""; position: absolute; left: 25%; right: 25%; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue); } |
| 103 | 110 |
#tabs .badge { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--blue); color: var(--on-blue); font-size: 11px; line-height: 18px; } |
|
|
@@ -127,15 +134,28 @@ |
| 127 | 134 |
#joinErr { margin: 0; color: var(--bad); font-size: 13px; } #joinErr:empty { display: none; } |
| 128 | 135 |
#forgeSignin { color: var(--link); font-size: 13px; align-self: flex-start; } |
| 129 | 136 |
|
| 130 | |
|
| 131 | |
#reach { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; } |
| 132 | |
#pad { position: relative; width: min(46vw, 180px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--btn) 0 58%, var(--raised) 59%); border: 1px solid var(--line); touch-action: none; -webkit-user-select: none; user-select: none; } |
| 137 |
|
| 138 |
#tab-drive { position: relative; padding: 0; gap: 0; overflow: hidden; } |
| 139 |
#turnCard { margin: 12px calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l)); padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); display: grid; gap: 10px; } |
| 140 |
#turnCard p { margin: 0; color: var(--fg2); font-size: 14px; } |
| 141 |
#reach { flex: 1; min-height: 0; display: flex; gap: 16px; align-items: center; justify-content: center; padding: 12px calc(12px + var(--safe-r)) calc(var(--peek) + 12px) calc(12px + var(--safe-l)); } |
| 142 |
#driveSheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: min(45dvh, 100%); display: flex; flex-direction: column; background: var(--raised); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -6px 18px rgba(0,0,0,.28); transform: translateY(calc(100% - var(--peek))); transition: transform .22s cubic-bezier(.32,.72,0,1); will-change: transform; } |
| 143 |
#driveSheet[data-snap=open] { transform: none; } |
| 144 |
#driveSheet.dragging { transition: none; } |
| 145 |
#grab { position: relative; flex: none; width: 100%; min-height: 28px; height: 28px; padding: 0; border: 0; border-radius: 16px 16px 0 0; background: none; display: grid; place-items: center; touch-action: none; cursor: grab; } |
| 146 |
#grab .handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); } |
| 147 |
#grab::after { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 44px; } |
| 148 |
#driveSheet .peek { flex: none; height: calc(var(--peek) - 28px); display: flex; align-items: center; gap: 10px; padding: 0 calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l)); } |
| 149 |
#state { flex: 1; min-width: 0; color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } |
| 150 |
.grip { display: flex; gap: 8px; } .grip button { min-width: 72px; touch-action: none; -webkit-user-select: none; user-select: none; } |
| 151 |
#driveMore { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px calc(12px + var(--safe-r)) 16px calc(12px + var(--safe-l)); display: flex; flex-direction: column; gap: 12px; } |
| 152 |
#driveMore .hint { margin: 0; color: var(--dim); font-size: 12px; } |
| 153 |
#pad { position: relative; flex: none; width: min(52vw, 200px, 30svh); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--btn) 0 58%, var(--raised) 59%); border: 1px solid var(--line); touch-action: none; -webkit-user-select: none; user-select: none; } |
| 133 | 154 |
#pad::before, #pad::after { content: ""; position: absolute; background: var(--line); left: 50%; top: 12%; bottom: 12%; width: 1px; } #pad::after { left: 12%; right: 12%; top: 50%; bottom: auto; width: auto; height: 1px; } |
| 134 | 155 |
#knob { position: absolute; left: 50%; top: 50%; width: 38%; aspect-ratio: 1; margin: -19% 0 0 -19%; border-radius: 50%; background: var(--blue); box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: transform .12s ease-out; pointer-events: none; z-index: 1; } |
| 135 | 156 |
#pad.held #knob { transition: none; } |
| 136 | |
#reach .side { display: grid; gap: 8px; } |
| 137 | |
#reach .side button { width: 100%; touch-action: none; -webkit-user-select: none; user-select: none; } |
| 138 | |
#reach .hint { grid-column: 1 / -1; margin: 0; color: var(--dim); font-size: 12px; } |
| 157 |
#reach .side { display: grid; gap: 10px; } |
| 158 |
#reach .side button { min-width: 96px; min-height: 52px; touch-action: none; -webkit-user-select: none; user-select: none; } |
| 139 | 159 |
#joints { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 14px; } |
| 140 | 160 |
.j { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name val" "slide slide"; align-items: center; column-gap: 6px; padding: 4px 6px; border-radius: 10px; } |
| 141 | 161 |
.j.jam { background: var(--bad-soft); } .j.drag { background: var(--blue-soft); } |
|
|
@@ -203,29 +223,55 @@ |
| 203 | 223 |
|
| 204 | 224 |
|
| 205 | 225 |
@media (orientation: landscape) and (min-width: 900px) and (min-height: 501px) { |
| 206 | |
#shell { --view: 1fr; grid-template-columns: minmax(0, 1fr) min(400px, 36vw); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "view sheet" "strip sheet"; } |
| 207 | |
#shell.typing { --view: 1fr; } |
| 226 |
#shell { grid-template-columns: minmax(0, 1fr) min(400px, 36vw); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "view sheet" "strip sheet"; } |
| 227 |
#app, #shell.typing #app { aspect-ratio: auto; max-height: none; height: 100%; } |
| 208 | 228 |
#sheet { border-left: 1px solid var(--line); } |
| 209 | 229 |
#strip { border-bottom: 0; border-top: 1px solid var(--line); } |
| 230 |
|
| 231 |
#tab-drive { overflow: auto; } |
| 232 |
#reach { flex: none; padding-bottom: 12px; } |
| 233 |
#driveSheet { position: static; height: auto; transform: none; box-shadow: none; border-radius: 0; transition: none; } |
| 234 |
#grab { display: none; } |
| 235 |
#driveSheet .peek { height: auto; padding-top: 4px; } |
| 236 |
#driveMore { overflow: visible; } |
| 210 | 237 |
} |
| 211 | |
|
| 238 |
|
| 239 |
|
| 212 | 240 |
@media (orientation: landscape) and (max-height: 500px) { |
| 213 | |
#shell, #shell.typing { grid-template-columns: 100%; grid-template-rows: 100%; grid-template-areas: "view"; } |
| 214 | |
#app, #strip, #sheet { grid-area: auto; } |
| 215 | |
#strip { position: absolute; z-index: 7; top: 6px; left: calc(6px + var(--safe-l)); max-width: calc(100% - min(380px, 48vw) - 18px - var(--safe-l) - var(--safe-r)); min-height: 0; padding: 6px 6px 6px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(13,17,23,.82); color: #e8eaed; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); } |
| 216 | |
#shell.bare #strip { max-width: calc(100% - 12px - var(--safe-l) - var(--safe-r)); } |
| 217 | |
#strip #clock { color: #9aa4ae; } |
| 218 | |
#sheetToggle { display: inline-flex !important; align-items: center; background: rgba(255,255,255,.08); color: #e8eaed; border-color: rgba(255,255,255,.18); } |
| 219 | |
#sheet { position: absolute; z-index: 7; top: 0; bottom: 0; right: 0; width: calc(min(380px, 48vw) + var(--safe-r)); background: rgba(13,17,23,.9); background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-left: 1px solid var(--line); transition: transform .2s ease-out; } |
| 220 | |
#shell.bare #sheet { transform: translateX(100%); visibility: hidden; transition: transform .2s ease-out, visibility 0s .2s; } |
| 221 | |
#top { top: auto; bottom: 6px; justify-content: flex-start; right: calc(min(380px, 48vw) + 12px + var(--safe-r)); } |
| 222 | |
#shell.bare #top { right: calc(var(--pill) + var(--safe-r)); } |
| 223 | |
#banner { top: 64px; } |
| 224 | |
#msg { bottom: 52px; } |
| 225 | |
.tab { padding-top: 8px; } |
| 226 | |
#pad { width: min(30vh, 150px); } |
| 241 |
#shell { grid-template-columns: 100%; grid-template-rows: 100%; grid-template-areas: "view"; } |
| 242 |
#app, #shell.typing #app { grid-area: view; aspect-ratio: auto; max-height: none; height: 100%; } |
| 243 |
#strip { grid-area: auto; position: absolute; z-index: 7; top: calc(6px + var(--safe-t)); left: calc(6px + var(--safe-l)); max-width: calc(100% - var(--drawer) - 18px - var(--safe-l) - var(--safe-r)); min-height: 0; padding: 6px 10px 6px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(13,17,23,.86); color: #e8eaed; } |
| 244 |
#strip #clock, #strip #capLine { color: #9aa4ae; } |
| 245 |
.estop { position: fixed; z-index: 12; top: calc(8px + var(--safe-t)); right: calc(8px + var(--safe-r)); } |
| 246 |
#sheet { display: contents; } |
| 247 |
#notice { position: absolute; z-index: 7; top: calc(80px + var(--safe-t)); left: calc(6px + var(--safe-l)); max-width: 50%; border-radius: 10px; } |
| 248 |
|
| 249 |
#tabs { position: absolute; z-index: 9; bottom: calc(6px + var(--safe-b)); left: 50%; transform: translateX(-50%); padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--raised) 92%, transparent); } |
| 250 |
#shell.drawer #tabs { left: calc((100% - var(--drawer) - var(--safe-r)) / 2); } |
| 251 |
#tabs button { flex: none; min-height: var(--tap); padding: 0 14px; font-size: 13px; } |
| 252 |
#tabs button[aria-selected=true]::before { left: 20%; right: 20%; } |
| 253 |
|
| 254 |
.tab { position: absolute; z-index: 8; top: 0; bottom: 0; right: 0; width: calc(var(--drawer) + var(--safe-r)); padding-top: calc(80px + var(--safe-t)); background: color-mix(in srgb, var(--surface) 94%, transparent); border-left: 1px solid var(--line); } |
| 255 |
#tab-chat { padding-top: calc(76px + var(--safe-t)); } |
| 256 |
.tab:not(#tab-drive) { padding-bottom: calc(var(--pill) + var(--safe-b)); } |
| 257 |
|
| 258 |
#tab-drive { position: absolute; inset: 0; width: auto; padding: 0; background: none; border: 0; pointer-events: none; overflow: visible; } |
| 259 |
#tab-drive > * { pointer-events: auto; } |
| 260 |
#turnCard { position: absolute; left: calc(6px + var(--safe-l)); bottom: calc(60px + var(--safe-b)); margin: 0; max-width: 46%; background: rgba(13,17,23,.88); color: #e8eaed; } |
| 261 |
#reach { position: absolute; left: calc(10px + var(--safe-l)); bottom: calc(10px + var(--safe-b)); padding: 0; gap: 10px; align-items: flex-end; } |
| 262 |
#pad { width: min(40svh, 150px); background: radial-gradient(circle, rgba(33,38,45,.7) 0 58%, rgba(22,27,34,.55) 59%); border-color: rgba(255,255,255,.18); } |
| 263 |
#reach .side button { min-width: 72px; background: rgba(0,0,0,.6); color: #e8eaed; border-color: rgba(255,255,255,.18); } |
| 264 |
#driveSheet { left: auto; right: calc(8px + var(--safe-r)); bottom: calc(var(--pill) + var(--safe-b)); width: min(320px, 38vw); height: auto; max-height: calc(100% - var(--pill) - var(--stop) - 24px - var(--safe-t) - var(--safe-b)); transform: none; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--raised) 92%, transparent); transition: none; } |
| 265 |
#driveSheet .peek { height: 52px; padding: 0 10px 6px; } |
| 266 |
#driveSheet[data-snap=peek] #driveMore { display: none; } |
| 267 |
#driveMore { padding: 4px 10px 12px; } |
| 268 |
#joints { grid-template-columns: 1fr; } |
| 269 |
#top { top: calc(var(--stop) + 16px + var(--safe-t)); right: calc(8px + var(--safe-r)); left: auto; max-width: 40%; } |
| 270 |
#banner { top: calc(78px + var(--safe-t)); } |
| 271 |
#banner.stop { top: calc(78px + var(--safe-t)); } |
| 272 |
#msg { bottom: calc(60px + var(--safe-b)); } |
| 227 | 273 |
} |
| 228 | |
@media (max-width: 420px) { #top .label { display: none; } #link { max-width: 30vw; } } |
| 274 |
@media (max-width: 420px) { #link { max-width: 30vw; } } |
| 229 | 275 |
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } } |
| 230 | 276 |
</style> |
| 231 | 277 |
</head> |
|
|
@@ -237,23 +283,54 @@ |
| 237 | 283 |
</div> |
| 238 | 284 |
<div id="top"> |
| 239 | 285 |
<span class="seg" role="group" aria-label="Views"><button id="v3" aria-pressed="false">3D</button></span> |
| 240 | |
<span class="info"><span id="link" hidden></span><span id="live" class="label"></span><span class="dot" id="dot"></span><span id="state">…</span></span> |
| 286 |
<span class="info"><span id="link" hidden></span><span id="live"></span></span> |
| 241 | 287 |
<button id="fs" title="F">Fullscreen</button> |
| 242 | 288 |
</div> |
| 243 | 289 |
<div id="banner" role="alert"></div> |
| 244 | 290 |
<div id="msg" role="status"></div> |
| 245 | 291 |
</div> |
| 246 | 292 |
|
| 247 | |
<section id="strip" aria-label="Who drives" aria-live="polite"> |
| 248 | |
<div class="who"><div id="driverLine" class="none">Connecting…</div><div id="clock"></div><div id="capLine"></div></div> |
| 293 |
|
| 294 |
<section id="strip" aria-label="Status"> |
| 295 |
<div class="who"> |
| 296 |
<div class="l1"><span class="dot" id="dot"></span><span id="driverLine" class="none" aria-live="polite">Connecting…</span></div> |
| 297 |
<div class="l2"><span id="conn">…</span><span id="clock"></span></div> |
| 298 |
<div id="capLine"></div> |
| 299 |
</div> |
| 249 | 300 |
<div id="turnActions"></div> |
| 250 | |
<button id="sheetToggle" hidden aria-controls="sheet" aria-expanded="true">Hide</button> |
| 251 | |
<button id="stop" class="danger" hidden title="End what the arm is doing and hold (space)">Stop</button> |
| 252 | |
<button id="estop" class="estop" title="Emergency stop (Esc): halt, hold with torque, until an admin clears it" aria-label="Emergency stop">Stop</button> |
| 301 |
<button id="estop" class="estop" data-stop title="Emergency stop (Esc): halt, hold with torque, until an admin resumes" aria-label="Emergency stop">Stop</button> |
| 253 | 302 |
</section> |
| 254 | 303 |
|
| 255 | |
<section id="sheet" aria-label="Chat, queue and controls"> |
| 304 |
<section id="sheet" aria-label="Drive, queue, chat and moderation"> |
| 256 | 305 |
<div id="notice" role="status" hidden></div> |
| 306 |
<div class="tab" id="tab-drive" role="tabpanel" aria-labelledby="t-drive" hidden> |
| 307 |
<div id="turnCard" hidden><p id="turnNote"></p></div> |
| 308 |
<div id="reach" hidden> |
| 309 |
<div id="pad" role="application" aria-label="Move the gripper: up reaches out, down pulls in, sideways swings around the base"><span id="knob"></span></div> |
| 310 |
<div class="side"> |
| 311 |
<button data-lift="1" aria-label="Gripper up">▲ Up</button> |
| 312 |
<button data-lift="-1" aria-label="Gripper down">▼ Down</button> |
| 313 |
</div> |
| 314 |
</div> |
| 315 |
<section id="driveSheet" data-snap="peek" aria-label="Drive controls"> |
| 316 |
<button id="grab" type="button" aria-controls="driveMore" aria-expanded="false" aria-label="Joint controls"><span class="handle"></span></button> |
| 317 |
<div class="peek"><span id="state">…</span><span class="grip" id="grip"><button data-grip="1">Open</button><button data-grip="-1">Close</button></span></div> |
| 318 |
<div id="driveMore"> |
| 319 |
<p class="hint">Hold the pad to move the gripper: up reaches out, sideways swings around the base. The jog speed sets how fast.</p> |
| 320 |
<div id="joints"></div> |
| 321 |
<div class="row" id="poses"></div> |
| 322 |
<div class="row" id="drive"> |
| 323 |
<label class="inline">jog <select id="rate"><option value="100">slow</option><option value="300" selected>medium</option><option value="800">fast</option></select></label> |
| 324 |
<button id="hold" title="torque on, stay where it is">Hold</button> |
| 325 |
<button id="releaseBtn" class="danger" title="torque off">Release</button> |
| 326 |
<button id="record" class="rec">● Record</button> |
| 327 |
<button id="play">▶ Play…</button> |
| 328 |
<button id="leaderDrive" class="go" hidden title="stream the leader arm's pose to the arm during your turn">Drive with leader</button> |
| 329 |
</div> |
| 330 |
<div id="readout"></div> |
| 331 |
</div> |
| 332 |
</section> |
| 333 |
</div> |
| 257 | 334 |
<div class="tab" id="tab-chat" role="tabpanel" aria-labelledby="t-chat"> |
| 258 | 335 |
<div id="chat" role="log" aria-label="Chat"></div> |
| 259 | 336 |
<form id="say" hidden><input id="sayText" type="text" maxlength="500" autocomplete="off" enterkeyhint="send" placeholder="Say something" aria-label="Message"><button class="go">Send</button></form> |
|
|
@@ -267,33 +344,10 @@ |
| 267 | 344 |
<a id="forgeSignin" hidden>Have a forge account? Sign in instead</a> |
| 268 | 345 |
<h2>Waiting</h2> |
| 269 | 346 |
<ol id="queue" aria-label="Queue"></ol> |
| 270 | |
<p class="note">A turn lasts a few minutes and ends early when the arm sits idle. When yours comes, the Controls tab appears.</p> |
| 347 |
<p class="note">A turn lasts a few minutes and ends early when the arm sits idle. When yours comes, the Drive tab opens.</p> |
| 271 | 348 |
<h2>Leader arm</h2> |
| 272 | 349 |
<div class="row"><button id="leaderBtn" title="read a leader arm plugged into this computer or phone (Chrome, Edge)">Connect leader arm</button><button id="leaderCal" hidden title="teach this page your own leader arm: once, kept with your name">Calibrate leader</button></div> |
| 273 | |
<p class="note">Plug an SO-101 leader into this computer or Android phone. The 3D model mirrors it while you wait; on your turn, Drive with leader in Controls moves the arm with it.</p> |
| 274 | |
</div> |
| 275 | |
<div class="tab" id="tab-controls" role="tabpanel" aria-labelledby="t-controls" hidden> |
| 276 | |
<div id="reach" hidden> |
| 277 | |
<div id="pad" role="application" aria-label="Move the gripper: up reaches out, down pulls in, sideways swings around the base"><span id="knob"></span></div> |
| 278 | |
<div class="side"> |
| 279 | |
<button data-lift="1" aria-label="Gripper up">▲ Up</button> |
| 280 | |
<button data-lift="-1" aria-label="Gripper down">▼ Down</button> |
| 281 | |
<button data-grip="1">Open</button> |
| 282 | |
<button data-grip="-1">Close</button> |
| 283 | |
</div> |
| 284 | |
<p class="hint">Hold the pad to move the gripper: up reaches out, sideways swings around the base. The jog speed sets how fast.</p> |
| 285 | |
</div> |
| 286 | |
<div id="joints"></div> |
| 287 | |
<div class="row" id="poses"></div> |
| 288 | |
<div class="row" id="drive"> |
| 289 | |
<label class="inline">jog <select id="rate"><option value="100">slow</option><option value="300" selected>medium</option><option value="800">fast</option></select></label> |
| 290 | |
<button id="hold" title="torque on, stay where it is">Hold</button> |
| 291 | |
<button id="releaseBtn" class="danger" title="torque off">Release</button> |
| 292 | |
<button id="record" class="rec">● Record</button> |
| 293 | |
<button id="play">▶ Play…</button> |
| 294 | |
<button id="leaderDrive" class="go" hidden title="stream the leader arm's pose to the arm during your turn">Drive with leader</button> |
| 295 | |
</div> |
| 296 | |
<div id="readout"></div> |
| 350 |
<p class="note">Plug an SO-101 leader into this computer or Android phone. The 3D model mirrors it while you wait; on your turn, Drive with leader in the Drive tab moves the arm with it.</p> |
| 297 | 351 |
</div> |
| 298 | 352 |
<div class="tab" id="tab-admin" role="tabpanel" aria-labelledby="t-admin" hidden> |
| 299 | 353 |
<div class="card" id="modCard"> |
|
|
@@ -359,10 +413,10 @@ |
| 359 | 413 |
<div class="row"><button id="metricsBtn">Metrics</button><button id="calib">3D calibration</button></div> |
| 360 | 414 |
</div> |
| 361 | 415 |
<nav id="tabs" role="tablist" aria-label="Sheet"> |
| 362 | |
<button role="tab" id="t-chat" data-tab="chat" aria-controls="tab-chat" aria-selected="true">Chat<span class="badge" id="unread"></span></button> |
| 416 |
<button role="tab" id="t-drive" data-tab="drive" aria-controls="tab-drive" aria-selected="false">Drive</button> |
| 363 | 417 |
<button role="tab" id="t-queue" data-tab="queue" aria-controls="tab-queue" aria-selected="false">Queue<span class="badge" id="waiting"></span></button> |
| 364 | |
<button role="tab" id="t-controls" data-tab="controls" aria-controls="tab-controls" aria-selected="false" hidden>Controls</button> |
| 365 | |
<button role="tab" id="t-admin" data-tab="admin" aria-controls="tab-admin" aria-selected="false" hidden>Admin</button> |
| 418 |
<button role="tab" id="t-chat" data-tab="chat" aria-controls="tab-chat" aria-selected="true">Chat<span class="badge" id="unread"></span></button> |
| 419 |
<button role="tab" id="t-admin" data-tab="admin" aria-controls="tab-admin" aria-selected="false" hidden>Mod</button> |
| 366 | 420 |
</nav> |
| 367 | 421 |
</section> |
| 368 | 422 |
|
|
|
@@ -458,6 +512,7 @@ |
| 458 | 512 |
</div> |
| 459 | 513 |
<script type="module"> |
| 460 | 514 |
import { cameraPlan } from "/ui/__VERSION__/camera-plan.js"; |
| 515 |
import { dragTo, settle } from "/ui/__VERSION__/sheet.js"; |
| 461 | 516 |
import { mapLeaderFrame, parseCalibration } from "/leader-map.js"; |
| 462 | 517 |
|
| 463 | 518 |
const $ = (id) => document.getElementById(id); |
|
|
@@ -476,6 +531,8 @@ |
| 476 | 531 |
const NAMES = { 1: "shoulder_pan", 2: "shoulder_lift", 3: "elbow_flex", 4: "wrist_flex", 5: "wrist_roll", 6: "gripper" }; |
| 477 | 532 |
const IDS = Object.fromEntries(Object.entries(NAMES).map(([id, n]) => [n, Number(id)])); |
| 478 | 533 |
const narrow = matchMedia("(max-width: 760px), (max-height: 500px)"); |
| 534 |
const sideways = matchMedia("(orientation: landscape) and (max-height: 500px)"); |
| 535 |
const wide = matchMedia("(orientation: landscape) and (min-width: 900px) and (min-height: 501px)"); |
| 479 | 536 |
|
| 480 | 537 |
|
| 481 | 538 |
|
|
|
@@ -483,14 +540,11 @@ |
| 483 | 540 |
const vv = window.visualViewport; |
| 484 | 541 |
const fit = () => { if (!vv) return; shell.style.setProperty("--vv-h", `${vv.height}px`); shell.style.setProperty("--vv-top", `${vv.offsetTop}px`); }; |
| 485 | 542 |
vv?.addEventListener("resize", fit); vv?.addEventListener("scroll", fit); fit(); |
| 486 | |
$("sheetToggle").onclick = () => { |
| 487 | |
const bare = shell.classList.toggle("bare"); |
| 488 | |
$("sheetToggle").textContent = bare ? "Show" : "Hide"; $("sheetToggle").setAttribute("aria-expanded", String(!bare)); |
| 489 | |
}; |
| 490 | 543 |
let tab = "chat"; |
| 491 | 544 |
function showTab(name, focus = false) { |
| 492 | |
if ($(`t-${name}`).hidden) name = ["controls", "chat", "admin"].find((t) => !$(`t-${t}`).hidden) ?? "chat"; |
| 545 |
if ($(`t-${name}`).hidden) name = ["drive", "chat", "admin"].find((t) => !$(`t-${t}`).hidden) ?? "drive"; |
| 493 | 546 |
tab = name; |
| 547 |
shell.classList.toggle("drawer", name !== "drive"); |
| 494 | 548 |
for (const b of $("tabs").querySelectorAll("[role=tab]")) { |
| 495 | 549 |
const on = b.dataset.tab === name; |
| 496 | 550 |
b.setAttribute("aria-selected", String(on)); b.tabIndex = on ? 0 : -1; |
|
|
@@ -498,10 +552,11 @@ |
| 498 | 552 |
if (on && focus) b.focus(); |
| 499 | 553 |
} |
| 500 | 554 |
if (name === "chat") { $("unread").textContent = ""; chatBox.scrollTop = chatBox.scrollHeight; } |
| 501 | |
if (name === "controls") load3D(); |
| 555 |
if (name === "drive") load3D(); |
| 502 | 556 |
if (name === "admin") loadSettings(); |
| 503 | 557 |
} |
| 504 | |
for (const b of $("tabs").querySelectorAll("[role=tab]")) b.onclick = () => showTab(b.dataset.tab); |
| 558 |
|
| 559 |
for (const b of $("tabs").querySelectorAll("[role=tab]")) b.onclick = () => showTab(sideways.matches && b.dataset.tab === tab ? "drive" : b.dataset.tab); |
| 505 | 560 |
$("tabs").addEventListener("keydown", (e) => { |
| 506 | 561 |
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return; |
| 507 | 562 |
const shown = [...$("tabs").querySelectorAll("[role=tab]:not([hidden])")]; |
|
|
@@ -511,6 +566,41 @@ |
| 511 | 566 |
$("sayText").addEventListener("focus", () => { shell.classList.add("typing"); setTimeout(() => (chatBox.scrollTop = chatBox.scrollHeight), 250); }); |
| 512 | 567 |
$("sayText").addEventListener("blur", () => shell.classList.remove("typing")); |
| 513 | 568 |
|
| 569 |
|
| 570 |
|
| 571 |
{ |
| 572 |
const sheet = $("driveSheet"), grab = $("grab"); |
| 573 |
let drag = null, dragged = false; |
| 574 |
const snapTo = (where) => { |
| 575 |
sheet.dataset.snap = where; sheet.style.transform = ""; sheet.classList.remove("dragging"); |
| 576 |
grab.setAttribute("aria-expanded", String(where === "open")); |
| 577 |
}; |
| 578 |
const peekPx = () => parseFloat(getComputedStyle(sheet).getPropertyValue("--peek")) || 96; |
| 579 |
grab.addEventListener("pointerdown", (e) => { |
| 580 |
if (e.button || sideways.matches || wide.matches) return; |
| 581 |
const open = sheet.offsetHeight, peek = peekPx(); |
| 582 |
drag = { id: e.pointerId, y0: e.clientY, start: sheet.dataset.snap === "open" ? open : peek, shown: 0, open, peek, t: e.timeStamp, y: e.clientY, v: 0 }; |
| 583 |
drag.shown = drag.start; dragged = false; |
| 584 |
try { grab.setPointerCapture(e.pointerId); } catch {} |
| 585 |
}); |
| 586 |
grab.addEventListener("pointermove", (e) => { |
| 587 |
if (drag?.id !== e.pointerId) return; |
| 588 |
if (!dragged && Math.abs(e.clientY - drag.y0) < 6) return; |
| 589 |
dragged = true; sheet.classList.add("dragging"); |
| 590 |
const dt = Math.max(1, e.timeStamp - drag.t); |
| 591 |
drag.v = (drag.y - e.clientY) / dt; drag.t = e.timeStamp; drag.y = e.clientY; |
| 592 |
drag.shown = dragTo(drag.start, e.clientY - drag.y0, drag.peek, drag.open); |
| 593 |
sheet.style.transform = `translateY(${drag.open - drag.shown}px)`; |
| 594 |
}); |
| 595 |
const end = (e) => { |
| 596 |
if (drag?.id !== e.pointerId) return; |
| 597 |
const d = drag; drag = null; |
| 598 |
if (dragged) snapTo(settle({ shown: d.shown, velocity: e.timeStamp - d.t > 120 ? 0 : d.v, peek: d.peek, open: d.open })); |
| 599 |
}; |
| 600 |
grab.addEventListener("pointerup", end); grab.addEventListener("pointercancel", end); |
| 601 |
grab.addEventListener("click", () => { if (dragged) { dragged = false; return; } snapTo(sheet.dataset.snap === "open" ? "peek" : "open"); }); |
| 602 |
} |
| 603 |
|
| 514 | 604 |
|
| 515 | 605 |
|
| 516 | 606 |
const relayed = await fetch("/link", { cache: "no-store" }).then((r) => r.ok, () => false); |
|
|
@@ -761,20 +851,46 @@ |
| 761 | 851 |
msg(r.stopped ? `stopped ${r.stopped}${r.saved ? `; saved recording ${r.saved}` : ""}; the arm holds` : r.ok ? "stopped: nothing was driving" : r.error, !r.ok); |
| 762 | 852 |
if (r.saved) loadRecordings(); |
| 763 | 853 |
} |
| 764 | |
$("stop").onclick = stop; |
| 765 | |
|
| 854 |
|
| 855 |
|
| 766 | 856 |
async function eStop() { |
| 767 | |
const r = await api("/estop", {}); |
| 768 | |
msg(r.ok ? "EMERGENCY STOP: the arm holds; an admin must clear it" : r.error, true); |
| 857 |
reachEnd(); |
| 769 | 858 |
if (stream.ws) stream.ws.close(); |
| 770 | 859 |
if (leaderStreaming()) stopLeaderDrive(); |
| 860 |
const r = await api("/estop", {}); |
| 861 |
msg(r.ok ? "EMERGENCY STOP: the arm holds until an admin resumes" : r.error, true); |
| 862 |
if (r.ok && status) { status.estop = r.estop; renderStop(); banner(status); applyLock(); } |
| 771 | 863 |
} |
| 772 | 864 |
async function clearEStop() { |
| 773 | |
if (!confirm("Clear the emergency stop? The arm stays where it is; the driver can move it again.")) return; |
| 774 | 865 |
const r = await api("/estop/clear", {}); |
| 775 | |
msg(r.ok ? "the emergency stop is cleared" : r.error, !r.ok); |
| 866 |
msg(r.ok ? "resumed: the driver can move the arm again" : r.error, !r.ok); |
| 867 |
if (r.ok && status) { status.estop = null; renderStop(); banner(status); applyLock(); } |
| 776 | 868 |
} |
| 777 | |
$("estop").onclick = eStop; |
| 869 |
let resumeArmed = null, pressedAt = -Infinity; |
| 870 |
|
| 871 |
function renderStop() { |
| 872 |
const b = $("estop"), stopped = Boolean(status?.estop), owner = isOwner(); |
| 873 |
if (!stopped && resumeArmed) { clearTimeout(resumeArmed); resumeArmed = null; } |
| 874 |
b.classList.toggle("on", stopped && !resumeArmed); b.classList.toggle("armed", Boolean(resumeArmed)); |
| 875 |
b.textContent = !stopped ? "Stop" : !owner ? "Stopped" : resumeArmed ? "Tap again to resume" : "Resume"; |
| 876 |
b.disabled = stopped ? !owner : !(mayDrive() || owner); |
| 877 |
b.setAttribute("aria-label", !stopped ? "Emergency stop" : owner ? (resumeArmed ? "Confirm: resume the arm" : "Resume the arm") : "Stopped: an admin resumes it"); |
| 878 |
b.title = b.disabled && !stopped ? "Emergency stop: the driver and the admins can press it" : stopped ? "The arm holds until an admin resumes it" : "Emergency stop (Esc): halt, hold with torque, until an admin resumes"; |
| 879 |
} |
| 880 |
function resumeTap() { |
| 881 |
if (!resumeArmed) { resumeArmed = setTimeout(() => { resumeArmed = null; renderStop(); }, 4000); return renderStop(); } |
| 882 |
clearTimeout(resumeArmed); resumeArmed = null; renderStop(); |
| 883 |
void clearEStop(); |
| 884 |
} |
| 885 |
$("estop").addEventListener("pointerdown", (e) => { |
| 886 |
if (e.button || $("estop").disabled || status?.estop) return; |
| 887 |
pressedAt = e.timeStamp; void eStop(); |
| 888 |
}); |
| 889 |
$("estop").addEventListener("click", (e) => { |
| 890 |
if (e.timeStamp - pressedAt < 1500) { pressedAt = -Infinity; return; } |
| 891 |
if (status?.estop) return resumeTap(); |
| 892 |
void eStop(); |
| 893 |
}); |
| 778 | 894 |
$("hold").onclick = async () => { const r = await api("/torque", { on: true }); msg(r.ok ? "holding: torque on" : r.error, !r.ok); }; |
| 779 | 895 |
$("releaseBtn").onclick = async () => { |
| 780 | 896 |
if (!confirm("Release torque? Hold the arm so it does not fall.")) return; |
|
|
@@ -853,7 +969,7 @@ |
| 853 | 969 |
msg(r.ok ? `recording ${name}: torque is off, move the arm by hand, then press ■ Stop recording` : r.error, !r.ok); |
| 854 | 970 |
$("recName").value = ""; |
| 855 | 971 |
}); |
| 856 | |
$("play").onclick = () => { loadRecordings(); $("playDlg").showModal(); }; |
| 972 |
$("play").onclick = () => { if (driving() === "play") return void stop(); loadRecordings(); $("playDlg").showModal(); }; |
| 857 | 973 |
$("playClose").onclick = () => $("playDlg").close(); |
| 858 | 974 |
|
| 859 | 975 |
|
|
|
@@ -1186,7 +1302,7 @@ |
| 1186 | 1302 |
for (const ev of ["pointerup", "pointercancel", "lostpointercapture"]) b.addEventListener(ev, up); |
| 1187 | 1303 |
b.addEventListener("contextmenu", (e) => e.preventDefault()); |
| 1188 | 1304 |
} |
| 1189 | |
for (const b of document.querySelectorAll("#reach [data-grip]")) jog(b, 6, () => Number(b.dataset.grip)); |
| 1305 |
for (const b of document.querySelectorAll("[data-grip]")) jog(b, 6, () => Number(b.dataset.grip)); |
| 1190 | 1306 |
} |
| 1191 | 1307 |
|
| 1192 | 1308 |
|
|
|
@@ -1274,20 +1390,18 @@ |
| 1274 | 1390 |
let drove = false; |
| 1275 | 1391 |
function applyLock() { |
| 1276 | 1392 |
const can = mayDrive() && !status?.estop, owner = isOwner(); |
| 1277 | |
$("t-controls").hidden = !mayDrive(); |
| 1278 | 1393 |
$("t-admin").hidden = !owner; |
| 1279 | 1394 |
$("t-chat").hidden = $("t-queue").hidden = !relayed; |
| 1280 | |
for (const id of ["joints", "poses", "drive", "reach"]) $(id).inert = !can; |
| 1281 | |
$("stop").hidden = !(can || owner); |
| 1282 | |
$("estop").disabled = !(mayDrive() || owner); |
| 1283 | |
$("estop").title = $("estop").disabled ? "Emergency stop: the driver and the admins can press it" : "Emergency stop (Esc): halt, hold with torque, until an admin clears it"; |
| 1395 |
for (const id of ["joints", "poses", "drive", "reach", "grip"]) $(id).inert = !can; |
| 1396 |
$("turnCard").hidden = mayDrive(); |
| 1397 |
renderStop(); |
| 1284 | 1398 |
|
| 1285 | 1399 |
for (const id of ["zoneRow", "trims", "safety", "jointLimits"]) $(id).inert = !owner; |
| 1286 | 1400 |
viewer.toggleAttribute("disable-dragging", !can); |
| 1287 | 1401 |
if (!can) reachEnd(); |
| 1288 | 1402 |
if (!can && leaderStreaming()) stopLeaderDrive(); |
| 1289 | |
|
| 1290 | |
if (mayDrive() !== drove) { drove = mayDrive(); if (relayed) showTab(drove ? "controls" : "chat"); } |
| 1403 |
|
| 1404 |
if (mayDrive() !== drove) { drove = mayDrive(); if (relayed) showTab(drove ? "drive" : "chat"); } |
| 1291 | 1405 |
else if ($(`t-${tab}`).hidden) showTab(tab); |
| 1292 | 1406 |
} |
| 1293 | 1407 |
const serverNow = () => Date.now() + lobby.offset; |
|
|
@@ -1327,6 +1441,10 @@ |
| 1327 | 1441 |
$("notice").textContent = st.announcement ?? ""; |
| 1328 | 1442 |
$("capLine").textContent = st.maxSpeedPercent < 100 ? `Speed limited to ${st.maxSpeedPercent}% of full` : ""; |
| 1329 | 1443 |
$("turnActions").replaceChildren(...turnButtons()); |
| 1444 |
const mine = me ? st.queue.find((x) => x.id === me.id) : null; |
| 1445 |
$("turnNote").textContent = lobby.hello.banned ? "You can watch, but not drive." |
| 1446 |
: mine ? `You're ${ordinal(mine.place)} in line. The Drive tab opens when your turn comes.` |
| 1447 |
: d ? `${d.name} is driving. Join the line, above, to take a turn.` : "Nobody is driving. Take control, above, to move the arm."; |
| 1330 | 1448 |
$("queueActions").replaceChildren(el("span", { textContent: d ? (me && d.id === me.id ? "You" : d.name) : "Nobody", style: "flex:1;font-weight:600" }), ...turnButtons()); |
| 1331 | 1449 |
const joining = lobby.hello.signin && !me; |
| 1332 | 1450 |
$("joinForm").hidden = $("forgeSignin").hidden = !joining; |
|
|
@@ -1434,10 +1552,19 @@ |
| 1434 | 1552 |
if ($("modDlg").returnValue === "ban" && confirm(`Ban ${line.dataset.name}? They can still watch, but nobody from their name, browser or address can chat or drive.`)) say({ type: "ban", id: line.dataset.from, on: true }); |
| 1435 | 1553 |
}); |
| 1436 | 1554 |
} |
| 1555 |
|
| 1556 |
let armOk = null; |
| 1557 |
function renderConn() { |
| 1558 |
const c = $("conn"), roomUp = !relayed || lobby.ws?.readyState === 1; |
| 1559 |
const [text, cls] = armOk === false ? ["No arm", "bad"] : !roomUp ? ["Reconnecting", "warn"] : armOk ? ["Live", ""] : ["…", ""]; |
| 1560 |
if (c.textContent !== text) c.textContent = text; |
| 1561 |
c.className = cls; |
| 1562 |
$("dot").className = armOk && roomUp ? "dot on" : "dot"; |
| 1563 |
} |
| 1437 | 1564 |
function lobbyConnect() { |
| 1438 | 1565 |
const ws = new WebSocket(`${location.protocol === "https:" ? "wss" : "ws"}://${location.host}/live`); |
| 1439 | 1566 |
lobby.ws = ws; |
| 1440 | |
ws.onopen = () => { lobby.retry = 500; }; |
| 1567 |
ws.onopen = () => { lobby.retry = 500; renderConn(); }; |
| 1441 | 1568 |
ws.onmessage = (e) => { |
| 1442 | 1569 |
const m = JSON.parse(e.data); |
| 1443 | 1570 |
if (m.type === "ping") return say({ type: "pong" }); |
|
|
@@ -1459,6 +1586,7 @@ |
| 1459 | 1586 |
lobby.ws = null; lobby.hello = null; |
| 1460 | 1587 |
applyLock(); |
| 1461 | 1588 |
$("driverLine").className = "none"; $("driverLine").textContent = "Reconnecting…"; |
| 1589 |
renderConn(); |
| 1462 | 1590 |
setTimeout(lobbyConnect, lobby.retry); |
| 1463 | 1591 |
lobby.retry = Math.min(lobby.retry * 2, 8000); |
| 1464 | 1592 |
}; |
|
|
@@ -1569,8 +1697,7 @@ |
| 1569 | 1697 |
}; |
| 1570 | 1698 |
if (d.estop) { |
| 1571 | 1699 |
b.className = "stop"; |
| 1572 | |
b.replaceChildren(`EMERGENCY STOP by ${d.estop.by} at ${new Date(d.estop.at).toLocaleTimeString()}. The arm holds with torque on until an admin clears it.`); |
| 1573 | |
if (isOwner()) b.append(el("button", { textContent: "Clear the stop", className: "danger", onclick: clearEStop })); |
| 1700 |
b.replaceChildren(`STOPPED by ${d.estop.by} at ${new Date(d.estop.at).toLocaleTimeString()}. The arm holds with torque on${isOwner() ? ": tap Resume twice to free it." : " until an admin resumes it."}`); |
| 1574 | 1701 |
return; |
| 1575 | 1702 |
} |
| 1576 | 1703 |
if (d.jammed?.length) { b.className = "bad"; b.textContent = `jam: ${d.jammed.map((id) => NAMES[id] ?? id).join(", ")} pushed against something and stopped — back the leader off`; } |
|
|
@@ -1587,21 +1714,23 @@ |
| 1587 | 1714 |
rtts.push(performance.now() - started); if (rtts.length > 10) rtts.shift(); |
| 1588 | 1715 |
status = d; |
| 1589 | 1716 |
if (Boolean(d.estop) !== wasStopped) applyLock(); |
| 1590 | |
$("dot").className = "dot on"; |
| 1591 | |
$("state").textContent = d.driving === null ? "idle" : d.driving === "record" ? `recording ${d.recording}` : leaderStreaming() ? `leader · ${leader.frames} frames` : d.driving; |
| 1592 | |
$("estop").classList.toggle("on", Boolean(d.estop)); $("estop").textContent = d.estop ? "Stopped" : "Stop"; |
| 1717 |
armOk = true; renderConn(); |
| 1718 |
$("state").textContent = d.estop ? "stopped" : d.driving === null ? "arm idle" : d.driving === "record" ? `recording ${d.recording}` : leaderStreaming() ? `leader · ${leader.frames} frames` : `arm: ${d.driving}`; |
| 1719 |
renderStop(); |
| 1593 | 1720 |
$("record").textContent = d.driving === "record" ? "■ Stop recording" : "● Record"; |
| 1594 | |
for (const id of ["hold", "releaseBtn", "play"]) $(id).disabled = d.driving !== null; |
| 1595 | |
if (tab === "controls") render(d); |
| 1721 |
$("play").textContent = d.driving === "play" ? "■ End playback" : "▶ Play…"; |
| 1722 |
for (const id of ["hold", "releaseBtn"]) $(id).disabled = d.driving !== null; |
| 1723 |
$("play").disabled = d.driving !== null && d.driving !== "play"; |
| 1724 |
if (tab === "drive") render(d); |
| 1596 | 1725 |
banner(d); applyModel(d); |
| 1597 | 1726 |
$("readout").innerHTML = `<span>lowest part <b>${Number.isFinite(d.lowestMm) ? d.lowestMm : "—"} mm</b> above the table</span><span>zone <b>${d.zone === "enforce" || d.zone === "warn" || d.zone === "off" ? d.zone : "—"}</b></span>`; |
| 1598 | |
} catch { $("dot").className = "dot"; $("state").textContent = "no arm"; } |
| 1727 |
} catch { armOk = false; renderConn(); $("state").textContent = "no arm"; } |
| 1599 | 1728 |
|
| 1600 | 1729 |
setTimeout(poll, document.hidden ? 2000 : 200); |
| 1601 | 1730 |
} |
| 1602 | 1731 |
(async () => { |
| 1603 | 1732 |
applyLock(); |
| 1604 | |
if (relayed) lobbyConnect(); else showTab("controls"); |
| 1733 |
if (relayed) lobbyConnect(); else showTab("drive"); |
| 1605 | 1734 |
limits = await api("/limits"); |
| 1606 | 1735 |
await loadSettings(); |
| 1607 | 1736 |
await loadPoses(); |