PageSourceSearch

https://treeal.com/assets/AdminMonitor-DKV81h2G.js

js treeal.com collected 2026-10-04 05:39:13 UTC 10,754 bytes, 1 lines download raw bytes

1import{r as g,j as e}from"./vendor-react-63GBCzgN.js";import{L as S}from"./vendor-router-DoA1Duab.js";import{h as D}from"./moment-BLMuvzoS.js";import{F as R,N as B,b as T,h as E}from"./index-BJrnvmHL.js";import{a as q}from"./seoAudit-Do5fV0Hu.js";import{L as F}from"./loader-circle-CLDhf0El.js";import{R as G}from"./refresh-cw-DZLT-2WF.js";import{A as _}from"./activity-BS47hGFP.js";import{U as I}from"./users-Dy3mMk6J.js";import{T as w}from"./trending-up-76QJI40f.js";import{C as U}from"./circle-check-maW-HQzw.js";import{S as Q}from"./sparkles-CJH0sU-K.js";import{G as z}from"./gauge-Cg4Yvq-g.js";import{B as H}from"./bot-CN_XRPjh.js";import{T as K}from"./triangle-alert-ChdiuBUv.js";import"./vendor-base44-C5mCKdwd.js";function $({icon:r,title:c,subtitle:l,accent:d,to:b,actionLabel:k,children:N}){return e.jsxs("section",{className:"rounded-2xl border border-black/5 bg-white",children:[e.jsxs("header",{className:"flex items-center justify-between gap-3 border-b border-black/5 p-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl",style:{backgroundColor:`${d}14`},children:e.jsx(r,{className:"h-5 w-5",style:{color:d}})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-heading text-base font-bold text-treeal-black",children:c}),e.jsx("p",{className:"text-xs text-treeal-gray",children:l})]})]}),b&&e.jsxs(S,{to:b,className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-black/10 px-3 py-1.5 text-xs font-semibold text-treeal-black transition-colors hover:bg-treeal-bg-soft",children:[k," ",e.jsx(E,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-5",children:N})]})}function h({icon:r,label:c,value:l,sub:d,accent:b}){return e.jsxs("div",{className:"rounded-xl border border-black/5 bg-treeal-bg-soft/40 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-treeal-gray",children:[e.jsx(r,{className:"h-3.5 w-3.5",style:{color:b||"#0f6e14"}}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:c})]}),e.jsx("p",{className:"mt-1.5 font-heading text-2xl font-bold text-treeal-black",children:l}),d&&e.jsx("p",{className:"text-[11px] text-treeal-gray",children:d})]})}function P({label:r,value:c,max:l,color:d="#0f6e14"}){const b=l>0?Math.max(c/l*100,c>0?4:0):0;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"truncate font-medium text-treeal-black",children:r}),e.jsx("span",{className:"shrink-0 text-treeal-gray",children:c})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-treeal-bg-soft",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${b}%`,backgroundColor:d}})})]})}function M({to:r,icon:c,label:l,desc:d}){return e.jsxs(S,{to:r,className:"group flex items-center gap-3 rounded-2xl border border-black/5 bg-white p-4 transition-all hover:-translate-y-0.5 hover:border-[#e8da11]",children:[e.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-treeal-bg-soft text-[#0f6e14] transition-colors group-hover:bg-[#e8da11] group-hover:text-[#213325]",children:e.jsx(c,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-semibold text-treeal-black",children:l}),e.jsx("p",{className:"truncate text-xs text-treeal-gray",children:d})]}),e.jsx(E,{className:"h-4 w-4 text-treeal-gray transition-transform group-hover:translate-x-0.5"})]})}function de(){const[r,c]=g.useState([]),[l,d]=g.useState([]),[b,k]=g.useState(!0),[N,A]=g.useState(!1),C=async()=>{A(!0);try{const[s,i]=await Promise.all([T.entities.Lead.list("-created_date",500).catch(()=>[]),T.entities.BlogPost.list("-updated_date",500).catch(()=>[])]);c(s||[]),d(i||[])}finally{k(!1),A(!1)}};g.useEffect(()=>{C()},[]);const o=g.useMemo(()=>{const s=D(),i=s.clone().startOf("day"),u=s.clone().subtract(7,"days"),f={};for(let a=13;a>=0;a--)f[s.clone().subtract(a,"days").format("DD/MM")]=0;const j={}
1,n={novo:0,contatado:0,qualificado:0,cliente:0};let v=0,t=0,x=0;r.forEach(a=>{const p=D(a.created_date),O=p.format("DD/MM");f[O]!==void 0&&f[O]++,p.isSameOrAfter(i)&&v++,p.isSameOrAfter(u)&&t++,a.crm_synced&&x++;const L=a.origem||"(não informado)";j[L]=(j[L]||0)+1,a.status&&n[a.status]!==void 0&&n[a.status]++});const y=Object.entries(j).map(([a,p])=>({k:a,v:p})).sort((a,p)=>p.v-a.v).slice(0,5);return{total:r.length,today:v,week:t,crmSynced:x,crmRate:r.length?Math.round(x/r.length*100):0,byDay:Object.values(f),byDayMax:Math.max(...Object.values(f),1),byDayLabels:Object.keys(f),topOrigem:y,topOrigemMax:y[0]?.v||1,funnel:[["Novo",n.novo],["Contatado",n.contatado],["Qualificado",n.qualificado],["Cliente",n.cliente]],funnelMax:Math.max(n.novo,n.contatado,n.qualificado,n.cliente,1)}},[r]),m=g.useMemo(()=>{const s=l.filter(t=>t.status==="published"),i=s.map(t=>({p:t,a:q(t)})),u=t=>t.length?Math.round(t.reduce((x,y)=>x+y,0)/t.length):0,f=s.filter(t=>!t.meta_title).length,j=s.filter(t=>!t.meta_description).length,n=s.filter(t=>t.noindex).length,v=i.map(({p:t,a:x})=>({id:t.id,slug:t.slug,title:t.title,seo_score:x.seoScore})).sort((t,x)=>t.seo_score-x.seo_score).slice(0,5);return{totalPosts:l.length,published:s.length,drafts:l.length-s.length,seoAvg:u(i.map(({a:t})=>t.seoScore)),perfAvg:u(i.map(({a:t})=>t.performanceScore)),aiAvg:u(i.map(({a:t})=>t.aiScore)),noMetaTitle:f,noMetaDesc:j,noindexCount:n,lowest:v}},[l]);return b?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-treeal-bg-soft",children:e.jsx(F,{className:"h-7 w-7 animate-spin text-[#0f6e14]"})}):e.jsxs("div",{className:"mx-auto max-w-6xl px-5 py-8 sm:px-8",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-2xl font-bold text-treeal-black sm:text-3xl",children:"Monitor"}),e.jsx("p",{className:"mt-1 text-sm text-treeal-gray",children:"Sinais essenciais de leads e SEO em tempo real — leve, sem travar."})]}),e.jsxs("button",{onClick:C,disabled:N,className:"inline-flex items-center gap-1.5 rounded-full border border-black/10 bg-white px-4 py-2 text-xs font-semibold text-treeal-black transition-colors hover:bg-treeal-bg-soft disabled:opacity-60",children:[e.jsx(G,{className:`h-3.5 w-3.5 ${N?"animate-spin":""}`})," Atualizar"]})]}),e.jsxs("div",{className:"mt-8 grid gap-5 lg:grid-cols-2",children:[e.jsxs($,{icon:_,title:"Leads & CRM",subtitle:"Atribuição e funil de conversão",accent:"#0f6e14",to:"/admin/metricas-crm",actionLabel:"Detalhar",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx(h,{icon:I,label:"Total",value:o.total}),e.jsx(h,{icon:w,label:"Hoje",value:o.today,accent:"#e8da11"}),e.jsx(h,{icon:_,label:"7 dias",value:o.week,accent:"#0f6e14"}),e.jsx(h,{icon:U,label:"CRM sync",value:`${o.crmRate}%`,sub:`${o.crmSynced} leads`,accent:"#213325"})]}),e.jsxs("div",{className:"mt-5",children:[e.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-treeal-gray",children:"Leads por dia (14 dias)"}),e.jsx("div",{className:"flex h-16 items-end gap-1",children:o.byDay.map((s,i)=>e.jsx("div",{className:"flex-1 rounded-t bg-[#0f6e14]/80 transition-all",style:{height:`${Math.max(s/o.byDayMax*100,s>0?8:2)}%`},title:`${o.byDayLabels[i]}: ${s}`},i))})]}),e.jsxs("div",{className:"mt-5",children:[e.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-treeal-gray",children:"Funil"}),e.jsx("div",{className:"space-y-2",children:o.funnel.map(([s,i])=>e.jsx(P,{label:s,value:i,max:o.funnelMax,color:"#213325"},s))})]}),o.topOrigem.length>0&&e.jsxs("div",{className:"mt-5",children:[e.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-treeal-gray",children:"Top origens"}),e.jsx("div",{className:"space-y-2",children:o.topOrigem.map(s=>e.jsx(P,{label:s.k,value:s.v,max:o.topOrigemMax,color:"#0f6e14"},s.k))})]})]}),e.jsxs($,{icon:Q,title:"SEO & Conteúdo",subtitle:"Scores médios e qualidade dos artigos",accent:"#c9bd0f",to:"/admin/seo",actionLabel:"Auditar",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx(h,{icon:R,label:"Publicados",value:m.published,sub:`${m.totalPosts} total`}),e.jsx(h,{icon:w,label:"SEO médio",value:m.seoAvg,accent:"#0f6e14"}),e.jsx(h,{icon:z,label:"Perf. média",value:m.perfAvg,accent:"#b9740a"}),e.jsx(h,{icon:H,label:"IA média",value:m.aiAvg,accent:"#213325"})]}),e.jsxs("div",{className:"mt-5 grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-amber-200/60 bg-amber-50/60 p-3 text-center",children:[e.jsx("p",{className:"font-heading text-xl font-bold text-amber-700",children:m.noMetaTitle}),e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-amber-700/80",children:"Sem meta title"})]}),e.jsxs("div",{className:"rounded-xl border border-amber-200/60 bg-amber-50/60 p-3 text-center",children:[e.jsx("p",{className:"font-heading text-xl font-bold text-amber-700",children:m.noMetaDesc}),e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-amber-700/80",children:"Sem meta desc"})]}),e.jsxs("div",{className:"rounded-xl border border-black/5 bg-treeal-bg-soft/50 p-3 text-center",children:[e.jsx("p",{className:"font-heading text-xl font-bold text-treeal-gray",children:m.noindexCount}),e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-treeal-gray",children:"Noindex"})]})]}),m.lowest.length>0&&e.jsxs("div",{className:"mt-5",children:[e.jsxs("p",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-treeal-gray",children:[e.jsx(K,{className:"h-3 w-3 text-amber-600"})," Revisão prioritária"]}),e.jsx("div",{className:"space-y-2",children:m.lowest.map(s=>e.jsxs(S,{to:`/blog/${s.slug}`,className:"flex items-center justify-between gap-2 rounded-xl border border-black/5 bg-treeal-bg-soft/40 px-3 py-2 transition-colors hover:bg-treeal-bg-soft",children:[e.jsx("span",{className:"truncate text-xs font-medium text-treeal-black",children:s.title}),e.jsxs("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-bold",style:{backgroundColor:"rgba(220,38,38,0.12)",color:"#dc2626"},children:["SEO ",s.seo_score??0]})]},s.id))})]})]})]}),e.jsxs("div",{className:"mt-6 grid gap-3 sm:grid-cols-3",children:[e.jsx(M,{to:"/admin/integracoes",icon:B,label:"Integrações & Conectores",desc:"Status de APIs e funil"}),e.jsx(M,{to:"/admin/relatorios",icon:w,label:"Relatórios GA4",desc:"Tráfego detalhado"}),e.jsx(M,{to:"/admin/blog",icon:R,label:"Blog",desc:"Artigos e conteúdo"})]})]})}export{de 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.