Merge main into projects-ux
Main now carries conn-row-polish and settings-ux. Conflicts resolved keeping both sides: work_parts.html keeps projects-ux's star toggle and repository facts with settings-ux's Thinking words group; the Plan 3 copy inventory keeps both sets of rows; budgets re-measured with all three merged, internal/equipo 15942 (16000) and internal/thintest 10768 (10850), both above either side's allowance, reasons combined.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 files changed,
+1,260
−152
.rastrillo/budgets.txt+2 −2docs/mockups/built/2026-11-11/settings-connections-1280.pngbinarydocs/mockups/built/2026-11-11/settings-connections-390.pngbinarydocs/mockups/built/2026-11-11/settings-connections-add-1280.pngbinarydocs/mockups/built/2026-11-11/settings-connections-add-390.pngbinarydocs/mockups/built/2026-11-11/settings-connections-add-before-1280.pngbinarydocs/mockups/built/2026-11-11/settings-connections-add-before-390.pngbinarydocs/mockups/built/2026-11-11/settings-connections-before-1280.pngbinarydocs/mockups/built/2026-11-11/settings-connections-before-390.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-1280.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-390.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-before-1280.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-before-390.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-paused-1280.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-paused-390.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-quiet-off-1280.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-quiet-off-390.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-saved-1280.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-saved-390.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-unsaved-1280.pngbinarydocs/mockups/built/2026-11-11/settings-housekeeping-unsaved-390.pngbinarydocs/mockups/built/2026-11-11/settings-notebook-1280.pngbinarydocs/mockups/built/2026-11-11/settings-notebook-390.pngbinarydocs/mockups/built/2026-11-11/settings-notebook-before-1280.pngbinarydocs/mockups/built/2026-11-11/settings-notebook-before-390.pngbinarydocs/mockups/built/2026-11-11/settings-teams-1280.pngbinarydocs/mockups/built/2026-11-11/settings-teams-390.pngbinarydocs/mockups/built/2026-11-11/settings-teams-add-1280.pngbinarydocs/mockups/built/2026-11-11/settings-teams-add-390.pngbinarydocs/mockups/built/2026-11-11/settings-teams-before-1280.pngbinarydocs/mockups/built/2026-11-11/settings-teams-before-390.pngbinarydocs/mockups/built/2026-11-11/settings-teams-undo-1280.pngbinarydocs/mockups/built/2026-11-11/settings-teams-undo-390.pngbinarydocs/mockups/built/2026-11-11/settings-thinking-1280.pngbinarydocs/mockups/built/2026-11-11/settings-thinking-390.pngbinarydocs/mockups/built/2026-11-11/settings-thinking-before-1280.pngbinarydocs/mockups/built/2026-11-11/settings-thinking-before-390.pngbinarydocs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+32 −3internal/equipo/chat_connections.go+42 −4internal/equipo/connections_view.go+56 −24internal/equipo/connections_view_test.go+90 −3internal/equipo/copy.go+34 −6internal/equipo/render.go+1 −1internal/equipo/settings_hub.go+28 −1internal/equipo/static/connections.js+19 −0internal/equipo/static/equipo.css+128 −16internal/equipo/static/settings.js+281 −34internal/equipo/team_links.go+3 −1internal/equipo/templates/housekeeping_settings.html+22 −8internal/equipo/templates/models.html+5 −5internal/equipo/templates/notebook.html+1 −1internal/equipo/templates/settings_hub.html+2 −2internal/equipo/templates/settings_nav.html+14 −0internal/equipo/templates/teams.html+34 −20internal/equipo/templates/work_parts.html+5 −6internal/equipotest/pages_test.go+11 −0internal/plan3test/teams_navigation_browser_test.go+16 −8internal/thintest/housekeeping_browser_test.go+3 −3internal/thintest/settings_browser_test.go+4 −4internal/thintest/settings_ux_browser_test.go+280 −0internal/thintest/settings_ux_pages_test.go+147 −0
CI passed — run details
Intent
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 5b11ebe4..ce857bfb 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -14,7 +14,7 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr |
| time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI. |
| time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage. |
| -size internal/equipo 15850 - Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here. |
| +size internal/equipo 16000 - Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here. |
| size internal/equipotest - 13400 Task 21 repairs historical migration and conversation fixtures after Plan 3. Measured 13024 test lines; the 300s time ceiling is unchanged. |
| time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded); 60s gives 34 percent headroom. Shared baseline capture reduces repeated Go runs; retain the CI allowance for sandbox sentinels, timeout and child cleanup. 2026-11-07: loaded CI (host load about 24) measured 66.5s with the package unchanged by thin v1 slice 4 beyond optional check mounts; 90s keeps 35 percent headroom. |
| time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s). Parallel plan graphs and removal of repeated progress floods reduced their local targeted run from 146.920s to 30.784s; the original bug graph retains volume coverage. Keep 330s for journal, proxy, recovery and namespace integration, with 13 percent headroom. |
| @@ -62,4 +62,4 @@ perf GET /conversation/attachments/{id}/preview skip Composer attachments: an im |
| perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section. |
| time cmd/equipo-runner 60s Mac runners slice B: TestReleaseRunnerHasNoFakeWorker builds the release runner exactly as make release-runner does and the thin package under the testbuild tag (measured 11.9s locally with a warm cache). |
| size internal/headless - 8300 Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. |
| -size internal/thintest - 10400 Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness. |
| +size internal/thintest - 10850 Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness. |
diff --git a/docs/mockups/built/2026-11-11/settings-connections-1280.png b/docs/mockups/built/2026-11-11/settings-connections-1280.png| new file mode 100644 |
| index 00000000..8b9545aa |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-connections-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-connections-390.png b/docs/mockups/built/2026-11-11/settings-connections-390.png| new file mode 100644 |
| index 00000000..0a09096d |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-connections-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-connections-add-1280.png b/docs/mockups/built/2026-11-11/settings-connections-add-1280.png| new file mode 100644 |
| index 00000000..231174b0 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-connections-add-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-connections-add-390.png b/docs/mockups/built/2026-11-11/settings-connections-add-390.png| new file mode 100644 |
| index 00000000..b47b87dd |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-connections-add-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-connections-add-before-1280.png b/docs/mockups/built/2026-11-11/settings-connections-add-before-1280.png| new file mode 100644 |
| index 00000000..a5f638fa |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-connections-add-before-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-connections-add-before-390.png b/docs/mockups/built/2026-11-11/settings-connections-add-before-390.png| new file mode 100644 |
| index 00000000..cee2ed22 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-connections-add-before-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-connections-before-1280.png b/docs/mockups/built/2026-11-11/settings-connections-before-1280.png| new file mode 100644 |
| index 00000000..9f1759fa |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-connections-before-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-connections-before-390.png b/docs/mockups/built/2026-11-11/settings-connections-before-390.png| new file mode 100644 |
| index 00000000..1400eb02 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-connections-before-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-1280.png b/docs/mockups/built/2026-11-11/settings-housekeeping-1280.png| new file mode 100644 |
| index 00000000..ba4475d9 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-390.png b/docs/mockups/built/2026-11-11/settings-housekeeping-390.png| new file mode 100644 |
| index 00000000..8942ee82 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-before-1280.png b/docs/mockups/built/2026-11-11/settings-housekeeping-before-1280.png| new file mode 100644 |
| index 00000000..b4443670 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-before-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-before-390.png b/docs/mockups/built/2026-11-11/settings-housekeeping-before-390.png| new file mode 100644 |
| index 00000000..649f3295 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-before-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-paused-1280.png b/docs/mockups/built/2026-11-11/settings-housekeeping-paused-1280.png| new file mode 100644 |
| index 00000000..c2e9a846 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-paused-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-paused-390.png b/docs/mockups/built/2026-11-11/settings-housekeeping-paused-390.png| new file mode 100644 |
| index 00000000..9b19dbd3 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-paused-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-quiet-off-1280.png b/docs/mockups/built/2026-11-11/settings-housekeeping-quiet-off-1280.png| new file mode 100644 |
| index 00000000..280b1656 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-quiet-off-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-quiet-off-390.png b/docs/mockups/built/2026-11-11/settings-housekeeping-quiet-off-390.png| new file mode 100644 |
| index 00000000..b396241a |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-quiet-off-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-saved-1280.png b/docs/mockups/built/2026-11-11/settings-housekeeping-saved-1280.png| new file mode 100644 |
| index 00000000..ee50deec |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-saved-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-saved-390.png b/docs/mockups/built/2026-11-11/settings-housekeeping-saved-390.png| new file mode 100644 |
| index 00000000..434c814a |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-saved-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-unsaved-1280.png b/docs/mockups/built/2026-11-11/settings-housekeeping-unsaved-1280.png| new file mode 100644 |
| index 00000000..3b57f51d |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-unsaved-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-housekeeping-unsaved-390.png b/docs/mockups/built/2026-11-11/settings-housekeeping-unsaved-390.png| new file mode 100644 |
| index 00000000..dea35c39 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-housekeeping-unsaved-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-notebook-1280.png b/docs/mockups/built/2026-11-11/settings-notebook-1280.png| new file mode 100644 |
| index 00000000..15b40cbd |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-notebook-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-notebook-390.png b/docs/mockups/built/2026-11-11/settings-notebook-390.png| new file mode 100644 |
| index 00000000..3513bfc2 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-notebook-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-notebook-before-1280.png b/docs/mockups/built/2026-11-11/settings-notebook-before-1280.png| new file mode 100644 |
| index 00000000..004af201 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-notebook-before-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-notebook-before-390.png b/docs/mockups/built/2026-11-11/settings-notebook-before-390.png| new file mode 100644 |
| index 00000000..2951e30c |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-notebook-before-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-teams-1280.png b/docs/mockups/built/2026-11-11/settings-teams-1280.png| new file mode 100644 |
| index 00000000..fe1f5512 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-teams-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-teams-390.png b/docs/mockups/built/2026-11-11/settings-teams-390.png| new file mode 100644 |
| index 00000000..05584b19 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-teams-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-teams-add-1280.png b/docs/mockups/built/2026-11-11/settings-teams-add-1280.png| new file mode 100644 |
| index 00000000..1d962e54 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-teams-add-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-teams-add-390.png b/docs/mockups/built/2026-11-11/settings-teams-add-390.png| new file mode 100644 |
| index 00000000..1d48094b |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-teams-add-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-teams-before-1280.png b/docs/mockups/built/2026-11-11/settings-teams-before-1280.png| new file mode 100644 |
| index 00000000..d16dd54c |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-teams-before-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-teams-before-390.png b/docs/mockups/built/2026-11-11/settings-teams-before-390.png| new file mode 100644 |
| index 00000000..c8571743 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-teams-before-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-teams-undo-1280.png b/docs/mockups/built/2026-11-11/settings-teams-undo-1280.png| new file mode 100644 |
| index 00000000..4aa9ce92 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-teams-undo-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-teams-undo-390.png b/docs/mockups/built/2026-11-11/settings-teams-undo-390.png| new file mode 100644 |
| index 00000000..2111c866 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-teams-undo-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-thinking-1280.png b/docs/mockups/built/2026-11-11/settings-thinking-1280.png| new file mode 100644 |
| index 00000000..f229a4b3 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-thinking-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-thinking-390.png b/docs/mockups/built/2026-11-11/settings-thinking-390.png| new file mode 100644 |
| index 00000000..e7f5898f |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-thinking-390.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-thinking-before-1280.png b/docs/mockups/built/2026-11-11/settings-thinking-before-1280.png| new file mode 100644 |
| index 00000000..00da6094 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-thinking-before-1280.png differ |
diff --git a/docs/mockups/built/2026-11-11/settings-thinking-before-390.png b/docs/mockups/built/2026-11-11/settings-thinking-before-390.png| new file mode 100644 |
| index 00000000..fbd372c4 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-11/settings-thinking-before-390.png differ |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index c4919efe..f6e21c99 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -5134,7 +5134,8 @@ records remain unchanged. |
| | `chat.connections.cancel` | Cancel | Connections slice 1 (Connections page) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.healthy` | Ready | Connections slice 1 (Connections page) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.limited` | Limited, no reset time reported | Connections slice 1 (Connections page) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| -| `chat.connections.limited_until` | Limited until %s | Connections slice 1 (Connections page) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.limited_now` | Limited | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.limited_resets_in` | Limited, resets in %s | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.signed_out` | Signed out | Connections slice 1 (Connections page) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.sign_in_again` | Needs signing in again | Connections slice 1 (Connections page) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.error` | Not working | Connections slice 1 (Connections page) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| @@ -5250,7 +5251,10 @@ records remain unchanged. |
| | `chat.connections.answering.on` | Your coordinator is on %s. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.answering.while` | while %s. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.answering.rests` | %s rests | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| -| `chat.connections.answering.rests_until` | %s rests until %s | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.answering.back_in` | %s is back in %s | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.answering.then` | . %s. | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.answering.resets_in` | %s resets in %s | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.answering.resets_at` | %s resets %s | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.and` | and | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.answering.too` | Engineering and Review are on %s too. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.answering.stays` | Work stays where it is until the next message or step, then Equipo picks the healthiest connection with headroom. | Connections page fixes (Paul, 2026-11-10: name the account, say what Automatic does) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| @@ -5284,7 +5288,14 @@ records remain unchanged. |
| | `chat.connections.window_hours` | %d h window | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.window_week` | Week | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.window_used` | Used | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| -| `chat.connections.resets` | resets %s | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.resets_in` | resets in %s | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.in.day` | %d day | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.in.days` | %d days | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.in.hour` | %d hour | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.in.hours` | %d hours | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.in.minute` | %d minute | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.in.minutes` | %d minutes | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `chat.connections.in.under_minute` | under a minute | Connections page fixes (Paul, 2026-11-11: "Can we get Resets in Xdays Yhours", the format as he dictated it) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.add` | Add a connection | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.add_hint` | Another account of yours, or a second provider so Review can use a different model family. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `chat.connections.chooser_lede` | Equipo signs in through the provider's own flow and never sees your password. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| @@ -5881,6 +5892,24 @@ records remain unchanged. |
| | `runner.verdict.failed` | Failed | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `runner.verdict.skipped` | Not run | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `runner.verdict.unavailable` | Unavailable | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.unsaved` | Unsaved changes | Settings UX pass (Paul, 2026-11-11): the savebar, beside Discard and Save | Runtime; COPY REVIEW REQUIRED | |
| +| `settings.discard` | Discard | Settings UX pass (Paul, 2026-11-11): the savebar | Runtime; COPY REVIEW REQUIRED | |
| +| `housekeeping.settings.status` | Status | Settings UX pass (Paul, 2026-11-11): Housekeeping, the group heading over Pause | Runtime; COPY REVIEW REQUIRED | |
| +| `housekeeping.settings.status_hint` | Pause and Resume apply at once. | Settings UX pass (Paul, 2026-11-11): Housekeeping, the Status group's line | Runtime; COPY REVIEW REQUIRED | |
| +| `housekeeping.settings.on` | Housekeeping is on | Settings UX pass (Paul, 2026-11-11): Housekeeping, the state beside Pause | Runtime; COPY REVIEW REQUIRED | |
| +| `housekeeping.settings.off` | Housekeeping is paused | Settings UX pass (Paul, 2026-11-11): Housekeeping, the state beside Resume | Runtime; COPY REVIEW REQUIRED | |
| +| `housekeeping.settings.off_desc` | Nothing is tidied until you resume. | Settings UX pass (Paul, 2026-11-11): Housekeeping, under the paused state | Runtime; COPY REVIEW REQUIRED | |
| +| `housekeeping.settings.hours` | Hours | Settings UX pass (Paul, 2026-11-11): Housekeeping, the row of From and Until | Runtime; COPY REVIEW REQUIRED | |
| +| `thinking.choose` | Word set | Settings UX pass (Paul, 2026-11-11): Thinking words, the group heading over the sets | Runtime; COPY REVIEW REQUIRED | |
| +| `thinking.choose_hint` | Your choice applies at once. | Settings UX pass (Paul, 2026-11-11): Thinking words, the group's line | Runtime; COPY REVIEW REQUIRED | |
| +| `teams.lede` | Links to the other Equipo teams you use. Only you can see them. | Settings UX pass (Paul, 2026-11-11): Teams, the page's one line | Runtime; COPY REVIEW REQUIRED | |
| +| `teams.none` | No other teams yet. | Settings UX pass (Paul, 2026-11-11): Teams, no remembered teams | Runtime; COPY REVIEW REQUIRED | |
| +| `teams.add_open` | Add a team | Settings UX pass (Paul, 2026-11-11): Teams, the button that opens the add form | Runtime; COPY REVIEW REQUIRED | |
| +| `teams.add_help` | Each team has its own sign-in and members. A link gives no access to it. | Settings UX pass (Paul, 2026-11-11): Teams, help in the add form | Runtime; COPY REVIEW REQUIRED | |
| +| `teams.last_signin_ago` | Last signed in %s | Settings UX pass (Paul, 2026-11-11): Teams, a remembered row; %s is "4 days ago" (work.ago.*), the exact time on hover | Runtime; COPY REVIEW REQUIRED | |
| +| `teams.forget_short` | Forget | Settings UX pass (Paul, 2026-11-11): Teams, the quiet action on a remembered row | Runtime; COPY REVIEW REQUIRED | |
| +| `teams.forgotten` | %s forgotten. | Settings UX pass (Paul, 2026-11-11): Teams, in the row's place before Undo; %s is the team's name | Runtime; COPY REVIEW REQUIRED | |
| +| `teams.undo` | Undo | Settings UX pass (Paul, 2026-11-11): Teams, after Forget | Runtime; COPY REVIEW REQUIRED | |
| | `chat.activity.star_project` | Starring a project… | Coordinator activity (projects-ux) | COPY REVIEW REQUIRED | |
| | `work.reason.provider_failed` | the model connection failed | Tasks: why a step stopped (projects-ux) | COPY REVIEW REQUIRED | |
| | `work.reason.provider_rejected` | the model provider refused it | Tasks: why a step stopped (projects-ux) | COPY REVIEW REQUIRED | |
diff --git a/internal/equipo/chat_connections.go b/internal/equipo/chat_connections.go| index 2e90e5eb..2ef0983f 100644 |
| --- a/internal/equipo/chat_connections.go |
| +++ b/internal/equipo/chat_connections.go |
| @@ -106,16 +106,54 @@ func providerName(p string) string { |
| } |
| // resetText renders a provider's reset time in UTC, the instance's only |
| -// zone until a person's zone is known. |
| +// zone until a person's zone is known. The conversation's lines keep it: |
| +// they are history under old messages. |
| func resetText(t time.Time) string { return t.UTC().Format("Mon 15:04") + " UTC" } |
| -func connectionState(c wire.Connection) string { |
| +// inText is how long until something, in words (Paul, 2026-11-11: |
| +// "Resets in Xdays Yhours"): days and hours from a day, hours and |
| +// minutes under a day, minutes under an hour, then under a minute. A |
| +// part that is zero is left out; what is left of a minute is dropped. |
| +func inText(d time.Duration) string { |
| + if d < time.Minute { |
| + return copyText("chat.connections.in.under_minute") |
| + } |
| + days, hours, minutes := int(d/(24*time.Hour)), int(d/time.Hour)%24, int(d/time.Minute)%60 |
| + var parts []string |
| + part := func(n int, unit string) { |
| + switch { |
| + case n == 1: |
| + parts = append(parts, fmt.Sprintf(copyText("chat.connections.in."+unit), n)) |
| + case n > 1: |
| + parts = append(parts, fmt.Sprintf(copyText("chat.connections.in."+unit+"s"), n)) |
| + } |
| + } |
| + switch { |
| + case days > 0: |
| + part(days, "day") |
| + part(hours, "hour") |
| + case hours > 0: |
| + part(hours, "hour") |
| + part(minutes, "minute") |
| + default: |
| + part(minutes, "minute") |
| + } |
| + return strings.Join(parts, " ") |
| +} |
| + |
| +// connectionState is a held connection's state in words on the |
| +// Connections page. A limited one says when it resets, unless a meter |
| +// beside it already does (metered). |
| +func connectionState(c wire.Connection, now time.Time, metered bool) string { |
| switch c.State { |
| case wire.ConnHealthy: |
| return copyText("chat.connections.healthy") |
| case wire.ConnLimited: |
| - if c.Headroom != nil && c.Headroom.ResetsAt != nil { |
| - return fmt.Sprintf(copyText("chat.connections.limited_until"), resetText(*c.Headroom.ResetsAt)) |
| + switch { |
| + case metered: |
| + return copyText("chat.connections.limited_now") |
| + case c.Headroom != nil && c.Headroom.ResetsAt != nil: |
| + return fmt.Sprintf(copyText("chat.connections.limited_resets_in"), inText(c.Headroom.ResetsAt.Sub(now))) |
| } |
| return copyText("chat.connections.limited") |
| case wire.ConnSignedOut: |
diff --git a/internal/equipo/connections_view.go b/internal/equipo/connections_view.go| index 96492349..0b25307f 100644 |
| --- a/internal/equipo/connections_view.go |
| +++ b/internal/equipo/connections_view.go |
| @@ -23,10 +23,11 @@ type connRow struct { |
| // says when its token expires, Renew asks for a new one near then. |
| Kind, Expires string |
| Renew bool |
| - // State is the wire state; Words says it. |
| - State, Words string |
| - Meters []connMeter |
| - Roles []connRole |
| + // State is the wire state; Words says it, WordsAt the reset it |
| + // counts down to as a time (the hover title). |
| + State, Words, WordsAt string |
| + Meters []connMeter |
| + Roles []connRole |
| // RolesNote stands where no role chip does. |
| RolesNote string |
| // Usage is today's tokens in words, "0" included; UsageTail the words |
| @@ -48,10 +49,11 @@ type connRow struct { |
| New bool |
| } |
| -// connMeter is one provider-reported rate window. |
| +// connMeter is one provider-reported rate window. Resets counts down to |
| +// its reset; At is that reset as a time (the hover title). |
| type connMeter struct { |
| - Name, Level, Resets string |
| - Used int |
| + Name, Level, Resets, At string |
| + Used int |
| } |
| // connRole is one role a connection serves, Live while it runs one now. |
| @@ -65,7 +67,10 @@ type connAnswering struct { |
| Tone string |
| // Lead is LeadStart, LeadName in bold, LeadEnd. |
| LeadStart, LeadName, LeadEnd string |
| - Sub string |
| + // LeadAt names the resets the lead counts down to as times (the |
| + // hover title). |
| + LeadAt string |
| + Sub string |
| // SeeConversation adds the link to the conversation after Sub. |
| SeeConversation bool |
| } |
| @@ -137,19 +142,27 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre |
| } |
| work := workOn(snap, held, coord) |
| for _, c := range held { |
| - row := connRow{ID: c.ID, Provider: c.Provider, Name: providerName(c.Provider), Glyph: providerGlyph(c.Provider), Label: c.Label, Plan: c.Plan, Kind: c.Kind, State: c.State, Words: connectionState(c), Usage: tokensText(today[c.LocalID]), PreferRevision: prefer.Revision} |
| + row := connRow{ID: c.ID, Provider: c.Provider, Name: providerName(c.Provider), Glyph: providerGlyph(c.Provider), Label: c.Label, Plan: c.Plan, Kind: c.Kind, State: c.State, Usage: tokensText(today[c.LocalID]), PreferRevision: prefer.Revision} |
| _, row.UsageTail, _ = strings.Cut(copyText("chat.connections.usage_today"), "%s") |
| if c.State == wire.ConnError { |
| row.State = wire.ConnSignInAgain |
| } |
| - if c.Kind == wire.KindToken { |
| - tokenFacts(&row, c, now) |
| - } |
| + metered := false |
| if c.Headroom != nil && row.State != wire.ConnSignedOut && row.State != wire.ConnSignInAgain { |
| for _, w := range c.Headroom.Windows { |
| - row.Meters = append(row.Meters, meterOf(w)) |
| + m := meterOf(w, now) |
| + metered = metered || m.Resets != "" |
| + row.Meters = append(row.Meters, m) |
| } |
| } |
| + // The status and a meter do not both say when: the meter does. |
| + row.Words = connectionState(c, now, metered) |
| + if c.State == wire.ConnLimited && !metered && c.Headroom != nil && c.Headroom.ResetsAt != nil { |
| + row.WordsAt = resetText(*c.Headroom.ResetsAt) |
| + } |
| + if c.Kind == wire.KindToken { |
| + tokenFacts(&row, c, now) |
| + } |
| switch row.State { |
| case wire.ConnSignedOut: |
| row.Needs, row.Forget = copyText("chat.connections.connect_again"), true |
| @@ -187,7 +200,7 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre |
| } |
| v.Rows = append(v.Rows, row) |
| } |
| - v.Answering = answering(held, coord, v.Attempts, names, prefer.Provider) |
| + v.Answering = answering(held, coord, v.Attempts, names, prefer.Provider, now) |
| return v |
| } |
| @@ -264,7 +277,8 @@ func coordinatorOn(snap wire.Snapshot) string { |
| // provider; what happens next is what the choice does, not a promise |
| // (Paul, 2026-11-10): under Automatic work stays put until its next |
| // message or step; with a preference it moves to the preferred one. |
| -func answering(held []wire.Connection, coord string, attempts []modelLine, names connNames, prefer string) connAnswering { |
| +// A rest counts down to its reset from now (Paul, 2026-11-11). |
| +func answering(held []wire.Connection, coord string, attempts []modelLine, names connNames, prefer string, now time.Time) connAnswering { |
| if len(held) == 0 { |
| return connAnswering{} |
| } |
| @@ -279,13 +293,14 @@ func answering(held []wire.Connection, coord string, attempts []modelLine, names |
| } |
| } |
| if on == nil { |
| - var parts []string |
| + var parts, at []string |
| for _, c := range held { |
| name := names.of(c) |
| switch c.State { |
| case wire.ConnLimited: |
| if c.Headroom != nil && c.Headroom.ResetsAt != nil { |
| - parts = append(parts, fmt.Sprintf(copyText("chat.no_connection.resets"), name, resetText(*c.Headroom.ResetsAt))) |
| + parts = append(parts, fmt.Sprintf(copyText("chat.connections.answering.resets_in"), name, inText(c.Headroom.ResetsAt.Sub(now)))) |
| + at = append(at, resetAt(name, *c.Headroom.ResetsAt)) |
| } else { |
| parts = append(parts, fmt.Sprintf(copyText("chat.connections.answering.no_reset"), name)) |
| } |
| @@ -299,26 +314,35 @@ func answering(held []wire.Connection, coord string, attempts []modelLine, names |
| if len(parts) > 0 { |
| why = " " + strings.Join(parts, "; ") + "." |
| } |
| - return connAnswering{Tone: "attention", LeadName: copyText("chat.connections.answering.none"), LeadEnd: why, Sub: copyText("chat.connections.answering.kept"), SeeConversation: true} |
| + return connAnswering{Tone: "attention", LeadName: copyText("chat.connections.answering.none"), LeadEnd: why, LeadAt: strings.Join(at, "; "), Sub: copyText("chat.connections.answering.kept"), SeeConversation: true} |
| } |
| a := connAnswering{} |
| a.LeadStart, a.LeadEnd, _ = strings.Cut(copyText("chat.connections.answering.on"), "%s") |
| a.LeadName = names.of(*on) |
| a.Sub = fmt.Sprintf(copyText("chat.connections.answering.too"), a.LeadName) |
| if len(resting) > 0 { |
| - var rests []string |
| + var rests, at []string |
| for _, c := range resting { |
| name := names.of(c) |
| if c.Provider == on.Provider && names[c.Provider] == 2 { |
| name = fmt.Sprintf(copyText("chat.connections.answering.other"), providerName(c.Provider)) |
| } |
| if c.Headroom != nil && c.Headroom.ResetsAt != nil { |
| - rests = append(rests, fmt.Sprintf(copyText("chat.connections.answering.rests_until"), name, resetText(*c.Headroom.ResetsAt))) |
| + rests = append(rests, fmt.Sprintf(copyText("chat.connections.answering.back_in"), name, inText(c.Headroom.ResetsAt.Sub(now)))) |
| + at = append(at, resetAt(name, *c.Headroom.ResetsAt)) |
| } else { |
| rests = append(rests, fmt.Sprintf(copyText("chat.connections.answering.rests"), name)) |
| } |
| } |
| - a.LeadEnd = fmt.Sprintf(copyText("chat.connections.answering.while"), strings.Join(rests, copyText("chat.connections.and"))) |
| + // "On X while Y rests." With a time it is a sentence of its own: |
| + // "On X. Your other Codex account is back in 22 hours 5 minutes." |
| + said := strings.Join(rests, copyText("chat.connections.and")) |
| + if len(at) == 0 { |
| + a.LeadEnd = fmt.Sprintf(copyText("chat.connections.answering.while"), said) |
| + } else { |
| + a.LeadEnd = fmt.Sprintf(copyText("chat.connections.answering.then"), sentenceCase(said)) |
| + } |
| + a.LeadAt = strings.Join(at, "; ") |
| switch { |
| case prefer == "": |
| a.Sub += " " + copyText("chat.connections.answering.stays") |
| @@ -332,6 +356,12 @@ func answering(held []wire.Connection, coord string, attempts []modelLine, names |
| return a |
| } |
| +// resetAt is a reset as a time, for a hover title: "Codex resets Thu |
| +// 09:36 UTC". |
| +func resetAt(name string, t time.Time) string { |
| + return sentenceCase(fmt.Sprintf(copyText("chat.connections.answering.resets_at"), name, resetText(t))) |
| +} |
| + |
| // connNames counts the person's connections by provider, to name each: |
| // the provider, and the account when there is more than one of it. |
| type connNames map[string]int |
| @@ -398,8 +428,9 @@ func freshen(c wire.Connection, now time.Time) wire.Connection { |
| return c |
| } |
| -// meterOf is one reported window in words. |
| -func meterOf(w wire.Window) connMeter { |
| +// meterOf is one reported window in words, its reset counted down from |
| +// now. |
| +func meterOf(w wire.Window, now time.Time) connMeter { |
| m := connMeter{Used: int(w.UsedPercent + 0.5), Level: "ok"} |
| switch { |
| case w.Minutes >= 7*24*60: |
| @@ -416,7 +447,8 @@ func meterOf(w wire.Window) connMeter { |
| m.Level = "high" |
| } |
| if w.ResetsAt != nil { |
| - m.Resets = fmt.Sprintf(copyText("chat.connections.resets"), resetText(*w.ResetsAt)) |
| + m.Resets = fmt.Sprintf(copyText("chat.connections.resets_in"), inText(w.ResetsAt.Sub(now))) |
| + m.At = resetText(*w.ResetsAt) |
| } |
| return m |
| } |
diff --git a/internal/equipo/connections_view_test.go b/internal/equipo/connections_view_test.go| index 7556a0af..55806294 100644 |
| --- a/internal/equipo/connections_view_test.go |
| +++ b/internal/equipo/connections_view_test.go |
| @@ -5,6 +5,7 @@ import ( |
| "testing" |
| "time" |
| + "amadan.net/oficina/equipo/internal/equipo/chat" |
| "amadan.net/oficina/equipo/internal/wire" |
| ) |
| @@ -48,7 +49,7 @@ func lead(a connAnswering) string { return a.LeadStart + a.LeadName + a.LeadEnd |
| // the resting one is the other Codex account, not "Codex". |
| func TestConnectionsSummaryNamesTheAccount(t *testing.T) { |
| v := connectionsPage(screenshotSnapshot(), nil, wire.Preferences{}, "Tito Studio", screenshotNow) |
| - want := "Your coordinator is on Codex (paul@keymail.dev) while your other Codex account rests until Thu 09:36 UTC." |
| + want := "Your coordinator is on Codex (paul@keymail.dev). Your other Codex account is back in 1 day 11 hours." |
| if got := lead(v.Answering); got != want { |
| t.Fatalf("lead %q, want %q", got, want) |
| } |
| @@ -60,7 +61,7 @@ func TestConnectionsSummaryNamesTheAccount(t *testing.T) { |
| snap.Connections = snap.Connections[:2] |
| snap.Turns = snap.Turns[:0] |
| one := connectionsPage(snap, nil, wire.Preferences{}, "Tito Studio", screenshotNow) |
| - if got := lead(one.Answering); got != "Your coordinator is on Claude while Codex rests until Thu 09:36 UTC." { |
| + if got := lead(one.Answering); got != "Your coordinator is on Claude. Codex is back in 1 day 11 hours." { |
| t.Fatalf("one of each: %q", got) |
| } |
| } |
| @@ -73,7 +74,7 @@ func TestConnectionsStaleMeterAfterReset(t *testing.T) { |
| t.Fatalf("Claude shows a stale meter after its reset: %+v", m) |
| } |
| // The resting Codex keeps its reported window: its reset is ahead. |
| - if m := rowOf(t, v, "c-promax").Meters; len(m) != 1 || m[0].Used != 100 || m[0].Resets != "resets Thu 09:36 UTC" { |
| + if m := rowOf(t, v, "c-promax").Meters; len(m) != 1 || m[0].Used != 100 || m[0].Resets != "resets in 1 day 11 hours" || m[0].At != "Thu 09:36 UTC" { |
| t.Fatalf("promax meters %+v", m) |
| } |
| snap := screenshotSnapshot() |
| @@ -151,3 +152,89 @@ func TestConnectionsEndedNoteClears(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// Paul, 2026-11-11: "Can we get Resets in Xdays Yhours". Days and hours |
| +// from a day, hours and minutes under one, minutes under an hour; a zero |
| +// part left out, singular and plural. |
| +func TestInText(t *testing.T) { |
| + for _, c := range []struct { |
| + d time.Duration |
| + want string |
| + }{ |
| + {0, "under a minute"}, |
| + {59 * time.Second, "under a minute"}, |
| + {time.Minute, "1 minute"}, |
| + {12 * time.Minute, "12 minutes"}, |
| + {59*time.Minute + 59*time.Second, "59 minutes"}, |
| + {time.Hour, "1 hour"}, |
| + {time.Hour + time.Minute, "1 hour 1 minute"}, |
| + {5*time.Hour + 20*time.Minute, "5 hours 20 minutes"}, |
| + {23*time.Hour + 59*time.Minute, "23 hours 59 minutes"}, |
| + {24 * time.Hour, "1 day"}, |
| + {24*time.Hour + 59*time.Minute, "1 day"}, |
| + {25 * time.Hour, "1 day 1 hour"}, |
| + {49 * time.Hour, "2 days 1 hour"}, |
| + {51*time.Hour + 30*time.Minute, "2 days 3 hours"}, |
| + {-time.Minute, "under a minute"}, |
| + } { |
| + if got := inText(c.d); got != c.want { |
| + t.Errorf("inText(%v) = %q, want %q", c.d, got, c.want) |
| + } |
| + } |
| +} |
| + |
| +// A limited row says when it is back once: the meter counts down and the |
| +// status says "Limited"; without a meter the status counts down. Each |
| +// keeps the time as its hover title. |
| +func TestConnectionsLimitedRowCountsDown(t *testing.T) { |
| + now := time.Date(2026, 11, 11, 11, 31, 0, 0, time.UTC) |
| + reset := time.Date(2026, 11, 12, 9, 36, 0, 0, time.UTC) |
| + snap := screenshotSnapshot() |
| + snap.Connections[1].Headroom = &wire.Headroom{ResetsAt: &reset, Windows: []wire.Window{{Name: "secondary", UsedPercent: 100, Minutes: 7 * 24 * 60, ResetsAt: &reset}}} |
| + r := rowOf(t, connectionsPage(snap, nil, wire.Preferences{}, "", now), "c-promax") |
| + if r.Words != "Limited" || r.WordsAt != "" || len(r.Meters) != 1 || r.Meters[0].Resets != "resets in 22 hours 5 minutes" || r.Meters[0].At != "Thu 09:36 UTC" { |
| + t.Fatalf("metered limited row: %q (%q) %+v", r.Words, r.WordsAt, r.Meters) |
| + } |
| + snap.Connections[1].Headroom = &wire.Headroom{ResetsAt: &reset} |
| + r = rowOf(t, connectionsPage(snap, nil, wire.Preferences{}, "", now), "c-promax") |
| + if r.Words != "Limited, resets in 22 hours 5 minutes" || r.WordsAt != "Thu 09:36 UTC" || len(r.Meters) != 0 { |
| + t.Fatalf("limited row without a meter: %q (%q) %+v", r.Words, r.WordsAt, r.Meters) |
| + } |
| + // A meter without a reset time leaves the countdown to the status. |
| + snap.Connections[1].Headroom = &wire.Headroom{ResetsAt: &reset, Windows: []wire.Window{{Name: "secondary", UsedPercent: 100}}} |
| + if r = rowOf(t, connectionsPage(snap, nil, wire.Preferences{}, "", now), "c-promax"); r.Words != "Limited, resets in 22 hours 5 minutes" { |
| + t.Fatalf("limited row with an untimed meter: %q", r.Words) |
| + } |
| +} |
| + |
| +// The answering card counts down too: "is back in", the time in its |
| +// title; and when nothing can answer, "resets in". |
| +func TestConnectionsAnsweringCountsDown(t *testing.T) { |
| + now := time.Date(2026, 11, 11, 11, 31, 0, 0, time.UTC) |
| + v := connectionsPage(screenshotSnapshot(), nil, wire.Preferences{}, "", now) |
| + if got := lead(v.Answering); got != "Your coordinator is on Codex (paul@keymail.dev). Your other Codex account is back in 22 hours 5 minutes." { |
| + t.Fatalf("lead %q", got) |
| + } |
| + if v.Answering.LeadAt != "Your other Codex account resets Thu 09:36 UTC" { |
| + t.Fatalf("lead title %q", v.Answering.LeadAt) |
| + } |
| + snap := screenshotSnapshot() |
| + snap.Connections = snap.Connections[1:2] |
| + snap.Turns = nil |
| + v = connectionsPage(snap, nil, wire.Preferences{}, "", now) |
| + if got := lead(v.Answering); got != "Nothing can answer right now. Codex resets in 22 hours 5 minutes." || v.Answering.LeadAt != "Codex resets Thu 09:36 UTC" { |
| + t.Fatalf("nothing answers: %q (%q)", got, v.Answering.LeadAt) |
| + } |
| +} |
| + |
| +// The conversation's lines are history under old messages: they keep the |
| +// time, not a countdown. |
| +func TestConnectionsChatLinesStayAbsolute(t *testing.T) { |
| + reset := time.Date(2026, 11, 12, 9, 36, 0, 0, time.UTC) |
| + if got := switchedText(&wire.Switched{From: wire.ProviderCodex, To: wire.ProviderClaude, ResetsAt: &reset}); got != "Switched to Claude; Codex resets Thu 09:36 UTC" { |
| + t.Fatalf("switched %q", got) |
| + } |
| + if got := noConnectionText([]chat.NoConnectionLine{{Provider: wire.ProviderCodex, State: wire.ConnLimited, ResetsAt: &reset}}); got != "Nothing can answer right now. Codex resets Thu 09:36 UTC." { |
| + t.Fatalf("no connection %q", got) |
| + } |
| +} |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index e07c0332..ce305701 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -130,17 +130,34 @@ var pageCopy = map[string]string{ |
| "api.authorization_pending": "Approve this device in your browser.", |
| "teams.title": "Teams", |
| "teams.add": "Remember a team", |
| - "teams.forget": "Forget this link", |
| "teams.remembered": "Your remembered teams", |
| - "teams.directory_help": "Add links to other Equipo instances you have signed in to. Only you can see this directory. Each instance has its own sign-in and membership. Links do not give access or share accounts.", |
| "teams.last_signin_unknown": "Last sign-in unknown", |
| - "teams.last_signin": "Last signed in", |
| "teams.remote_unavailable": "Remote status unavailable", |
| "teams.counts_unknown": "Counts unavailable", |
| "teams.origin": "Instance address", |
| "teams.name": "Team name", |
| "teams.current": "Current team", |
| "teams.parent_task": "Task", |
| + // Settings UX pass (Paul, 2026-11-11: "proper UX and aren't just |
| + // random forms"). Each entry is pending review on its own. |
| + "settings.unsaved": "Unsaved changes", // COPY REVIEW REQUIRED |
| + "settings.discard": "Discard", // COPY REVIEW REQUIRED |
| + "housekeeping.settings.status": "Status", // COPY REVIEW REQUIRED |
| + "housekeeping.settings.status_hint": "Pause and Resume apply at once.", // COPY REVIEW REQUIRED |
| + "housekeeping.settings.on": "Housekeeping is on", // COPY REVIEW REQUIRED |
| + "housekeeping.settings.off": "Housekeeping is paused", // COPY REVIEW REQUIRED |
| + "housekeeping.settings.off_desc": "Nothing is tidied until you resume.", // COPY REVIEW REQUIRED |
| + "housekeeping.settings.hours": "Hours", // COPY REVIEW REQUIRED |
| + "thinking.choose": "Word set", // COPY REVIEW REQUIRED |
| + "thinking.choose_hint": "Your choice applies at once.", // COPY REVIEW REQUIRED |
| + "teams.lede": "Links to the other Equipo teams you use. Only you can see them.", // COPY REVIEW REQUIRED |
| + "teams.none": "No other teams yet.", // COPY REVIEW REQUIRED |
| + "teams.add_open": "Add a team", // COPY REVIEW REQUIRED |
| + "teams.add_help": "Each team has its own sign-in and members. A link gives no access to it.", // COPY REVIEW REQUIRED |
| + "teams.last_signin_ago": "Last signed in %s", // COPY REVIEW REQUIRED |
| + "teams.forget_short": "Forget", // COPY REVIEW REQUIRED |
| + "teams.forgotten": "%s forgotten.", // COPY REVIEW REQUIRED |
| + "teams.undo": "Undo", // COPY REVIEW REQUIRED |
| "account_setup.title": "Connect a model account", |
| "account_setup.label": "Account label", |
| @@ -716,7 +733,8 @@ var pageCopy = map[string]string{ |
| "chat.connections.cancel": "Cancel", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.healthy": "Ready", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.limited": "Limited, no reset time reported", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| - "chat.connections.limited_until": "Limited until %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.limited_now": "Limited", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.limited_resets_in": "Limited, resets in %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.signed_out": "Signed out", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.sign_in_again": "Needs signing in again", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.error": "Not working", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| @@ -747,7 +765,10 @@ var pageCopy = map[string]string{ |
| "chat.connections.answering.on": "Your coordinator is on %s.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.answering.while": " while %s.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.answering.rests": "%s rests", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| - "chat.connections.answering.rests_until": "%s rests until %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.answering.back_in": "%s is back in %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.answering.then": ". %s.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.answering.resets_in": "%s resets in %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.answering.resets_at": "%s resets %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.and": " and ", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.answering.too": "Engineering and Review are on %s too.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.answering.stays": "Work stays where it is until the next message or step, then Equipo picks the healthiest connection with headroom.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| @@ -781,7 +802,14 @@ var pageCopy = map[string]string{ |
| "chat.connections.window_hours": "%d h window", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.window_week": "Week", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.window_used": "Used", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| - "chat.connections.resets": "resets %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.resets_in": "resets in %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.in.day": "%d day", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.in.days": "%d days", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.in.hour": "%d hour", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.in.hours": "%d hours", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.in.minute": "%d minute", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.in.minutes": "%d minutes", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "chat.connections.in.under_minute": "under a minute", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.add": "Add a connection", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.add_hint": "Another account of yours, or a second provider so Review can use a different model family.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "chat.connections.chooser_lede": "Equipo signs in through the provider's own flow and never sees your password.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/internal/equipo/render.go b/internal/equipo/render.go| index 895db5d1..efc0642e 100644 |
| --- a/internal/equipo/render.go |
| +++ b/internal/equipo/render.go |
| @@ -37,7 +37,7 @@ func init() { |
| for _, name := range []string{"person_devices", "person_device", "teams", "onboarding", "invite", "playbooks", "playbook_form", "playbook_diff", "specialist_form", "template_library", "template_diff", "conversation", "chat", "thread", "plan", "coordinator", "preferences", "index", "empty", "projects", "project", "project_form", "people", "settings", "specialist", "errors", "signin_page", "form_error", "runners", "tasks", "task", "task_form", "question", "merge", "connections", "recovery", "recovery_form", "rendered_approval", "notebook", "housekeeping", "work_tasks", "work_task", "work_projects", "work_project", "models", "work_needs", "settings_hub"} { |
| page := template.Must(template.New("layout"). |
| Funcs(ui.Funcs(ui.WithIcons(icons.Icon, icons.Assets))). |
| - Funcs(template.FuncMap{"chatMarkdown": chatmarkdown.Render, "fileSize": fileSize, "loadingLine": loadingLine, "split": strings.Split, "since": sinceMillis, "elapsed": elapsedText, "short": short, "agoData": agoData, "agoFormats": agoFormats, "projectAllows": library.ProjectAllowed, "asset": assets.Path, "copy": copyText, "taskGroups": func() []string { return []string{"needs-person", "running", "queued", "finished"} }, |
| + Funcs(template.FuncMap{"chatMarkdown": chatmarkdown.Render, "fileSize": fileSize, "loadingLine": loadingLine, "split": strings.Split, "since": sinceMillis, "elapsed": elapsedText, "short": short, "agoData": agoData, "agoText": agoText, "hostOf": hostOf, "deref": deref, "agoFormats": agoFormats, "projectAllows": library.ProjectAllowed, "asset": assets.Path, "copy": copyText, "taskGroups": func() []string { return []string{"needs-person", "running", "queued", "finished"} }, |
| "kindKey": func(k ProjectKind) string { return "kind." + string(k) }, |
| "ownerKey": func(k string) string { return "owner." + k }, |
| "roleKey": func(k Role) string { return "role." + string(k) }, |
diff --git a/internal/equipo/settings_hub.go b/internal/equipo/settings_hub.go| index 7cfcc017..3bdf0195 100644 |
| --- a/internal/equipo/settings_hub.go |
| +++ b/internal/equipo/settings_hub.go |
| @@ -4,6 +4,7 @@ import ( |
| "net/http" |
| "net/url" |
| "strings" |
| + "time" |
| ) |
| // Settings (Paul, 2026-11-09: "settings could probably get a submenu on |
| @@ -29,7 +30,7 @@ func crossedSettings(r *http.Request) bool { |
| return false |
| } |
| in := func(p string) bool { |
| - return p == "/conversation/settings" || strings.HasPrefix(p, "/conversation/settings/") |
| + return p == "/conversation/settings" || strings.HasPrefix(p, "/conversation/settings/") || p == "/teams" |
| } |
| return in(from.Path) != in(r.URL.Path) |
| } |
| @@ -121,3 +122,29 @@ func movedTo(path string) http.HandlerFunc { |
| http.Redirect(w, r, path, http.StatusSeeOther) |
| } |
| } |
| + |
| +// agoText is a quiet relative time, "4 days ago", for a template. |
| +func agoText(v any) string { |
| + ms := sinceMillis(v) |
| + if ms == 0 { |
| + return "" |
| + } |
| + return ago(time.Now(), time.UnixMilli(ms)) |
| +} |
| + |
| +// hostOf is an instance address as a person reads it: its host, without |
| +// the scheme. |
| +func hostOf(origin string) string { |
| + if u, err := url.Parse(origin); err == nil && u.Host != "" { |
| + return u.Host |
| + } |
| + return origin |
| +} |
| + |
| +// deref is the number behind a known count. |
| +func deref(n *int) int { |
| + if n == nil { |
| + return 0 |
| + } |
| + return *n |
| +} |
diff --git a/internal/equipo/static/connections.js b/internal/equipo/static/connections.js| index 35175f37..bc0f77e7 100644 |
| --- a/internal/equipo/static/connections.js |
| +++ b/internal/equipo/static/connections.js |
| @@ -287,6 +287,25 @@ |
| } |
| var source, failures = 0; |
| live(root); |
| + |
| + // Resets count down ("resets in 22 hours 5 minutes"), so the |
| + // Connections page reads itself again in place each minute while it is |
| + // seen, and once on coming back to it. Not while a menu is open or a |
| + // control in it has focus: a tick never takes them away. |
| + if (!adding) { |
| + var ticked = Date.now(); |
| + var tick = function () { |
| + var box = root.querySelector("[data-connections-live]"); |
| + if (leaving || document.hidden || !box) return; |
| + if (box.querySelector("details[open]") || box.contains(document.activeElement)) return; |
| + ticked = Date.now(); |
| + refresh().catch(function () {}); |
| + }; |
| + setInterval(tick, 60000); |
| + document.addEventListener("visibilitychange", function () { |
| + if (Date.now() - ticked >= 60000) tick(); |
| + }); |
| + } |
| if (!window.EventSource) return; |
| function open() { |
| if (leaving) return; |
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css| index b7b04404..0d2918d0 100644 |
| --- a/internal/equipo/static/equipo.css |
| +++ b/internal/equipo/static/equipo.css |
| @@ -785,9 +785,12 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex |
| [equipo-conn-row] { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--rst-sp-4); align-items: start; padding: var(--rst-sp-4); transition: background .15s; } |
| [equipo-conn-row] + [equipo-conn-row] { border-block-start: 1px solid var(--rst-line); } |
| [equipo-conn-row]:hover { background: var(--rst-tint-hover, var(--rst-surface-2)); } |
| -/* A row that needs the person: a gentle tint and a hairline, never a stripe. */ |
| -[equipo-conn-row][data-needs], [equipo-conn-row][data-state="limited"] { background: color-mix(in srgb, var(--rst-tone-warning-bg) 30%, var(--rst-surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rst-tone-warning-fg) 14%, transparent); } |
| -[equipo-conn-row][data-state="signed_out"] { background: var(--rst-surface-2); box-shadow: inset 0 0 0 1px var(--rst-line); } |
| +/* A row that needs the person: a gentle tint, no border of its own (the |
| + list's separators are the only lines) and never a stripe. A limited |
| + row whose work moved needs nothing from the person: its dot and full |
| + meter say it, untinted. */ |
| +[equipo-conn-row][data-needs] { background: color-mix(in srgb, var(--rst-tone-warning-bg) 30%, var(--rst-surface)); } |
| +[equipo-conn-row][data-state="signed_out"] { background: var(--rst-surface-2); } |
| [equipo-conn-row][data-state="signed_out"] [equipo-pmark], [equipo-conn-row][data-state="sign_in_again"] [equipo-pmark] { filter: saturate(.35); opacity: .75; } |
| /* The row just added, back from the Add page: it arrives, then a soft |
| accent wash fades from it. */ |
| @@ -888,7 +891,29 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex |
| [equipo-conn-code] { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.6rem; font-weight: 600; letter-spacing: .08em; padding: .2rem .7rem; border: 1px solid var(--rst-line); border-radius: var(--rst-radius); background: var(--rst-surface); white-space: nowrap; user-select: all; } |
| [equipo-conn-code][data-command] { font-size: var(--rst-fs-sm); font-weight: 400; letter-spacing: 0; padding: .35rem .7rem; white-space: normal; overflow-wrap: anywhere; } |
| [equipo-conn-once] { flex-basis: 100%; margin: 0; color: var(--rst-text-faint, var(--rst-text-muted)); font-size: var(--rst-fs-xs); } |
| -[equipo-conn-waiting] { display: flex; align-items: center; gap: .1em; margin: var(--rst-sp-4) 0 0; font-size: var(--rst-fs-sm); } |
| +[equipo-conn-waiting] { display: flex; align-items: center; gap: 0; margin: var(--rst-sp-4) 0 0; font-size: var(--rst-fs-sm); } |
| +/* Waiting on the runner (the link coming, finishing the sign-in, |
| + checking a token, an approval): the shared star floats gently while |
| + its motes circle it, going out and coming back, and a soft light |
| + passes along the words. Slower and quieter than the coordinator's |
| + thinking line; the star keeps a clear gap from the words. */ |
| +[equipo-conn-waiting] [equipo-sparkle], [equipo-conn-loading] [equipo-sparkle] { --orbit: .95em; animation: equipo-conn-float 4.8s cubic-bezier(.37, 0, .63, 1) infinite; } |
| +[equipo-conn-waiting] [equipo-sparkle] { margin-inline-end: .95em; } |
| +[equipo-conn-loading] [equipo-sparkle] { --orbit: .8em; } |
| +[equipo-conn-waiting] [equipo-sparkle] [data-mote], [equipo-conn-loading] [equipo-sparkle] [data-mote] { animation: equipo-conn-orbit 4.8s linear calc(-1 * var(--d, 0s)) infinite; } |
| +@keyframes equipo-conn-float { 0%, 100% { transform: translate(0, .07em); } 50% { transform: translate(.04em, -.09em); } } |
| +@keyframes equipo-conn-orbit { |
| + 0% { opacity: .2; transform: rotate(0turn) translateX(calc(.55 * var(--orbit))) scale(.6); } |
| + 50% { opacity: .8; transform: rotate(.5turn) translateX(var(--orbit)) scale(.95); } |
| + 100% { opacity: .2; transform: rotate(1turn) translateX(calc(.55 * var(--orbit))) scale(.6); } |
| +} |
| +[equipo-conn-waiting] [data-words], [equipo-conn-loading] [data-phrase] { --ink: var(--rst-text); background: linear-gradient(100deg, var(--ink) 0 40%, var(--rst-accent) 50%, var(--ink) 60% 100%) 100% 0 / 250% 100% no-repeat; -webkit-background-clip: text; background-clip: text; color: transparent; animation: equipo-conn-shimmer 3.6s cubic-bezier(.37, 0, .63, 1) infinite; } |
| +[equipo-conn-loading] [data-phrase] { --ink: var(--rst-text-muted); } |
| +@keyframes equipo-conn-shimmer { 0% { background-position: 100% 0; } 70%, 100% { background-position: 0 0; } } |
| +@media (prefers-reduced-motion: reduce) { |
| + [equipo-conn-waiting] [equipo-sparkle], [equipo-conn-loading] [equipo-sparkle] { animation: none; } |
| + [equipo-conn-waiting] [data-words], [equipo-conn-loading] [data-phrase] { animation: none; background: none; color: var(--ink); } |
| +} |
| [equipo-conn-small] { margin: var(--rst-sp-3) 0 0; color: var(--rst-text-faint, var(--rst-text-muted)); font-size: var(--rst-fs-xs); } |
| [equipo-conn-card-foot] { display: flex; align-items: center; justify-content: space-between; gap: var(--rst-sp-3); margin-block-start: var(--rst-sp-4); } |
| [equipo-conn-card-foot] [equipo-conn-small] { margin: 0; } |
| @@ -1021,14 +1046,6 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex |
| [equipo-hk-empty] { margin: var(--rst-sp-3) 0; color: var(--rst-text-muted); } |
| @media (pointer: coarse) { [equipo-hk-list] [equipo-link] { min-block-size: 2.75rem; padding-inline: var(--rst-sp-2); } } |
| [equipo-card-line][data-digest] a { font-size: var(--rst-fs-sm); color: var(--rst-text-muted); text-underline-offset: 2px; } |
| -/* Housekeeping in Settings: Pause, then quiet hours on one line. */ |
| -[equipo-hk-settings] form { margin-block: var(--rst-sp-3); } |
| -[equipo-hk-settings] fieldset { border: 0; margin: 0; padding: 0; min-inline-size: 0; } |
| -[equipo-hk-settings] legend { font-weight: 500; padding: 0; } |
| -[equipo-hk-settings] label[equipo-hk-check] { display: flex; flex-direction: row; gap: var(--rst-sp-2); align-items: center; justify-content: flex-start; margin-block: var(--rst-sp-2); } |
| -[equipo-hk-settings] label[equipo-hk-check] input { inline-size: auto; margin: 0; } |
| -[equipo-hk-hours] { display: flex; flex-wrap: wrap; gap: var(--rst-sp-2) var(--rst-sp-4); margin-block-end: var(--rst-sp-3); } |
| -[equipo-hk-hours] label { display: inline-flex; align-items: center; gap: var(--rst-sp-2); } |
| [equipo-hk-to-settings] { margin: var(--rst-sp-1) 0 0; font-size: var(--rst-fs-sm); } |
| [equipo-hk-to-settings] a { color: var(--rst-text-muted); text-underline-offset: 2px; } |
| /* The phone's home screen (Paul, f2602d3: "Vertical alignment of header |
| @@ -1057,10 +1074,6 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex |
| [equipo-setting-row] [equipo-desc] { margin: 0; color: var(--rst-text-muted); font-size: var(--rst-fs-sm); } |
| [equipo-setting-row][data-placeholder] { color: var(--rst-text-muted); } |
| [equipo-settings-section] [equipo-conn-prefer] { margin-block-start: var(--rst-sp-3); } |
| -[equipo-hk-hours] label { white-space: nowrap; flex: none; } |
| -[equipo-hk-hours] select { inline-size: auto; } |
| -[equipo-hk-settings] [equipo-hk-quiet] [equipo-desc] { margin: var(--rst-sp-1) 0 0; font-size: var(--rst-fs-sm); color: var(--rst-text-muted); } |
| -[equipo-hk-settings] [equipo-hk-pause-form] { margin-block: var(--rst-sp-3); } |
| /* ── The composer (Paul, 2026-11-08, after Eleven's): a round + on the |
| left, a pill that grows to about six lines, and inside it on the right |
| @@ -1240,3 +1253,102 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex |
| } |
| /* The Notebook page keeps its columns (a later rule makes the project page's notes a grid). */ |
| [equipo-notebook] [equipo-notes] { display: block; } |
| +/* The Settings pattern (Paul, 2026-11-11: "make sure all the settings |
| + screens have proper UX and aren't just random forms"). One content |
| + width and one heading scale for every section; a section is groups, |
| + each a heading and one line over a card of rows, the label on the |
| + left and the control on the right. */ |
| +[equipo-settings-body] { max-inline-size: 46rem; } |
| +[equipo-sp-head] { margin: 0 0 var(--rst-sp-6); } |
| +[equipo-sp-head] h1 { margin: 0; font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; } |
| +[equipo-sp-head] p { margin: var(--rst-sp-2) 0 0; max-inline-size: 62ch; color: var(--rst-text-muted); line-height: 1.5; } |
| +[equipo-sp-group] { display: block; margin: 0 0 var(--rst-sp-6); padding: 0; border: 0; min-inline-size: 0; } |
| +[equipo-sp-group-head] { margin-block-end: var(--rst-sp-3); } |
| +[equipo-sp-group-head] h2 { display: flex; align-items: center; margin: 0; font-size: var(--rst-fs-base); font-weight: 600; line-height: 1.3; } |
| +[equipo-sp-group-head] p { margin: .2rem 0 0; max-inline-size: 64ch; font-size: var(--rst-fs-sm); color: var(--rst-text-muted); line-height: 1.45; } |
| +[equipo-sp-card] { list-style: none; margin: 0; padding: 0; overflow: clip; border: 1px solid var(--rst-line); border-radius: calc(2 * var(--rst-radius)); background: var(--rst-surface); } |
| +[equipo-sp-row] { position: relative; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--rst-sp-2) var(--rst-sp-4); min-block-size: 3.5rem; margin: 0; padding: var(--rst-sp-3) var(--rst-sp-4); border: 0; min-inline-size: 0; } |
| +[equipo-sp-row][hidden] { display: none; } |
| +/* A line between rows: above every shown row after the first shown. */ |
| +[equipo-sp-card] > [equipo-sp-row]:not([hidden]) ~ [equipo-sp-row] { border-block-start: 1px solid var(--rst-line); } |
| +[equipo-sp-label] { display: grid; gap: .15rem; min-inline-size: 0; margin: 0; } |
| +label[equipo-sp-label] { cursor: pointer; } |
| +[equipo-sp-title] { display: flex; align-items: center; gap: var(--rst-sp-2); margin: 0; font-weight: 500; } |
| +[equipo-sp-desc] { margin: 0; font-size: var(--rst-fs-sm); color: var(--rst-text-muted); } |
| +[equipo-sp-desc] a { color: inherit; text-underline-offset: 2px; } |
| +[equipo-sp-desc] a:hover { color: var(--rst-text); } |
| +[equipo-sp-control] { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--rst-sp-2) var(--rst-sp-3); margin: 0; } |
| +/* The state dot is Connections' own: filled with a halo when on, a |
| + hollow ring when paused. */ |
| +[equipo-sp-dot] { flex: none; inline-size: .5rem; block-size: .5rem; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--rst-line-strong, var(--rst-text-muted)); } |
| +[equipo-sp-dot][data-active] { background: var(--rst-tone-positive-fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rst-tone-positive-fg) 18%, transparent); } |
| +[equipo-sp-row]:disabled [equipo-sp-title] { color: var(--rst-text-faint); } |
| +[equipo-sp-empty] { margin: 0; padding: var(--rst-sp-4); border: 1px solid var(--rst-line); border-radius: calc(2 * var(--rst-radius)); background: var(--rst-surface); color: var(--rst-text-muted); font-size: var(--rst-fs-sm); } |
| +[equipo-sp-group-head] [equipo-saved-tick] { font-weight: 500; } |
| +/* Quiet hours: From and Until side by side, off with the switch. */ |
| +[equipo-hk-hours] label { display: inline-flex; align-items: center; gap: var(--rst-sp-2); white-space: nowrap; font-size: var(--rst-fs-sm); color: var(--rst-text-muted); } |
| +[equipo-hk-hours] select { inline-size: auto; } |
| +[equipo-hk-hours] select:disabled { opacity: .55; cursor: not-allowed; } |
| +@media (max-width: 559.98px) { |
| + [equipo-sp-row]:has([equipo-hk-hours]) { grid-template-columns: minmax(0, 1fr); } |
| + [equipo-sp-row] [equipo-hk-hours] { justify-content: flex-start; } |
| +} |
| +/* Thinking words: the preview, then the sets as one group. */ |
| +[equipo-thinking-words] [equipo-thinking-preview] { margin-block-end: var(--rst-sp-6); } |
| +[equipo-thinking-words] [equipo-thinking-form] fieldset { margin: 0; } |
| +/* The savebar: fixed to the foot of the screen under the content |
| + column, Save on the right where the content ends; on a phone the |
| + whole width, above the safe area. */ |
| +[equipo-settings-body]:has([equipo-savebar]) { padding-block-end: 5rem; } |
| +[equipo-savebar] { container-type: inline-size; position: fixed; z-index: 30; inset-inline: 0; inset-block-end: 0; padding-block-end: env(safe-area-inset-bottom, 0px); background: color-mix(in srgb, var(--rst-surface) 94%, transparent); backdrop-filter: blur(10px); border-block-start: 1px solid var(--rst-line); box-shadow: 0 -8px 20px -16px rgb(0 0 0 / .35); } |
| +[equipo-savebar-in] { box-sizing: border-box; display: flex; align-items: center; gap: var(--rst-sp-3); max-inline-size: 64rem; margin-inline: auto; padding: var(--rst-sp-3) var(--rst-sp-4); } |
| +[equipo-savebar-in] > :first-child { flex: 1; } |
| +@media (min-width: 800px) { |
| + [equipo-savebar] { inset-inline-start: 17rem; } |
| + /* The bar's content is the section's own width, so Save sits under |
| + the right edge of the cards. */ |
| + [equipo-savebar-in] { padding-inline-end: calc(var(--rst-sp-4) + max(0px, min(64rem, 100cqi) - 2 * var(--rst-sp-4) - 46rem)); } |
| +} |
| +[equipo-savebar-note] { display: flex; align-items: center; gap: .3rem; margin: 0; min-inline-size: 0; font-size: var(--rst-fs-sm); color: var(--rst-text-muted); } |
| +[equipo-savebar-note] [data-savebar-saved] { display: inline-flex; align-items: center; gap: .3rem; color: var(--rst-tone-positive-fg); font-weight: 500; } |
| +[equipo-savebar-note] [hidden] { display: none; } |
| +[equipo-savebar-note] .icon { inline-size: 1em; block-size: 1em; margin: 0; } |
| +[equipo-savebar] [rst-btn][hidden] { display: none; } |
| +[equipo-savebar] [rst-btn]:disabled { cursor: default; } |
| +@media (pointer: coarse) { [equipo-savebar] [rst-btn] { min-block-size: 2.75rem; } } |
| +/* Teams: the current team as a header row, the remembered ones as a |
| + list whose rows open the team, Forget a quiet action with Undo, and |
| + Add a team behind its button. */ |
| +[equipo-team-row] { grid-template-columns: auto minmax(0, 1fr) auto; } |
| +[equipo-team-mark] { display: inline-grid; place-items: center; inline-size: 2rem; block-size: 2rem; border-radius: var(--rst-radius); background: var(--rst-surface-2); color: var(--rst-text-muted); } |
| +[equipo-team-mark] .icon { margin: 0; } |
| +[equipo-team-row] [equipo-row-link] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
| +[equipo-team-row]:has([equipo-row-link]):hover { background: var(--rst-tint-hover); } |
| +[equipo-team-row]:has([equipo-row-link]:focus-visible) { box-shadow: inset 0 0 0 2px var(--rst-focus-edge); } |
| +[equipo-team-facts] { display: flex; flex-wrap: wrap; gap: 0 var(--rst-sp-2); } |
| +[equipo-team-facts] > * + *::before { content: "·"; margin-inline-end: var(--rst-sp-2); color: var(--rst-text-faint); } |
| +[equipo-team-facts] time { position: relative; z-index: 1; cursor: help; } |
| +[equipo-team-needs] { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem; border-radius: var(--rst-radius-pill); background: var(--rst-accent-soft); color: var(--rst-text); font-size: var(--rst-fs-sm); text-decoration: none; } |
| +[equipo-team-needs] b { font-variant-numeric: tabular-nums; } |
| +[equipo-team-forget] { font-size: var(--rst-fs-sm); } |
| +@media (hover: hover) { |
| + [equipo-team-row] [equipo-team-forget] { opacity: .7; } |
| + [equipo-team-row]:hover [equipo-team-forget], [equipo-team-forget]:focus-visible { opacity: 1; } |
| +} |
| +[equipo-team-gone] { grid-template-columns: minmax(0, 1fr) auto; background: var(--rst-surface-2); } |
| +[equipo-team-gone] [equipo-sp-label] { font-size: var(--rst-fs-sm); color: var(--rst-text-muted); } |
| +[equipo-team-add] { margin-block-start: var(--rst-sp-3); } |
| +[equipo-team-add] > summary { list-style: none; display: inline-flex; align-items: center; cursor: pointer; } |
| +[equipo-team-add] > summary::-webkit-details-marker { display: none; } |
| +[equipo-team-add] > summary .icon { margin-inline-end: var(--rst-sp-1); } |
| +[equipo-team-add-form] { display: grid; gap: var(--rst-sp-4); margin-block-start: var(--rst-sp-3); padding: var(--rst-sp-4); border: 1px solid var(--rst-line); border-radius: calc(2 * var(--rst-radius)); background: var(--rst-surface); } |
| +[equipo-team-field] { display: grid; gap: var(--rst-sp-1); min-inline-size: 0; font-size: var(--rst-fs-sm); font-weight: 500; } |
| +[equipo-team-field] input { box-sizing: border-box; } |
| +[equipo-team-field][data-field="address"] input { inline-size: min(100%, 26rem); } |
| +[equipo-team-field][data-field="name"] input { inline-size: min(100%, 18rem); } |
| +[equipo-team-add-form] [equipo-sp-desc] { max-inline-size: 60ch; } |
| +[equipo-team-add-actions] { margin: 0; } |
| +@media (max-width: 559.98px) { |
| + [equipo-team-facts] { flex-direction: column; } |
| + [equipo-team-facts] > * + *::before { content: none; } |
| +} |
diff --git a/internal/equipo/static/settings.js b/internal/equipo/static/settings.js| index 906e77ea..067ecf08 100644 |
| --- a/internal/equipo/static/settings.js |
| +++ b/internal/equipo/static/settings.js |
| @@ -1,27 +1,40 @@ |
| // Settings save in the background (Paul: choosing an option made the |
| // sliding nav play again, because each change posted and came back to |
| -// the page). A change posts with fetch, the page is read again, and only |
| -// what changed is put back in place (the Prefer control, the Housekeeping |
| -// section, a form's revision), with a quiet "Saved" tick by the section's |
| -// heading. No navigation, no reload. Without script the forms post as |
| -// before. |
| +// the page). Two kinds of control, never mixed in one group (Paul, |
| +// 2026-11-11): |
| +// |
| +// - At once (Pause, Prefer, a word set, Reset): the form posts with |
| +// fetch, the page is read again, only what changed is put back in |
| +// place, and a quiet "Saved" tick shows by the group's heading. |
| +// - Editable fields ([data-savebar-form]): Save in the bar at the foot |
| +// of the screen is off until something changes; then "Unsaved changes" |
| +// and Discard show beside it, and leaving the page asks first. Save |
| +// posts in the background and says "Saved" in the bar. |
| +// |
| +// No navigation, no reload. Without script every form posts as before. |
| (function () { |
| "use strict"; |
| var root = document.querySelector("[data-settings-live]"); |
| - if (!root || !window.fetch) return; |
| - var swaps = ["[equipo-conn-prefer]", "[data-hk-settings]", "[equipo-notebook]"]; |
| + if (!root || !window.fetch || !window.URLSearchParams) return; |
| + var swaps = ["[equipo-conn-prefer]", "[data-hk-status]", "[equipo-notebook]"]; |
| var template = document.querySelector("template[equipo-saved-template]"); |
| - root.addEventListener("submit", function (event) { |
| - var form = event.target; |
| - if (!form.matches("form[method=post]")) return; |
| - event.preventDefault(); |
| - save(form, event.submitter); |
| - }); |
| - function save(form, submitter) { |
| - var body = new URLSearchParams(new FormData(form, submitter || undefined)); |
| - var section = form.closest("[equipo-settings-section]") || root; |
| - section.setAttribute("aria-busy", "true"); |
| - fetch(form.action, { method: "POST", credentials: "same-origin", headers: { "Accept": "application/json" }, body: body }) |
| + var leaving = false; |
| + |
| + // body is a form's fields, the ones a switch has turned off included: |
| + // the server reads the hours whether or not quiet hours are on. |
| + function body(form, submitter) { |
| + var data = new FormData(form, submitter || undefined); |
| + for (var i = 0; i < form.elements.length; i++) { |
| + var el = form.elements[i]; |
| + if (!el.name || !el.matches(":disabled") || el.type === "submit" || el.type === "button" || el.type === "reset") continue; |
| + if ((el.type === "checkbox" || el.type === "radio") && !el.checked) continue; |
| + data.append(el.name, el.value); |
| + } |
| + return new URLSearchParams(data); |
| + } |
| + |
| + function post(form, submitter) { |
| + return fetch(form.action, { method: "POST", credentials: "same-origin", headers: { "Accept": "application/json" }, body: body(form, submitter) }) |
| .then(function (r) { |
| if (!r.ok) throw new Error("save"); |
| return fetch(location.pathname + location.search, { credentials: "same-origin", headers: { "Accept": "text/html" } }); |
| @@ -30,35 +43,71 @@ |
| if (!r.ok) throw new Error("read"); |
| return r.text(); |
| }) |
| - .then(function (html) { |
| - refresh(form, new DOMParser().parseFromString(html, "text/html")); |
| - section.removeAttribute("aria-busy"); |
| - // The section itself may have been put back (the notebook). |
| - tick((section.id && document.getElementById(section.id)) || section); |
| + .then(function (html) { return new DOMParser().parseFromString(html, "text/html"); }); |
| + } |
| + |
| + // fallback is the server's own answer, as without script. |
| + function fallback(form) { |
| + leaving = true; |
| + HTMLFormElement.prototype.submit.call(form); |
| + } |
| + |
| + root.addEventListener("submit", function (event) { |
| + var form = event.target; |
| + if (!form.matches("form[method=post]")) return; |
| + event.preventDefault(); |
| + if (form.matches("[data-savebar-form]")) save(form); |
| + else apply(form, event.submitter); |
| + }); |
| + |
| + // apply is a control that takes effect at once. |
| + function apply(form, submitter) { |
| + var group = form.closest("[equipo-sp-group]") || form.closest("[equipo-settings-section]") || root; |
| + var id = group.id; |
| + group.setAttribute("aria-busy", "true"); |
| + post(form, submitter) |
| + .then(function (doc) { |
| + refresh(form, doc); |
| + group.removeAttribute("aria-busy"); |
| + // The group itself may have been put back (Status, the notebook). |
| + var now = (id && document.getElementById(id)) || group; |
| + now.removeAttribute("aria-busy"); |
| + tick(now); |
| }) |
| .catch(function () { |
| - // The server's own answer, as without script. |
| - section.removeAttribute("aria-busy"); |
| - HTMLFormElement.prototype.submit.call(form); |
| + group.removeAttribute("aria-busy"); |
| + fallback(form); |
| }); |
| } |
| - // refresh puts back the part of the page the change touched. |
| + |
| + // refresh puts back the part of the page the change touched, and moves |
| + // every form's revision on, so a form with unsaved changes keeps them |
| + // and still saves over the new record. |
| function refresh(form, doc) { |
| for (var i = 0; i < swaps.length; i++) { |
| var mine = form.closest(swaps[i]), fresh = doc.querySelector(swaps[i]); |
| if (mine && fresh) { |
| mine.replaceWith(document.importNode(fresh, true)); |
| - return; |
| + break; |
| } |
| } |
| - // A form that stays (Thinking words): its revision moves on. |
| - var next = doc.querySelector('form[action="' + form.getAttribute("action") + '"] input[name=revision]'); |
| - var mine = form.querySelector("input[name=revision]"); |
| - if (next && mine) mine.value = next.value; |
| + revisions(doc); |
| + } |
| + |
| + function revisions(doc) { |
| + var seen = {}; |
| + root.querySelectorAll("form[method=post]").forEach(function (f) { |
| + var action = f.getAttribute("action"), n = seen[action] || 0; |
| + seen[action] = n + 1; |
| + var next = doc.querySelectorAll('form[action="' + action + '"]')[n]; |
| + var a = f.querySelector("input[name=revision]"), b = next && next.querySelector("input[name=revision]"); |
| + if (a && b) a.value = a.defaultValue = b.value; |
| + }); |
| } |
| - function tick(section) { |
| + |
| + function tick(group) { |
| if (!template) return; |
| - var head = section.querySelector("h2, h1") || section; |
| + var head = group.querySelector("h2, h1") || group; |
| var t = head.querySelector("[equipo-saved-tick]"); |
| if (!t) { |
| t = template.content.firstElementChild.cloneNode(true); |
| @@ -69,4 +118,202 @@ |
| clearTimeout(t.timer); |
| t.timer = setTimeout(function () { t.setAttribute("data-gone", ""); }, 2400); |
| } |
| + |
| + // A switch that turns other fields on and off: data-enables names the |
| + // fieldset it governs. |
| + function enables(form) { |
| + form.querySelectorAll("[data-enables]").forEach(function (sw) { |
| + var target = document.getElementById(sw.dataset.enables); |
| + if (target) target.disabled = !sw.checked; |
| + }); |
| + } |
| + |
| + // The savebar forms. |
| + var bars = []; |
| + root.querySelectorAll("[data-savebar-form]").forEach(function (form) { |
| + var bar = { |
| + form: form, |
| + save: form.querySelector("[data-savebar-save]"), |
| + discard: form.querySelector("[data-savebar-discard]"), |
| + unsaved: form.querySelector("[data-savebar-unsaved]"), |
| + saved: form.querySelector("[data-savebar-saved]"), |
| + busy: false, |
| + timer: 0 |
| + }; |
| + form._bar = bar; |
| + bar.base = state(form); |
| + bars.push(bar); |
| + enables(form); |
| + show(bar); |
| + form.addEventListener("input", function () { changed(bar); }); |
| + form.addEventListener("change", function (e) { |
| + if (e.target.matches("[data-enables]")) enables(form); |
| + changed(bar); |
| + }); |
| + // Discard is the form's reset: back to what was last saved. |
| + form.addEventListener("reset", function () { |
| + setTimeout(function () { |
| + enables(form); |
| + changed(bar); |
| + }); |
| + }); |
| + }); |
| + |
| + // state is what a person can change in the form, for "has it changed". |
| + function state(form) { |
| + var out = []; |
| + for (var i = 0; i < form.elements.length; i++) { |
| + var el = form.elements[i]; |
| + if (!el.name || el.type === "hidden" || el.type === "submit" || el.type === "button" || el.type === "reset") continue; |
| + out.push(el.name + "=" + ((el.type === "checkbox" || el.type === "radio") ? el.checked : el.value)); |
| + } |
| + return out.join("&"); |
| + } |
| + |
| + function dirty(bar) { return state(bar.form) !== bar.base; } |
| + |
| + function changed(bar) { |
| + if (dirty(bar)) { |
| + clearTimeout(bar.timer); |
| + bar.saved.hidden = true; |
| + } |
| + show(bar); |
| + } |
| + |
| + function show(bar) { |
| + var d = dirty(bar); |
| + bar.save.disabled = !d || bar.busy; |
| + bar.discard.hidden = !d || bar.busy; |
| + bar.unsaved.hidden = !d; |
| + bar.form.toggleAttribute("data-dirty", d); |
| + } |
| + |
| + function save(form) { |
| + var bar = form._bar; |
| + if (!bar || bar.busy || !dirty(bar)) return; |
| + bar.busy = true; |
| + bar.save.setAttribute("aria-busy", "true"); |
| + show(bar); |
| + post(form) |
| + .then(function (doc) { |
| + revisions(doc); |
| + // What was saved is now what Discard goes back to. |
| + for (var i = 0; i < form.elements.length; i++) { |
| + var el = form.elements[i]; |
| + if (el.type === "checkbox" || el.type === "radio") el.defaultChecked = el.checked; |
| + else if (el.tagName === "SELECT") for (var j = 0; j < el.options.length; j++) el.options[j].defaultSelected = el.options[j].selected; |
| + else if (el.type !== "hidden") el.defaultValue = el.value; |
| + } |
| + bar.base = state(form); |
| + bar.busy = false; |
| + bar.save.removeAttribute("aria-busy"); |
| + show(bar); |
| + bar.saved.hidden = false; |
| + clearTimeout(bar.timer); |
| + bar.timer = setTimeout(function () { bar.saved.hidden = true; }, 2400); |
| + tick(form); |
| + }) |
| + .catch(function () { |
| + bar.busy = false; |
| + bar.save.removeAttribute("aria-busy"); |
| + fallback(form); |
| + }); |
| + } |
| + |
| + // Leaving with unsaved changes asks first. |
| + window.addEventListener("beforeunload", function (e) { |
| + if (leaving) return; |
| + for (var i = 0; i < bars.length; i++) { |
| + if (dirty(bars[i])) { |
| + e.preventDefault(); |
| + e.returnValue = ""; |
| + return; |
| + } |
| + } |
| + }); |
| +})(); |
| + |
| +// Teams (Paul, 2026-11-11): Forget is a quiet action with Undo. The row |
| +// goes at once with "Studio forgotten. Undo" in its place; the link is |
| +// forgotten a few seconds later, or as the page is left. Undo before |
| +// then keeps it, last sign-in and all. Without script Forget posts. |
| +(function () { |
| + "use strict"; |
| + var list = document.querySelector("[data-team-list]"); |
| + var undo = document.querySelector("template[data-team-undo-template]"); |
| + if (!list || !undo || !window.fetch || !window.URLSearchParams) return; |
| + var WAIT = 6000; |
| + var pending = []; |
| + |
| + list.addEventListener("submit", function (e) { |
| + var form = e.target; |
| + if (!form.matches("[data-team-forget-form]")) return; |
| + e.preventDefault(); |
| + var row = form.closest("[data-team-row]"); |
| + row.insertAdjacentHTML("afterend", undo.innerHTML); |
| + var note = row.nextElementSibling; |
| + note.querySelector("[data-team-gone-text]").textContent = (list.dataset.forgotten || "%s").replace("%s", row.dataset.teamName || ""); |
| + row.hidden = true; |
| + var p = { row: row, form: form, note: note }; |
| + p.timer = setTimeout(function () { commit(p); }, WAIT); |
| + pending.push(p); |
| + var button = note.querySelector("[data-team-undo]"); |
| + button.addEventListener("click", function () { |
| + clearTimeout(p.timer); |
| + pending.splice(pending.indexOf(p), 1); |
| + note.remove(); |
| + row.hidden = false; |
| + var link = row.querySelector("a"); |
| + if (link) link.focus(); |
| + }); |
| + button.focus(); |
| + }); |
| + |
| + function commit(p) { |
| + var at = pending.indexOf(p); |
| + if (at < 0) return; |
| + pending.splice(at, 1); |
| + fetch(p.form.action, { method: "POST", credentials: "same-origin", keepalive: true, headers: { "Accept": "application/json" }, body: new URLSearchParams(new FormData(p.form)) }) |
| + .then(function (r) { |
| + if (!r.ok) throw new Error("forget"); |
| + p.note.remove(); |
| + p.row.remove(); |
| + // The last one gone: say there are none, as the page would. |
| + if (!list.querySelector("[data-team-row], [data-team-forgotten]")) { |
| + var none = document.createElement("p"); |
| + none.setAttribute("equipo-sp-empty", ""); |
| + none.setAttribute("data-empty-state", "teams.none"); |
| + none.textContent = list.dataset.none || ""; |
| + list.replaceWith(none); |
| + } |
| + }) |
| + .catch(function () { HTMLFormElement.prototype.submit.call(p.form); }); |
| + } |
| + |
| + // Leaving the page forgets what is waiting: Undo is no longer there. |
| + window.addEventListener("pagehide", function () { |
| + pending.slice().forEach(function (p) { |
| + clearTimeout(p.timer); |
| + commit(p); |
| + }); |
| + }); |
| +})(); |
| + |
| +// Add a team: the name from the address where it says one ("studio" in |
| +// studio.example.com), until the person types their own. |
| +(function () { |
| + "use strict"; |
| + var origin = document.querySelector("[data-team-origin]"); |
| + var name = document.querySelector("[data-team-add] [data-team-name]"); |
| + if (!origin || !name) return; |
| + var guessed = ""; |
| + origin.addEventListener("change", function () { |
| + if (name.value && name.value !== guessed) return; |
| + var host = ""; |
| + try { host = new URL(origin.value).hostname; } catch (e) { return; } |
| + var parts = host.split(".").filter(function (p) { return p && !/^(www|app|equipo)$/i.test(p); }); |
| + if (parts.length < 2 || /^\d+$/.test(parts[0])) return; |
| + guessed = parts[0].charAt(0).toUpperCase() + parts[0].slice(1); |
| + name.value = guessed; |
| + }); |
| })(); |
diff --git a/internal/equipo/team_links.go b/internal/equipo/team_links.go| index 72f68c69..e4d0a1f2 100644 |
| --- a/internal/equipo/team_links.go |
| +++ b/internal/equipo/team_links.go |
| @@ -12,7 +12,9 @@ func (a *application) teamLinkHandler() *setup.TeamLinkHandler { |
| return &setup.TeamLinkHandler{Store: a.store, Invalid: ErrInvalid, Failure: a.failure, |
| Actor: library.SessionActor(ErrForbidden), |
| Render: func(w http.ResponseWriter, r *http.Request, v setup.TeamLinkView) { |
| - data, err := a.page(r, "teams") |
| + // Teams is a Settings section (Paul, 2026-11-11): the |
| + // Settings nav beside it, the same width and headings. |
| + data, err := a.settingsPage(r, "teams", false) |
| if err != nil { |
| a.failure(w, r, err) |
| return |
diff --git a/internal/equipo/templates/housekeeping_settings.html b/internal/equipo/templates/housekeeping_settings.html| index b56cd67e..5291e0d7 100644 |
| --- a/internal/equipo/templates/housekeeping_settings.html |
| +++ b/internal/equipo/templates/housekeeping_settings.html |
| @@ -1,10 +1,24 @@ |
| -{{define "housekeeping-settings"}}<div equipo-hk-settings data-hk-settings{{if .Paused}} data-paused{{end}}> |
| -<ol equipo-rows><li equipo-row equipo-setting-row><span equipo-mono data-size="s" aria-hidden="true">{{icon "list-checks"}}</span><div equipo-row-body><p equipo-row-title><a equipo-row-link href="/housekeeping" data-hk-activity>{{copy "housekeeping.settings.activity"}}</a></p><p equipo-desc>{{copy "housekeeping.settings.lede"}}</p></div></li></ol> |
| -<form method="post" action="/settings/housekeeping/pause" equipo-hk-pause-form><input type="hidden" name="revision" value="{{.Revision}}">{{if .Paused}}<p equipo-hk-paused role="status">{{copy "housekeeping.paused"}}</p><input type="hidden" name="paused" value="0"><button rst-btn type="submit" data-hk-resume>{{copy "housekeeping.resume"}}</button>{{else}}<input type="hidden" name="paused" value="1"><button rst-btn type="submit" data-hk-pause>{{copy "housekeeping.pause"}}</button>{{end}}</form> |
| -<form method="post" action="/settings/housekeeping/quiet" equipo-form equipo-hk-quiet data-hk-quiet><input type="hidden" name="revision" value="{{.Revision}}"> |
| -<fieldset><legend>{{copy "housekeeping.settings.quiet"}}</legend><p equipo-desc>{{copy "housekeeping.settings.quiet_hint"}}</p> |
| -<label equipo-hk-check><input type="checkbox" name="on" value="1"{{if .QuietOn}} checked{{end}} data-hk-quiet-on>{{copy "housekeeping.settings.quiet_on"}}</label> |
| -<span equipo-hk-hours><label>{{copy "housekeeping.settings.from"}}<select rst-input name="from" data-hk-quiet-from>{{$f := .From}}{{range .Hours}}<option value="{{.Value}}"{{if eq .Value $f}} selected{{end}}>{{.Label}}</option>{{end}}</select></label> |
| +{{/* Settings' Housekeeping: two groups of the Settings pattern |
| + (settings_nav.html). Status applies at once: the state in words and |
| + Pause or Resume beside it. Quiet hours are editable fields saved from |
| + the savebar; the hours are off while the switch is (settings.js). */}} |
| +{{define "housekeeping-settings"}}<div equipo-hk-settings data-hk-settings> |
| +{{template "hk-status" .}} |
| +<form method="post" action="/settings/housekeeping/quiet" equipo-sp-group id="hk-quiet" aria-labelledby="hk-quiet-h" data-hk-quiet data-savebar-form><input type="hidden" name="revision" value="{{.Revision}}"> |
| +<div equipo-sp-group-head><h2 id="hk-quiet-h">{{copy "housekeeping.settings.quiet"}}</h2><p>{{copy "housekeeping.settings.quiet_hint"}}</p></div> |
| +<div equipo-sp-card> |
| +<div equipo-sp-row><label equipo-sp-label for="hk-quiet-on"><span equipo-sp-title>{{copy "housekeeping.settings.quiet_on"}}</span></label><span equipo-sp-control><label rst-switch><input type="checkbox" id="hk-quiet-on" name="on" value="1"{{if .QuietOn}} checked{{end}} data-hk-quiet-on data-enables="hk-hours"><span rst-switch-track aria-hidden="true"></span><span equipo-visually-hidden>{{copy "housekeeping.settings.quiet_on"}}</span></label></span></div> |
| +<fieldset equipo-sp-row id="hk-hours" aria-labelledby="hk-hours-h" data-hk-hours><span equipo-sp-label><span equipo-sp-title id="hk-hours-h">{{copy "housekeeping.settings.hours"}}</span></span> |
| +<span equipo-sp-control equipo-hk-hours><label>{{copy "housekeeping.settings.from"}}<select rst-input name="from" data-hk-quiet-from>{{$f := .From}}{{range .Hours}}<option value="{{.Value}}"{{if eq .Value $f}} selected{{end}}>{{.Label}}</option>{{end}}</select></label> |
| <label>{{copy "housekeeping.settings.until"}}<select rst-input name="until" data-hk-quiet-until>{{$u := .Until}}{{range .Hours}}<option value="{{.Value}}"{{if eq .Value $u}} selected{{end}}>{{.Label}}</option>{{end}}</select></label></span></fieldset> |
| -<button rst-btn="primary" type="submit" data-hk-quiet-save>{{copy "form.save"}}</button></form> |
| +</div> |
| +{{template "savebar"}} |
| +</form> |
| </div>{{end}} |
| +{{define "hk-status"}}<section equipo-sp-group id="hk-status" aria-labelledby="hk-status-h" data-hk-status{{if .Paused}} data-paused{{end}}> |
| +<div equipo-sp-group-head><h2 id="hk-status-h">{{copy "housekeeping.settings.status"}}</h2><p>{{copy "housekeeping.settings.status_hint"}}</p></div> |
| +<div equipo-sp-card><div equipo-sp-row> |
| +<div equipo-sp-label><p equipo-sp-title><span equipo-sp-dot{{if not .Paused}} data-active{{end}} aria-hidden="true"></span>{{if .Paused}}{{copy "housekeeping.settings.off"}}{{else}}{{copy "housekeeping.settings.on"}}{{end}}</p><p equipo-sp-desc>{{if .Paused}}{{copy "housekeeping.settings.off_desc"}} {{end}}<a href="/housekeeping" data-hk-activity>{{copy "housekeeping.settings.activity"}}</a></p></div> |
| +<form method="post" action="/settings/housekeeping/pause" equipo-sp-control><input type="hidden" name="revision" value="{{.Revision}}">{{if .Paused}}<input type="hidden" name="paused" value="0"><button rst-btn type="submit" data-hk-resume>{{copy "housekeeping.resume"}}</button>{{else}}<input type="hidden" name="paused" value="1"><button rst-btn type="submit" data-hk-pause>{{copy "housekeeping.pause"}}</button>{{end}}</form> |
| +</div></div> |
| +</section>{{end}} |
diff --git a/internal/equipo/templates/models.html b/internal/equipo/templates/models.html| index 36cda1a5..a7773ea6 100644 |
| --- a/internal/equipo/templates/models.html |
| +++ b/internal/equipo/templates/models.html |
| @@ -7,7 +7,7 @@ |
| {{define "conn-copy-link"}}<button type="button" rst-btn data-copy="{{.}}" data-copy-link data-copied="{{copy "chat.connections.copied"}}">{{copy "chat.connections.copy_link"}}</button>{{end}} |
| {{define "conn-sign-in-instead"}}<form method="post" action="/conversation/connections" data-add-form equipo-inline-form><input type="hidden" name="provider" value="claude"><input type="hidden" name="kind" value="subscription"><button equipo-link type="submit" data-sign-in-instead>{{copy "chat.connections.sign_in_instead"}}</button></form>{{end}} |
| {{define "conn-paste-instead"}}<form method="post" action="/conversation/connections" data-add-form equipo-inline-form><input type="hidden" name="provider" value="claude"><input type="hidden" name="kind" value="token"><button equipo-link type="submit" data-paste-instead>{{copy "chat.connections.paste_token_instead"}}</button></form>{{end}} |
| -{{define "conn-waiting"}}<p equipo-conn-waiting aria-live="polite">{{template "conn-star"}}<span>{{.}}</span></p>{{end}} |
| +{{define "conn-waiting"}}<p equipo-conn-waiting aria-live="polite">{{template "conn-star"}}<span data-words>{{.}}</span></p>{{end}} |
| {{define "conn-cancel"}}<form method="post" action="/conversation/connections/{{.}}/cancel" equipo-inline-form><button rst-btn data-quiet type="submit" data-connection-cancel>{{copy "chat.connections.cancel"}}</button></form>{{end}} |
| {{define "conn-attempt"}}<div equipo-conn-card data-connection="{{.ID}}" data-connecting data-provider="{{.Provider}}"{{if eq .Kind "token"}} data-kind="token" data-runner="{{.RunnerID}}" data-endpoint="{{.Endpoint}}"{{with .SealKey}} data-seal-key="{{.}}"{{end}}{{else if .SignIn}} data-kind="sign_in" data-runner="{{.RunnerID}}" data-endpoint="{{.Endpoint}}" data-attempt="{{.Prompt.Attempt}}"{{with .SealKey}} data-seal-key="{{.}}"{{end}}{{end}}> |
| <div equipo-conn-card-head>{{template "conn-mark" .Provider}}<div><h3>{{if eq .Provider "codex"}}{{copy "chat.connections.title_codex"}}{{else}}{{copy "chat.connections.title_claude"}}{{end}}</h3><p>{{if eq .Kind "token"}}{{copy "chat.connections.token_sub"}}{{else if .Phrases}}{{copy "chat.connections.loading_sub"}}{{else if eq .Provider "codex"}}{{copy "chat.connections.codex_sub"}}{{else}}{{copy "chat.connections.claude_sub"}}{{end}}</p></div></div> |
| @@ -59,7 +59,7 @@ |
| {{template "conn-mark" .Provider}} |
| <div equipo-conn-body> |
| <p equipo-conn-head><span equipo-conn-name>{{.Name}}</span><span equipo-conn-account>{{.Label}}{{with .Plan}}, {{.}}{{end}}</span>{{if .Preferred}}<span equipo-conn-pref>{{icon "star"}}{{copy "chat.connections.preferred"}}</span>{{end}}</p> |
| -<p equipo-conn-facts><span equipo-conn-state data-connection-state data-s="{{.State}}">{{.Words}}</span>{{with .Expires}}<span equipo-conn-expires data-token-expires>{{.}}</span>{{end}}{{range .Meters}}<span equipo-conn-meter data-level="{{.Level}}"><span equipo-conn-bar><i data-w="{{.Used}}"></i></span><span>{{.Name}} <b>{{.Used}}%</b>{{with .Resets}}, {{.}}{{end}}</span></span>{{end}}</p> |
| +<p equipo-conn-facts><span equipo-conn-state data-connection-state data-s="{{.State}}"{{with .WordsAt}} title="{{.}}"{{end}}>{{.Words}}</span>{{with .Expires}}<span equipo-conn-expires data-token-expires>{{.}}</span>{{end}}{{range .Meters}}<span equipo-conn-meter data-level="{{.Level}}"{{with .At}} title="{{.}}"{{end}}><span equipo-conn-bar><i data-w="{{.Used}}"></i></span><span>{{.Name}} <b>{{.Used}}%</b>{{with .Resets}}, {{.}}{{end}}</span></span>{{end}}</p> |
| {{if .Renew}}<div equipo-conn-renew data-token-renew>{{copy "chat.connections.token_renew"}} <form method="post" action="/conversation/connections" data-add-form equipo-inline-form><input type="hidden" name="provider" value="{{.Provider}}"><button equipo-link type="submit" data-renew>{{copy "chat.connections.sign_in_again_action"}}</button></form></div>{{end}} |
| {{if .Roles}}<p equipo-conn-roles><span equipo-conn-roles-label>{{copy "chat.connections.serving"}}</span>{{range .Roles}}<span equipo-conn-chip{{if .Live}} data-live{{end}}>{{if .Live}}{{template "conn-star"}}{{end}}{{.Name}}</span>{{end}}</p>{{else}}{{with .RolesNote}}<p equipo-conn-roles><span equipo-conn-roles-note>{{.}}</span></p>{{end}}{{end}} |
| </div> |
| @@ -74,14 +74,14 @@ |
| <template equipo-saved-template><span equipo-saved-tick role="status">{{icon "check"}}<span>{{copy "settings.saved"}}</span></span></template> |
| {{template "settings-nav" .}} |
| <section equipo-settings-body equipo-connections data-connections{{if .Models.Adding}} data-adding{{end}} data-cursor="{{.Models.Cursor}}" data-connected="{{copy "chat.connections.connected_big"}}" data-connected-next="{{copy "chat.connections.connected_next"}}"> |
| -{{if .Models.Adding}}<header equipo-conn-page-head><h1>{{copy "chat.connections.add"}}</h1><p>{{copy "chat.connections.chooser_lede"}}</p></header> |
| -{{else}}<header equipo-conn-page-head><h1>{{copy "chat.connections.title"}}</h1>{{if .Models.Rows}}<p>{{copy "chat.connections.lede"}}</p>{{end}}</header>{{end}} |
| +{{if .Models.Adding}}{{template "settings-head" (dict "Title" "chat.connections.add" "Lede" "chat.connections.chooser_lede")}} |
| +{{else}}{{template "settings-head" (dict "Title" "chat.connections.title" "Lede" (and .Models.Rows "chat.connections.lede"))}}{{end}} |
| {{if .Models.Offline}}<p equipo-offline role="status">{{copy "chat.connections.offline"}}</p>{{end}} |
| <div data-connections-live> |
| {{if .Models.Adding}}{{range .Models.Ended}}{{template "conn-note" (dict "Row" . "Add" $.Models.Adding)}}{{end}} |
| <div equipo-conn-add-area data-attempts>{{range .Models.Attempts}}{{template "conn-attempt" .}}{{else}}{{template "conn-chooser"}}{{end}}</div> |
| <div hidden>{{range .Models.Rows}}<i data-held-connection="{{.ID}}" data-state="{{.State}}" data-account="{{.Label}}"></i>{{end}}</div> |
| -{{else if .Models.Rows}}{{with .Models.Answering}}<section equipo-conn-answering{{with .Tone}} data-tone="{{.}}"{{end}} aria-label="{{copy "chat.connections.title"}}" data-answering>{{if .Tone}}<span equipo-conn-lead-icon aria-hidden="true">{{icon "alert-triangle"}}</span>{{else}}{{template "conn-star"}}{{end}}<p equipo-conn-lead>{{.LeadStart}}<b>{{.LeadName}}</b>{{.LeadEnd}}</p><p equipo-conn-sub>{{.Sub}}{{if .SeeConversation}} <a href="/conversation">{{copy "chat.connections.answering.see"}}</a>{{end}}</p> |
| +{{else if .Models.Rows}}{{with .Models.Answering}}<section equipo-conn-answering{{with .Tone}} data-tone="{{.}}"{{end}} aria-label="{{copy "chat.connections.title"}}" data-answering>{{if .Tone}}<span equipo-conn-lead-icon aria-hidden="true">{{icon "alert-triangle"}}</span>{{else}}{{template "conn-star"}}{{end}}<p equipo-conn-lead{{with .LeadAt}} title="{{.}}"{{end}}>{{.LeadStart}}<b>{{.LeadName}}</b>{{.LeadEnd}}</p><p equipo-conn-sub>{{.Sub}}{{if .SeeConversation}} <a href="/conversation">{{copy "chat.connections.answering.see"}}</a>{{end}}</p> |
| {{if not .Tone}}{{with $.Models.Prefer}}<div equipo-conn-prefer><span>{{copy "chat.connections.prefer"}}</span><span equipo-seg role="group" aria-label="{{copy "chat.connections.prefer"}}">{{range .Options}}<form method="post" action="/conversation/connections/prefer" equipo-inline-form><input type="hidden" name="provider" value="{{.Value}}"><input type="hidden" name="revision" value="{{$.Models.Prefer.Revision}}"><button type="submit" aria-pressed="{{.On}}" data-prefer="{{.Value}}">{{.Label}}</button></form>{{end}}</span><span equipo-conn-hint>{{.Hint}}</span></div>{{end}}{{end}} |
| </section>{{end}} |
| <section equipo-conn-group><h2>{{copy "chat.connections.group"}} <span equipo-conn-n>{{len .Models.Rows}}</span><span equipo-conn-hint>{{copy "chat.connections.usage_resets"}}</span></h2> |
diff --git a/internal/equipo/templates/notebook.html b/internal/equipo/templates/notebook.html| index 38c57fd8..9a45187a 100644 |
| --- a/internal/equipo/templates/notebook.html |
| +++ b/internal/equipo/templates/notebook.html |
| @@ -6,7 +6,7 @@ |
| <template equipo-saved-template><span equipo-saved-tick role="status">{{icon "check"}}<span>{{copy "settings.saved"}}</span></span></template> |
| {{template "settings-nav" .}} |
| <section equipo-notebook equipo-settings-body equipo-settings-section id="notebook"> |
| -<header equipo-notebook-head><h1>{{copy "chat.notebook.title"}}</h1><p>{{copy "chat.notebook.lede"}}</p></header> |
| +{{template "settings-head" (dict "Title" "chat.notebook.title" "Lede" "chat.notebook.lede")}} |
| {{if .Notebook}}<ul equipo-notes role="list">{{range .Notebook}}<li equipo-note{{if .Said}} data-said{{end}}>{{if .Said}}<blockquote><p>{{.Text}}</p></blockquote>{{else}}<p>{{.Text}}</p>{{end}}<p equipo-note-caption><span>{{.Who}}</span><time datetime="{{.At.UTC.Format "2006-01-02"}}">{{.Day}}</time></p></li>{{end}}</ul>{{else}}<p data-empty-state="chat.notebook.empty">{{copy "chat.notebook.empty"}}</p>{{end}} |
| <footer equipo-notebook-foot><form method="post" action="/conversation/notebook/reset"><button equipo-link type="submit" data-notebook-reset>{{copy "chat.notebook.reset"}}</button></form><p>{{copy "chat.notebook.reset_help"}}</p></footer> |
| </section> |
diff --git a/internal/equipo/templates/settings_hub.html b/internal/equipo/templates/settings_hub.html| index 964b16ae..4e35d8ab 100644 |
| --- a/internal/equipo/templates/settings_hub.html |
| +++ b/internal/equipo/templates/settings_hub.html |
| @@ -6,9 +6,9 @@ |
| <template equipo-saved-template><span equipo-saved-tick role="status">{{icon "check"}}<span>{{copy "settings.saved"}}</span></span></template> |
| {{template "settings-nav" .}} |
| <section equipo-settings-body equipo-settings-section id="{{.Settings.Section}}"> |
| -{{if eq .Settings.Section "thinking"}}<div equipo-page-head><h1>{{copy "thinking.title"}}</h1></div> |
| +{{if eq .Settings.Section "thinking"}}{{template "settings-head" (dict "Title" "thinking.title" "Lede" "thinking.lede")}} |
| {{template "thinking-form" (dict "Thinking" .Settings.Thinking "From" "settings")}} |
| -{{else if eq .Settings.Section "housekeeping"}}<div equipo-page-head><h1>{{copy "settings.housekeeping"}}</h1></div> |
| +{{else if eq .Settings.Section "housekeeping"}}{{template "settings-head" (dict "Title" "settings.housekeeping" "Lede" "housekeeping.settings.lede")}} |
| {{with .HousekeepingSettings}}{{template "housekeeping-settings" .}}{{end}} |
| {{end}} |
| </section> |
diff --git a/internal/equipo/templates/settings_nav.html b/internal/equipo/templates/settings_nav.html| index 02bae4f3..a078a431 100644 |
| --- a/internal/equipo/templates/settings_nav.html |
| +++ b/internal/equipo/templates/settings_nav.html |
| @@ -2,3 +2,17 @@ |
| {{define "settings-up"}}{{if .Settings.Root}}/work#nav-settings-hub{{else}}/conversation/settings{{end}}{{end}} |
| {{define "settings-up-label"}}{{if .Settings.Root}}{{.TeamName}}{{else}}{{copy "nav.settings"}}{{end}}{{end}} |
| {{define "settings-rail"}}<nav rst-shell-nav equipo-settings-rail{{if .RailArriving}} data-arriving{{end}} aria-label="{{copy "nav.settings"}}"><a href="/conversation" equipo-settings-leave data-settings-leave>{{icon "chevron-left"}}<span>{{copy "brand"}}</span></a><p equipo-nav-group>{{copy "nav.settings"}}</p>{{range .SettingsNav}}<a href="{{.Href}}" data-rail-settings="{{.Key}}"{{if and .Current (not $.Models.Adding)}} aria-current="page"{{end}}>{{icon .Icon}}<span>{{copy .CopyKey}}</span></a>{{if eq .Key "connections"}}<a href="/conversation/settings/connections/add" equipo-settings-sub data-rail-settings="connections-add"{{if $.Models.Adding}} aria-current="page"{{end}}>{{icon "plus"}}<span>{{copy "chat.connections.add"}}</span></a>{{end}}{{end}}</nav>{{end}} |
| +{{/* The one Settings page pattern (Paul, 2026-11-11: "make sure all the |
| + settings screens have proper UX and aren't just random forms"): |
| + settings-head is every section's title and its one line; a section |
| + is groups ([equipo-sp-group]), each a heading, a line, and a card of |
| + rows with the label on the left and the control on the right. A |
| + group either applies each control at once (a Saved tick by its |
| + heading) or holds editable fields saved together from the savebar, |
| + never both. */}} |
| +{{define "settings-head"}}<header equipo-sp-head><h1>{{copy .Title}}</h1>{{with .Lede}}<p>{{copy .}}</p>{{end}}</header>{{end}} |
| +{{/* savebar: the bar fixed to the foot of the screen for a form of |
| + editable fields, Save on the right. settings.js disables Save until |
| + something changes, shows Unsaved changes and Discard, warns before |
| + leaving, and saves in place; without script Save just submits. */}} |
| +{{define "savebar"}}<div equipo-savebar data-savebar><div equipo-savebar-in><p equipo-savebar-note aria-live="polite"><span data-savebar-unsaved hidden>{{copy "settings.unsaved"}}</span><span data-savebar-saved hidden>{{icon "check"}}{{copy "settings.saved"}}</span></p><button type="reset" rst-btn data-quiet data-savebar-discard hidden>{{copy "settings.discard"}}</button><button rst-btn="primary" type="submit" data-savebar-save>{{copy "form.save"}}</button></div></div>{{end}} |
diff --git a/internal/equipo/templates/teams.html b/internal/equipo/templates/teams.html| index a212fdc7..bdd4c42b 100644 |
| --- a/internal/equipo/templates/teams.html |
| +++ b/internal/equipo/templates/teams.html |
| @@ -1,27 +1,41 @@ |
| {{define "view"}}page teams{{end}} |
| {{define "content"}} |
| -<h1>{{copy "teams.title"}}</h1> |
| -<section equipo-card> |
| -<h2>{{copy "teams.current"}}</h2> |
| -<a equipo-current-team href="/work">{{icon "users"}}<span equipo-secondary>{{.TeamName}}</span></a> |
| -<p>{{copy "nav.needs-you"}}: {{if ne .Teams.CurrentNeeds nil}}<span equipo-value>{{.Teams.CurrentNeeds}}</span>{{else}}<span equipo-value>{{copy "teams.counts_unknown"}}</span>{{end}}</p> |
| +<div equipo-settings-layout data-section="teams"> |
| +{{template "settings-nav" .}} |
| +<section equipo-settings-body equipo-settings-section id="teams" data-teams> |
| +{{template "settings-head" (dict "Title" "teams.title" "Lede" "teams.lede")}} |
| +<section equipo-sp-group aria-labelledby="teams-current-h"> |
| +<div equipo-sp-group-head><h2 id="teams-current-h">{{copy "teams.current"}}</h2></div> |
| +<div equipo-sp-card><div equipo-sp-row equipo-team-row data-team-current> |
| +<span equipo-team-mark aria-hidden="true">{{icon "users"}}</span> |
| +<div equipo-sp-label><p equipo-sp-title><a equipo-row-link equipo-current-team href="/work">{{.TeamName}}</a></p><p equipo-sp-desc>{{hostOf .Origin}}</p></div> |
| +<span equipo-sp-control>{{with .Teams.CurrentNeeds}}{{if gt (deref .) 0}}<a equipo-team-needs href="/tasks?needs=you" data-team-needs>{{copy "nav.needs-you"}} <b>{{deref .}}</b></a>{{end}}{{else}}<span equipo-sp-desc data-team-needs-unknown>{{copy "teams.counts_unknown"}}</span>{{end}}</span> |
| +</div></div> |
| </section> |
| -<h2>{{copy "teams.remembered"}}</h2> |
| -<p>{{copy "teams.directory_help"}}</p> |
| {{$request := .Teams.RequestID}}{{$origin := .Origin}} |
| -{{range .Teams.Links}} |
| -<section equipo-card equipo-team-link> |
| -<a href="{{if eq .Origin $origin}}/work{{else}}{{.Origin}}{{end}}" rel="noreferrer">{{icon "users"}}<span equipo-secondary>{{.Name}}</span></a> |
| -<p equipo-secondary>{{.Origin}}</p> |
| -<p>{{if .LastSignedInAt}}{{copy "teams.last_signin"}}: <time equipo-value datetime="{{.LastSignedInAt.Format "2006-01-02T15:04:05Z07:00"}}">{{.LastSignedInAt.Format "2006-01-02 15:04 UTC"}}</time>{{else}}{{copy "teams.last_signin_unknown"}}{{end}}</p> |
| -{{if ne .Origin $origin}}<p>{{copy "teams.remote_unavailable"}}</p>{{end}} |
| -<form method="post" action="/teams/links/{{.ID}}/forget"><input type="hidden" name="request_id" value="{{$request}}-{{.ID}}"><input type="hidden" name="revision" value="{{.Revision}}"><button rst-btn type="submit">{{copy "teams.forget"}}</button></form> |
| -</section> |
| -{{end}} |
| -<form equipo-form method="post" action="/teams/links"> |
| +<section equipo-sp-group aria-labelledby="teams-list-h"> |
| +<div equipo-sp-group-head><h2 id="teams-list-h">{{copy "teams.remembered"}}</h2></div> |
| +{{if .Teams.Links}}<ul equipo-sp-card role="list" data-team-list data-forgotten="{{copy "teams.forgotten"}}" data-none="{{copy "teams.none"}}"> |
| +{{range .Teams.Links}}<li equipo-sp-row equipo-team-row data-team-row data-team-name="{{.Name}}"> |
| +<span equipo-team-mark aria-hidden="true">{{icon "users"}}</span> |
| +<div equipo-sp-label><p equipo-sp-title><a equipo-row-link href="{{if eq .Origin $origin}}/work{{else}}{{.Origin}}{{end}}" rel="noreferrer">{{.Name}}</a></p> |
| +<p equipo-sp-desc equipo-team-facts><span>{{hostOf .Origin}}</span>{{if .LastSignedInAt}}<time datetime="{{.LastSignedInAt.Format "2006-01-02T15:04:05Z07:00"}}" title="{{.LastSignedInAt.UTC.Format "2006-01-02 15:04 UTC"}}">{{printf (copy "teams.last_signin_ago") (agoText .LastSignedInAt)}}</time>{{else}}<span>{{copy "teams.last_signin_unknown"}}</span>{{end}}{{if ne .Origin $origin}}<span>{{copy "teams.remote_unavailable"}}</span>{{end}}</p></div> |
| +<form method="post" action="/teams/links/{{.ID}}/forget" equipo-sp-control data-team-forget-form><input type="hidden" name="request_id" value="{{$request}}-{{.ID}}"><input type="hidden" name="revision" value="{{.Revision}}"><button type="submit" rst-btn data-quiet equipo-team-forget data-team-forget aria-label="{{copy "teams.forget_short"}} {{.Name}}">{{copy "teams.forget_short"}}</button></form> |
| +</li>{{end}} |
| +</ul> |
| +<template data-team-undo-template><li equipo-sp-row equipo-team-gone data-team-forgotten><p equipo-sp-label role="status" data-team-gone-text></p><span equipo-sp-control><button type="button" rst-btn data-quiet data-team-undo>{{copy "teams.undo"}}</button></span></li></template> |
| +{{else}}<p equipo-sp-empty data-empty-state="teams.none">{{copy "teams.none"}}</p>{{end}} |
| +<details equipo-team-add data-team-add> |
| +<summary rst-btn>{{icon "plus"}}<span>{{copy "teams.add_open"}}</span></summary> |
| +<form method="post" action="/teams/links" equipo-team-add-form> |
| <input type="hidden" name="request_id" value="{{.Teams.RequestID}}"><input type="hidden" name="revision" value="0"> |
| -<label>{{copy "teams.name"}}<input rst-input name="name" maxlength="160" required></label> |
| -<label>{{copy "teams.origin"}}<input rst-input type="url" name="origin" required></label> |
| -<button rst-btn type="submit">{{copy "teams.add"}}</button> |
| +<label equipo-team-field data-field="address"><span>{{copy "teams.origin"}}</span><input rst-input type="url" name="origin" inputmode="url" autocomplete="url" placeholder="https://" required data-team-origin></label> |
| +<label equipo-team-field data-field="name"><span>{{copy "teams.name"}}</span><input rst-input name="name" maxlength="160" required data-team-name></label> |
| +<p equipo-sp-desc>{{copy "teams.add_help"}}</p> |
| +<p equipo-team-add-actions><button rst-btn="primary" type="submit" data-team-remember>{{copy "teams.add"}}</button></p> |
| </form> |
| +</details> |
| +</section> |
| +</section> |
| +</div> |
| {{end}} |
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html| index fcca4411..57d19b95 100644 |
| --- a/internal/equipo/templates/work_parts.html |
| +++ b/internal/equipo/templates/work_parts.html |
| @@ -34,16 +34,15 @@ |
| </div>{{end}}{{end}} |
| {{define "star-toggle"}}{{$p := .P}}<form method="post" action="/projects/{{$p.ID}}/star" equipo-star-form><input type="hidden" name="starred" value="{{if $p.Star.On}}0{{else}}1{{end}}"><input type="hidden" name="from" value="{{.From}}"><button type="submit" equipo-star{{if $p.Star.On}} aria-pressed="true"{{if $p.Star.Auto}} data-auto{{end}}{{else}} aria-pressed="false"{{end}} aria-label="{{$p.Star.Label}}" title="{{$p.Star.Who}}" data-star-toggle>{{icon "star"}}</button></form>{{end}} |
| {{define "project-facts"}}{{with .StackLine}}<span>{{if $.PhoneStack}}{{icon "phone"}}{{else}}{{icon "code"}}{{end}}{{.}}</span>{{end}}{{with .Repos}}<span data-repos>{{icon "git"}}{{if eq (len .) 1}}{{copy "work.project.one_repo"}}{{else}}{{printf (copy "work.project.repos") (len .)}}{{end}}</span>{{end}}{{with .ChecksLine}}<span data-tone="{{if $.Checks.Here}}positive{{else}}warning{{end}}" data-checks-fact>{{if $.Checks.Here}}{{icon "check-circle"}}{{else}}{{icon "help-circle"}}{{end}}{{.}}</span>{{end}}{{end}} |
| -{{define "thinking-form"}}{{with .Thinking}}<div equipo-thinking-words data-thinking-words="{{.JSON}}"{{if not $.From}} data-settings-live{{end}}>{{if not $.From}}<template equipo-saved-template><span equipo-saved-tick role="status">{{icon "check"}}<span>{{copy "settings.saved"}}</span></span></template>{{end}} |
| -{{if not $.From}}<div equipo-page-head><h1>{{copy "thinking.title"}}</h1></div>{{end}} |
| -<p equipo-lede>{{copy "thinking.lede"}}</p> |
| +{{define "thinking-form"}}{{with .Thinking}}<div equipo-thinking-words data-thinking-words="{{.JSON}}"> |
| {{if .Saved}}<p equipo-saved role="status">{{copy "thinking.saved"}}</p>{{end}} |
| <div equipo-thinking-preview aria-hidden="true"><p equipo-quiet>{{copy "thinking.preview"}}</p><p equipo-activity-line data-preview-line><span data-preview-phrase></span></p></div> |
| -<form method="post" action="/settings/thinking" equipo-thinking-form> |
| +<form method="post" action="/settings/thinking" equipo-thinking-form equipo-sp-group aria-labelledby="thinking-set-h"> |
| <input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"> |
| -<fieldset><legend equipo-visually-hidden>{{copy "thinking.title"}}</legend> |
| +<div equipo-sp-group-head><h2 id="thinking-set-h">{{copy "thinking.choose"}}</h2><p>{{copy "thinking.choose_hint"}}</p></div> |
| +<fieldset><legend equipo-visually-hidden>{{copy "thinking.choose"}}</legend> |
| <ol equipo-rows>{{$cur := .Set}}{{range .Sets}}<li equipo-row equipo-set-row data-set="{{.ID}}"><label><input type="radio" name="set" value="{{.ID}}"{{if eq .ID $cur}} checked{{end}}><span equipo-set-name>{{.Name}}</span><span equipo-desc>{{.Description}}</span>{{with index .Phrases "think"}}<span equipo-set-sample>{{range $i, $p := .}}{{if lt $i 3}}{{if $i}} · {{end}}{{$p}}{{end}}{{end}}</span>{{end}}</label></li>{{end}}</ol> |
| </fieldset> |
| -<button equipo-btn data-primary type="submit">{{copy "thinking.use"}}</button> |
| +<noscript><button equipo-btn data-primary type="submit">{{copy "thinking.use"}}</button></noscript> |
| </form> |
| </div>{{end}}{{end}} |
diff --git a/internal/equipotest/pages_test.go b/internal/equipotest/pages_test.go| index 3a035b9f..0de1ac6e 100644 |
| --- a/internal/equipotest/pages_test.go |
| +++ b/internal/equipotest/pages_test.go |
| @@ -118,6 +118,17 @@ func TestRailRoutes(t *testing.T) { |
| t.Fatal("not phone index") |
| } |
| } |
| + // Teams is a Settings section (Paul, 2026-11-11): one position at |
| + // each of three levels, the app rail's Settings, the Settings |
| + // rail's Teams and the in-page Settings menu's Teams. |
| + if path == "/teams" { |
| + want = 3 |
| + for _, mark := range []string{`id="nav-settings-hub" href="/conversation/settings" aria-current="page"`, `data-rail-settings="teams" aria-current="page"`, `data-settings-link="teams" aria-current="page"`} { |
| + if !strings.Contains(body, mark) { |
| + t.Fatalf("/teams is not placed in Settings: no %s", mark) |
| + } |
| + } |
| + } |
| if currentCount != want { |
| t.Fatalf("ambiguous navigation position: %s: %d", path, currentCount) |
| } |
diff --git a/internal/plan3test/teams_navigation_browser_test.go b/internal/plan3test/teams_navigation_browser_test.go| index f8148530..fdcf750a 100644 |
| --- a/internal/plan3test/teams_navigation_browser_test.go |
| +++ b/internal/plan3test/teams_navigation_browser_test.go |
| @@ -53,20 +53,28 @@ func TestTeamsHierarchyBrowser(t *testing.T) { |
| _, err := cdp.Call(ctx, target, emulation.SetScriptExecutionDisabled, emulation.SetScriptExecutionDisabledParams{Value: true}) |
| return err |
| })) |
| - run("desktop sidebar", chromedp.EmulateViewport(1280, 900), chromedp.Navigate(rig.Origin+"/conversation")) |
| - if !harness.Evaluate[bool](rig, `document.querySelector('#nav-teams').getBoundingClientRect().width>0 && document.querySelector('[equipo-team-heading]').contains(document.querySelector('#nav-teams'))`) { |
| - t.Fatal("desktop Teams link hidden") |
| + // Teams left the sidebar's team heading for Settings in 2e53061 |
| + // ("old pages out of the nav"; equipotest pins the heading without |
| + // it). On a desktop the Settings rail lists it. |
| + run("desktop Settings", chromedp.EmulateViewport(1280, 900), chromedp.Navigate(rig.Origin+"/conversation/settings")) |
| + if !harness.Evaluate[bool](rig, `(()=>{const a=document.querySelector('[equipo-settings-rail] a[data-rail-settings="teams"]');return !!a && a.getAttribute('href')==='/teams' && a.getBoundingClientRect().width>0 && !document.querySelector('#nav-teams')})()`) { |
| + t.Fatal("desktop Settings rail lacks a visible Teams link") |
| } |
| run("phone directory", chromedp.EmulateViewport(390, 844), chromedp.Navigate(rig.Origin+"/teams")) |
| if !harness.Evaluate[bool](rig, `document.querySelector('[equipo-current-team]').getBoundingClientRect().width>0 && document.documentElement.scrollWidth<=innerWidth`) { |
| t.Fatal("phone directory hidden or overflowing") |
| } |
| - run("open current team", chromedp.Click(chromedp.CSS(`[equipo-current-team]`)), chromedp.WaitVisible(chromedp.CSS(`#nav-journey`))) |
| - if !harness.Evaluate[bool](rig, `document.querySelector('[rst-shell-back] a').getAttribute('href')==='/teams' && document.querySelector('[rst-shell-back]').getBoundingClientRect().height>0`) { |
| - t.Fatal("team index lacks visible Teams parent") |
| + run("open current team", chromedp.Click(chromedp.CSS(`[equipo-current-team]`)), chromedp.WaitVisible(chromedp.CSS(`#nav-tasks`))) |
| + // The phone home screen hides its back strip on purpose (index |
| + // browser test: no strip above the home screen); its parent is still |
| + // Teams. |
| + if !harness.Evaluate[bool](rig, `document.querySelector('[rst-shell-back] a').getAttribute('href')==='/teams'`) { |
| + t.Fatal("team index parent is not Teams") |
| } |
| - run("open Journey", chromedp.Click(chromedp.CSS(`#nav-journey`)), chromedp.WaitVisible(chromedp.CSS(`main a[href="/tasks/`+task.ID+`"]`))) |
| - if !harness.Evaluate[bool](rig, `document.querySelector('[rst-shell-back] a').getAttribute('href')==='/work#nav-journey'`) { |
| + // Journey is an old page out of the nav since 2e53061; it is still |
| + // served for its links and its parent is still the team. |
| + run("open Journey", chromedp.Navigate(rig.Origin+"/journey"), chromedp.WaitVisible(chromedp.CSS(`main a[href="/tasks/`+task.ID+`"]`))) |
| + if !harness.Evaluate[bool](rig, `document.querySelector('[rst-shell-back] a').getAttribute('href').startsWith('/work')`) { |
| t.Fatal("page parent is not team") |
| } |
| run("open task", chromedp.Click(chromedp.CSS(`main a[href="/tasks/`+task.ID+`"]`)), chromedp.WaitVisible(chromedp.CSS(`main a[href="/tasks/`+task.ID+`/thread"]`))) |
diff --git a/internal/thintest/housekeeping_browser_test.go b/internal/thintest/housekeeping_browser_test.go| index 7a985786..85449e4f 100644 |
| --- a/internal/thintest/housekeeping_browser_test.go |
| +++ b/internal/thintest/housekeeping_browser_test.go |
| @@ -132,8 +132,8 @@ func TestBrowserHousekeeping(t *testing.T) { |
| q := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, "light", "no-preference") |
| defer q.stop() |
| q.open("/conversation/settings/housekeeping") |
| - q.check(`(()=>{window.__hkmark=1;document.querySelector('[data-hk-quiet-from]').value='23';document.querySelector('[data-hk-quiet-until]').value='7';return true})()`, "choose hours") |
| - q.click(`[data-hk-quiet-save]`) |
| + q.check(`(()=>{window.__hkmark=1;for(const [s,v] of [['[data-hk-quiet-from]','23'],['[data-hk-quiet-until]','7']]){const e=document.querySelector(s);e.value=v;e.dispatchEvent(new Event('change',{bubbles:true}))}return true})()`, "choose hours") |
| + q.click(`[data-savebar-save]`) |
| // Saved in the background (Paul: a page post replayed the sliding nav). |
| q.wait(`window.__hkmark===1 && document.querySelector('#housekeeping [equipo-saved-tick][data-shown]') && document.querySelector('[data-hk-quiet-from]').value==='23' && document.querySelector('[data-hk-quiet-until]').value==='7'`, "quiet hours saved") |
| if h := r.housekeeping(); h.Quiet != (wire.QuietHours{From: 23, Until: 7}) { |
| @@ -141,7 +141,7 @@ func TestBrowserHousekeeping(t *testing.T) { |
| } |
| q.check(`(()=>{window.__hkmark=1;return true})()`, "mark") |
| q.click(`[data-hk-pause]`) |
| - q.wait(`window.__hkmark===1 && document.querySelector('[data-hk-settings][data-paused] [data-hk-resume]')`, "paused") |
| + q.wait(`window.__hkmark===1 && document.querySelector('[data-hk-status][data-paused] [data-hk-resume]')`, "paused") |
| q.stayed("Pause from Settings") |
| if h := r.housekeeping(); !h.Paused { |
| t.Fatal("Pause from Settings did not take") |
diff --git a/internal/thintest/settings_browser_test.go b/internal/thintest/settings_browser_test.go| index 3d87543c..b60b3eff 100644 |
| --- a/internal/thintest/settings_browser_test.go |
| +++ b/internal/thintest/settings_browser_test.go |
| @@ -59,15 +59,15 @@ func TestBrowserSettingsStayOnPage(t *testing.T) { |
| p.open("/conversation/settings/housekeeping") |
| mark() |
| p.click(`[data-hk-pause]`) |
| - p.wait(`!!document.querySelector('[data-hk-settings][data-paused] [data-hk-resume]') && `+tick("housekeeping"), "paused") |
| + p.wait(`!!document.querySelector('[data-hk-status][data-paused] [data-hk-resume]') && `+tick("housekeeping"), "paused") |
| same("Pause") |
| if h := r.housekeeping(); !h.Paused { |
| t.Fatalf("%d: Pause did not take", size.w) |
| } |
| p.click(`[data-hk-resume]`) |
| - p.wait(`!!document.querySelector('[data-hk-settings]:not([data-paused]) [data-hk-pause]')`, "resumed") |
| - p.check(`(()=>{document.querySelector('[data-hk-quiet-from]').value='21';document.querySelector('[data-hk-quiet-until]').value='6';return true})()`, "hours") |
| - p.click(`[data-hk-quiet-save]`) |
| + p.wait(`!!document.querySelector('[data-hk-status]:not([data-paused]) [data-hk-pause]')`, "resumed") |
| + p.check(`(()=>{for(const [s,v] of [['[data-hk-quiet-from]','21'],['[data-hk-quiet-until]','6']]){const e=document.querySelector(s);e.value=v;e.dispatchEvent(new Event('change',{bubbles:true}))}return true})()`, "hours") |
| + p.click(`[data-savebar-save]`) |
| p.waitFor(func() bool { return r.housekeeping().Quiet.From == 21 && !r.housekeeping().Paused }, "quiet hours saved") |
| p.wait(tick("housekeeping"), "quiet hours tick") |
| same("quiet hours") |
diff --git a/internal/thintest/settings_ux_browser_test.go b/internal/thintest/settings_ux_browser_test.go| new file mode 100644 |
| index 00000000..be9ba845 |
| --- /dev/null |
| +++ b/internal/thintest/settings_ux_browser_test.go |
| @@ -0,0 +1,280 @@ |
| +//go:build browser |
| + |
| +package thintest |
| + |
| +import ( |
| + "context" |
| + "os" |
| + "path/filepath" |
| + "strconv" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/equipo" |
| + "amadan.net/oficina/equipo/internal/wire" |
| + "github.com/chromedp/chromedp" |
| +) |
| + |
| +// The Settings UX pass (Paul, 2026-11-11: "Can we make sure all the |
| +// settings screens have proper UX and aren't just random forms? The |
| +// "Save" button should probably be fixed to the bottom of the screen, |
| +// bottom right?"). |
| + |
| +// settingsShot writes docs/mockups/built/2026-11-11/settings-<name>-<width>.png |
| +// when EQUIPO_CONN_SHOTS is set, as connShot does for Connections. |
| +func settingsShot(t *testing.T, p *innerPage, name string, width int64) { |
| + t.Helper() |
| + if os.Getenv("EQUIPO_CONN_SHOTS") == "" { |
| + return |
| + } |
| + dir := filepath.Join("..", "..", "docs", "mockups", "built", "2026-11-11") |
| + if err := os.MkdirAll(dir, 0755); err != nil { |
| + t.Fatal(err) |
| + } |
| + p.wait(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`, "the page settled") |
| + var shot []byte |
| + p.do(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error { |
| + var err error |
| + shot, err = chromedp.FullScreenshot(90)(ctx, target) |
| + return err |
| + })) |
| + if err := os.WriteFile(filepath.Join(dir, "settings-"+name+"-"+strconv.FormatInt(width, 10)+".png"), shot, 0644); err != nil { |
| + t.Fatal(err) |
| + } |
| +} |
| + |
| +var settingsSizes = []struct { |
| + w, h int64 |
| + touch bool |
| +}{{1280, 900, false}, {390, 844, true}} |
| + |
| +// setField changes a field the way a person does: its value, then the |
| +// change event. |
| +func setField(selector, value string) string { |
| + return `(()=>{const e=document.querySelector(` + jsString(selector) + `);e.value=` + jsString(value) + `;e.dispatchEvent(new Event('change',{bubbles:true}));return true})()` |
| +} |
| + |
| +// leaveWarns is whether leaving now would ask first. |
| +const leaveWarns = `(()=>{const e=new Event('beforeunload',{cancelable:true});dispatchEvent(e);return e.defaultPrevented})()` |
| + |
| +// TestBrowserSettingsSaveBar: on a screen with editable fields Save sits |
| +// in a bar fixed to the foot of the screen, on the right where the cards |
| +// end (the whole width on a phone); it is off until something changes, |
| +// then says Unsaved changes with Discard beside it, and leaving asks |
| +// first. Discard goes back; Save saves in place, says Saved, and the |
| +// page is never reloaded. Quiet hours' times are off while the switch |
| +// is, also when the page is opened again. |
| +func TestBrowserSettingsSaveBar(t *testing.T) { |
| + r := newToolRig(t) |
| + for _, size := range settingsSizes { |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference") |
| + w := strconv.FormatInt(size.w, 10) |
| + p.open("/conversation/settings/housekeeping") |
| + p.wait(`!!document.querySelector('[data-savebar-save]')`, "the savebar") |
| + // The bar: fixed at the foot, Save on its right under the cards' edge. |
| + p.check(`(()=>{const b=document.querySelector('[data-savebar]').getBoundingClientRect(),s=document.querySelector('[data-savebar-save]').getBoundingClientRect(),card=document.querySelector('#hk-quiet [equipo-sp-card]').getBoundingClientRect();const pos=getComputedStyle(document.querySelector('[data-savebar]')).position;const rail=document.querySelector('[rst-shell-rail]').getBoundingClientRect();return pos==='fixed'&&Math.abs(b.bottom-innerHeight)<1&&Math.abs(s.right-card.right)<=2&&(innerWidth<800?Math.abs(b.left)<1&&Math.abs(b.width-innerWidth)<1:Math.abs(b.left-rail.right)<=1)})()`, w+": the savebar is not fixed at the foot with Save under the cards' right edge") |
| + p.check(`document.querySelector('[data-savebar-save]').disabled && document.querySelector('[data-savebar-unsaved]').hidden && document.querySelector('[data-savebar-discard]').hidden`, w+": Save is on, or Unsaved changes shows, before any change") |
| + p.check(`!`+leaveWarns, w+": leaving warns with nothing changed") |
| + settingsShot(t, p, "housekeeping", size.w) |
| + p.check(`(()=>{window.__nav=performance.getEntriesByType('navigation').length;window.__href=location.href;return true})()`, "mark") |
| + |
| + // The switch off: the hours go off with it, and the bar wakes. |
| + p.click(`#hk-quiet [rst-switch]`) |
| + p.wait(`!document.querySelector('[data-hk-quiet-on]').checked`, "switched off") |
| + p.check(`document.querySelector('#hk-hours').disabled && document.querySelector('[data-hk-quiet-from]').matches(':disabled') && document.querySelector('[data-hk-quiet-until]').matches(':disabled')`, w+": the hours are not off with the switch") |
| + p.check(`!document.querySelector('[data-savebar-save]').disabled && !document.querySelector('[data-savebar-unsaved]').hidden && document.querySelector('[data-savebar-unsaved]').checkVisibility() && document.querySelector('[data-savebar-discard]').checkVisibility()`, w+": no Unsaved changes, Discard and Save after a change") |
| + p.check(leaveWarns, w+": leaving with unsaved changes does not ask") |
| + settingsShot(t, p, "housekeeping-unsaved", size.w) |
| + |
| + // Discard: back to what was saved, nothing to warn about. |
| + p.click(`[data-savebar-discard]`) |
| + p.wait(`document.querySelector('[data-hk-quiet-on]').checked && !document.querySelector('#hk-hours').disabled && document.querySelector('[data-savebar-save]').disabled && document.querySelector('[data-savebar-unsaved]').hidden`, "discarded") |
| + p.check(`!`+leaveWarns, w+": leaving warns after Discard") |
| + |
| + // Save: new hours, in place. |
| + from := map[int64]string{1280: "20", 390: "19"}[size.w] |
| + p.check(setField(`[data-hk-quiet-from]`, from), "From") |
| + p.check(`!document.querySelector('[data-savebar-save]').disabled`, w+": Save stays off after a change") |
| + p.click(`[data-savebar-save]`) |
| + p.wait(`!document.querySelector('[data-savebar-saved]').hidden && document.querySelector('[data-savebar-save]').disabled && document.querySelector('[data-savebar-unsaved]').hidden`, "Saved in the bar") |
| + p.stayed(w + ": Save") |
| + p.check(`!`+leaveWarns, w+": leaving warns after Save") |
| + want, _ := strconv.Atoi(from) |
| + p.waitFor(func() bool { return r.housekeeping().Quiet == wire.QuietHours{From: want, Until: 8} }, "the hours saved") |
| + settingsShot(t, p, "housekeeping-saved", size.w) |
| + // What Discard goes back to is now what was saved. |
| + p.check(setField(`[data-hk-quiet-until]`, "9"), "Until") |
| + p.click(`[data-savebar-discard]`) |
| + p.wait(`document.querySelector('[data-hk-quiet-until]').value==='8' && document.querySelector('[data-hk-quiet-from]').value===`+jsString(from), "discarded to the saved hours") |
| + |
| + // Quiet hours off, saved: opened again, the times are off. |
| + p.click(`#hk-quiet [rst-switch]`) |
| + p.click(`[data-savebar-save]`) |
| + p.waitFor(func() bool { q := r.housekeeping().Quiet; return q.From == q.Until }, "quiet hours off") |
| + p.wait(`document.querySelector('[data-savebar-save]').disabled`, "saved") |
| + p.open("/conversation/settings/housekeeping") |
| + p.check(`!document.querySelector('[data-hk-quiet-on]').checked && document.querySelector('#hk-hours').disabled && document.querySelector('[data-savebar-save]').disabled`, w+": quiet hours off, but the times are on when the page opens") |
| + settingsShot(t, p, "housekeeping-quiet-off", size.w) |
| + // And on again for the next size. |
| + p.click(`#hk-quiet [rst-switch]`) |
| + p.click(`[data-savebar-save]`) |
| + p.waitFor(func() bool { q := r.housekeeping().Quiet; return q.From != q.Until }, "quiet hours on") |
| + p.wait(`document.querySelector('[data-savebar-save]').disabled`, "saved") |
| + p.stop() |
| + } |
| +} |
| + |
| +// TestBrowserSettingsHousekeepingGroups: Pause belongs with the state it |
| +// changes, in the Status group, and applies at once with a tick; Quiet |
| +// hours are their own group with the savebar. Every control sits on one |
| +// right edge (on a phone the hours drop under their label). |
| +func TestBrowserSettingsHousekeepingGroups(t *testing.T) { |
| + r := newToolRig(t) |
| + for _, size := range settingsSizes { |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference") |
| + w := strconv.FormatInt(size.w, 10) |
| + p.open("/conversation/settings/housekeeping") |
| + p.check(`(()=>{const st=document.querySelector('[data-hk-status]');const row=st.querySelector('[equipo-sp-row]');const pause=row.querySelector('[data-hk-pause]');const t=row.querySelector('[equipo-sp-title]');return st.querySelector('h2').textContent==='Status'&&t.textContent.trim()==='Housekeeping is on'&&!!pause&&Math.abs(pause.getBoundingClientRect().top+pause.getBoundingClientRect().height/2-(row.getBoundingClientRect().top+row.getBoundingClientRect().height/2))<4&&!st.querySelector('[data-savebar]')})()`, w+": Pause is not beside Housekeeping is on in the Status group") |
| + p.check(`(()=>{const q=document.querySelector('#hk-quiet');return q.querySelector('h2').textContent.startsWith('Quiet hours')&&!!q.querySelector('[data-savebar]')&&!q.querySelector('[data-hk-pause],[data-hk-resume]')})()`, w+": Quiet hours are not their own group with the savebar") |
| + p.check(`(()=>{const e=s=>document.querySelector(s).getBoundingClientRect().right;const xs=[e('[data-hk-pause]'),e('#hk-quiet [rst-switch]')];if(innerWidth>=560)xs.push(e('[data-hk-quiet-until]'));return Math.max(...xs)-Math.min(...xs)<=2})()`, w+": the controls are not on one right edge") |
| + p.check(`(()=>{const a=document.querySelector('[equipo-sp-head] h1'),b=document.querySelector('#hk-status h2'),c=document.querySelector('#hk-quiet h2');return a.getBoundingClientRect().left===b.getBoundingClientRect().left&&b.getBoundingClientRect().left===c.getBoundingClientRect().left})()`, w+": the headings do not share a left edge") |
| + p.fits("housekeeping") |
| + p.check(`(()=>{window.__nav=performance.getEntriesByType('navigation').length;window.__href=location.href;return true})()`, "mark") |
| + // Unsaved hours survive a Pause, and save over the new revision. |
| + p.check(setField(`[data-hk-quiet-until]`, "7"), "Until") |
| + p.click(`[data-hk-pause]`) |
| + p.wait(`!!document.querySelector('[data-hk-status][data-paused] [data-hk-resume]') && !!document.querySelector('#hk-status [equipo-saved-tick][data-shown]:not([data-gone])')`, "paused at once") |
| + p.check(`document.querySelector('#hk-status [equipo-sp-title]').textContent.trim()==='Housekeeping is paused' && document.querySelector('[data-hk-quiet-until]').value==='7' && !document.querySelector('[data-savebar-save]').disabled`, w+": Pause lost the unsaved hours or did not say paused") |
| + p.stayed(w + ": Pause") |
| + settingsShot(t, p, "housekeeping-paused", size.w) |
| + p.click(`[data-savebar-save]`) |
| + p.waitFor(func() bool { h := r.housekeeping(); return h.Paused && h.Quiet.Until == 7 }, "the hours saved after Pause") |
| + p.click(`[data-hk-resume]`) |
| + p.wait(`!!document.querySelector('[data-hk-status]:not([data-paused]) [data-hk-pause]')`, "resumed") |
| + p.waitFor(func() bool { return !r.housekeeping().Paused }, "resumed on the server") |
| + p.check(setField(`[data-hk-quiet-until]`, "8"), "Until back") |
| + p.click(`[data-savebar-save]`) |
| + p.waitFor(func() bool { return r.housekeeping().Quiet.Until == 8 }, "Until back saved") |
| + p.stop() |
| + } |
| +} |
| + |
| +// TestBrowserSettingsTeams: Teams is a Settings section like the others. |
| +// The current team is one header row; remembered teams are a list whose |
| +// rows open the team, "Last signed in" words with the time on hover; |
| +// Forget is quiet, with Undo before it takes; Add a team is a button that |
| +// opens a compact form, the address first and the name from it. |
| +func TestBrowserSettingsTeams(t *testing.T) { |
| + r := newToolRig(t) |
| + owner := equipo.Actor{Address: Owner} |
| + for i, size := range settingsSizes { |
| + studio, err := r.inst.Store.RememberTeam(r.ctx, owner, equipo.TeamLink{Origin: "https://studio" + strconv.Itoa(i) + ".example.com", Name: "Studio"}, equipo.Mutation{RequestID: "teams-ux-" + strconv.Itoa(i)}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference") |
| + w := strconv.FormatInt(size.w, 10) |
| + p.open("/teams") |
| + p.check(`(()=>{const h=document.querySelector('[equipo-sp-head]');return h.querySelector('h1').textContent==='Teams'&&h.querySelectorAll('p').length===1&&!!document.querySelector('[equipo-current-team][href="/work"]')})()`, w+": Teams has no Settings head or current team row") |
| + if size.w > 800 { |
| + p.check(`document.querySelector('[equipo-settings-rail]').checkVisibility() && document.querySelector('[equipo-settings-rail] [aria-current="page"]').dataset.railSettings==='teams'`, "1280: Teams is not a section in the Settings rail") |
| + } |
| + row := `[data-team-row][data-team-name="Studio"]` |
| + p.check(`(()=>{const row=document.querySelector(`+jsString(row)+`);const a=row.querySelector('[equipo-row-link]');const r=row.getBoundingClientRect();const hit=document.elementFromPoint(r.left+r.width*0.45,r.bottom-6);return a.getAttribute('href')==='https://studio`+strconv.Itoa(i)+`.example.com'&&(hit===a||a.contains(hit))&&getComputedStyle(row.querySelector('[data-team-forget]')).backgroundColor!==getComputedStyle(document.querySelector('[data-team-add] > summary')).backgroundColor})()`, w+": the row does not open the team, or Forget is not quiet") |
| + p.check(`(()=>{const add=document.querySelector('[data-team-add]');return !add.open&&!add.querySelector('[data-team-origin]').checkVisibility()})()`, w+": the add form shows before Add a team") |
| + p.fits("teams") |
| + settingsShot(t, p, "teams", size.w) |
| + p.check(`(()=>{window.__nav=performance.getEntriesByType('navigation').length;window.__href=location.href;return true})()`, "mark") |
| + |
| + // Forget, then Undo: the row back, the link kept. |
| + p.click(row + ` [data-team-forget]`) |
| + p.wait(`document.querySelector(`+jsString(row)+`).hidden && document.querySelector('[data-team-forgotten]').textContent.includes('Studio forgotten.') && document.activeElement===document.querySelector('[data-team-undo]')`, "forgotten, with Undo") |
| + settingsShot(t, p, "teams-undo", size.w) |
| + p.click(`[data-team-undo]`) |
| + p.wait(`!document.querySelector(`+jsString(row)+`).hidden && !document.querySelector('[data-team-forgotten]')`, "undone") |
| + links, err := r.inst.Store.TeamLinks(r.ctx, owner) |
| + if err != nil || !hasLink(links, studio.ID) { |
| + t.Fatalf("%s: Undo did not keep the link: %v %v", w, links, err) |
| + } |
| + // Forget for good: it goes after the wait. |
| + p.click(row + ` [data-team-forget]`) |
| + p.waitForLong(func() bool { |
| + l, err := r.inst.Store.TeamLinks(r.ctx, owner) |
| + return err == nil && !hasLink(l, studio.ID) |
| + }, "forgotten for good") |
| + p.wait(`!document.querySelector(`+jsString(row)+`) && !document.querySelector('[data-team-forgotten]') && document.querySelector('[data-empty-state="teams.none"]').textContent==='No other teams yet.'`, "the row gone, none left") |
| + p.stayed(w + ": Forget") |
| + |
| + // Add a team: compact, address first, the name from it. |
| + p.click(`[data-team-add] > summary`) |
| + p.wait(`document.querySelector('[data-team-origin]').checkVisibility()`, "the add form") |
| + p.check(`(()=>{const f=[...document.querySelectorAll('[equipo-team-add-form] input:not([type=hidden])')];const card=document.querySelector('[equipo-team-add-form]').getBoundingClientRect();return f[0].name==='origin'&&f[1].name==='name'&&(innerWidth<800||f.every(i=>i.getBoundingClientRect().width<card.width*0.75))})()`, w+": the address is not first, or the fields are full-bleed") |
| + p.check(setField(`[data-team-origin]`, "https://design.example.org"), "address") |
| + p.check(`document.querySelector('[data-team-add] [data-team-name]').value==='Design'`, w+": the name is not filled in from the address") |
| + p.fits("the add form") |
| + settingsShot(t, p, "teams-add", size.w) |
| + p.click(`[data-team-remember]`) |
| + p.wait(`location.pathname==='/teams' && !!document.querySelector('[data-team-row][data-team-name="Design"]')`, "the new team") |
| + links, _ = r.inst.Store.TeamLinks(r.ctx, owner) |
| + for _, l := range links { |
| + if l.Name == "Design" { |
| + if err := r.inst.Store.ForgetTeam(r.ctx, owner, l.ID, equipo.Mutation{RequestID: "teams-ux-design-" + w, Revision: l.Revision}); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + } |
| + p.stop() |
| + } |
| +} |
| + |
| +func hasLink(links []equipo.TeamLink, id string) bool { |
| + for _, l := range links { |
| + if l.ID == id { |
| + return true |
| + } |
| + } |
| + return false |
| +} |
| + |
| +// waitForLong polls a server-side condition for up to fifteen seconds. |
| +func (p *innerPage) waitForLong(cond func() bool, what string) { |
| + p.t.Helper() |
| + for range 3 { |
| + for i := 0; i < 100; i++ { |
| + if cond() { |
| + return |
| + } |
| + time.Sleep(50 * time.Millisecond) |
| + } |
| + } |
| + p.t.Fatalf("timed out waiting for %s", what) |
| +} |
| + |
| +// TestBrowserSettingsShots: every Settings screen at 1280 and 390, one |
| +// head and one content width, nothing wider than the screen, and the |
| +// after shots. |
| +func TestBrowserSettingsShots(t *testing.T) { |
| + r := newToolRig(t) |
| + if _, err := r.inst.Store.RememberTeam(r.ctx, equipo.Actor{Address: Owner}, equipo.TeamLink{Origin: "https://studio.example.com", Name: "Studio"}, equipo.Mutation{RequestID: "shots-team"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, size := range settingsSizes { |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference") |
| + var width float64 |
| + for _, s := range []struct{ name, path string }{{"thinking", "/conversation/settings/thinking"}, {"connections", "/conversation/settings/connections"}, {"connections-add", "/conversation/settings/connections/add"}, {"housekeeping", "/conversation/settings/housekeeping"}, {"notebook", "/conversation/settings/notebook"}, {"teams", "/teams"}} { |
| + p.open(s.path) |
| + p.check(`document.querySelectorAll('[equipo-settings-body] h1').length===1 && !!document.querySelector('[equipo-settings-body] [equipo-sp-head] h1') && getComputedStyle(document.querySelector('[equipo-sp-head] h1')).fontSize==='24px'`, s.name+": not one Settings head") |
| + got := eval[float64](p, `document.querySelector('[equipo-settings-body]').getBoundingClientRect().width`) |
| + if width == 0 { |
| + width = got |
| + } else if got != width { |
| + t.Fatalf("%d %s: content width %v, the others %v", size.w, s.name, got, width) |
| + } |
| + p.fits(s.name) |
| + if s.name != "housekeeping" && s.name != "teams" { |
| + settingsShot(t, p, s.name, size.w) |
| + } |
| + } |
| + p.stop() |
| + } |
| +} |
diff --git a/internal/thintest/settings_ux_pages_test.go b/internal/thintest/settings_ux_pages_test.go| new file mode 100644 |
| index 00000000..94805536 |
| --- /dev/null |
| +++ b/internal/thintest/settings_ux_pages_test.go |
| @@ -0,0 +1,147 @@ |
| +package thintest |
| + |
| +import ( |
| + "net/http" |
| + "net/url" |
| + "regexp" |
| + "strconv" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/equipo" |
| +) |
| + |
| +// TestPagesSettingsPattern: Paul, 2026-11-11: "Can we make sure all the |
| +// settings screens have proper UX and aren't just random forms?" Every |
| +// Settings section, Teams included, opens with the one Settings head (a |
| +// title and one line) beside the Settings menu, current; Housekeeping is |
| +// a Status group (the state in words with Pause beside it) and a Quiet |
| +// hours group of fields with the savebar, never the two mixed; without |
| +// script Save is a plain submit and the forms still post. |
| +func TestPagesSettingsPattern(t *testing.T) { |
| + r := newToolRig(t) |
| + owner := r.inst.Cookie() |
| + for _, tc := range []struct{ path, current, head string }{ |
| + {"/conversation/settings/thinking", "thinking", "Thinking words"}, |
| + {"/conversation/settings/connections", "connections", "Connections"}, |
| + {"/conversation/settings/connections/add", "connections", "Add a connection"}, |
| + {"/conversation/settings/housekeeping", "housekeeping", "Housekeeping"}, |
| + {"/conversation/settings/notebook", "notebook", "Notebook"}, |
| + {"/teams", "teams", "Teams"}, |
| + } { |
| + page := r.get(owner, tc.path, 200) |
| + if !strings.Contains(page, `<header equipo-sp-head><h1>`+tc.head+`</h1><p>`) || strings.Count(page, "<h1>") != 1 { |
| + t.Errorf("%s: not one Settings head %q with its line", tc.path, tc.head) |
| + } |
| + if !strings.Contains(page, `data-settings-link="`+tc.current+`" aria-current="page"`) || !strings.Contains(page, `data-rail-settings="`+tc.current+`"`) { |
| + t.Errorf("%s: the Settings menu and rail do not mark %s", tc.path, tc.current) |
| + } |
| + } |
| + |
| + hk := r.get(owner, "/conversation/settings/housekeeping", 200) |
| + status := between(t, hk, `<section equipo-sp-group id="hk-status"`, `</section>`) |
| + for _, want := range []string{`<h2 id="hk-status-h">Status</h2>`, "Housekeeping is on", `action="/settings/housekeeping/pause"`, `data-hk-pause`, `data-hk-activity`} { |
| + if !strings.Contains(status, want) { |
| + t.Errorf("Status lacks %s", want) |
| + } |
| + } |
| + quiet := between(t, hk, `<form method="post" action="/settings/housekeeping/quiet"`, `</form>`) |
| + for _, want := range []string{`data-savebar-form`, `<h2 id="hk-quiet-h">Quiet hours</h2>`, `rst-switch`, `data-enables="hk-hours"`, `<fieldset equipo-sp-row id="hk-hours"`, `data-savebar`, `<button rst-btn="primary" type="submit" data-savebar-save>Save</button>`, `data-savebar-discard hidden`, `data-savebar-unsaved hidden`} { |
| + if !strings.Contains(quiet, want) { |
| + t.Errorf("Quiet hours lacks %s", want) |
| + } |
| + } |
| + // Never mixed: no Pause in the savebar's group, no savebar in Status. |
| + if strings.Contains(quiet, "data-hk-pause") || strings.Contains(status, "data-savebar") || strings.Count(hk, "data-savebar-form") != 1 { |
| + t.Error("a group mixes controls that apply at once with fields saved from the bar") |
| + } |
| + // Without script Save is a plain post that comes back here. |
| + rev := regexp.MustCompile(`name="revision" value="(\d+)"`).FindStringSubmatch(quiet)[1] |
| + if code, to := r.post(owner, "/settings/housekeeping/quiet", url.Values{"revision": {rev}, "on": {"1"}, "from": {"21"}, "until": {"7"}}); code != http.StatusSeeOther || to != "/conversation/settings/housekeeping" { |
| + t.Fatalf("Save without script: %d to %q", code, to) |
| + } |
| + if q := r.housekeeping().Quiet; q.From != 21 || q.Until != 7 { |
| + t.Fatalf("quiet hours without script: %+v", q) |
| + } |
| + // Quiet hours off: the switch is off and the hours are drawn anyway, |
| + // for settings.js to turn off with it. |
| + h := r.housekeeping() |
| + if _, err := r.client.SetQuiet(r.ctx, h.Paused, 3, 3, h.Revision); err != nil { |
| + t.Fatal(err) |
| + } |
| + off := r.get(owner, "/conversation/settings/housekeeping", 200) |
| + if strings.Contains(between(t, off, `id="hk-quiet-on"`, `>`), "checked") || !strings.Contains(off, `data-hk-quiet-from`) { |
| + t.Error("quiet hours off: the switch is on, or the hours are gone") |
| + } |
| + |
| + // Thinking words apply at once: no Save, the old button only without script. |
| + thinking := r.get(owner, "/conversation/settings/thinking", 200) |
| + if !strings.Contains(thinking, `<h2 id="thinking-set-h">Word set</h2><p>Your choice applies at once.</p>`) || !strings.Contains(thinking, `<noscript><button equipo-btn data-primary type="submit">Use these words</button></noscript>`) || strings.Contains(thinking, "data-savebar") { |
| + t.Error("Thinking words is not one group that applies at once") |
| + } |
| +} |
| + |
| +// TestPagesSettingsTeams: Teams as a Settings section (Paul, 2026-11-11: |
| +// "Teams UI is all over the place too"): the current team one header row |
| +// with its address and no zero count; each remembered team a row that |
| +// opens it, its address and "Last signed in" in words with the exact time |
| +// on hover, Forget a quiet button; Add a team a button over a compact |
| +// form, the address first, the long explanation as help beside it. |
| +func TestPagesSettingsTeams(t *testing.T) { |
| + r := newToolRig(t) |
| + owner := r.inst.Cookie() |
| + link, err := r.inst.Store.RememberTeam(r.ctx, equipo.Actor{Address: Owner}, equipo.TeamLink{Origin: "https://studio.example.com", Name: "Studio"}, equipo.Mutation{RequestID: "pages-teams"}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + at := time.Now().Add(-4*24*time.Hour - time.Hour).UTC() |
| + if _, err := r.inst.DB.Writer().Exec("UPDATE team_links SET last_signed_in_at = ? WHERE id = ?", at, link.ID); err != nil { |
| + t.Fatal(err) |
| + } |
| + page := r.get(owner, "/teams", 200) |
| + current := between(t, page, `data-team-current`, `</section>`) |
| + host := strings.TrimPrefix(strings.TrimPrefix(r.inst.URL, "http://"), "https://") |
| + if !strings.Contains(current, `<a equipo-row-link equipo-current-team href="/work">`) || !strings.Contains(current, `<p equipo-sp-desc>`+host+`</p>`) || strings.Contains(current, "data-team-needs>") { |
| + t.Error("the current team is not one row with its address and no zero count") |
| + } |
| + row := between(t, page, `data-team-name="Studio"`, `</li>`) |
| + for _, want := range []string{ |
| + `<a equipo-row-link href="https://studio.example.com" rel="noreferrer">Studio</a>`, |
| + `<span>studio.example.com</span>`, |
| + `title="` + at.Format("2006-01-02 15:04") + ` UTC">Last signed in 4 days ago</time>`, |
| + `<button type="submit" rst-btn data-quiet equipo-team-forget data-team-forget aria-label="Forget Studio">Forget</button>`, |
| + } { |
| + if !strings.Contains(row, want) { |
| + t.Errorf("the remembered row lacks %s", want) |
| + } |
| + } |
| + add := between(t, page, `<details equipo-team-add data-team-add>`, `</details>`) |
| + if !strings.Contains(add, `<summary rst-btn>`) || strings.Index(add, `name="origin"`) > strings.Index(add, `name="name"`) || !strings.Contains(add, "Each team has its own sign-in") { |
| + t.Error("Add a team is not a button over a compact form, the address first, with its help") |
| + } |
| + if strings.Contains(page, "Add links to other Equipo instances") || strings.Contains(page, "Forget this link") { |
| + t.Error("the old paragraph or Forget this link is still on the page") |
| + } |
| + // Without script Forget still posts and comes back to Teams. |
| + if code, to := r.post(owner, "/teams/links/"+link.ID+"/forget", url.Values{"request_id": {"pages-forget"}, "revision": {strconv.FormatInt(link.Revision, 10)}}); code != http.StatusSeeOther || to != "/teams" { |
| + t.Fatalf("Forget without script: %d to %q", code, to) |
| + } |
| + if after := r.get(owner, "/teams", 200); strings.Contains(after, `data-team-name="Studio"`) || !strings.Contains(after, "No other teams yet.") { |
| + t.Error("Forget without script did not forget, or no empty line") |
| + } |
| +} |
| + |
| +// between is the part of page from start up to the first end after it. |
| +func between(t *testing.T, page, start, end string) string { |
| + t.Helper() |
| + i := strings.Index(page, start) |
| + if i < 0 { |
| + t.Fatalf("no %s", start) |
| + } |
| + j := strings.Index(page[i:], end) |
| + if j < 0 { |
| + t.Fatalf("no %s after %s", end, start) |
| + } |
| + return page[i : i+j] |
| +} |