From d7fbdce04d696441216f8a094e4fde0eeeca3ee8 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 1 Oct 2026 12:24:44 +0000 Subject: [PATCH] Extension: icon-state feedback + overlay picker instead of inline panels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- backend/extension-src/content-script.js | 337 +++++++++++++++--------- backend/extension-src/popup/popup.js | 13 +- 2 files changed, 214 insertions(+), 136 deletions(-) diff --git a/backend/extension-src/content-script.js b/backend/extension-src/content-script.js index c13cfb0..f437cad 100644 --- a/backend/extension-src/content-script.js +++ b/backend/extension-src/content-script.js @@ -95,7 +95,7 @@ function makeSendButton(bookingId, guestName, variant = 'block') { btn.id = `tcp-btn-${bookingId}-${variant}`; btn.type = 'button'; btn.className = variant === 'block' ? 'button most_width' : 'button'; - btn.innerHTML = ' Tablet Push'; + btn.innerHTML = ' Tablet Push'; btn.style.cssText = ` ${variant === 'block' ? 'margin-top: 6px;' : 'margin-right: 8px;'} background: #be123c; border-color: #be123c; color: #fff; @@ -103,121 +103,193 @@ function makeSendButton(bookingId, guestName, variant = 'block') { btn.addEventListener('click', e => { e.preventDefault(); e.stopPropagation(); - handleSendClick(btn, bookingId, guestName, variant); + handleSendClick(btn, bookingId, guestName); }); return btn; } +function escapeHtml(s) { + const div = document.createElement('div'); + div.textContent = s; + return div.innerHTML; +} + +// Visual feedback is split two ways: a per-button icon swap for the simple +// pass/fail cases (no page real estate taken, self-explanatory at a glance), +// and the picker overlay below for anything that actually needs a human +// decision (no default configured, default busy, default offline). Detail +// text lives in the title attribute (hover tooltip) rather than a persistent +// inline block — keeps every variant (table-cell row, banner, nav-bar menu +// item) visually identical instead of needing per-container layout math. +const STATE_ICON = { + idle: 'fa-tablet-alt', + loading: 'fa-spinner fa-spin', + success: 'fa-check', + warning: 'fa-exclamation-triangle', + error: 'fa-exclamation-triangle', +}; +const STATE_BG = { + idle: '#be123c', + loading: '#be123c', + success: '#166534', + warning: '#b45309', + error: '#dc2626', +}; +const STATE_ICON_COLOR = { + success: '#86efac', + warning: '#fde68a', + error: '#fecaca', +}; + +//