// Reusable presentational bits for the e-shop kit: // VNTasteProfile (light↔dark + mild↔strong scales), VNBatchSeal (provenance stamp), // VNStock (honest availability badge). All placeholder-friendly. (function () { if (typeof React === "undefined") return; const Icon = window.VNIcon; // ---- Taste profile: two 5-step scales (med) or sweetness (medovina) ---- // Scale defined at module scope so it keeps a stable component identity — // otherwise it remounts on every parent re-render (e.g. switching product // photos) and the fill animation replays. One mount → animate once → static. function Scale({ label, lo, hi, value }) { return (
{lo} {[1,2,3,4,5].map((n) => ( ))} {hi}
); } function TasteProfile({ profile, compact }) { if (!profile || (!profile.color && !profile.sweet && !(profile.traits && profile.traits.length))) return null; return (
{profile.traits && profile.traits.length ? ( profile.traits.map((t, i) => ( )) ) : profile.sweet ? ( ) : ( <> )} {!compact && profile.notes && profile.notes.length > 0 && (
{profile.notes.map((n, i) => {n})}
)}
); } // ---- Batch seal: circular provenance stamp ---- function BatchSeal({ prov, weight }) { if (!prov) return null; return (
stočeno {prov.bottled} {weight && {weight}}
); } // ---- Honest stock badge ---- const STOCK = { in: { label: "Skladem", cls: "in", icon: "check" }, low: { label: "Poslední kusy", cls: "low", icon: "spark" }, out: { label: "Vyprodáno", cls: "out", icon: "close" }, }; function Stock({ status }) { const s = STOCK[status] || STOCK.in; return ( {s.label} ); } Object.assign(window, { VNTasteProfile: TasteProfile, VNBatchSeal: BatchSeal, VNStock: Stock }); })();