PageSourceSearch

https://podemos.org.br/assets/painel.leads-B_OHxOOH.js

js podemos.org.br collected 2026-09-24 23:03:05 UTC 5,288 bytes, 2 lines download raw bytes

1import{ad as g,ae as N,r as a,j as e,aH as w,D as y,aG as v,ah as L}from"./index-DxYKwA6-.js";import{u as S}from"./useServerFn-DEjFmqxX.js";import{r as C}from"./auth-middleware-DXMiBSBc.js";import{A as E}from"./arrow-left-B4sptGEn.js";const R=g({method:"GET"}).middleware([C]).handler(N("a79bb56d3da28cb983be9a4c0088d0f4ff9b52a70423c37ed1a0de33616876f1"));function k(n){const r=["Nome","E-mail","Estado","Origem","Data"],c=n.map(t=>[t.nome,t.email,t.estado,t.origem??"",new Date(t.created_at).toLocaleString("pt-BR")]);return[r,...c].map(t=>t.map(m=>`"${String(m).replace(/"/g,'""')}"`).join(";")).join(`
2`)}function A(){const n=S(R),[r,c]=a.useState([]),[t,m]=a.useState(!0),[p,h]=a.useState(null),[x,u]=a.useState(""),[i,f]=a.useState("");a.useEffect(()=>{n().then(s=>{s.ok||h(s.message??"Não foi possível carregar."),c(s.leads)}).catch(()=>h("Não foi possível carregar os interessados.")).finally(()=>m(!1))},[n]);const b=a.useMemo(()=>Array.from(new Set(r.map(s=>s.estado))).sort(),[r]),o=a.useMemo(()=>{const s=x.trim().toLowerCase();return r.filter(l=>(!i||l.estado===i)&&(!s||l.nome.toLowerCase().includes(s)||l.email.toLowerCase().includes(s)))},[r,x,i]);function j(){const s=new Blob(["\uFEFF"+k(o)],{type:"text/csv;charset=utf-8"}),l=URL.createObjectURL(s),d=document.createElement("a");d.href=l,d.download=`filiacao-leads-${new Date().toISOString().slice(0,10)}.csv`,document.body.appendChild(d),d.click(),d.remove(),URL.revokeObjectURL(l)}return e.jsxs("div",{className:"container mx-auto max-w-5xl px-3 sm:px-4 py-6 sm:py-10",children:[e.jsxs("a",{href:"/painel",className:"text-xs font-bold uppercase tracking-wider text-primary inline-flex items-center gap-1",children:[e.jsx(E,{className:"w-3.5 h-3.5"})," Voltar ao painel"]}),e.jsxs("header",{className:"mt-3 flex flex-col sm:flex-row sm:flex-wrap sm:items-end sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold font-display flex items-center gap-2",children:[e.jsx(w,{className:"w-7 h-7 text-primary"})," Quero me filiar"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Todas as pessoas que pediram contato pelo formulário do site."})]}),e.jsxs("button",{onClick:j,disabled:o.length===0,className:"inline-flex items-center justify-center gap-2 text-sm font-bold bg-primary text-white rounded-md px-4 min-h-11 py-2.5 hover:opacity-90 disabled:opacity-60 w-full sm:w-auto",children:[e.jsx(y,{className:"w-4 h-4"})," Baixar planilha"]})]}),e.jsxs("div",{className:"mt-6 flex flex-col sm:flex-row sm:flex-wrap gap-3",children:[e.jsxs("div",{className:"relative flex-1 sm:min-w-[220px]",children:[e.jsx(v,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{value:x,onChange:s=>u(s.target.value),placeholder:"Buscar por nome ou e-mail…",className:"w-full rounded-md border border-input bg-white pl-9 pr-3 py-2.5 text-base sm:text-sm"})]}),e.jsxs("select",{value:i,onChange:s=>f(s.target.value),className:"rounded-md border border-input bg-white px-3 py-2.5 text-base sm:text-sm",children:[e.jsx("option",{value:"",children:"Todos os estados"}),b.map(s=>e.jsx("option",{value:s,children:s},s))]})]}),p&&e.jsx("div",{className:"mt-4 text-sm text-red-600 bg-red-50 border border-red-200 rounded-md px-3 py-2",children:p}),t?e.jsx("div",{className:"py-20 flex justify-center text-muted-foreground",children:e.jsx(L,{className:"w-6 h-6 animate-spin"})}):o.length===0?e.jsx("p",{className:"py-20 text-center text-sm text-muted-foreground",children:r.length===0?"Ainda não há solicitações.":"Nenhum resultado para esse filtro."}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mt-6 text-xs text-muted-foreground",children:[o.length," solicitação",o.length===1?"":"s"]}),e.jsx("ul",{className:"mt-3 space-y-2 sm:hidden",children:o.map(s=>e.jsxs("li",{className:"bg-white rounded-xl border border-border p-4",children:[e.jsx("p",{className:"font-semibold break-words",children:s.nome}),e.jsx("a",{href:`mailto:${s.email}`,className:"text-sm text-primary break-all hover:underline",children:s.email}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[s.estado," · ",new Date(s.created_at).toLocaleStr
2ing("pt-BR")]})]},s.id))}),e.jsx("div",{className:"mt-3 bg-white rounded-xl border border-border overflow-x-auto hidden sm:block",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50 text-left",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Nome"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"E-mail"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Estado"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Data"})]})}),e.jsx("tbody",{children:o.map(s=>e.jsxs("tr",{className:"border-t border-border",children:[e.jsx("td",{className:"px-4 py-3",children:s.nome}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("a",{href:`mailto:${s.email}`,className:"text-primary hover:underline",children:s.email})}),e.jsx("td",{className:"px-4 py-3",children:s.estado}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-muted-foreground",children:new Date(s.created_at).toLocaleString("pt-BR")})]},s.id))})]})})]})]})}export{A 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.