PageSourceSearch

https://faf.co.ao/assets/AdminCompetitions-wNjcNSmW.js

js faf.co.ao collected 2026-10-02 19:09:51 UTC 5,550 bytes, 1 lines download raw bytes

1import{r as n,s as A,b as p,t as _,j as e}from"./vendor-react-core-_0sZDOLQ.js";import{B as j,b as l}from"./index-j07E1qHv.js";import{I as g}from"./input-rti45mgP.js";import{C as u,b as G,c as D,a as N}from"./card-DHmBnTdH.js";import{D as H,a as S,b as q,c as F,d as E}from"./dialog-C9ty4md6.js";import{L as f}from"./label-7HT5__eZ.js";import{t as c}from"./index-CDqomOa1.js";import{h as a,S as b,a0 as T,L as I}from"./vendor-lucide-Ddz0eB7N.js";import{m as L}from"./vendor-framer-motion-C1oRD-X5.js";import"./vendor-radix-CFmJ1img.js";import"./vendor-utils-BRu4i-LD.js";import"./vendor-supabase-Ca6cp8v2.js";function Y(){const[y,m]=n.useState(!1),[t,d]=n.useState(""),[r,x]=n.useState(""),v=A(),{data:i}=p({queryKey:["current-user"],queryFn:()=>l.auth.me()}),{data:h,isLoading:k}=p({queryKey:["season-histories"],queryFn:()=>l.entities.SeasonHistory.list("-created_date"),initialData:[]}),o=_({mutationFn:async({competition_name:s,season:w})=>(await l.functions.invoke("generateCompetitionHistory",{competition_name:s,season:w})).data,onSuccess:s=>{c.success(s.message),v.invalidateQueries({queryKey:["season-histories"]}),m(!1),d(""),x("")},onError:s=>{c.error("Erro ao gerar histórico: "+s.message)}});if((i==null?void 0:i.role)!=="admin")return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(a,{className:"w-20 h-20 text-red-600 mx-auto mb-4"}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Acesso Negado"}),e.jsx("p",{className:"text-gray-600",children:"Apenas administradores podem aceder a esta área"})]})});const C=()=>{if(!t||!r){c.error("Preencha todos os campos");return}o.mutate({competition_name:t,season:r})};return e.jsxs("main",{className:"min-h-screen bg-gray-50",children:[e.jsx("section",{className:"bg-gradient-to-br from-gray-900 via-gray-800 to-black py-20",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:[e.jsx(a,{className:"w-16 h-16 mb-4 text-white"}),e.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4 text-white",children:"Gestão de Competições"}),e.jsx("p",{className:"text-xl text-white/90",children:"Gerar históricos de temporadas com IA"})]})})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs(u,{className:"mb-8",children:[e.jsx(G,{children:e.jsxs(D,{className:"flex items-center gap-3",children:[e.jsx(b,{className:"w-6 h-6 text-yellow-500"}),"Geração Automática de Históricos"]})}),e.jsxs(N,{children:[e.jsx("p",{className:"text-gray-600 mb-4",children:"A IA irá pesquisar informações oficiais sobre temporadas de competições no site da FAF (faf.co.ao) e outras fontes desportivas para gerar históricos completos incluindo campeões, artilheiros e estatísticas."}),e.jsxs(H,{open:y,onOpenChange:m,children:[e.jsx(S,{asChild:!0,children:e.jsxs(j,{className:"bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700",children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),"Gerar Novo Histórico"]})}),e.jsxs(q,{children:[e.jsx(F,{children:e.jsx(E,{children:"Gerar Histórico de Competição"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(f,{children:"Nome da Competição"}),e.jsx(g,{placeholder:"Ex: Girabola",value:t,onChange:s=>d(s.target.value)})]}),e.jsxs("div",{children:[e.jsx(f,{children:"Temporada"}),e.jsx(g,{placeholder:"Ex: 2023/24",value:r,onChange:s=>x(s.target.value)})]}),e.jsx(j,{onClick:C,disabled:o.isPending,className:"w-full bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700",children:o.isPending?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4 mr-2 animate-spin"}),"A gerar..."]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"w-4 h-4 mr-2"}),"Gerar com IA"]})})]})]})]})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:h.map(s=>e.jsx(u,{className:"hover:shadow-lg transition-shadow",children:e.jsxs(N,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(a,{className:"w-8 h-8 text-yellow-500"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-gray-900",children:s.competition_name}),e.jsx("p",{className:"text-sm text-gray-600",children:s.season})]})]}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:"Campeão:"}),e.jsx("span",{className:"font-semibold",children:s.champion||"N/A"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:"Vice:"}),e.jsx("span",{className:"font-semibold",children:s.runner_up||"N/A"})]}),s.top_scorer&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:"Artilheiro:"}),e.jsxs("span",{className:"font-semibold",children:[s.top_scorer," (",s.top_scorer_goals,")"]})]}),s.total_goals&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:"Total Golos:"}),e.jsx("span",{className:"font-semibold",children:s.total_goals})]})]})]})},s.id))}),h.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(a,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"Nenhum histórico gerado ainda"})]})]})})]})}export{Y 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.