mirror of
https://github.com/samsonjs/spirit-tracker.git
synced 2026-03-25 09:25:51 +00:00
UX Improvements
This commit is contained in:
parent
1a5b638c58
commit
8531eba4e3
1 changed files with 6 additions and 11 deletions
|
|
@ -598,19 +598,14 @@ export async function renderStore($app, storeLabelRaw) {
|
||||||
return `<span class="badge badgeBad">+$${esc(abs)}</span>`;
|
return `<span class="badge badgeBad">+$${esc(abs)}</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any non-sale sort: still show % off on exclusives/last-stock when applicable.
|
// Any NON-sale sort: still show the % badge (same as Sale %) when there was a change.
|
||||||
// (% off vs best other store price)
|
const p = Number.isFinite(it._salePct) ? it._salePct : 0;
|
||||||
const sp = it && Number.isFinite(it._storePrice) ? it._storePrice : null;
|
if (!p) return "";
|
||||||
const other = it && Number.isFinite(it._bestOther) ? it._bestOther : null;
|
const abs = Math.abs(p);
|
||||||
if (sp === null || other === null || !(other > 0)) return "";
|
if (p < 0) return `<span class="badge badgeGood">${esc(abs)}% off</span>`;
|
||||||
if (!(sp < other - EPS)) return "";
|
return `<span class="badge badgeBad">+${esc(abs)}%</span>`;
|
||||||
|
|
||||||
const pct = Math.round(((other - sp) / other) * 100);
|
|
||||||
if (!Number.isFinite(pct) || pct <= 0) return "";
|
|
||||||
return `<span class="badge badgeGood">${esc(pct)}% off</span>`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function renderCard(it) {
|
function renderCard(it) {
|
||||||
const price = listingPriceStr(it);
|
const price = listingPriceStr(it);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue