feat(dev): lab ⋯ menu — repo link + auto-close #99
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos#99
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Two improvements to the lab's per-project
⋯menu (the per-card menu where AFK runs are handled), inhosts/fw/vms/dev/modules/lab:Single PR, commit scope
feat(dev):(lab is vendored under the dev microVM, ADR-0004).1. Repository link (Forgejo-only)
Repository ↗row at the bottom of the⋯menu, below a 1px divider, after the existing AFK controls (Start AFK run / Auto / Reset).https://git.cloonar.com/<Owner>/<Repo>, opening in a new tab (target="_blank" rel="noopener").Implementation:
forgejo.go: addfunc (f forgejoInfo) RepoURL() stringbuildinghttps://<forgejoHost>/<Owner>/<Repo>(keepsforgejoHostthe single source of the host); returns "" when!IsForgejo.handlers.go: addRepoURL stringtoprojectGroup; populate at the snapshot site (~:697) fromforgejoFor(p.Path).RepoURL().templates/index.html: render<a class="menu-item" href="{{.RepoURL}}" target="_blank" rel="noopener">Repository ↗</a>inside the{{if .Forgejo}}block, after the AFK forms, preceded by a.menu-sepdivider.a.menu-item:hover { background: var(--hover); }(current hover rule isbutton-scoped); add a.menu-seprule (1pxvar(--border)). The existing.menu-itembase already supplies the 44px tap target.2. Auto-close
The
⋯menu (<details class="menu">) currently never closes on its own: the DOM-morph deliberately preserves theopenattribute across the ~4s poll (patchAttrsskipsopen). Add explicit, event-driven auto-close without touching that morph rule, so a background refresh still never snaps an open menu shut:documentclick handler (+ akeydownfor Escape). For each opendetails.menu: click on its own<summary>→ do nothing (native toggle owns it); click inside its.menu-list→ close; click outside the menu → close. Gives accordion behavior for free (opening one closes another).<summary>toggle; and since we close via JS while the morph leavesopenuntouched, a later morph keeps it closed.<details>still opens/closes by tapping⋯(graceful degradation; auto-close is a JS-only enhancement).Testing
forgejo_test.goforRepoURL(), plus snapshot/handlers rendering): rungo test ./... && go vet ./... && go build ./...locally — the pre-commit hook is eval-only (nix-instantiate) and does not run Go tests./tmp(ADR-0004, no committed JS harness) — assert outside-click, action-click, and Escape each close the menu; summary-click still toggles; and a simulatedapply()morph neither reopens a closed menu nor closes an open one.Acceptance criteria
⋯menu showsRepository ↗at the bottom under a divider; openshttps://git.cloonar.com/<owner>/<repo>in a new tab.⋯still opens/closes normally; the background poll never opens or closes the menu on its own.go test ./... && go vet ./... && go build ./...pass; JS behavior verified via jsdom.feat(dev):scope.