1import{r as a,j as t}from"./react-RN8z7mqm.js";import{s as f}from"./supabase-D7bm-uKx.js";import{toast as g}from"./sonner-CSA395gJ.js";import{ao as k,aE as v,p as y,z as S,C as _,X as C}from"./icons-CFy5kY0-.js";const b={linktree:{label:"Linktree",cls:"bg-emerald-500/10 text-emerald-600 border-emerald-500/30"},stan:{label:"Stan Store",cls:"bg-violet-500/10 text-violet-600 border-violet-500/30"},beacons:{label:"Beacons",cls:"bg-sky-500/10 text-sky-600 border-sky-500/30"},other:{label:"Link-in-bio",cls:"bg-amber-500/10 text-amber-600 border-amber-500/30"},none:{label:"â",cls:"text-muted-foreground"}};function T(){const[c,j]=a.useState([]),[n,m]=a.useState([]),[l,x]=a.useState(!0),[i,N]=a.useState("new"),u=async()=>{x(!0);try{const{data:{session:e}}=await f.auth.getSession();if(!e?.access_token)throw new Error("Not signed in");const s=await fetch("/api/influencers/data",{method:"POST",headers:{Authorization:`Bearer ${e.access_token}`}}),r=await s.json();if(!s.ok)throw new Error(r.error??"load_failed");j(r.stats??[]),m(r.leads??[])}catch(e){g.error(e instanceof Error?e.message:"Load failed")}finally{x(!1)}};a.useEffect(()=>{u()},[]);const d=async(e,s)=>{m(r=>r.map(o=>o.id===e?{...o,status:s}:o));try{const{data:{session:r}}=await f.auth.getSession();if(!(await fetch("/api/influencers/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r?.access_token}`},body:JSON.stringify({id:e,status:s})})).ok)throw new Error("update_failed")}catch{g.error("Update failed â refresh and retry")}},h=a.useMemo(()=>{const e=new Map;for(const s of c)e.has(s.handle)||e.set(s.handle,s);return[...e.values()]},[c]),w=a.useMemo(()=>{const e={new:0,shortlist:0,contacted:0,skip:0};for(const s of n)e[s.status]=(e[s.status]??0)+1;return e},[n]),p=n.filter(e=>i==="all"?!0:e.status===i);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg font-semibold",children:"Influencers â link-in-bio target market"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Creators using Linktree / Stan Store already invest in their link-in-bio â they're the focus segment for Testivo's proof widgets. Seed audiences below; scraped leads under it."})]}),t.jsxs("button",{onClick:()=>{u()},className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[t.jsx(k,{className:`h-3.5 w-3.5 ${l?"animate-spin":""}`})," Refresh"]})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[h.length===0&&!l&&t.jsxs("p",{className:"text-sm text-muted-foreground sm:col-span-2 lg:col-span-4",children:["No snapshots yet â run ",t.jsx("code",{children:"node scripts/scrape-influencers.mjs"})," on the Mac (one-time ",t.jsx("code",{children:"node scripts/x-login.mjs"})," first)."]}),h.map(e=>t.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium",children:[t.jsx(v,{className:"h-4 w-4 text-primary"})," @",e.handle]}),t.jsx("p",{className:"mt-2 text-2xl font-semibold",children:e.followers_label??"â"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["followers · ",e.following_label??"â"," following"]}),t.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:new Date(e.captured_at).toLocaleDateString()})]},e.handle))]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["new","shortlist","contacted","skip","all"].map(e=>t.jsxs("button",{onClick:()=>N(e),className:`rounded-full border px-3 py-1 text-xs capitalize transition ${i===e?"border-primary bg-primary/10 font-medium text-primary":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[e,e!=="all"&&t.jsxs("span",{className:"ml-1 text-muted-foreground",children:["(",w[e]??0,")"]})]},e)),t.jsxs("span",{className:"ml-auto text-xs text-muted-foreground",children:[n.length," leads total"]})]}),t.jsxs("div",{className:"grid gap-2",children:[p.length===0&&!l&&t.jsxs("p",{className:"rounded-lg border p-4 text-sm text-muted-foreground",children:["Nothing here. New leads land via ",t.jsx("code",{children:"scripts/scrape-influencers.mjs"})," (weekly, or run it manually)."]}),p.map(e=>{const s=b[e.platform]??b.other;return t.jsxs("div",{className:"rounded-lg border p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"font-medium",children:e.display_name??e.handle}),t.jsxs("a",{href:`https://x.com/${e.handle}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-sky-600 hover:underline",children:[t.jsx(y,{className:"h-3 w-3"}),"@",e.handle]}),t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[11px] font-medium ${s.cls}`,children:s.label}),e.followers_label&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.followers_label," followers"]}),t.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[t.jsx("button",{onClick:()=>{d(e.id,"shortlist")},title:"Shortlist",className:`rounded-md border p-1.5 hover:bg-accent ${e.status==="shortlist"?"border-amber-500/50 text-amber-500":"text-muted-foreground"}`,children:t.jsx(S,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>{d(e.id,"contacted")},title:"Mark contacted",className:`rounded-md border p-1.5 hover:bg-accent ${e.status==="contacted"?"border-emerald-500/50 text-emerald-600":"text-muted-foreground"}`,children:t.jsx(_,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>
1{d(e.id,"skip")},title:"Skip",className:`rounded-md border p-1.5 hover:bg-accent ${e.status==="skip"?"border-red-500/50 text-red-500":"text-muted-foreground"}`,children:t.jsx(C,{className:"h-3.5 w-3.5"})})]})]}),e.bio&&t.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:e.bio}),t.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground",children:[e.linkinbio_url&&t.jsx("a",{href:e.linkinbio_url.startsWith("http")?e.linkinbio_url:`https://${e.linkinbio_url}`,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:e.linkinbio_url}),e.source&&t.jsxs("span",{children:["via ",e.source]})]})]},e.id)})]})]})}export{T 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.