mirror of
https://github.com/samsonjs/spirit-tracker.git
synced 2026-03-25 09:25:51 +00:00
fix: Recent SKUs
This commit is contained in:
parent
be5fd437ff
commit
da13f919bf
1 changed files with 9 additions and 3 deletions
|
|
@ -157,16 +157,22 @@ export function renderSearch($app) {
|
||||||
const when = r.ts ? prettyTs(r.ts) : r.date || "";
|
const when = r.ts ? prettyTs(r.ts) : r.date || "";
|
||||||
const rawSku = String(r.sku || "");
|
const rawSku = String(r.sku || "");
|
||||||
const sku = canon(rawSku);
|
const sku = canon(rawSku);
|
||||||
const img = aggBySku.get(sku)?.img || "";
|
|
||||||
|
const agg = aggBySku.get(sku) || null;
|
||||||
|
const img = agg?.img || "";
|
||||||
|
|
||||||
|
// show "+N" if the canonical SKU exists in other stores (via SKU mapping)
|
||||||
|
const storeCount = agg?.stores?.size || 0;
|
||||||
|
const plus = storeCount > 1 ? ` +${storeCount - 1}` : "";
|
||||||
|
|
||||||
const href = String(r.url || "").trim();
|
const href = String(r.url || "").trim();
|
||||||
const storeBadge = href
|
const storeBadge = href
|
||||||
? `<a class="badge" href="${esc(
|
? `<a class="badge" href="${esc(
|
||||||
href
|
href
|
||||||
)}" target="_blank" rel="noopener noreferrer" onclick="event.stopPropagation()">${esc(
|
)}" target="_blank" rel="noopener noreferrer" onclick="event.stopPropagation()">${esc(
|
||||||
r.storeLabel || ""
|
(r.storeLabel || "") + plus
|
||||||
)}</a>`
|
)}</a>`
|
||||||
: `<span class="badge">${esc(r.storeLabel || "")}</span>`;
|
: `<span class="badge">${esc((r.storeLabel || "") + plus)}</span>`;
|
||||||
|
|
||||||
// date as a badge so it sits nicely in the single meta row
|
// date as a badge so it sits nicely in the single meta row
|
||||||
const dateBadge = when ? `<span class="badge mono">${esc(when)}</span>` : "";
|
const dateBadge = when ? `<span class="badge mono">${esc(when)}</span>` : "";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue