/* store-app.jsx — top-level state (cart, wishlist, quick view), cart drawer,
cursor glow, and page assembly. */
const { Button: ABtn } = window.FluvexDesignsDesignSystem_072666;
const { CursorGlow: ACursorGlow, StoreIcon: AIcon } = window;
const {
Hero, TrustBar, Marquee, BestSellers, Shop, Categories, Bundle, Gallery,
Why, HowItWorks, Reviews, FAQ, FinalCTA, Footer, QuickView,
} = window;
/* ---- Cart drawer ---- */
function CartDrawer({ open, items, onClose, onQty, onRemove }) {
React.useEffect(() => {
if (open) document.body.style.overflow = "hidden";
else document.body.style.overflow = "";
return () => { document.body.style.overflow = ""; };
}, [open]);
const total = items.reduce((s, it) => s + it.product.price * it.qty, 0);
return (
<>
>
);
}
/* ---- Toast ---- */
function Toast({ msg }) {
return (
);
}
function App() {
const [cart, setCart] = React.useState([]);
const [wishes, setWishes] = React.useState(new Set());
const [quick, setQuick] = React.useState(null);
const [cartOpen, setCartOpen] = React.useState(false);
const [toast, setToast] = React.useState("");
const toastTimer = React.useRef(null);
const showToast = (m) => {
setToast(m);
clearTimeout(toastTimer.current);
toastTimer.current = setTimeout(() => setToast(""), 1800);
};
const addToCart = (p) => {
setCart((c) => {
const found = c.find((it) => it.product.id === p.id);
if (found) return c.map((it) => it.product.id === p.id ? { ...it, qty: it.qty + 1 } : it);
return [...c, { product: p, qty: 1 }];
});
showToast(`Added “${p.title}” to cart`);
};
const changeQty = (id, d) => setCart((c) => c.map((it) => it.product.id === id ? { ...it, qty: Math.max(1, it.qty + d) } : it));
const removeItem = (id) => setCart((c) => c.filter((it) => it.product.id !== id));
const toggleWish = (id) => setWishes((w) => { const n = new Set(w); n.has(id) ? n.delete(id) : n.add(id); return n; });
const cartCount = cart.reduce((s, it) => s + it.qty, 0);
const openCart = () => setCartOpen(true);
const pickFilter = () => {}; // filter handled inside Shop; anchor scroll is enough
return (
{quick &&
setQuick(null)} onAdd={addToCart} />}
setCartOpen(false)} onQty={changeQty} onRemove={removeItem} />
);
}
ReactDOM.createRoot(document.getElementById("root")).render();