Repository navigation
feat(web): LAN modal stays open — status panel, QR connect, loopback link - #200
Conversation
… link Enable-LAN used to close the dialog before the async rebind (the "dialog-closes-first" quirk), leaving only toasts behind: the copyable hostname/IP URLs vanished exactly when they became reachable, and a failed bind flashed by unnoticed (issue #197). The enable flow now owns the modal until the user closes it: - confirming moves to a status panel (Enabling… → Enabled / Failed) that reports the rebind outcome inline instead of toast-only; - the enabled panel keeps the copyable hostname + IP URLs, adds the one-line "on another device" instruction, and an explicit ❌ close (Escape works too) — the panel uses useModalA11y (#146); - a QR encoding the IP URL appears once LAN is actually enabled, reusing generateBarcode / POST /api/actions/barcode — no new client dependency, display-only for phone scanning (issue #198); - a clickable http://127.0.0.1:{port} link sits alongside the copyable URLs in both phases — loopback always resolves on this machine and gives a one-click re-entry for --server-only runs (issue #199). The restrict path keeps its historical confirm-and-vanish flow, the App.tsx contract is unchanged (pending/onConfirmed/onCancel), and a stale flow can never paint over a reopened dialog (BarcodeModal's issue-#140 seq pattern). Closes #197 Closes #198 Closes #199
|
Live verification transcript (real browser, rebuilt dist served by
|
…ame UX both ways User review on PR #200 reshaped the modal into a single LAN panel used for BOTH directions: - ONE modal (LanConfirmDialog → LanModal): it reflects the live systemInfo.lan_enabled and offers the opposite action, so enable and disable share the same UX. The disable path no longer uses the confirm-and-vanish flow — it runs in place like the enable one, and the dialog-closes-first quirk is gone entirely. - QR always displayed, on the LEFT of the addresses column, even while LAN is disabled (user decision overriding #198's original gating: the URL is unreachable for other devices until enabled). - Footer buttons never disappear: Cancel + the flip action ("Enable LAN" / "Disable LAN" per the live state) stay in every state, the action disabling while a rebind is in flight. - ❌ close always visible in the header; Escape still works; initial focus sits on Cancel (ConfirmDialog safety precedent). - App contract: pending/onCancel becomes open/onClose — toggleLan ignores the requested direction and just opens the modal. 391 web tests pass (31 files); verified in the real browser across enable → disable round trip with the rebuilt dist.
|
UX revision pushed (
391 web tests pass (31 files, incl. 13 rewritten |
…olumn User review on PR #200: the header now carries the live state at a glance — icon chip (Wifi on success-green when exposed, WifiOff neutral when restricted) plus "LAN Access — Reachable on this network." / "LAN Access — Restricted to the host machine." The body status line and the "On another device…" instruction are removed (that information lives in the header), and the loopback row gets its own margin so it no longer hugs the IP address row (8px → 16px). 391 web tests pass; both states verified in the real browser with the rebuilt dist.
|
Layout adjustment pushed ( |
User review on PR #200: the "Updating the LAN binding…" progress leaves the addresses column for the footer's left slot, announced via role="status"; the Cancel + action buttons stay right (ml-auto) and the action keeps its disabled-in-flight state. The body now holds only the addresses and (on failure) the inline error box. 391 web tests pass; footer placement verified in the real browser (status is the footer's first child, same row, left of the buttons).
|
Pushed the footer placement ( |
…warning back User-approved layout from the design-mode mockup (原型/lan-modal-proposals.html): - Header split: stable "LAN Access" title over a color-coded subtitle — grey "Restricted to the host machine" / green "Reachable on this network" / amber "Updating the LAN binding…" with a mini-spinner while a rebind is in flight (chip follows: grey WifiOff, green Wifi, amber). The subtitle is the single role=status surface — the footer busy slot is gone (user review: no duplicate when the header shows it). - Addresses grouped by audience: "For other devices" with the IP URL FIRST (the one the QR encodes — caption now says "Scans the IP address") then the hostname; "This machine" holds the loopback row, which gains a copy button for symmetry. Rows get a subtle elevated background. - Security warning restored while restricted — the line the old confirm dialog carried, in the user's wording: "If Enabled, ProFiles will be reachable by anyone on this network." Hidden once LAN is on or a rebind is in flight. 391 web tests pass (31 files); verified in the real browser across an enable → disable round trip with the rebuilt dist (machine restored to loopback-only).
|
Pushed the approved mockup layout ( |
Ctrl+N — the requested mnemonic — is reserved by browsers for "new window": a page handler never fires and the WebView2 accelerator table does the same on Windows, so the LAN modal lands on Ctrl+K instead (free in this shortcut table, browser-overridable like the GitHub palette). Wired in useGlobalShortcuts next to the other surface openers, guarded by the inert-while-modal rule (#55); ShortcutsModal lists it; the second deps fixture (useBarcodeMode cross-hook harness) gains the new setter. 391 web tests pass; the handler was exercised in the real browser via the page's keydown path (real-key automation was inconclusive — the review tab runs backgrounded and Chrome suppresses input to hidden tabs — same mechanism as the table's existing shortcuts).
|
Added a Ctrl + K shortcut to open the LAN modal ( |
Resolves the three LAN-modal issues filed this morning, in one PR as planned:
http://127.0.0.1:{port}linkWhat changed
LanConfirmDialogkeeps its App contract (pending/onConfirmed/onCancel— zero App.tsx changes) but the two directions now diverge:Enable (new panel flow): confirming no longer calls
onCancel()first. The dialog moves through Enabling… → Enabled / Failed inline:useModalA11yper Web UI: DRY the modals — adopt useModalA11y in 5 hand-rolled modals; route remaining raw fetches through the API client #146 (focus trap + restore).onConfirmed(sys)+ toast, so App state stays in sync.generateBarcode({ content })→POST /api/actions/barcode(the files' "Generate QR Code" endpoint) rendered likeBarcodeModal— no new npm dependency. Generated once on entering the enabled state; failure degrades to an in-place message. Display-only, no Save button (browser-only downloads no-op in the desktop shell, Web UI: browser-only APIs break in the desktop shell — window.confirm delete is a silent no-op, QR "Save Image" never lands #31 precedent).Restrict (unchanged): keeps the historical confirm-and-vanish flow with the dialog-closes-first quirk and toast feedback, verbatim.
#199 loopback link: shown in the enable-confirm phase and the enabled panel (
target="_blank" rel="noopener noreferrer", StatusBar/MarkdownMessage precedent) — loopback always resolves on this machine, useful for--server-onlyruns.Tests
LanConfirmDialog.test.tsxrewritten: 16 tests covering confirm/restrict phases, the panel states (gated deterministic flow), QR generation + failure degradation, loopback link attributes, mid-flow close fallback to toasts, and the unchanged restrict contract.tsc -b && vite buildclean.Verified in the real browser
Served the rebuilt dist via
uv run profiles --server-onlyand drove the real flow: confirm phase (URLs + loopback link) → Enable LAN → Enabling LAN… panel → LAN access enabled with live QR PNG from the barcode endpoint → ❌ close → restrict back to loopback-only (state restored, restrict toast confirmed).