fix(devices): pairing input moves into the Add Device modal

The pairing field sat at the bottom of the Devices page, below the
device grid — unreachable on any account with more than a screenful of
devices (the user's dev account has ~480 accumulated test devices;
scrolling 224k px to reach the field is a non-starter). The Add Device
button at the top of the page is where pairing intent already lives,
so the code input and Find device button now sit inside the Connect a
KOReader Device modal as instruction step 6, with the confirm card
swapping into the same modal (container keeps the pairing-lookup ids;
the htmx error-toast listener scopes to #add-device-modal now).

Verified live: modal renders the full instruction list + input, a
wrong code swaps the templ error partial inside the modal, and claim
still HX-Refreshes on success (modal state resets with the reload,
paired device appears in the grid).

ui-controls glossary where-fields and the COVERAGE row updated with
the control's new home.
This commit is contained in:
John O'Keefe committed 2026-11-02 16:56:32 -05:00
1 parent 5211edf264
commit d15f115505
5 files changed
+47 -55

No files matched your search

+5 -5
View File
@@ -463,13 +463,13 @@ function setupEventDelegation(): void {
}
});
// Pairing section: htmx only swaps 2xx bodies, so claim/lookup failures
// (wrong code, rate limit, expired) would otherwise fail silently.
// Content-level answers come from the templ partial; this toast covers
// the non-swap error path.
// Pairing (Add Device modal): htmx only swaps 2xx bodies, so claim/lookup
// failures (wrong code, rate limit, expired) would otherwise fail
// silently. Content-level answers come from the templ partial; this
// toast covers the non-swap error path.
document.body.addEventListener("htmx:responseError", (e) => {
const detail = (e as CustomEvent<{ requestConfig?: { elt?: Element } }>).detail;
if (detail?.requestConfig?.elt?.closest("#pairing-section")) {
if (detail?.requestConfig?.elt?.closest("#add-device-modal")) {
showToast("Pairing failed — check the code and try again.", "error");
}
});