diff --git a/assets/css/style.css b/assets/css/style.css index 1847f07..2e01a4b 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -5767,6 +5767,47 @@ body.cooking-mode-active .app-header { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); } +.screensaver-shopping { + text-align: center; + user-select: none; + margin: -8px 0 0; +} +.screensaver-shopping-card { + display: inline-flex; + align-items: center; + gap: 18px; + background: rgba(255,255,255,0.07); + border: 1px solid rgba(255,255,255,0.13); + border-radius: 20px; + padding: 14px 32px; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); +} +.ss-shop-col { + display: flex; + flex-direction: column; + align-items: center; + gap: 2px; +} +.ss-shop-sep { + width: 1px; + height: 36px; + background: rgba(255,255,255,0.18); +} +.ss-shop-value { + color: rgba(255,255,255,0.92); + font-size: 1.9rem; + font-weight: 300; + letter-spacing: 1px; + line-height: 1; +} +.ss-shop-label { + color: rgba(255,255,255,0.38); + font-size: 0.8rem; + font-weight: 400; + letter-spacing: 0.8px; + text-transform: uppercase; +} .screensaver-shortcuts { position: absolute; bottom: max(32px, env(safe-area-inset-bottom, 32px)); diff --git a/assets/js/app.js b/assets/js/app.js index 4f8f36b..04afa63 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -12448,6 +12448,7 @@ function activateScreensaver() { requestAnimationFrame(() => overlay.classList.add('visible')); updateScreensaverClock(); _screensaverClockInterval = setInterval(updateScreensaverClock, 1000); + updateScreensaverShopping(); // Load data and start fact/nutrition rotation loadScreensaverData().then(() => { _startScreensaverRotation(); @@ -12465,6 +12466,34 @@ function updateScreensaverClock() { } /** Show/hide the planned meal type badge on the screensaver based on current time slot. */ +function updateScreensaverShopping() { + const el = document.getElementById('screensaver-shopping'); + if (!el) return; + const s = getSettings(); + const itemCount = shoppingItems.length; + if (itemCount === 0) { el.style.display = 'none'; return; } + + const countCol = `
+
${itemCount}
+
๐Ÿ›’ articoli
+
`; + + let priceCol = ''; + if (s.price_enabled) { + const saved = sessionStorage.getItem('_pricetotal'); + if (saved) { + priceCol = `
+
+
${saved.replace('ca. ', '')}
+
๐Ÿ’ฐ spesa stimata
+
`; + } + } + + el.innerHTML = `
${countCol}${priceCol}
`; + el.style.display = 'block'; +} + function updateScreensaverMealPlan() { const el = document.getElementById('screensaver-mealplan'); if (!el) return; @@ -12759,36 +12788,29 @@ function generateScreensaverFact() { facts.push(() => `In questo mese scadranno ${expiringThisMonth.length} prodotti.`); } - // --- Shopping list facts --- + // --- Shopping list facts (skip count/names โ€” already shown in the shopping panel) --- if (shop.length > 0) { - facts.push(() => `Hai ${shop.length} ${shop.length === 1 ? 'prodotto' : 'prodotti'} nella lista della spesa.`); - facts.push(() => { - const names = shop.slice(0, 4).map(i => i.name); - return `Nella spesa: ${names.join(', ')}${shop.length > 4 ? '...' : ''}`; - }); + const names = shop.slice(0, 3).map(i => i.name).join(', '); + const extra = shop.length > 3 ? ` e altri ${shop.length - 3}` : ''; + facts.push(() => `Metti in lista: ${names}${extra} ๐Ÿ›’`); } if (shop.length === 0) { - facts.push(() => `La lista della spesa รจ vuota. Tutto a posto!`); + facts.push(() => `Lista della spesa vuota. Tutto rifornito! โœ…`); } // --- Location-based facts --- if (inFrigo.length > 0) { - facts.push(() => `Hai ${inFrigo.length} prodotti in frigo.`); facts.push(() => { const item = rItem(inFrigo); return `In frigo c'รจ: ${item.name}${item.brand ? ' (' + item.brand + ')' : ''}.`; }); } if (inFreezer.length > 0) { - facts.push(() => `Hai ${inFreezer.length} prodotti nel freezer.`); facts.push(() => { const item = rItem(inFreezer); return `Nel freezer c'รจ: ${item.name}. Non dimenticartelo!`; }); } - if (inDispensa.length > 0) { - facts.push(() => `In dispensa ci sono ${inDispensa.length} prodotti.`); - } // --- Category-based facts --- const catEntries = Object.entries(byCategory); @@ -12834,7 +12856,6 @@ function generateScreensaverFact() { // --- General inventory facts --- if (inv.length > 0) { - facts.push(() => `Hai ${totalProducts} prodotti diversi in casa per un totale di ${Math.round(totalItems)} pezzi.`); facts.push(() => { const item = rItem(inv); return `Lo sapevi? Hai ${item.name} in ${LOCATIONS[item.location]?.label || item.location}.`; diff --git a/index.html b/index.html index b7dfab9..9886dcc 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ EverShelf - + @@ -1416,6 +1416,7 @@ - +