PageSourceSearch

https://dealorb.ai/assets/AdminContactSubmissions-WTucE-Gk.js

js dealorb.ai collected 2026-10-02 00:42:44 UTC 4,477 bytes, 2 lines download raw bytes

1import{i as E,r as n,s as C,j as e,B as x,aU as D,L as T,M as j,Q as $,ab as L,ad as A,ae as B,af as H}from"./index-D8_nJFcn.js";import{A as R}from"./AdminLayout-lD57VhJn.js";import{T as _,a as k,b as u,c as l,d as O,e as r}from"./table-BBjYE-Z_.js";import{E as V}from"./eye-BeXTBJ8m.js";import{f as d}from"./format-dVXnaPEj.js";import"./layout-dashboard-AdN55fFa.js";import"./activity-B5cZifEb.js";import"./user-plus-DgANr11A.js";import"./shield-check-BnOr42Ug.js";import"./en-US-wfBU2YNu.js";const W=()=>{const{toast:o}=E(),[t,p]=n.useState([]),[f,g]=n.useState(!0),[a,y]=n.useState(null),[N,h]=n.useState(!1);n.useEffect(()=>{b()},[]);const b=async()=>{try{const{data:s,error:c}=await C.from("contact_submissions").select("*").order("created_at",{ascending:!1});if(c)throw c;p(s||[])}catch(s){o({title:"Error loading submissions",description:s.message,variant:"destructive"})}finally{g(!1)}},v=s=>{y(s),h(!0)},w=()=>{if(t.length===0){o({title:"No data to export",description:"There are no contact submissions to export.",variant:"destructive"});return}const s=["Name","Email","Message","Submitted At"],c=t.map(i=>[i.name,i.email,`"${i.message.replace(/"/g,'""')}"`,d(new Date(i.created_at),"yyyy-MM-dd HH:mm:ss")]),S=[s.join(","),...c.map(i=>i.join(","))].join(`
2`),M=new Blob([S],{type:"text/csv;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(M),m.download=`contact-submissions-${d(new Date,"yyyy-MM-dd")}.csv`,m.click(),o({title:"Export successful",description:`Exported ${t.length} contact submissions.`})};return e.jsx(R,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Contact Submissions"}),e.jsxs("p",{className:"text-muted-foreground mt-1",children:[t.length," total submissions"]})]}),e.jsxs(x,{onClick:w,variant:"outline",className:"gap-2",children:[e.jsx(D,{className:"h-4 w-4"}),"Export CSV"]})]}),f?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(T,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(j,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No contact submissions yet."})]}):e.jsx("div",{className:"border rounded-lg",children:e.jsxs(_,{children:[e.jsx(k,{children:e.jsxs(u,{children:[e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Email"}),e.jsx(l,{children:"Message"}),e.jsx(l,{children:"Submitted"}),e.jsx(l,{className:"text-right",children:"Actions"})]})}),e.jsx(O,{children:t.map(s=>e.jsxs(u,{children:[e.jsx(r,{className:"font-medium",children:s.name}),e.jsx(r,{children:e.jsx("a",{href:`mailto:${s.email}`,className:"text-primary hover:underline",children:s.email})}),e.jsx(r,{className:"max-w-xs truncate",children:s.message.length>50?`${s.message.substring(0,50)}...`:s.message}),e.jsx(r,{children:e.jsx($,{variant:"secondary",children:d(new Date(s.created_at),"MMM d, yyyy")})}),e.jsx(r,{className:"text-right",children:e.jsxs(x,{variant:"ghost",size:"sm",onClick:()=>v(s),children:[e.jsx(V,{className:"h-4 w-4 mr-1"}),"View"]}
2)})]},s.id))})]})}),e.jsx(L,{open:N,onOpenChange:h,children:e.jsxs(A,{className:"max-w-lg",children:[e.jsx(B,{children:e.jsx(H,{children:"Contact Submission Details"})}),a&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),e.jsx("p",{className:"mt-1",children:a.name})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Email"}),e.jsx("p",{className:"mt-1",children:e.jsx("a",{href:`mailto:${a.email}`,className:"text-primary hover:underline",children:a.email})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Submitted"}),e.jsx("p",{className:"mt-1",children:d(new Date(a.created_at),"MMMM d, yyyy 'at' h:mm a")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Message"}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap bg-muted/50 p-3 rounded-lg",children:a.message})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(x,{asChild:!0,children:e.jsxs("a",{href:`mailto:${a.email}`,children:[e.jsx(j,{className:"h-4 w-4 mr-2"}),"Reply via Email"]})})})]})]})})]})})};export{W 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.