diff --git a/assets/js/app.js b/assets/js/app.js index 69a682e..a2c72d4 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -112,6 +112,9 @@ function _updateGeminiButtonState() { function _applyDemoModeUI() { if (!_demoMode) return; + // In demo mode Gemini is always "available" — no real key needed + _geminiAvailable = true; + _updateGeminiButtonState(); // Hide the settings ⚙️ nav button document.querySelectorAll('.nav-btn[data-page="settings"]').forEach(btn => { btn.style.display = 'none'; @@ -119,7 +122,7 @@ function _applyDemoModeUI() { // Prevent the setup wizard from showing const wizard = document.getElementById('setup-wizard'); if (wizard) wizard.style.display = 'none'; - // Optionally show a small demo badge in the header + // Show a small demo badge in the header const headerLeft = document.getElementById('header-left'); if (headerLeft && !document.getElementById('_demo_badge')) { const badge = document.createElement('span'); @@ -2233,6 +2236,17 @@ function togglePasswordVisibility(inputId) { // ===== API HELPER ===== async function api(action, params = {}, method = 'GET', body = null, extraHeaders = {}) { + // In demo mode, all Bring! write operations are no-ops + if (_demoMode) { + const BRING_WRITE_ACTIONS = ['bring_add', 'bring_remove', 'bring_migrate_names', 'bring_set_spec']; + if (BRING_WRITE_ACTIONS.includes(action)) { + return { success: true, added: 0, removed: 0, skipped: 0, _demo: true }; + } + // bring_list returns the in-memory demo list + if (action === 'bring_list') { + return { success: true, purchase: shoppingItems, listUUID: 'demo-list', _demo: true }; + } + } let url = `${API_BASE}?action=${action}`; if (method === 'GET') { Object.entries(params).forEach(([k, v]) => { @@ -8636,6 +8650,28 @@ async function loadShoppingList() { statusEl.innerHTML = `
Mostra un orologio con fatti utili dopo 5 minuti di inattività. Di default è disattivato.
+Mostra un orologio con fatti utili dopo 5 minuti di inattività. Di default è disattivato.