mirror of
https://github.com/samsonjs/spirit-tracker.git
synced 2026-03-25 09:25:51 +00:00
feat: V4 store page
This commit is contained in:
parent
13f15a8eb0
commit
50e0556452
4 changed files with 21 additions and 10 deletions
|
|
@ -231,9 +231,11 @@ export async function renderItem($app, skuInput) {
|
|||
`;
|
||||
|
||||
document.getElementById("back").addEventListener("click", () => {
|
||||
location.hash = "#/";
|
||||
const last = sessionStorage.getItem("viz:lastRoute");
|
||||
if (last && last !== location.hash) location.hash = last;
|
||||
else location.hash = "#/";
|
||||
});
|
||||
|
||||
|
||||
const $title = document.getElementById("title");
|
||||
const $links = document.getElementById("links");
|
||||
const $status = document.getElementById("status");
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ export function renderSearch($app) {
|
|||
<div class="itemName">${esc(it.name || "(no name)")}</div>
|
||||
<a class="badge mono skuLink" href="${esc(
|
||||
skuLink
|
||||
)}" onclick="event.stopPropagation()">${esc(displaySku(it.sku))}</a>
|
||||
)}" target="_blank" rel="noopener noreferrer" onclick="event.stopPropagation()">${esc(displaySku(it.sku))}</a>
|
||||
</div>
|
||||
<div class="metaRow">
|
||||
<span class="mono price">${esc(price)}</span>
|
||||
|
|
@ -149,6 +149,7 @@ export function renderSearch($app) {
|
|||
const sku = el.getAttribute("data-sku") || "";
|
||||
if (!sku) return;
|
||||
saveQuery($q.value);
|
||||
sessionStorage.setItem("viz:lastRoute", location.hash);
|
||||
location.hash = `#/item/${encodeURIComponent(sku)}`;
|
||||
});
|
||||
}
|
||||
|
|
@ -419,7 +420,7 @@ export function renderSearch($app) {
|
|||
<div class="itemName">${esc(r.name || "(no name)")}</div>
|
||||
<a class="badge mono skuLink" href="${esc(
|
||||
skuLink
|
||||
)}" onclick="event.stopPropagation()">${esc(displaySku(sku))}</a>
|
||||
)}" target="_blank" rel="noopener noreferrer" onclick="event.stopPropagation()">${esc(displaySku(sku))}</a>
|
||||
</div>
|
||||
<div class="metaRow">
|
||||
<span class="badge"${kindBadgeStyle}>${esc(kindLabel)}</span>
|
||||
|
|
@ -440,6 +441,7 @@ export function renderSearch($app) {
|
|||
const sku = el.getAttribute("data-sku") || "";
|
||||
if (!sku) return;
|
||||
saveQuery($q.value);
|
||||
sessionStorage.setItem("viz:lastRoute", location.hash);
|
||||
location.hash = `#/item/${encodeURIComponent(sku)}`;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,10 @@ export async function renderStore($app, storeLabelRaw) {
|
|||
</div>
|
||||
`;
|
||||
|
||||
document.getElementById("back").addEventListener("click", () => (location.hash = "#/"));
|
||||
document.getElementById("back").addEventListener("click", () => {
|
||||
sessionStorage.setItem("viz:lastRoute", location.hash);
|
||||
location.hash = "#/"
|
||||
});
|
||||
|
||||
const $q = document.getElementById("q");
|
||||
const $status = document.getElementById("status");
|
||||
|
|
@ -230,7 +233,7 @@ export async function renderStore($app, storeLabelRaw) {
|
|||
<div class="itemBody">
|
||||
<div class="itemTop">
|
||||
<div class="itemName">${esc(it.name || "(no name)")}</div>
|
||||
<a class="badge mono skuLink" href="${esc(skuLink)}" onclick="event.stopPropagation()">${esc(
|
||||
<a class="badge mono skuLink" target="_blank" rel="noopener noreferrer" href="${esc(skuLink)}" onclick="event.stopPropagation()">${esc(
|
||||
displaySku(it.sku)
|
||||
)}</a>
|
||||
</div>
|
||||
|
|
@ -294,6 +297,7 @@ export async function renderStore($app, storeLabelRaw) {
|
|||
if (!el) return;
|
||||
const sku = el.getAttribute("data-sku") || "";
|
||||
if (!sku) return;
|
||||
sessionStorage.setItem("viz:lastRoute", location.hash);
|
||||
location.hash = `#/item/${encodeURIComponent(sku)}`;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -245,12 +245,15 @@ a.skuLink:hover { text-decoration: underline; cursor: pointer; }
|
|||
margin-top: 12px; /* slightly more gap from the top text */
|
||||
}
|
||||
|
||||
.storeBar {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
.storeBar{
|
||||
display:flex;
|
||||
gap:8px;
|
||||
flex-wrap:wrap;
|
||||
width:100%;
|
||||
justify-content: space-between; /* spread each row to fill */
|
||||
}
|
||||
|
||||
|
||||
.storeBtn {
|
||||
border: 1px solid var(--border);
|
||||
background: #0f1318;
|
||||
|
|
|
|||
Loading…
Reference in a new issue