1import{j as e}from"./vendor-query-CmFN4-M1.js";import{r as j}from"./vendor-react-7PyNDetJ.js";import{u,a as p}from"./useEmailCampaigns-_9LvQvoK.js";import{av as g,aD as N,aE as f,aG as b,ab as c,p as w,aw as C,ax as v,ay as D,az as T}from"./index-BZSaBQD0.js";import{T as d,a as x,b as l,c as t,d as o,e as a}from"./table-BEgIk-tI.js";import{L as _,n as y,a as E}from"./vendor-ui-DjI1iuvA.js";import"./vendor-supabase-BfoV2C50.js";const S=n=>{switch(n){case"sent":return"default";case"sending":return"secondary";case"draft":return"outline";case"failed":return"destructive";default:return"outline"}},q=()=>{const{data:n,isLoading:h}=u(),[r,i]=j.useState(null),{data:m}=p(r);return h?e.jsx("div",{className:"flex justify-center p-8",children:e.jsx(_,{className:"h-6 w-6 animate-spin"})}):e.jsxs(g,{children:[e.jsx(N,{children:e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-5 w-5"})," Histórico de campanhas"]})}),e.jsxs(b,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(d,{className:"min-w-[920px]",children:[e.jsx(x,{children:e.jsxs(l,{children:[e.jsx(t,{children:"Nome"}),e.jsx(t,{children:"Assunto"}),e.jsx(t,{children:"Status"}),e.jsx(t,{className:"text-right tabular-nums",children:"Enviados"}),e.jsx(t,{className:"text-right tabular-nums",children:"Abertos"}),e.jsx(t,{className:"text-right tabular-nums",children:"Cliques"}),e.jsx(t,{children:"Data"}),e.jsx(t,{})]})}),e.jsxs(o,{children:[(n??[]).map(s=>e.jsxs(l,{children:[e.jsx(a,{className:"font-medium",children:s.name}),e.jsx(a,{className:"text-muted-foreground text-xs",children:s.subject}),e.jsx(a,{children:e.jsx(c,{variant:S(s.status),children:s.status})}),e.jsxs(a,{className:"text-right tabular-nums",children:[s.total_sent,"/",s.total_recipients]}),e.jsx(a,{className:"text-right tabular-nums",children:s.total_opened}),e.jsx(a,{className:"text-right tabular-nums",children:s.total_clicked}),e.jsx(a,{className:"text-xs text-muted-foreground",children:s.sent_at?new Date(s.sent_at).toLocaleString("pt-BR"):"â"}),e.jsx(a,{children:e.jsx(w,{size:"sm",variant:"ghost",onClick:()=>i(s.id),children:e.jsx(E,{className:"h-4 w-4"})})})]},s.id)),!(n!=null&&n.length)&&e.jsx(l,{children:e.jsx(a,{colSpan:8,className:"text-center text-muted-foreground py-8",children:"Nenhuma campanha ainda"})})]})]})}),e.jsx(C,{open:!!r,onOpenChange:s=>!s&&i(null),children:e.jsxs(v,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[e.jsx(D,{children:e.jsx(T,{children:"Destinatários da campanha"})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(d,{className:"min-w-[600px]",children:[e.jsx(x,{children:e.jsxs(l,{children:[e.jsx(t,{children:"E-mail"}),e.jsx(t,{children:"Status"}),e.jsx(t,{children:"Enviado"}),e.jsx(t,{children:"Aberto"})]})}),e.jsx(o,{children:(m??[]).map(s=>e.jsxs(l,{children:[e.jsx(a,{className:"text-xs",children:s.email}),e.jsx(a,{children:e.jsx(c,{variant:"outline",children:s.status})}),e.jsx(a,{className:"text-xs",children:s.sent_at?new Date(s.sent_at).toLocaleString("pt-BR"):"â"}),e.jsx(a,{className:"text-xs",children:s.opened_at?new Date(s.opened_at).toLocaleString("pt-BR"):"â"})]},s.id))})]})})]})})]})]})};export{q as CampaignsHistoryTab};
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.