Extension: icon-state feedback + overlay picker instead of inline panels

- Injected buttons now show state via the tablet icon itself — spinner
  while sending, check on success, warning triangle on busy/offline/error —
  with detail in a hover tooltip, rather than a persistent inline text block
- Replaced the in-page dropdown panel (block-inserted for row/banner
  buttons, fixed-position floating for menu items) with a single centred
  modal overlay used by all three injection shapes — simpler than
  maintaining per-variant positioning logic, and looks the same everywhere
- Picker overlay now opens automatically when the default tablet is busy
  (409) or configured but not actually connected (delivered: false), not
  just when no default is set at all — mirrored in popup.js's own fallback

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-10-01 12:24:44 +00:00
parent 4aeca15281
commit d7fbdce04d
2 changed files with 214 additions and 136 deletions

View file

@ -126,12 +126,13 @@ function renderBooking(el, bookingId, devices, defaultDeviceId, baseUrl, apiKey)
const msgEl = document.getElementById('msg');
if (!msgEl) return; // "Send to a different tablet" was clicked before this resolved
if (result.ok) {
if (result.delivered === false) {
setMsg(msgEl, 'Sent, but that tablet isn’t connected right now — it’ll pick this up if it reconnects.', 'warn');
} else {
setMsg(msgEl, 'Sent — the tablet should navigate now.', 'ok');
}
if (result.ok && result.delivered !== false) {
setMsg(msgEl, 'Sent — the tablet should navigate now.', 'ok');
} else if (result.ok) {
// Session created server-side but nothing's actually listening on
// that device right now — same "needs a human decision" case as
// busy, so offer the picker rather than a dead-end message.
renderPicker(el, bookingId, devices, defaultDeviceId, baseUrl, apiKey, 'Default tablet isn’t connected — choose another:');
} else if (result.status === 409) {
// Default went busy in the moment between loading the popup and
// sending — fall back to the manual picker rather than leaving the