[object Object]

← back to Dw Collections Viewer

color preview toast green/red by product-count delta

3b2d32d6cff81dd134994760b9a9cbccf0f1050c · 2026-05-06 11:26:14 -0700 · SteveStudio2

Files touched

Diff

commit 3b2d32d6cff81dd134994760b9a9cbccf0f1050c
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 6 11:26:14 2026 -0700

    color preview toast green/red by product-count delta
---
 public/index.html | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/public/index.html b/public/index.html
index bcfa86c..53d7313 100644
--- a/public/index.html
+++ b/public/index.html
@@ -152,6 +152,8 @@ aside { border-left: 1px solid var(--rule); background: var(--bg2);
   display: none; z-index: 100; max-width: 460px }
 .toast.show { display: block }
 .toast.err { border-color: var(--red); color: var(--red) }
+.toast.up { border-color: var(--green); color: var(--green) }
+.toast.down { border-color: var(--red); color: var(--red) }
 
 /* Bulk-mode toolbar */
 .toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap }
@@ -243,10 +245,14 @@ let SUGGESTIONS = {};  // slug → array of suggested collections
 let PRODUCTS = [], PRODUCT_SELECTED = new Set(), PRODUCTS_LOADING = false;
 
 function esc(s) { return String(s||'').replace(/[<>&"']/g, c => ({'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;',"'":'&#39;'}[c])); }
-function toast(msg, ok = true) {
+function toast(msg, ok = true, tone = null) {
   const t = document.getElementById('toast');
   t.textContent = msg;
-  t.className = 'toast show ' + (ok ? '' : 'err');
+  let cls = 'toast show';
+  if (!ok) cls += ' err';
+  else if (tone === 'up') cls += ' up';
+  else if (tone === 'down') cls += ' down';
+  t.className = cls;
   setTimeout(() => t.classList.remove('show'), 4000);
 }
 
@@ -637,7 +643,8 @@ async function persistCollsAndRefresh() {
         const after = j2.total_unique || 0;
         const delta = after - before;
         const sign = delta > 0 ? `+${delta}` : `${delta}`;
-        toast(`previewed · ${before} → ${after} products (${sign}, not deployed)`);
+        const tone = delta > 0 ? 'up' : (delta < 0 ? 'down' : null);
+        toast(`previewed · ${before} → ${after} products (${sign}, not deployed)`, true, tone);
         await fetchProducts(slug);
         await loadSites();
       } while (_persistPending && CURRENT);

← 9c53f65 add Save & Deploy combined button (one-click save + render +  ·  back to Dw Collections Viewer  ·  show SKU + published_at in product card hover tooltip 7455efd →