/* ============================================================ AfricaSpares — Basket page (standard e-commerce cart) Route: #basket — cart state is shared via localStorage ============================================================ */ function BasketPage() { return (
); } function BasketBody() { const { cart, clearCart } = useCart(); const { go } = useContext(NavCtx); const [checkoutOpen, setCheckoutOpen] = useState(false); const count = cart.reduce((s, i) => s + i.qty, 0); return (
{L("AfricaSpares · Secure checkout", "AfricaSpares · Commande sécurisée")}

{L("Your Basket", "Votre Panier")}.

{count > 0 && {count} {count > 1 ? L("items", "articles") : L("item", "article")}}
{cart.length === 0 ? ( go("spares")} /> ) : (
{/* ITEMS */}
{cart.map((item) => )}
{/* SUMMARY */} setCheckoutOpen(true)} />
)}
setCheckoutOpen(false)} />
); } /* ─── Single basket line ─────────────────────────────────── */ const basketQtyBtn = { width: 34, height: 34, display: "flex", alignItems: "center", justifyContent: "center", background: "none", border: "none", cursor: "pointer", color: "var(--ink)", fontSize: 17 }; function BasketRow({ item }) { const { updateQty, removeItem } = useCart(); const img = item.img || (window.PARTS_IMGS ? window.PARTS_IMGS[item.name] : null); return (
{img ? {item.name} : }
{item.name}
{item.sku} · {L("Fits", "Compatible")}: {item.fit}
{item.price.toLocaleString("fr-FR")} FCFA {L("each", "/ unité")}
{item.qty}
{(item.price * item.qty).toLocaleString("fr-FR")} FCFA
); } /* ─── Order summary (sticky) ─────────────────────────────── */ function BasketSummary({ onCheckout }) { const { cart, total } = useCart(); const count = cart.reduce((s, i) => s + i.qty, 0); return (
{L("Order Summary", "Récapitulatif")}
{L("Subtotal", "Sous-total")} ({count} {count > 1 ? L("items", "articles") : L("item", "article")}) {total.toLocaleString("fr-FR")} FCFA
{L("Delivery — Niamey (25 km)", "Livraison — Niamey (25 km)")} {L("Free", "Offerte")}
{L("Outside Niamey: shipping quoted after order confirmation.", "Hors Niamey : frais de livraison calculés après confirmation de la commande.")}

Total {total.toLocaleString("fr-FR")} FCFA
{L("100% secure payment", "Paiement 100% sécurisé")}
{["VISA", "Mastercard", "Orange Money", "Airtel Money"].map((p) => ( {p} ))}
{[ ["shield", L("Fitment & quality warranty on every part", "Garantie conformité & qualité sur chaque pièce")], ["truck", L("Fast dispatch across Niger", "Expédition rapide dans tout le Niger")], ["users", L("Technical support — send your VIN to confirm fitment", "Support technique — envoyez votre VIN pour confirmer la compatibilité")], ].map(([ic, t]) => (
{t}
))}
); } /* ─── Empty state ────────────────────────────────────────── */ function EmptyBasket({ onBrowse }) { return (

{L("Your basket is empty", "Votre panier est vide")}

{L("Browse the AfricaSpares catalogue and add the parts you need.", "Parcourez le catalogue AfricaSpares et ajoutez les pièces dont vous avez besoin.")}

); } Object.assign(window, { BasketPage });