PageSourceSearch

https://loveacrossborders.com/assets/admin.shop.index-Bg1g_sDt.js

js loveacrossborders.com collected 2026-10-08 14:17:02 UTC 3,823 bytes, 1 lines download raw bytes

1import{m as x,G as p,j as e,L as s}from"./index-hs4a0mYW.js";import{u}from"./useQuery-C-iGd3mh.js";import{u as i}from"./useServerFn-DgMZqDJQ.js";import{A as h}from"./SiteHeader-BqOOKgqK.js";function g(){const a=i(x),n=i(p),{data:d,isLoading:o,error:r,refetch:c}=u({queryKey:["admin","shop","products"],queryFn:()=>a(),retry:!1});async function m(t,l){confirm(`Delete "${l}"? This cannot be undone.`)&&(await n({data:{id:t}}),c())}return e.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[e.jsx(h,{active:"products"}),e.jsxs("main",{className:"mx-auto max-w-6xl px-6 sm:px-8 py-12",children:[e.jsxs("div",{className:"flex items-baseline justify-between flex-wrap gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-serif text-primary",style:{fontSize:"2rem"},children:"Storefront products"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add, edit, price, and publish everything in the shop."})]}),e.jsx(s,{to:"/admin/shop/$id",params:{id:"new"},className:"px-4 py-2 rounded text-sm bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"+ New product"})]}),o?e.jsx("p",{className:"mt-8 text-muted-foreground",children:"Loading…"}):r?e.jsxs("div",{className:"mt-8 p-6 rounded bg-card border border-border",children:[e.jsx("p",{className:"text-destructive font-medium",children:"Could not load products."}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:r.message.includes("Forbidden")||r.message.includes("Unauthorized")?"You need to sign in as an administrator.":r.message}),e.jsx(s,{to:"/admin",className:"mt-4 inline-block text-sm text-primary underline",children:"← Back to admin home"})]}):!d||d.length===0?e.jsxs("div",{className:"mt-8 p-10 rounded bg-card border border-border text-center",children:[e.jsx("p",{className:"font-serif text-xl text-primary",children:"No products yet."}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Add your first title to open the shop."}),e.jsx(s,{to:"/admin/shop/$id",params:{id:"new"},className:"mt-6 inline-block px-5 py-2.5 rounded text-sm bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"+ Create first product"})]}):e.jsx("div",{className:"mt-8 overflow-hidden rounded bg-card border border-border",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"Title"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"Type"}),e.jsx("th",{className:"text-right px-4 py-3 font-medium",children:"Price"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-3"})]})}),e.jsx("tbody",{children:d.map(t=>e.jsxs("tr",{className:"border-t border-border",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx(s,{to:"/admin/shop/$id",params:{id:t.id},className:"text-primary hover:underline",children:t.title}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["/",t.slug]})]}),e.jsx("td",{className:"px-4 py-3 text-foreground/80",children:t.type}),e.jsxs("td",{className:"px-4 py-3 text-right",children:["$",(t.price_cents/100).toFixed(2)]}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:t.is_active?"text-accent":"text-muted-foreground",children:t.is_active?"● Live":"○ Draft"})}),e.jsxs("td",{className:"px-4 py-3 text-right",children:[e.jsx(s,{to:"/admin/shop/$id",params:{id:t.id},className:"text-xs text-primary hover:underline mr-4",children:"Edit"}),e.jsx("button",{onClick:()=>m(t.id,t.title),className:"text-xs text-destructive hover:underline",children:"Delete"})]})]},t.id))})]})})]})]})}export{g as component};

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.