From 2882017876ab658e096faf9096ff7d235ec4cb50 Mon Sep 17 00:00:00 2001 From: "Brennan Wilkes (Text Groove)" Date: Tue, 20 Jan 2026 14:08:21 -0800 Subject: [PATCH] feat: Better URL rendering --- viz/app/linker_page.js | 27 ++++++++++++++------------- viz/app/search_page.js | 31 +++++++++++++++++++++++-------- viz/style.css | 4 ++++ 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/viz/app/linker_page.js b/viz/app/linker_page.js index 9e8d20d..c010007 100644 --- a/viz/app/linker_page.js +++ b/viz/app/linker_page.js @@ -1,3 +1,4 @@ +/* viz/app/linker_page.js */ import { esc, renderThumbHtml } from "./dom.js"; import { tokenizeQuery, @@ -110,14 +111,6 @@ function buildMappedSkuSet(links) { return s; } -function openLinkHtml(url) { - const u = String(url || "").trim(); - if (!u) return ""; - return `open`; -} - function isBCStoreLabel(label) { const s = String(label || "").toLowerCase(); return s.includes("bcl") || s.includes("strath"); @@ -381,7 +374,17 @@ export async function renderSkuLinker($app) { const plus = storeCount > 1 ? ` +${storeCount - 1}` : ""; const price = it.cheapestPriceStr ? it.cheapestPriceStr : "(no price)"; const store = it.cheapestStoreLabel || ([...it.stores][0] || "Store"); - const open = openLinkHtml(it.sampleUrl || ""); + + // NEW: store badge is the link (use first store url) + const href = String(it.sampleUrl || "").trim(); + const storeBadge = href + ? `${esc( + store + )}${esc(plus)}` + : `${esc(store)}${esc(plus)}`; + return `
@@ -393,10 +396,8 @@ export async function renderSkuLinker($app) {
${esc(price)} - ${esc(store)}${esc(plus)} - ${open} + ${storeBadge}
-
${esc(it.sampleUrl || "")}
${pinned ? `
Pinned (click again to unpin)
` : ``}
@@ -639,7 +640,7 @@ export async function renderSkuLinker($app) { return; } if (isIgnoredPair(a, b)) { - $status.textContent = "This pair is already ignored."; + $status.textContent = "Not allowed: unknown SKUs cannot be ignored."; return; } diff --git a/viz/app/search_page.js b/viz/app/search_page.js index 98dca4e..2897163 100644 --- a/viz/app/search_page.js +++ b/viz/app/search_page.js @@ -1,3 +1,4 @@ +/* viz/app/search_page.js */ import { esc, renderThumbHtml, prettyTs } from "./dom.js"; import { tokenizeQuery, matchesAllTokens, displaySku } from "./sku.js"; import { loadIndex, loadRecent, loadSavedQuery, saveQuery } from "./state.js"; @@ -45,6 +46,16 @@ export function renderSearch($app) { const price = it.cheapestPriceStr ? it.cheapestPriceStr : "(no price)"; const store = it.cheapestStoreLabel || ([...it.stores][0] || "Store"); + // NEW: store badge is the link (use first store url) + const href = String(it.sampleUrl || "").trim(); + const storeBadge = href + ? `${esc( + store + )}${esc(plus)}` + : `${esc(store)}${esc(plus)}`; + return `
@@ -58,10 +69,7 @@ export function renderSearch($app) {
${esc(price)} - ${esc(store)}${esc(plus)} -
-
- ${esc(it.sampleUrl || "")} + ${storeBadge}
@@ -123,6 +131,16 @@ export function renderSearch($app) { const img = aggBySku.get(sku)?.img || ""; + // NEW: store badge links to this row's url + const href = String(r.url || "").trim(); + const storeBadge = href + ? `${esc( + r.storeLabel || "" + )}` + : `${esc(r.storeLabel || "")}`; + return `
@@ -136,15 +154,12 @@ export function renderSearch($app) {
${esc(kind)} - ${esc(r.storeLabel || "")} + ${storeBadge} ${esc(priceLine)}
${esc(when)}
-
- ${esc(r.url || "")} -
diff --git a/viz/style.css b/viz/style.css index 16d6686..51017d6 100644 --- a/viz/style.css +++ b/viz/style.css @@ -1,3 +1,4 @@ +/* viz/style.css */ :root { --bg: #0b0d10; --panel: #12161b; @@ -18,6 +19,9 @@ body { a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; } +/* NEW: don't underline badge-links on hover */ +a.badge:hover { text-decoration: none; } + .container { max-width: 980px; margin: 0 auto;