PageSourceSearch

https://ctvcam.com/assets/leads-D4bOdEfF.js

js ctvcam.com collected 2026-10-04 02:39:27 UTC 13,252 bytes, 6 lines download raw bytes

1import{a as d,j as e}from"./query-Ban24u4e.js";import{c as I,u as M,H as z,F as n,B as w,X as P,a as D}from"./index-jvhwSSW_.js";import{A as V}from"./AdminLayout-D4fzZ2x1.js";import{I as $}from"./input-DcaHre60.js";import{R as q,S as C,a as S,b as K,c as k,d as c,C as O,D as B,e as U,f as R,g as E}from"./dialog-UeF9Ts51.js";import{S as _}from"./search-D8Je0oyf.js";import{U as F}from"./users-Bq-EBKxW.js";import{M as J,P as Q}from"./phone-BueQnwTw.js";import"./radix-ui-DdasXo-Q.js";import"./chevron-right-Bm_-M2lJ.js";import"./check-Dcx7_PRd.js";/**
2 * @license lucide-react v0.454.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const W=I("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]),T={new:"bg-blue-500/10 text-blue-400 border-blue-500/20",contacted:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",qualified:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",lost:"bg-muted text-muted-foreground border-border/60"},X=[{value:"all",label:"All statuses"},{value:"new",label:"New"},{value:"contacted",label:"Contacted"},{value:"qualified",label:"Qualified"},{value:"lost",label:"Lost"}];function L(u){return new Date(u).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function oe(){const[u,A]=M(),[H,p]=d.useState([]),[g,b]=d.useState(!0),[i,j]=d.useState(""),[s,x]=d.useState(null),[N,y]=d.useState(null),m=u.get("status")??"all",h=d.useCallback(async()=>{b(!0);try{const t=m!=="all"?`/api/leads?status=${m}`:"/api/leads",r=await fetch(t).then(a=>a.json());p(Array.isArray(r)?r:[])}catch{p([])}finally{b(!1)}},[m]);d.useEffect(()=>{h()},[h]);const v=(t,r)=>{y(t),fetch(`/api/leads/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:r})}).then(a=>a.json()).then(a=>{p(o=>o.map(f=>f.id===t?{...f,status:a.status}:f)),(s==null?void 0:s.id)===t&&x(o=>o&&{...o,status:a.status})}).catch(()=>{}).finally(()=>y(null))},l=H.filter(t=>{if(!i)return!0;const r=i.toLowerCase();return`${t.firstName} ${t.lastName}`.toLowerCase().includes(r)||t.email.toLowerCase().includes(r)||(t.company??"").toLowerCase().includes(r)||(t.interest??"").toLowerCase().includes(r)});return e.jsxs(V,{children:[e.jsxs(z,{children:[e.jsx("title",{children:"Leads — CTVCam Admin"}),e.jsx("meta",{name:"description",content:"Manage inbound leads for CTVCam."}),e.jsx("link",{rel:"canonical",href:"https://ctvcam.com/admin/leads"}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"}),e.jsx("meta",{property:"og:title",content:"Leads — CTVCam Admin"}),e.jsx("meta",{property:"og:description",content:"Manage inbound leads for CTVCam."}),e.jsx("meta",{property:"og:image",content:"https://ctvcam.com/og-image.png"}),e.jsx("meta",{property:"og:url",content:"https://ctvcam.com/admin/leads"}),e.jsx("meta",{property:"og:type",content:"website"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:image",content:"https://ctvcam.com/og-image.png"}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebPage",name:"Leads — CTVCam Admin",url:"https://ctvcam.com/admin/leads",noIndex:!0}).replace(/</g,"<")})]}),e.jsxs("div",{className:"max-w-6xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6 flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Leads"}),e.jsx("p",{className:"text-muted-foreground text-sm mt-0.5",children:e.jsx(n,{devId:"27427a",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:5639e0a18bf2d12905f07eece283f02544963e60200b7c4dcbb917a3129f03ce"},children:g?"Loading…":`${l.length} lead${l.length!==1?"s":""}`})})]}),e.jsxs(w,{variant:"outline",size:"sm",onClick:h,className:"border-border text-muted-foreground hover:text-foreground gap-1.5",children:[e.jsx(q,{size:13}),"Refresh"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-5",children:[e.jsxs("div",{className:"relative flex-1 max-w-xs",children:[e.jsx(_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e.jsx($,{value:i,onChange:t=>j(t.target.value),placeholder:"Search leads…",className:"pl-8 pr-8 bg-card border-border/60 text-foreground placeholder:text-muted-foreground text-sm"}),i&&e.jsx("button",{onClick:()=>j(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(P,{size:13})})]}),e.jsxs(C,{value:m,onValueChange:t=>A(t==="all"?{}:{status:t}),children:[e.jsx(S,{className:"w-44 bg-card border-border/60 text-foreground text-sm",children:e.jsx(K,{})}),e.jsx(k,{children:X.map(t=>e.jsx(c,{value:t.value,children:t.label},t.value))})]})]}),e.jsx("div",{className:"rounded-xl border border-border/60 bg-card overflow-hidden",children:g?e.jsx("div",{className:"p-8 text-center",children:e.jsx("div",{className:"w-6 h-6 border-2 border-primary border-t-transparent roun
6ded-full animate-spin mx-auto"})}):l.length===0?e.jsxs("div",{className:"p-12 text-center",children:[e.jsx(F,{size:36,className:"text-muted-foreground/30 mx-auto mb-3"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No leads found."})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border/60 bg-muted/30",children:[e.jsx("th",{className:"text-left px-4 py-3 text-muted-foreground font-medium text-xs uppercase tracking-wide",children:"Name"}),e.jsx("th",{className:"text-left px-4 py-3 text-muted-foreground font-medium text-xs uppercase tracking-wide hidden md:table-cell",children:"Contact"}),e.jsx("th",{className:"text-left px-4 py-3 text-muted-foreground font-medium text-xs uppercase tracking-wide hidden lg:table-cell",children:"Interest"}),e.jsx("th",{className:"text-left px-4 py-3 text-muted-foreground font-medium text-xs uppercase tracking-wide hidden sm:table-cell",children:"Source"}),e.jsx("th",{className:"text-left px-4 py-3 text-muted-foreground font-medium text-xs uppercase tracking-wide",children:"Status"}),e.jsx("th",{className:"text-left px-4 py-3 text-muted-foreground font-medium text-xs uppercase tracking-wide hidden lg:table-cell",children:"Date"}),e.jsx("th",{className:"px-4 py-3"})]})}),e.jsx("tbody",{children:l.map((t,r)=>e.jsxs("tr",{className:`border-b border-border/40 hover:bg-muted/20 transition-colors cursor-pointer ${r===l.length-1?"border-b-0":""}`,onClick:()=>x(t),children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsxs("p",{className:"text-foreground font-medium",children:[t.firstName," ",t.lastName]}),t.company&&e.jsxs("p",{className:"text-muted-foreground text-xs mt-0.5 flex items-center gap-1",children:[e.jsx(W,{size:10}),t.company]})]}),e.jsxs("td",{className:"px-4 py-3 hidden md:table-cell",children:[e.jsxs("p",{className:"text-muted-foreground text-xs flex items-center gap-1",children:[e.jsx(J,{size:10}),t.email]}),t.phone&&e.jsxs("p",{className:"text-muted-foreground text-xs flex items-center gap-1 mt-0.5",children:[e.jsx(Q,{size:10}),t.phone]})]}),e.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:e.jsx("p",{className:"text-muted-foreground text-xs",children:t.interest??"—"})}),e.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:e.jsx("p",{className:"text-muted-foreground text-xs",children:t.source??"—"})}),e.jsx("td",{className:"px-4 py-3",onClick:a=>a.stopPropagation(),children:e.jsxs(C,{value:t.status,onValueChange:a=>v(t.id,a),disabled:N===t.id,children:[e.jsxs(S,{className:`h-7 text-xs px-2 border rounded-full w-28 ${T[t.status]}`,children:[e.jsx(K,{}),e.jsx(O,{size:11,className:"ml-auto shrink-0"})]}),e.jsxs(k,{children:[e.jsx(c,{value:"new",children:"New"}),e.jsx(c,{value:"contacted",children:"Contacted"}),e.jsx(c,{value:"qualified",children:"Qualified"}),e.jsx(c,{value:"lost",children:"Lost"})]})]})}),e.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:e.jsx("p",{className:"text-muted-foreground text-xs",children:L(t.createdAt)})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{onClick:a=>{a.stopPropagation(),x(t)},className:"text-xs text-primary hover:underline",children:"View"})})]},t.id))})]})})})]}),e.jsx(B,{open:!!s,onOpenChange:t=>!t&&x(null),children:e.jsxs(U,{className:"bg-card border-border/60 max-w-lg",children:[e.jsx(R,{children:e.jsxs(E,{className:"text-foreground",children:[s==null?void 0:s.firstName," ",s==null?void 0:s.lastName]})}),s&&e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Email"}),e.jsx("p",{className:"text-foreground",children:e.jsx(n,{devId:"41a8d8",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:52f0a356ab514a29577bf84e62d1e220e8297305c7399db263a032ffc81b13e5"},children:s.email})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Phone"}),e.jsx("p",{className:"text-foreground",children:e.jsx(n,{devId:"53c159",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionH
6ash:"sha256:adbd7987f79c4634ef24f1eb757b8814f2ba8bd60ea63b9f570ee633b734b681"},children:s.phone??"—"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Company"}),e.jsx("p",{className:"text-foreground",children:e.jsx(n,{devId:"65d9da",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:69eb3c80cc520449da2302f1d25887674a265046d03b7b1322e2f7f4a3765f14"},children:s.company??"—"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Job title"}),e.jsx("p",{className:"text-foreground",children:e.jsx(n,{devId:"77f25b",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:844a8f5e745f39020ad8d8e7929f203995a80f7d415085b50ef296f40f87c391"},children:s.jobTitle??"—"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Source"}),e.jsx("p",{className:"text-foreground",children:e.jsx(n,{devId:"8a0adc",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:38f3eb84697c28ec38975ce215443cc9e4643b05011d98b5694e2076f6497d32"},children:s.source??"—"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Interest"}),e.jsx("p",{className:"text-foreground",children:e.jsx(n,{devId:"9c235d",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:738b62a37d2635e0e9a9d6082f8cd021be3f08ea425d808cad7da35cb4c5dad9"},children:s.interest??"—"})})]})]}),s.message&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-1",children:"Message"}),e.jsx("p",{className:"text-foreground bg-muted/30 rounded-lg p-3 text-xs leading-relaxed whitespace-pre-wrap",children:e.jsx(n,{devId:"225e05",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:4ddbc2ee7ec99f967dee33763a84f7bbc0e6ca9d60a8cd1ac83c3e26e4a461ca"},children:s.message})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border/40",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Status"}),e.jsx(D,{className:`mt-1 text-xs border ${T[s.status]}`,children:s.status})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Created"}),e.jsx("p",{className:"text-foreground text-xs mt-0.5",children:e.jsx(n,{devId:"0d2bdb",guard:{file:"src/pages/admin/leads.tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:d1b1e44fabd69e18dce10733a1299f0b3121b1439ef4a060bf768a7475a954cd"},children:L(s.createdAt)})})]})]}),e.jsx("div",{className:"flex gap-2 pt-1",children:["new","contacted","qualified","lost"].filter(t=>t!==s.status).map(t=>e.jsxs(w,{size:"sm",variant:"outline",disabled:N===s.id,onClick:()=>v(s.id,t),className:"text-xs border-border/60 text-muted-foreground hover:text-foreground capitalize",children:["Mark ",t]},t))})]})]})})]})}export{oe 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.