1import{aa as e}from"./index-CAXCr2dA.js";import{f as p}from"./react-vendor-Clvj-Tss.js";import{P as x,C as h}from"./card-C3jtoumP.js";import{E as j}from"./empty-state-DTbr10Wb.js";import{E as u,S as f}from"./error-state-C8YtfWas.js";import{D as b,a as g,d as y,e as N,b as D}from"./dialog-BRlK_tlX.js";import{T as C,d as E,e as l,c as r,a as w,b as t}from"./table-BmF3gmF6.js";import{b as S}from"./use-admin-D2twr_YN.js";import{I as T}from"./inbox-YKIausZk.js";import{f as M}from"./format-Cy1cCpwh.js";import{p as k}from"./parseISO-DLrPfdCa.js";import"./supabase-vendor-c_8iEK2M.js";import"./chart-vendor-CRVLmFP-.js";import"./en-US-BMcnMstS.js";function G(){const{data:n,isPending:c,isError:m,refetch:d}=S(),[a,o]=p.useState(null);return e.jsxs("div",{className:"space-y-6",children:[e.jsx(x,{title:"Contact messages",description:"Messages submitted through the public contact form."}),m?e.jsx(u,{onRetry:()=>d()}):c?e.jsx(f,{className:"h-96 rounded-xl"}):n.length===0?e.jsx(j,{icon:T,title:"No messages",description:"No contact messages have been submitted yet."}):e.jsx(h,{className:"gap-0 overflow-hidden p-0",children:e.jsxs(C,{children:[e.jsx(E,{children:e.jsxs(l,{children:[e.jsx(r,{children:"Date"}),e.jsx(r,{children:"Name"}),e.jsx(r,{children:"Email"}),e.jsx(r,{children:"Subject"})]})}),e.jsx(w,{children:n.map(s=>e.jsxs(l,{role:"button",tabIndex:0,"aria-label":`Open message from ${s.name}`,onClick:()=>o(s),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),o(s))},className:"cursor-pointer",children:[e.jsx(t,{className:"whitespace-nowrap",children:M(k(s.created_at),"MMM d, yyyy")}),e.jsx(t,{className:"font-medium",children:s.name}),e.jsx(t,{className:"text-muted-foreground",children:s.email}),e.jsx(t,{className:"max-w-xs truncate text-muted-foreground",children:s.subject||"â"})]},s.id))})]})}),e.jsx(b,{open:a!==null,onOpenChange:s=>!s&&o(null),children:e.jsx(g,{children:a&&e.jsxs(e.Fragment,{children:[e.jsxs(y,{children:[e.jsx(N,{children:a.subject||"Contact message"}),e.jsxs(D,{children:["From ",a.name," · ",a.email]})]}),e.jsx("p",{className:"whitespace-pre-wrap text-sm text-foreground",children:a.message})]})})})]})}export{G as AdminMessagesPage};
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.