1import{r as d,j as s,M as l,P as x,i as r,t as m}from"./index-BYkFCx3B.js";import{T as p}from"./trash-2-CYBdHdSb.js";function u(){const[t,i]=d.useState([]),a=async()=>{const{data:e}=await r.from("contact_messages").select("*").order("created_at",{ascending:!1});i(e??[])};d.useEffect(()=>{a()},[]);const c=async e=>{await r.from("contact_messages").update({read:!e.read}).eq("id",e.id),a()},o=async e=>{if(!confirm("Smazat zprávu?"))return;const{error:n}=await r.from("contact_messages").delete().eq("id",e);n?m.error(n.message):a()};return s.jsxs("div",{className:"p-8 max-w-4xl",children:[s.jsx("h1",{className:"font-display text-3xl tracking-wider mb-6",children:"Zprávy z formuláÅe"}),s.jsxs("div",{className:"space-y-3",children:[t.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"Žádné zprávy."}),t.map(e=>s.jsx("div",{className:`bg-background border rounded-xl p-4 ${e.read?"border-border":"border-primary/50"}`,children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium",children:e.name}),e.sport&&s.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:e.sport}),!e.read&&s.jsx("span",{className:"text-xs bg-primary text-primary-foreground px-2 py-0.5 rounded",children:"Nové"})]}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-1 flex-wrap",children:[e.email&&s.jsxs("a",{href:`mailto:${e.email}`,className:"flex items-center gap-1 hover:text-primary",children:[s.jsx(l,{size:12})," ",e.email]}),e.phone&&s.jsxs("a",{href:`tel:${e.phone}`,className:"flex items-center gap-1 hover:text-primary",children:[s.jsx(x,{size:12})," ",e.phone]}),s.jsx("span",{children:new Date(e.created_at).toLocaleString("cs-CZ")})]}),e.message&&s.jsx("p",{className:"text-sm mt-3 whitespace-pre-wrap",children:e.message})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("button",{onClick:()=>c(e),className:"text-xs px-2 py-1 border border-border rounded hover:bg-muted",children:e.read?"OznaÄit nepÅeÄtené":"PÅeÄteno"}),s.jsx("button",{onClick:()=>o(e.id),className:"text-destructive p-1 hover:bg-destructive/10 rounded self-end",children:s.jsx(p,{size:14})})]})]})},e.id))]})]})}export{u 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.