PageSourceSearch

https://fedeesp.org.br/assets/Competitions-BxcyXoPa.js

js fedeesp.org.br collected 2026-10-04 07:48:15 UTC 7,319 bytes, 1 lines download raw bytes

1import{b as w,j as e,B as A}from"./index-BbKxumrM.js";import{f as T,r,L as z}from"./react-vendor-DT1_wbt4.js";import{g as h}from"./competitionStatus-DVzOlwuc.js";import{S as F}from"./spMunicipalities-2IjAWKqb.js";import{ap as B,at as k,r as S,am as P}from"./ui-vendor-BfDHuItz.js";import"./firebase-vendor-CSkRnVBi.js";const V=()=>{const[o]=T(),[f,C]=r.useState([]),[c,I]=r.useState([]),[m,b]=r.useState(""),[i,p]=r.useState(o.get("sport")||""),[n,v]=r.useState(o.get("level")||""),[L,g]=r.useState(!0);r.useEffect(()=>{const s=o.get("level")||"",t=o.get("sport")||"";s!==n&&v(s),t!==i&&p(t)},[o]),r.useEffect(()=>{let s=!1;return g(!0),w.getCompetitions().then(t=>{s||(C(t),g(!1))}).catch(t=>{console.error("Failed to fetch competitions",t),s||g(!1)}),w.getDisputes().then(t=>{s||I(t)}).catch(t=>console.error("Failed to fetch disputes",t)),()=>{s=!0}},[]);const d=r.useMemo(()=>f.filter(s=>{var y,N;const t=m.toLowerCase(),a=["Estadual","Nacional","Internacional","V","IV","III","II"].includes(String(s.level)),l=t.length>2&&F.some(u=>u.toLowerCase().includes(t)||t.includes(u.toLowerCase())),x=!t||s.name.toLowerCase().includes(t)||((y=s.sportType)==null?void 0:y.toLowerCase().includes(t))||((N=s.cities)==null?void 0:N.some(u=>u.toLowerCase().includes(t)))||a&&l,M=n===""||String(s.level)===n;return x&&M}),[f,m,n]),E=r.useMemo(()=>{const s=new Map;return d.forEach(t=>{var a;(a=t.sportsConfig)==null||a.forEach(l=>{const x=String(l.sportId);!s.has(x)&&l.sportName&&s.set(x,l.sportName)})}),Array.from(s.entries()).map(([t,a])=>({id:t,name:a})).sort((t,a)=>t.name.localeCompare(a.name))},[d]),j=r.useMemo(()=>d.filter(s=>{var a;return i===""||((a=s.sportsConfig)==null?void 0:a.some(l=>String(l.sportId)===i))}).sort((s,t)=>{const a=h(s,c),l=h(t,c);return a==="active"&&l!=="active"?-1:a!=="active"&&l==="active"?1:s.name.localeCompare(t.name)}),[d,i,c]);return e.jsx("div",{className:"min-h-screen bg-gray-50 py-12",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-bold text-gray-900 mb-4",children:"Competições Oficiais"}),e.jsx("p",{className:"text-gray-600 max-w-2xl mx-auto",children:"Acompanhe os principais eventos do calendário esportivo escolar do estado de São Paulo."})]}),e.jsx("div",{className:"max-w-6xl mx-auto mb-12",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-[2]",children:[e.jsx("input",{type:"text",placeholder:"Buscar competição por nome...",className:"w-full pl-12 pr-4 py-4 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white text-gray-900 text-lg",value:m,onChange:s=>b(s.target.value)}),e.jsx(B,{className:"absolute left-4 top-5 text-gray-400",size:20})]}),e.jsx("div",{className:"flex flex-1 gap-4",children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx("div",{className:"absolute left-4 top-5 pointer-events-none",children:e.jsx(k,{className:"text-gray-400",size:20})}),e.jsxs("select",{className:"w-full pl-12 pr-4 py-4 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white text-gray-900 text-lg appearance-none cursor-pointer",value:i,onChange:s=>p(s.target.value),children:[e.jsx("option",{value:"",children:"Todas as Modalidades"}),E.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})]})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:[{id:"",label:"Todas"},{id:"Municipal",label:"Municipais"},{id:"Estadual",label:"Estaduais"},{id:"Nacional",label:"Nacionais"},{id:"Internacional",label:"Internacionais"}].map(s=>e.jsx("button",{onClick:()=>v(s.id),className:`px-4 py-2 rounded-full text-sm font-bold transition-all ${n===s.id?"bg-blue-600 text-white shadow-md scale-105":"bg-white text-gray-600 border border-gray-200 hover:border-blue-300"}`,children:s.label},s.id))})]})}),L?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"w-12 h-12 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:j.map(s=>e.jsxs(z,{to:`/competicao/${s.slug}`,className:"group bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden hover:shadow-lg transition-all flex flex-col h-full",children:[e.jsxs("div",{className:"aspect-[2.4/1] overflow-hidden relative",children:[e.jsx("img",{src:s.bannerUrl,alt:s.name,loading:"lazy",decoding:"async",className:"w-full h-full object-contain object-center transition-transform duration-500 group-hover:scale-105"}),e.jsx("div",{className:"absolute top-4 right-4 flex flex-col gap-1 items-end",children:!["Nacional","Internacional"].includes(String(s.level))&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`px-3 py-1 text-xs font-bold rounded-full uppercase ${s.status==="active"?"bg-green-500 text-white":s.status==="upcoming"?"bg-yellow-500 text-blue-900":"bg-gray-500 text-white"}`,children:s.status==="active"?"Em Andamento":s.status==="upcoming"?"Em Breve":"Encerrada"}),(()=>{const t=h(s,c);return t==="active"?e.jsx("span",{className:"px-3 py-1 text-xs font-bold rounded-full uppercase bg-blue-600 text-white animate-pulse",children:"Inscrições Abertas"}):t==="upcoming"?e.jsx("span",{className:"px-3 py-1 text-xs font-bold rounded-full uppercase bg-yellow-400 text-yellow-900 border border-yellow-500",children:"Inscrições em Breve"}):e.jsx("span",{className:"px-3 py-1 text-xs font-bold rounded-full uppercase bg-red-100 text-red-600 border border-red-200",children:"Inscrições Encerradas"})})()]})})]}),e.jsxs("div",{className:"p-6 flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900 group-hover:text-blue-700 transition-colors line-clamp-2",children:s.name}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:s.sportType==="multi"?"Multi-esportiva":"Mono-esportiva"})]}),e.jsx("div",{className:"w-12 h-12 bg-gray-50 rounded-lg border border-gray-100 flex items-center justify-center flex-shrink-0 overflow-hidden",children:s.logoUrl?e.jsx("img",{src:s.logoUrl,alt:"Logo",loading:"lazy",decoding:"async",className:"w-full h-full object-contain p-1"}):e.jsx(S,{size:24,className:"text-blue-700"})})]}),e.jsx("div",{className:"pt-4 border-t border-gray-100 flex items-center justify-end",children:e.jsxs("span",{className:"text-blue-600 font-medium flex items-center gap-1 group-hover:translate-x-1 transition-transform",children:["Acessar Hotsite ",e.jsx(P,{size:16})]})})]})]},s.id))}),j.length===0&&e.jsxs("div",{className:"text-center py-16 bg-white rounded-lg border-2 border-dashed border-gray-200",children:[e.jsx(S,{size:48,className:"mx-auto text-gray-300 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Nenhuma competição encontrada"}),e.jsx("p",{className:"text-gray-500",children:"Tente ajustar os filtros de busca."}),e.jsx(A,{variant:"ghost",className:"mt-4",onClick:()=>{b(""),p("")},children:"Limpar Filtros"})]})]})]})})};export{V 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.