1import{u as w,a as C,j as e,b as c}from"./index-BbKxumrM.js";import{r as n,L as o}from"./react-vendor-DT1_wbt4.js";import{aA as z,r as A,G as S,a3 as _,d as E,C as L,am as p,V as u,a6 as P,aa as W,q as D}from"./ui-vendor-BfDHuItz.js";import"./firebase-vendor-CSkRnVBi.js";const I=()=>{const{user:t,activeSchoolId:l}=w(),{hasRole:r}=C(),[s,b]=n.useState(null),[d,v]=n.useState(0),[f,m]=n.useState(!0),[h,j]=n.useState("");if(n.useEffect(()=>{(async()=>{if(t){m(!0);try{const i=await c.getDashboardStats(t.role,l||void 0);if(b(i),t.role==="school_manager"&&l){const g=(await c.getSchools()).find(k=>String(k.id)===String(l));g&&j(g.name)}if(r(["admin","competition_manager"])){const x=await c.getPendingSchoolLinks();v(x.length)}}catch(i){console.error("Erro ao buscar estatÃsticas reais",i)}finally{m(!1)}}})()},[t]),!t)return null;if(f)return e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(z,{className:"animate-spin mb-4",size:48}),e.jsx("p",{className:"font-bold uppercase text-xs tracking-widest",children:"Atualizando Painel..."})]});const y=!s||s.newsCount===0&&s.activeComps===0&&s.totalSchools===0,N=[{title:t.role==="school_manager"?"Competições Agendadas":"Competições Ativas",value:(s==null?void 0:s.activeComps)||0,icon:A,color:"text-red-500",bgColor:"bg-red-50",link:"/admin/competicoes",visible:!0},{title:t.role==="school_manager"?"Minha Escola":"Escolas Ativas",value:(s==null?void 0:s.totalSchools)||0,icon:S,color:"text-green-600",bgColor:"bg-green-50",link:"/admin/escolas",visible:r(["admin","school_manager","competition_manager"])},{title:t.role==="school_manager"?"Atletas Inscritos":"Total de Atletas",value:(s==null?void 0:s.totalAthletes)||0,icon:_,color:"text-blue-600",bgColor:"bg-blue-50",link:"/admin/atletas",visible:r(["admin","school_manager","competition_manager","coach"])},{title:"NotÃcias Publicadas",value:(s==null?void 0:s.newsCount)||0,icon:E,color:"text-indigo-500",bgColor:"bg-indigo-50",link:"/admin/noticias",visible:r(["admin","editor"])}].filter(a=>a.visible);return e.jsxs("div",{className:"space-y-8 animate-fade-in-up",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-black text-gray-900 tracking-tighter mb-1 uppercase",children:"Resumo"}),e.jsx("p",{className:"text-gray-500 font-medium",children:t.role==="school_manager"&&h?`Bem-vindo de volta, gestor da ${h}.`:"Acompanhe os principais indicadores da plataforma."})]}),e.jsx("img",{src:"/fedeesp-logo-2026.jpg",alt:"Fedeesp",className:"h-12 object-contain"})]}),y&&e.jsxs("div",{className:"p-6 bg-amber-50 border border-amber-200 rounded-3xl flex items-center gap-4 text-amber-800 shadow-sm",children:[e.jsx(L,{size:24,className:"shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-black text-sm uppercase tracking-wider",children:"Atenção: Banco de dados vazio"}),e.jsxs("p",{className:"text-sm font-medium mt-1",children:["O sistema ainda não possui registros. Você pode usar a ferramenta de ",e.jsx(o,{to:"/admin/nuvem",className:"underline font-bold hover:text-amber-900 transition-colors",children:"sincronização"})," para popular os dados iniciais."]})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-
15",children:N.map((a,i)=>e.jsxs("div",{className:"bg-white rounded-3xl shadow-sm p-6 border border-gray-100 flex flex-col justify-between group hover:-translate-y-1 hover:shadow-lg transition-all duration-300 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-6 opacity-5 transform translate-x-4 -translate-y-4 group-hover:scale-110 group-hover:rotate-12 transition-transform duration-500",children:e.jsx(a.icon,{size:100})}),e.jsx("div",{className:"relative z-10 flex items-start justify-between mb-6",children:e.jsx("div",{className:`p-4 rounded-[20px] ${a.bgColor} ${a.color} shadow-sm`,children:e.jsx(a.icon,{size:28,strokeWidth:2})})}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("h3",{className:"text-[2.5rem] font-black text-gray-900 tracking-tighter leading-none mb-2",children:a.value}),e.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:a.title})]}),e.jsx("div",{className:"relative z-10 mt-6 pt-4 border-t border-gray-50",children:e.jsxs(o,{to:a.link,className:`text-[10px] ${a.color} font-black uppercase tracking-widest flex items-center gap-1.5 hover:opacity-70 transition-opacity`,children:["Gerenciar Painel ",e.jsx(p,{size:14,strokeWidth:3})]})})]},i))}),r(["admin","competition_manager"])&&d>0&&e.jsxs("div",{className:"bg-white rounded-3xl shadow-sm p-6 border border-gray-100 flex flex-col md:flex-row items-center justify-between gap-6 group hover:-translate-y-1 hover:shadow-lg transition-all duration-300 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-6 opacity-5 transform translate-x-4 -translate-y-4",children:e.jsx(u,{size:100})}),e.jsxs("div",{className:"flex items-center gap-4 relative z-10",children:[e.jsx("div",{className:"p-4 rounded-[20px] bg-orange-50 text-orange-500 shadow-sm",children:e.jsx(u,{size:28,strokeWidth:2})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[2.5rem] font-black text-gray-900 tracking-tighter leading-none mb-1",children:d}),e.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Solicitações de VÃnculo Pendentes"})]})]}),e.jsxs(o,{to:"/admin/solicitacoes-escola",className:"relative z-10 text-[10px] text-orange-500 font-black uppercase tracking-widest flex items-center gap-1.5 hover:opacity-70 transition-opacity whitespace-nowrap",children:["Analisar Solicitações ",e.jsx(p,{size:14,strokeWidth:3})]})]}),e.jsxs("div",{className:"pt-4",children:[e.jsx("h2",{className:"text-[11px] font-black text-gray-400 uppercase tracking-widest mb-4 ml-2",children:"Acesso Rápido"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-5",children:[e.jsxs(o,{to:"/admin/inscricoes",className:"bg-white p-6 rounded-3xl border border-gray-100 hover:border-fedeesp-red/30 shadow-sm hover:shadow-md transition-all group flex items-center gap-5",children:[e.jsx("div",{className:"bg-gray-50 text-gray-400 group-hover:bg-red-50 group-hover:text-fedeesp-red p-4 rounded-2xl transition-colors shrink-0",children:e.jsx(P,{size:24,strokeWidth:2})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-gray-900 tracking-tight",children:"Inscrições"}),e.jsx("p",{className:"text-xs text-gray-400 font-medium mt-0.5",children:"Listagem geral"})]})]}),r(["admin","school_manager"])&&e.jsxs(o,{to:"/admin/atletas/novo",className:"bg-white p-6 rounded-3xl border border-gray-100 hover:border-blue-200 shadow-sm hover:shadow-md transition-all group flex items-center gap-5",children:[e.jsx("div",{className:"bg-gray-50 text-gray-400 group-hover:bg-blue-50 group-hover:text-blue-600 p-4 rounded-2xl transition-colors shrink-0",children:e.jsx(W,{size:24,strokeWidth:2})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-gray-900 tracking-tight",children:"Novo Atleta"}),e.jsx("p",{className:"text-xs text-gray-400 font-medium mt-0.5",children:"Cadastrar no sistema"})]})]}),e.jsxs(o,{to:"/calendario",className:"bg-white p-6 rounded-3xl border border-gray-100 hover:border-green-200 shadow-sm hover:shadow-md transition-all group flex items-center gap-5",children:[e.jsx("div",{className:"bg-gray-50 text-gray-400 group-hover:bg-green-50 group-hover:text-green-600 p-4 rounded-2xl transition-colors shrink-0",children:e.jsx(D,{size:24,strokeWidth:2})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-gray-900 tracking-tight",children:"Calendário"}
1),e.jsx("p",{className:"text-xs text-gray-400 font-medium mt-0.5",children:"Eventos e etapas"})]})]})]})]})]})};export{I 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.