/* ==========================================================
YAPPY. — Shop + Product page
========================================================== */
function Shop() {
useReveal();
return (
);
}
function PDP({ id }) {
const p = PRODUCTS[id];
const { add, setCartOpen } = useStore();
const [view, setView] = React.useState(0);
const [qty, setQty] = React.useState(1);
const [added, setAdded] = React.useState(false);
const adm = useAdmin();
const oos = adm.stock[id] === false;
React.useEffect(() => { setView(0); setQty(1); }, [id]);
if (!p) return ;
const views = [
{ k: 'Pack', render: () => },
{ k: 'Studio', render: () =>
},
{ k: 'Detail', render: () =>
},
{ k: 'Back', render: () =>
Back of pack
Approved artwork to be supplied.
},
];
const addToCart = () => { add(id, qty); setAdded(true); setTimeout(() => setAdded(false), 1500); setCartOpen(true); };
const buyNow = () => { add(id, qty); go('/checkout'); };
const others = SKU_ORDER.filter((k) => k !== id);
const dot = p.id === 'dnd' ? 'var(--cream)' : 'var(--signal)';
return (
{views.map((v, i) => (
))}
{PACK.count}
{p.line}
setQty(Math.max(1, Math.min(9, q)))} dark={p.onDark} />
{VARIANT_NOTE}
{p.name}.
{fmtPrice(priceFor(id).now) || 'Price TBC'}
);
}
function NotFound() {
return (
Nothing here.
Just quiet. Let’s get you back.
Home
);
}
Object.assign(window, { Shop, PDP, NotFound });