PageSourceSearch

https://electro-hub-five.vercel.app/assets/OrderHistory-CbW1z6VO.js

js electro-hub-five.vercel.app collected 2026-10-03 06:52:04 UTC 2,912 bytes, 1 lines download raw bytes

1import{r,q as N,j as s,ac as C,af as S,P as O,ag as P,z as L,ah as T}from"./index-D3i7ThYB.js";const E=()=>{const[n,m]=r.useState("all"),[l,g]=r.useState(""),[a,x]=r.useState([]),[d,o]=r.useState(1),[c]=r.useState(2),p=N(),u=async e=>{const t=await T(e);t.success&&x(t.orders)};r.useEffect(()=>{u();const t=new URLSearchParams(window.location.search).get("page")||1;o(Number(t))},[]);const i=a.filter(e=>{const t=n==="all"||e.status===n,j=e._id.toLowerCase().includes(l.toLowerCase())||e.products.some(v=>v.product.title.toLowerCase().includes(l.toLowerCase()));return t&&j}),f=[{id:"all",label:"All Orders",count:a.length},{id:"delivered",label:"Delivered",count:a.filter(e=>e.status==="delivered").length},{id:"shipped",label:"Shipped",count:a.filter(e=>e.status==="shipped").length},{id:"processing",label:"Processing",count:a.filter(e=>e.status==="processing").length},{id:"cancelled",label:"Cancelled",count:a.filter(e=>e.status==="cancelled").length}],b=e=>{m(e);const t=new URLSearchParams(window.location.search);t.set("page",1),o(1),p({pathname:window.location.pathname,search:t.toString()})},h=d*c,w=h-c,y=i.slice(w,h);return s.jsxs("div",{className:"min-h-screen p-4 bg-white shadow-lg text-slate-900",children:[s.jsx(C,{title:"Order History",icon:s.jsx(S,{className:"w-6 h-6 text-white"})}),s.jsx("div",{className:"mb-8 bg-white rounded-lg shadow-sm p-6",children:s.jsx("div",{className:"flex flex-col sm:flex-row gap-4 justify-between items-center",children:s.jsx("div",{className:"relative flex-1 max-w-md",children:s.jsx("input",{type:"text",placeholder:"Search orders or products...",value:l,onChange:e=>g(e.target.value),className:"w-full pl-4 pr-4 py-2 outline-none border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})})})}),s.jsx("div",{className:"mb-6",children:s.jsx("nav",{className:"flex space-x-8 overflow-x-auto",children:f.map(e=>s.jsxs("button",{onClick:()=>b(e.id),className:`whitespace-nowrap cursor-pointer py-2 px-1 border-b-2 font-medium text-sm transition-colors ${n===e.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[e.label,s.jsx("span",{className:"ml-2 bg-gray-100 text-gray-600 py-0.5 px-2 rounded-full text-xs",children:e.count})]},e.id))})}),s.jsx("div",{className:"space-y-6",children:i.length===0?s.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow-sm",children:[s.jsx(O,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No orders found"}),s.jsx("p",{className:"text-gray-500",children:"Try adjusting your search or filter criteria"})]}):y.map(e=>s.jsx(P,{order:e,fetchOrders:u},e._id))}),s.jsx("div",{className:"mt-8 justify-end flex",children:s.jsx(L,{currentPage:d,totalCount:i.length,onPageChange:o,pageSize:c,siblingCount:1})})]})};export{E as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.