freshyo/apps/web-ui/.output/public/assets/flash.cart-Uj5DbknX.js
2026-05-10 16:45:39 +05:30

1 line
No EOL
2.3 KiB
JavaScript

import{d as e,l as t,r as n,s as r,t as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{t as s}from"./trash-2-B2Qxo_rV.js";import{t as c}from"./zap-CufcM84a.js";import{a as l,i as u,r as d}from"./cart-query-hooks-BCr0eax3.js";import{t as f}from"./central-product-store-DGoerB5U.js";var p=e();function m(){let e=o(),{data:m}=d(`flash`),h=l(`flash`),g=u(`flash`),_=f(e=>e.productsById),v=(m?.items||[]).filter(e=>_[e.productId]),y=0;return v.forEach(e=>{let t=_[e.productId];t&&(y+=(t.discountedPrice??t.price)*e.quantity)}),(0,p.jsxs)(i,{children:[(0,p.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,p.jsx)(c,{className:`h-5 w-5 text-yellow-500`}),(0,p.jsx)(a,{weight:`bold`,className:`text-xl`,children:`Flash Cart`})]}),v.length===0?(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,p.jsx)(a,{className:`text-gray-500`,children:`Your flash cart is empty`}),(0,p.jsx)(t,{textContent:`Browse Flash Products`,onClick:()=>e({to:`/flash`})})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:v.map(e=>{let t=_[e.productId],i=t.discountedPrice??t.price;return(0,p.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-gray-100 bg-white p-3 shadow-sm`,children:[(0,p.jsx)(`img`,{src:t.images?.[0],alt:t.name,className:`h-16 w-16 rounded-lg object-cover`}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(a,{weight:`semibold`,className:`text-sm`,numberOfLines:1,children:t.name}),(0,p.jsxs)(a,{className:`text-brand-600 text-sm font-bold`,children:[``,i]}),(0,p.jsx)(n,{value:e.quantity,setValue:t=>h.mutate({productId:e.productId,quantity:t})})]}),(0,p.jsx)(r,{onClick:()=>g.mutate(e.productId),children:(0,p.jsx)(s,{className:`h-5 w-5 text-red-500`})})]},e.productId)})}),(0,p.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4 shadow-lg`,children:[(0,p.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,p.jsx)(a,{weight:`bold`,children:`Total`}),(0,p.jsxs)(a,{weight:`bold`,className:`text-lg text-brand-600`,children:[``,y]})]}),(0,p.jsx)(t,{fullWidth:!0,textContent:`Proceed to Checkout`,onClick:()=>e({to:`/flash/checkout`}),className:`bg-brand-500 text-white`})]})]})]})}export{m as component};