diff --git a/viz/app/store_page.js b/viz/app/store_page.js index bf23190..8fed0d7 100644 --- a/viz/app/store_page.js +++ b/viz/app/store_page.js @@ -579,35 +579,36 @@ export async function renderStore($app, storeLabelRaw) { function exclusiveAnnotHtml(it) { const mode = String($exSort.value || "priceDesc"); - + // If sorting by sale, annotate with sale change ($ / %). If unchanged, show nothing. if (mode === "salePct") { const p = Number.isFinite(it._salePct) ? it._salePct : 0; if (!p) return ""; const abs = Math.abs(p); - if (p < 0) return `${esc(abs)}% off`; - return `+${esc(abs)}%`; + if (p < 0) return `[${esc(abs)}% Off]`; + return `[+${esc(abs)}%]`; } - + if (mode === "saleAbs") { const d = Number.isFinite(it._saleDelta) ? it._saleDelta : 0; if (!d) return ""; const abs = Math.round(Math.abs(d)); if (!abs) return ""; - if (d < 0) return `$${esc(abs)} off`; - return `+$${esc(abs)}`; + if (d < 0) return `[-$${esc(abs)}]`; + return `[+$${esc(abs)}]`; } - + // Otherwise: show % off vs best other store (only when actually cheaper). const sp = it && Number.isFinite(it._storePrice) ? it._storePrice : null; const other = it && Number.isFinite(it._bestOther) ? it._bestOther : null; if (sp === null || other === null || !(other > 0)) return ""; if (!(sp < other - EPS)) return ""; - + const pct = Math.round(((other - sp) / other) * 100); if (!Number.isFinite(pct) || pct <= 0) return ""; - return `${esc(pct)}% off`; + return `[${esc(pct)}% Off]`; } + function renderCard(it) { const price = listingPriceStr(it);