fix: scale dot white+glow, kiosk reconfigure fallback, live weight in settings

style.css:
- Connected dot: white fill + green border/glow (was green-on-green, invisible)

app.js:
- _kioskReconfigureScale(): show #kiosk-needs-update-notice + toast when
  kiosk APK is too old and reconfigureScale() method is missing
- _scaleUpdateStatus(): show/hide #scale-live-diag panel, update device + battery
- _scaleOnMessage weight: update #scale-diag-weight in real time
- _scaleOnMessage status: update #scale-diag-proto with BLE protocol

index.html:
- #kiosk-needs-update-notice: amber warning + download link inside kiosk panel
- #scale-live-diag: device name, battery, live weight readout, reconnect info
- CSS cache bump ?v=20260506d
This commit is contained in:
dadaloop82
2026-05-06 14:07:29 +00:00
parent e002cc4483
commit 891733aa8c
3 changed files with 53 additions and 4 deletions
+2 -2
View File
@@ -308,8 +308,8 @@ body {
transition: background 0.4s, box-shadow 0.4s, border-color 0.4s; transition: background 0.4s, box-shadow 0.4s, border-color 0.4s;
pointer-events: none; pointer-events: none;
} }
/* Connected: bright green fill + white border — visible on both dark and light backgrounds */ /* Connected: white fill + bright-green border ring — clearly visible on any dark/green bg */
.scale-status-connected .scale-status-dot { background: #4ade80; border-color: rgba(255,255,255,0.9); box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 0 6px #4ade80bb; } .scale-status-connected .scale-status-dot { background: #ffffff; border-color: #4ade80; box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 0 8px #4ade80cc, 0 0 2px #fff; }
.scale-status-connected .scale-icon-emoji { filter: none; opacity: 1; } .scale-status-connected .scale-icon-emoji { filter: none; opacity: 1; }
.scale-status-searching .scale-status-dot { background: #f59e0b; border-color: rgba(0,0,0,0.35); animation: scaleStatusPulse 1.4s infinite; } .scale-status-searching .scale-status-dot { background: #f59e0b; border-color: rgba(0,0,0,0.35); animation: scaleStatusPulse 1.4s infinite; }
.scale-status-searching .scale-icon-emoji { filter: none; opacity: 0.85; } .scale-status-searching .scale-icon-emoji { filter: none; opacity: 0.85; }
+28 -1
View File
@@ -290,6 +290,11 @@ function _scaleOnMessage(msg) {
_scaleDevice = msg.device || null; _scaleDevice = msg.device || null;
_scaleBattery = msg.battery ?? null; _scaleBattery = msg.battery ?? null;
_scaleUpdateStatus(_scaleConnected ? 'connected' : 'searching'); _scaleUpdateStatus(_scaleConnected ? 'connected' : 'searching');
// Update protocol info in settings diagnostic
if (msg.protocol) {
const protoEl = document.getElementById('scale-diag-proto');
if (protoEl) protoEl.textContent = `📡 ${msg.protocol}`;
}
// Refresh all scale UI elements immediately so buttons/live-box appear // Refresh all scale UI elements immediately so buttons/live-box appear
// without requiring a manual page refresh // without requiring a manual page refresh
updateScaleReadButtons(); updateScaleReadButtons();
@@ -322,6 +327,9 @@ function _scaleOnMessage(msg) {
// Also update edit-form inline scale reading if visible // Also update edit-form inline scale reading if visible
const editLive = document.getElementById('edit-scale-reading'); const editLive = document.getElementById('edit-scale-reading');
if (editLive) editLive.textContent = `${msg.value} ${msg.unit || 'kg'}${liveMsg.stable ? ' ✓' : ' …'}`; if (editLive) editLive.textContent = `${msg.value} ${msg.unit || 'kg'}${liveMsg.stable ? ' ✓' : ' …'}`;
// Update settings diagnostic live weight
const diagW = document.getElementById('scale-diag-weight');
if (diagW) diagW.textContent = `${parseFloat(msg.value).toFixed(1)} ${msg.unit || 'g'}`;
// Always update the persistent live box on the use page (every message, stable or not) // Always update the persistent live box on the use page (every message, stable or not)
_scaleUpdateLiveBox(liveMsg); _scaleUpdateLiveBox(liveMsg);
// If weight is NOT stable: stop any running timer/bar but keep the sentinel value. // If weight is NOT stable: stop any running timer/bar but keep the sentinel value.
@@ -803,6 +811,20 @@ function _scaleUpdateStatus(state) {
error: `⚖️ ${t('scale.status_error')}`, error: `⚖️ ${t('scale.status_error')}`,
}; };
el.title = labels[state] || ''; el.title = labels[state] || '';
// Update settings live-diagnostic panel
const diag = document.getElementById('scale-live-diag');
if (!diag) return;
diag.style.display = state === 'connected' ? '' : 'none';
if (state === 'connected') {
const devEl = document.getElementById('scale-diag-device');
const batEl = document.getElementById('scale-diag-battery');
if (devEl) devEl.textContent = _scaleDevice || 'Dispositivo sconosciuto';
if (batEl) batEl.textContent = _scaleBattery != null ? `🔋 ${_scaleBattery}%` : '';
const weightEl = document.getElementById('scale-diag-weight');
if (weightEl && _scaleLatestWeight) {
weightEl.textContent = `${parseFloat(_scaleLatestWeight.value).toFixed(1)} ${_scaleLatestWeight.unit || 'g'}`;
}
}
} }
/** /**
@@ -2038,7 +2060,12 @@ async function loadSettingsUI() {
function _kioskReconfigureScale() { function _kioskReconfigureScale() {
if (typeof _kioskBridge === 'undefined') return; if (typeof _kioskBridge === 'undefined') return;
if (typeof _kioskBridge.reconfigureScale === 'function') { if (typeof _kioskBridge.reconfigureScale === 'function') {
_kioskBridge.reconfigureScale(); try { _kioskBridge.reconfigureScale(); } catch(e) {}
} else {
// Kiosk APK is outdated — show update notice
const notice = document.getElementById('kiosk-needs-update-notice');
if (notice) notice.style.display = '';
showToast('⚠️ Aggiorna il kiosk per usare questa funzione', 'warning');
} }
} }
+23 -1
View File
@@ -11,7 +11,7 @@
<title>EverShelf</title> <title>EverShelf</title>
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<link rel="icon" type="image/png" href="assets/img/logo/logo_icon.png"> <link rel="icon" type="image/png" href="assets/img/logo/logo_icon.png">
<link rel="stylesheet" href="assets/css/style.css?v=20260506c"> <link rel="stylesheet" href="assets/css/style.css?v=20260506d">
<!-- QuaggaJS for barcode scanning --> <!-- QuaggaJS for barcode scanning -->
<script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script>
<!-- @xenova/transformers: ES-module bootstrap that exposes a lazy category-classifier as window._categoryPipelinePromise --> <!-- @xenova/transformers: ES-module bootstrap that exposes a lazy category-classifier as window._categoryPipelinePromise -->
@@ -1042,6 +1042,12 @@
<p style="margin:0 0 6px;font-weight:600">📡 Bilancia BLE integrata nel Kiosk</p> <p style="margin:0 0 6px;font-weight:600">📡 Bilancia BLE integrata nel Kiosk</p>
<p class="settings-hint" style="margin-bottom:12px">La bilancia è gestita direttamente dal Gateway BLE interno al kiosk. Per abbinare un nuovo dispositivo usa il wizard di configurazione.</p> <p class="settings-hint" style="margin-bottom:12px">La bilancia è gestita direttamente dal Gateway BLE interno al kiosk. Per abbinare un nuovo dispositivo usa il wizard di configurazione.</p>
<button class="btn btn-secondary full-width" onclick="_kioskReconfigureScale()">🔄 Riconfigura bilancia BLE</button> <button class="btn btn-secondary full-width" onclick="_kioskReconfigureScale()">🔄 Riconfigura bilancia BLE</button>
<!-- shown when kiosk APK is too old to have reconfigureScale() -->
<div id="kiosk-needs-update-notice" style="display:none;margin-top:10px;padding:8px 12px;background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.35);border-radius:8px;font-size:0.83rem">
⚠️ Il kiosk installato non supporta questa funzione.
Aggiorna l'app kiosk per abilitarla.
<a href="https://github.com/dadaloop82/EverShelf/releases/download/kiosk-latest/evershelf-kiosk.apk" target="_blank" rel="noopener noreferrer" style="display:block;margin-top:6px;color:#d97706;font-weight:600;text-decoration:none">📥 Scarica aggiornamento kiosk</a>
</div>
</div> </div>
<!-- Download gateway app --> <!-- Download gateway app -->
@@ -1080,6 +1086,22 @@
<div id="scale-test-status" style="display:none;margin-top:8px" class="settings-status"></div> <div id="scale-test-status" style="display:none;margin-top:8px" class="settings-status"></div>
</div> </div>
<!-- Live diagnostic: device info + real-time weight (visible when connected) -->
<div id="scale-live-diag" style="display:none;margin-top:14px;padding:12px 14px;background:var(--bg-secondary,#f8fafc);border-radius:10px;border:1px solid var(--border,#e2e8f0)">
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px">
<span style="font-size:0.8rem;color:var(--text-secondary)">🔗 <span id="scale-diag-device"></span></span>
<span id="scale-diag-battery" style="font-size:0.8rem;color:var(--text-secondary)"></span>
</div>
<div style="text-align:center">
<div id="scale-diag-weight" style="font-size:2rem;font-weight:700;line-height:1;letter-spacing:1px">— g</div>
<div style="font-size:0.72rem;color:var(--text-secondary);margin-top:3px">peso in tempo reale</div>
</div>
<div style="margin-top:10px;display:flex;gap:8px;font-size:0.78rem;color:var(--text-secondary)">
<span>🔁 Riconnessione: automatica</span>
<span style="margin-left:auto" id="scale-diag-proto"></span>
</div>
</div>
<!-- Protocol info --> <!-- Protocol info -->
<div class="settings-hint" style="margin-top:16px;padding:10px;background:var(--bg-secondary,#f8fafc);border-radius:8px"> <div class="settings-hint" style="margin-top:16px;padding:10px;background:var(--bg-secondary,#f8fafc);border-radius:8px">
<p style="margin:0 0 6px;font-weight:600">🔌 Protocolli BLE supportati:</p> <p style="margin:0 0 6px;font-weight:600">🔌 Protocolli BLE supportati:</p>