"use client"; import { useCart } from "@/lib/cart"; import { content } from "@/lib/content"; /** * `/cart` checkout button — reads the cart store (client) for `checkoutUrl` and * `totalQuantity`. Hidden when the cart is empty. Rendered as a client island * inside the server-rendered `/cart` page so it reflects the live cart. */ export function CartCheckoutButton() { const totalQuantity = useCart((state) => state.data.totalQuantity); const checkoutUrl = useCart((state) => state.data.checkoutUrl); const isEmpty = totalQuantity === 0; if (isEmpty || !checkoutUrl) return null; return (
{content.cart.checkout}
); }