import{d as e,s as t,t as n,u as r}from"./src-C0xjWfnx.js";import{t as i}from"./useNavigate-VRicZWJI.js";import{n as a}from"./trpc-client-QrVjRqP1.js";import{t as o}from"./createLucideIcon-7nArgiy8.js";import{t as s}from"./package-CgMILU3n.js";var c=o(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),l=e();function u(){let e=i(),{data:o}=a.user.order.getOrders.useQuery({page:0,limit:20}),u=o?.data||[];return(0,l.jsxs)(n,{children:[(0,l.jsx)(r,{weight:`bold`,className:`mb-4 text-xl`,children:`My Orders`}),u.length===0?(0,l.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,l.jsx)(s,{className:`h-12 w-12 text-gray-300`}),(0,l.jsx)(r,{className:`text-gray-500`,children:`No orders yet`})]}):(0,l.jsx)(`div`,{className:`flex flex-col gap-3`,children:u.map(n=>(0,l.jsxs)(t,{onClick:()=>e({to:`/me/orders/$id`,params:{id:String(n.id)}}),className:`rounded-xl border border-gray-100 bg-white p-4 shadow-sm`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(r,{weight:`semibold`,className:`text-sm`,children:[`Order #`,n.id]}),(0,l.jsx)(r,{className:`text-xs text-gray-500`,children:n.createdAt?new Date(n.createdAt).toLocaleDateString():``})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs font-medium ${n.status===`delivered`?`bg-green-100 text-green-700`:n.status===`cancelled`?`bg-red-100 text-red-700`:`bg-yellow-100 text-yellow-700`}`,children:n.status}),(0,l.jsx)(c,{className:`h-4 w-4 text-gray-400`})]})]}),(0,l.jsxs)(r,{className:`mt-1 text-xs text-gray-400`,children:[`Total: ₹`,n.totalAmount||0]})]},n.id))})]})}export{u as component};