PageSourceSearch

https://drophighlight.com/assets/Campaigns-BayxilVb.js

js drophighlight.com collected 2026-09-30 06:39:19 UTC 8,516 bytes, 1 lines download raw bytes

1import{r as m,j as e,y as u,bC as V,aj as A,f as W,a as K,B as v,S as O,C as Q,l as Y,M as Z,I as q,o as J,Q as X,U as ee,V as se,W as ae,Y as te,Z as ne,_ as le,$ as ie}from"./index-P0N1Je5T.js";import{E as re,u as oe,a as ce}from"./useEmailDomainStatus-CYqZ9wTr.js";import{A as de}from"./AppleIntelligenceButton-BYIEZF3c.js";import{T as me,a as ue,b,c as g,d as xe,e as d}from"./table-DyXCBCTZ.js";import{d as he}from"./internationalization-ClDqWLdo.js";import{P as ge}from"./PageHeader-zjaF7toz.js";import{g as je}from"./coverUrls-CgXMhAXv.js";import{C as pe}from"./chevron-left-Cjx7fP8f.js";import{C as fe}from"./circle-alert-CrhXFnHf.js";import{P as Ne}from"./plus-CwcvmBx0.js";import{T as ve}from"./trash-2-Dwmr_5Bh.js";import"./useMutation-DJI0oEf-.js";const _=({className:t,...a})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:u("mx-auto flex w-full justify-center",t),...a});_.displayName="Pagination";const M=m.forwardRef(({className:t,...a},o)=>e.jsx("ul",{ref:o,className:u("flex flex-row items-center gap-1",t),...a}));M.displayName="PaginationContent";const j=m.forwardRef(({className:t,...a},o)=>e.jsx("li",{ref:o,className:u("",t),...a}));j.displayName="PaginationItem";const C=({className:t,isActive:a,size:o="icon",...w})=>e.jsx("a",{"aria-current":a?"page":void 0,className:u(V({variant:a?"outline":"ghost",size:o}),t),...w});C.displayName="PaginationLink";const E=({className:t,...a})=>e.jsxs(C,{"aria-label":"Go to previous page",size:"default",className:u("gap-1 pl-2.5",t),...a,children:[e.jsx(pe,{className:"h-4 w-4"}),e.jsx("span",{children:"Previous"})]});E.displayName="PaginationPrevious";const I=({className:t,...a})=>e.jsxs(C,{"aria-label":"Go to next page",size:"default",className:u("gap-1 pr-2.5",t),...a,children:[e.jsx("span",{children:"Next"}),e.jsx(A,{className:"h-4 w-4"})]});I.displayName="PaginationNext";const F=({className:t,...a})=>e.jsxs("span",{"aria-hidden":!0,className:u("flex h-9 w-9 items-center justify-center",t),...a,children:[e.jsx(re,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]});F.displayName="PaginationEllipsis";const x=10,be=[{value:"all",label:"All"},{value:"draft",label:"Drafts"},{value:"scheduled",label:"Scheduled"},{value:"sent",label:"Sent"}],Ce={draft:"No draft campaigns",scheduled:"No campaigns currently scheduled",sent:"No campaigns sent yet"},we={draft:"secondary",scheduled:"outline",sending:"default",sent:"default",cancelled:"destructive"},Le=()=>{const t=W(),{data:a,isLoading:o,deleteCampaign:w}=oe(),{hasDomain:L,isVerified:k}=ce(),{language:B}=K(),R=!k,S=L&&!k,[p,y]=m.useState(null),[n,h]=m.useState(1),[c,U]=m.useState("all"),P=a==null?void 0:a.find(s=>s.id===p),f=m.useMemo(()=>a?c==="all"?a:a.filter(s=>s.status===c):[],[a,c]),N=f.length,r=Math.ceil(N/x),z=m.useMemo(()=>{const s=(n-1)*x;return f.slice(s,s+x)},[f,n]),$=N>0?(n-1)*x+1:0,H=Math.min(n*x,N),G=()=>{const s=[];if(r<=5)for(let l=1;l<=r;l++)s.push(l);else{s.push(1),n>3&&s.push("ellipsis");for(let l=Math.max(2,n-1);l<=Math.min(r-1,n+1);l++)s.push(l);n<r-2&&s.push("ellipsis"),s.push(r)}return s};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ge,{title:"Email Campaigns",subtitle:"Create and manage email campaigns for your audiences",actions:e.jsxs(e.Fragment,{children:[R&&e.jsxs(v,{variant:"outline",onClick:()=>t("/admin/settings/integrations"),children:[S&&e.jsx(fe,{className:"h-4 w-4 mr-2 text-destructive"}),!S&&e.jsx(O,{className:"h-4 w-4 mr-2"}),"Settings"]}),e.jsxs(de,{onClick:()=>t("/admin/campaigns/new"),children:[e.jsx(Ne,{className:"h-4 w-4 mr-2"}),"New Campaign"]})]})}),e.jsx("div",{className:"flex w-fit items-center rounded-md bg-muted p-1","aria-label":"Filter campaigns by status",children:be.map(s=>e.jsx(v,{type:"button",size:"sm",variant:c===s.value?"secondary":"ghost",className:`h-8 px-3 font-normal transition-colors ${c===s.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{U(s.value),h(1)},children:s.label},s.value))}),e.jsx(Q,{children:e.jsx(Y,{className:"p-0",children:e.jsxs(me,{className:"table-fixed",children:[e.jsx(ue,{children:e.jsxs(b,{children:[e.jsx(g,{className:"w-[38%]",children:"Campaign"}),e.jsx(g,{className:"w-[27%]",children:"Audience"}),e.jsx(g,{className:"w-[17%]",children:"Status"}),e.jsx(g,{className:"w-[18%]",children:"Sent"}),e.jsx(g,{className:"w-[76px]"})]})}),e.jsx(xe,{children:o?e.jsx(b,{children:e.jsx(d,{colSpan:4,className:"text-center text-muted-foreground",children:"Loading..."})}):f.length?z.map(s=>{var l;return e.jsxs(b,{className:"cursor-pointer hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",tabIndex:0,onKeyDown:i=>{i.target===i.currentTarget&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t(`/admin/campaigns/${s.id}`))},onClick:()=>t(`/admin/campaigns/${s.id}`),children:[e.jsx(d,{children:e.jsxs("div",{className:"flex min-w-[260px] items-center gap-3",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-md bg-muted",children:s.card_hero_image_url||s.galleryCoverUrl?e.jsx("img",{src:je(s.card_hero_image_url||s.galleryCoverUrl||"").thumbnail,alt:"",className:"h-full w-full object-cover",onError:i=>{const T=i.currentTarget,D=s.card_hero_image_url||s.galleryCoverUrl;D&&T.src!==D&&(T.src=D)}}):e.jsx(q,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 max-w-[300px]",children:[e.jsx("p",{className:"truncate font-medium",children:s.name}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s.subject||"No subject"})]})]})}),e.jsx(d,{className:"max-w-[220px] text-muted-foreground",children:(l=s.audienceNames)!=null&&l.length?e.jsx("span",{className:"block truncate",children:s.audienceNames.join(", ")}
1):e.jsx("span",{className:"text-muted-foreground/70",children:"—"})}),e.jsx(d,{children:e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsx(J,{variant:we[s.status]||"secondary",className:"capitalize",children:s.status}),s.status==="scheduled"&&s.scheduled_at&&e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:he(s.scheduled_at,B)})]})}),e.jsx(d,{className:"text-muted-foreground",children:s.sent_at?new Date(s.sent_at).toLocaleDateString():"—"}),e.jsx(d,{className:"text-right",onClick:i=>i.stopPropagation(),children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.status==="draft"&&e.jsx(v,{"aria-label":"Delete",title:"Delete",variant:"ghost",size:"icon",onClick:()=>y(s.id),children:e.jsx(ve,{className:"h-4 w-4 text-destructive"})}),e.jsx(A,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"})]})})]},s.id)}):e.jsx(b,{children:e.jsxs(d,{colSpan:4,className:"text-center py-12",children:[e.jsx(Z,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),c==="all"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground",children:"No campaigns yet"}),e.jsx(v,{variant:"link",onClick:()=>t("/admin/campaigns/new"),children:"Create your first campaign"})]}):e.jsx("p",{className:"text-muted-foreground",children:Ce[c]})]})})})]})})}),r>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",$,"–",H," of ",N," campaigns"]}),e.jsx(_,{children:e.jsxs(M,{children:[e.jsx(j,{children:e.jsx(E,{onClick:()=>h(s=>Math.max(1,s-1)),className:n===1?"pointer-events-none opacity-50":"cursor-pointer"})}),G().map((s,l)=>s==="ellipsis"?e.jsx(j,{children:e.jsx(F,{})},`ellipsis-${l}`):e.jsx(j,{children:e.jsx(C,{isActive:n===s,onClick:()=>h(s),className:"cursor-pointer",children:s})},s)),e.jsx(j,{children:e.jsx(I,{onClick:()=>h(s=>Math.min(r,s+1)),className:n===r?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]}),e.jsx(X,{open:!!p,onOpenChange:s=>!s&&y(null),children:e.jsxs(ee,{children:[e.jsxs(se,{children:[e.jsx(ae,{children:"Delete Campaign"}),e.jsxs(te,{children:["Are you sure you want to delete this campaign? This action cannot be undone.",e.jsx("br",{}),e.jsxs("strong",{children:['"',P==null?void 0:P.name,'"']})]})]}),e.jsxs(ne,{children:[e.jsx(le,{children:"Cancel"}),e.jsx(ie,{onClick:()=>{if(p){w.mutate(p),y(null);const s=Math.ceil((((a==null?void 0:a.length)||1)-1)/x);n>s&&s>0&&h(s)}},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})};export{Le 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.