PageSourceSearch

https://canonic.xyz/assets/OrderListPage-UgwnThJQ.js

js canonic.xyz collected 2026-10-05 05:44:39 UTC 4,814 bytes, 2 lines download raw bytes

1import{m as x,j as e,o as h,r as p,S as j,aj as b,a as g,k as y,d as w,h as v,K as N}from"./index-C7rVbH4G.js";import{u as C,f as m,e as R,g as k,b as S,a as F,c as P}from"./index-B_GZ0kNZ.js";import{F as M}from"./ArrowLeftIcon-BzmTfDX-.js";import{F as _}from"./ArrowRightIcon-C11ctMty.js";import{F as A}from"./ChevronUpIcon-CZ9nPJKR.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new r.Error().stack;i&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[i]="0e4df7dc-0737-4c77-9e81-f2881e0907cf",r._sentryDebugIdIdentifier="sentry-dbid-0e4df7dc-0737-4c77-9e81-f2881e0907cf")}catch{}})();const c=25;function B(){const{data:r,isLoading:i}=x.admin.orders.useQuery();return e.jsxs("div",{children:[e.jsx("h2",{className:"dark:text-theme-body-white mb-4 text-4xl text-black",children:"Orders"}),e.jsx(I,{orders:r??[],loading:i})]})}const D=r=>N(r,"M/d/yyyy h:mma"),d=R();function I({orders:r,loading:i}){const u=h(),f=p.useMemo(()=>[d.accessor("date",{header:"Date",cell:({getValue:t})=>D(t()*1e3)}),d.accessor("customer_pubkey",{header:"Customer",cell:({getValue:t})=>{const{data:s}=x.admin.customerSingle.useQuery({pubkey:t()});return s?.email}}),d.accessor("line_items",{header:"Items",cell:({getValue:t})=>e.jsxs("div",{className:"text-center",children:[t().length," item",t().length===1?"":"s"]}),sortingFn:(t,s,o)=>{const l=t.getValue(o),n=s.getValue(o);return!Array.isArray(l)||!Array.isArray(n)?0:l.length>n.length?1:n.length>l.length?-1:0}}),d.accessor("total_paid",{header:()=>e.jsx("div",{className:"w-full text-right",children:"Total"}),cell:({getValue:t})=>e.jsx("div",{className:"text-right",children:j(b(t()))})}),d.accessor("fulfilled_at",{header:()=>e.jsx("div",{className:"w-full text-center",children:"Status"}),cell:({getValue:t})=>{const s=!!t();return e.jsx("div",{className:`rounded px-1.5 py-0.5 text-center text-sm font-medium ${g({"bg-gray-400 text-gray-800":s,"bg-yellow-300 text-yellow-900":!s})}`,children:s?"Fulfilled":"Unfulfilled"})},sortingFn:(t,s,o)=>{const l=!!t.getValue(o),n=!!s.getValue(o);return l&&!n?1:!l&&n?-1:0}})],[r]),a=C({columns:f,data:r??[],getCoreRowModel:k(),getSortedRowModel:S(),getFilteredRowModel:F(),getPaginationRowModel:P(),initialState:{sorting:[{id:"date",desc:!0}],pagination:{pageSize:c}}});return e.jsx(e.Fragment,{children:i?e.jsx(y,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-6 overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"border-b dark:border-gray-600",children:a.getHeaderGroups().map(t=>e.jsx("tr",{className:"px-2",children:t.headers.map(s=>{const o=s.column.getIsSorted(),l=s.column.getCanSort(),n=o||null;return e.jsx("th",{className:`px-4 py-2 text-left ${s.column.id==="customer_pubkey"?"w-full":""}`,children:e.jsxs("div",{className:`flex items-center ${g({"cursor-pointer select-none":l})}`,title:l?"Click to sort":void 0,onClick:s.column.getToggleSortingHandler(),children:[m(s.column.columnDef.header,s.getContext()),n==="asc"&&e.jsx(A,{className:"ml-1 h-4 w-4"}),n==="desc"&&e.jsx(w,{className:"ml-1 h-4 w-4"})]})},s.id)})},t.id))}),e.jsx("tbody",{children:a.getRowModel().rows.map(t=>e.jsx("tr",{className:"border-collapse cursor-pointer border-b px-2 hover:bg-gray-200 dark:border-gray-600 hover:dark:bg-gray-700",onClick:()=>u(v.buildOrderRoute(t.original.id)),children:t.getVisibleCells().map(s=>e.jsx("td",{className:"whitespace-nowrap px-4 py-2",children:m(s.column.columnDef.cell,s.getContext())},s.id))},t.id))})]})}),e.jsxs("div",{className:"mt-5 grid grid-cols-[1fr,auto,1fr] items-center",children:[e.jsx("div",{}),a.getPageCount()>1?e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("button",{onClick:a.previousPage,disabled:!a.getCanPreviousPage(),className:"px-2 disabled:opacity-30",children:e.jsx(M,{className:"h-7 w-7"})}),e.jsxs("span",{children:[a.getState().pagination.pageIndex+1,"/",a.getPageCount()]}),e.jsx("button",{onClick:a.nextPage,disabled:!a.getCanNextPage(),className:"px-2 disabled:opacity-30",children:e.jsx(_,{className:"h-7 w-7"})})]}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center place-self-end",children:[e.jsx("div",{className:"mr-2",children:"Page Size:"}),e.jsxs("select",{className:"cursor-pointer rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-800",defaultValue:a.getState().pagination.pageSize,onChange:t=>{a.setPageSize(Number(t.currentTarget.value))},children:[e.jsx("option",{value:10,children:"10"}),e.jsx("option",{value:c,children:c}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"}),e.jsx("option",{value:250,children:"250"}),e.jsx("option",{value:r?.length,children:"All"})]})]})]})]})})}export{B as default};
2//# sourceMappingURL=OrderListPage-UgwnThJQ.js.map

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.