1import{r as n,s as g,j as e}from"./index-h8K-9rNZ.js";import{A as y}from"./AdminLayout-DLXAlpfY.js";import{C as c,a as l,b as o,c as d}from"./card-BIg0PVTn.js";import"./adminPermissions-C7YFcfej.js";import"./index-4s0DWx5z.js";import"./chevron-right-BeGrX8vQ.js";import"./circle-DPfg4jct.js";import"./bell-BuhrYo4P.js";import"./layout-dashboard-CLx6kUFU.js";import"./users-DqI8dAwo.js";import"./undo-2-VGlRYrwZ.js";import"./trending-up-ClfJKlz5.js";function $(){const[x,m]=n.useState([]),[h,j]=n.useState(!0),[a,p]=n.useState({total:0,converted:0});n.useEffect(()=>{(async()=>{const{data:s}=await g.from("fittech_sessions").select("*").order("created_at",{ascending:!1}).limit(200),t=s??[];m(t),p({total:t.length,converted:t.filter(r=>r.converted_to_purchase).length}),j(!1)})()},[]);const f=a.total>0?(a.converted/a.total*100).toFixed(1):"0.0";return e.jsxs(y,{title:"FITtech Sessions",description:"Body-measurement scans and conversion to purchase.",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 mb-6",children:[e.jsxs(c,{children:[e.jsx(l,{children:e.jsx(o,{className:"text-sm text-muted-foreground",children:"Total scans"})}),e.jsx(d,{className:"text-2xl font-serif",children:a.total})]}),e.jsxs(c,{children:[e.jsx(l,{children:e.jsx(o,{className:"text-sm text-muted-foreground",children:"Converted"})}),e.jsx(d,{className:"text-2xl font-serif",children:a.converted})]}),e.jsxs(c,{children:[e.jsx(l,{children:e.jsx(o,{className:"text-sm text-muted-foreground",children:"Conversion rate"})}),e.jsxs(d,{className:"text-2xl font-serif",children:[f,"%"]})]})]}),e.jsxs(c,{children:[e.jsx(l,{children:e.jsx(o,{children:"Recent sessions (last 200)"})}),e.jsx(d,{className:"overflow-x-auto",children:h?e.jsx("p",{className:"text-muted-foreground",children:"Loadingâ¦"}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-xs text-muted-foreground border-b",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left py-2",children:"When"}),e.jsx("th",{className:"text-left py-2",children:"User / Session"}),e.jsx("th",{className:"text-left py-2",children:"Product"}),e.jsx("th",{className:"text-left py-2",children:"Recommended"}),e.jsxs("th",{className:"text-left py-2",children:["Measurements (","in",")"]}),e.jsx("th",{className:"text-left py-2",children:"Converted"})]})}),e.jsx("tbody",{children:x.map(s=>{var t,r,i;return e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsx("td",{className:"py-2 whitespace-nowrap",children:new Date(s.created_at).toLocaleString()}),e.jsx("td",{className:"py-2 font-mono text-xs",children:((t=s.user_id)==null?void 0:t.slice(0,8))??((r=s.cart_session_id)==null?void 0:r.slice(0,10))??"-"}),e.jsx("td",{className:"py-2 font-mono text-xs",children:((i=s.seller_product_id)==null?void 0:i.slice(0,8))??"-"}),e.jsx("td",{className:"py-2",children:s.recommended_size??"-"}),e.jsx("td",{className:"py-2 text-xs",children:s.measurements?Object.entries(s.measurements).map(([u,N])=>`${u}:${N}`).join(" · "):"-"}),e.jsx("td",{className:"py-2",children:s.converted_to_purchase?"â":"â"})]},s.id)})})]})})]})]})}export{$ 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.