1import{j as e,L as v,r as x,b as w}from"./vendor-react-core-_0sZDOLQ.js";import{c as I,B as C,b as h,t as S}from"./index-j07E1qHv.js";import{I as g}from"./input-rti45mgP.js";import{S as E}from"./skeleton-ClHfYp06.js";import{S as Q,a as V,b as X,c as H,d as F}from"./select-DHshRvNJ.js";import{t as L}from"./index-CDqomOa1.js";import{B as M}from"./badge-BXqwvh8U.js";import{m as u}from"./vendor-framer-motion-C1oRD-X5.js";import{Z as n,k,p as A,N as D,r as J,S as K,a2 as O,i as U}from"./vendor-lucide-Ddz0eB7N.js";import{D as Z,E as _}from"./vendor-utils-BRu4i-LD.js";import"./vendor-radix-CFmJ1img.js";import"./vendor-supabase-Ca6cp8v2.js";const o={selecao:"bg-red-100 text-red-700",girabola:"bg-green-100 text-green-700",feminino:"bg-purple-100 text-purple-700",formacao:"bg-blue-100 text-blue-700",institucional:"bg-blue-50 text-faf-blue"},T={selecao:"Seleção",girabola:"Girabola",feminino:"Feminino",formacao:"Formação",institucional:"Institucional"};function ee({news:s,index:l=0,featured:t=!1}){return t?e.jsxs(u.article,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:l*.1},className:"group relative overflow-hidden rounded-3xl bg-gray-900 h-[500px]",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-slate-950 via-slate-900 to-faf-blue-dark"}),e.jsxs("div",{className:"absolute inset-0 p-8 flex flex-col justify-end",children:[e.jsx(M,{className:`${o[s.category]||o.institucional} w-fit mb-4`,children:T[s.category]||"NotÃcia"}),e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-white mb-3 leading-tight group-hover:text-yellow-400 transition-colors",children:s.title}),e.jsx("p",{className:"text-gray-300 mb-4 line-clamp-2",children:s.summary}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center text-gray-400 text-sm",children:[e.jsx(n,{className:"w-4 h-4 mr-2"}),s.created_date&&Z(new Date(s.created_date),"d 'de' MMMM, yyyy",{locale:_})]}),e.jsxs(v,{to:I(`NewsDetail?id=${s.id}`),className:"flex items-center text-yellow-500 font-medium hover:text-yellow-400 transition-colors",children:["Ler mais",e.jsx(k,{className:"w-4 h-4 ml-2 group-hover:translate-x-1 transition-transform"})]})]}),s.source_name&&e.jsxs("div",{className:"mt-4 inline-flex items-center gap-2 rounded-full bg-white/10 px-3 py-1 text-xs font-medium text-white",children:[e.jsx(A,{className:"h-3 w-3"}),s.source_name]})]})]}):e.jsxs(u.article,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:l*.1},className:"group bg-white rounded-2xl overflow-hidden shadow-sm hover:shadow-xl transition-all duration-300 border border-gray-100",children:[e.jsx("div",{className:"border-b border-gray-100 bg-slate-50 p-6",children:e.jsx(M,{className:`${o[s.category]||o.institucional}`,children:T[s.category]||"NotÃcia"})}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center text-gray-400 text-sm mb-3",children:[e.jsx(n,{className:"w-4 h-4 mr-2"}),s.created_date&&Z(new Date(s.created_date),"d 'de' MMMM, yyyy",{locale:_})]}),s.source_name&&e.jsxs("div",{className:"mb-3 inline-flex items-center gap-1.5 rounded-full bg-green-50 px-2.5 py-1 text-xs font-semibold text-green-700",children:[e.jsx(A,{className:"h-3 w-3"}),s.source_name]}),e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2 line-clamp-2 group-hover:text-green-600 transition-colors",children:s.title}),e.jsx("p",{className:"text-gray-600 text-sm line-clamp-2 mb-4",children:s.summary}),e.jsxs(v,{to:I(`NewsDetail?id=${s.id}`),className:"inline-flex items-center text-green-600 font-medium text-sm hover:text-green-700 transition-colors",children:["Ler artigo completo",e.jsx(k,{className:"w-4 h-4 ml-1 group-hover:translate-x-1 transition-transform"})]})]})]})}const ae=[{value:"selecao",label:"Seleção"},{value:"girabola",label:"Girabola"},{value:"feminino",label:"Feminino"},{value:"formacao",label:"Formação"},{value:"institucional",label:"Institucional"}],c={search:"",from:"",to:"",category:"all"};function ge(){const[s,l]=x.useState(c),[t,b]=x.useState(c),[p,f]=x.useState(!1),{data:d}=w({queryKey:["current-user"],queryFn:()=>h.auth.me()}),{data:G,isLoading:R,refetch:z}=w({queryKey:["news"],queryFn:async()=>{try{const a=await h.entities.News.list("-created_date",50);return S(a)}catch{return S()}},initialData:[],refetchInterval:3e4}),B=async()=>{f(!0);try{const a=await h.functions.invoke("fetchAngolaNews",{});L.success(a.data.message),await z()}catch(a){L.error("Erro ao buscar notÃcias: "+a.message)}finally{f(!1)}},i=(a,r)=>l(m=>({...m,[a]:r})),P=()=>b(s),Y=()=>{l(c),b(c)},y=G.filter(a=>{var N,j;const r=new Date(a.created_date||a.created_at),m=t.category==="all"||a.category===t.category,q=((N=a.title)==null?void 0:N.toLowerCase().includes(t.search.toLowerCase()))||((j=a.summary)==null?void 0:j.toLowerCase().includes(t.search.toLowerCase())),W=!t.from||r>=new Date(t.from),$=!t.to||r<=new Date(`${t.to}T23:59:59`);return m&&q&&W&&$});return e.jsxs("main",{className:"min-h-screen bg-gradient-to-br from-gray-50 via-white to-red-50/30",children:[e.jsxs("section",{className:"bg-gradient-to-br from-faf-blue via-faf-blue-light to-faf-blue-dark py-20 relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0zNiAxOGMtMy4zMTQgMC02IDIuNjg2LTYgNnMyLjY4NiA2IDYgNiA2LTIuNjg2IDYtNi0yLjY4
1Ni02LTYtNiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMSIvPjwvZz48L3N2Zz4=')] opacity-30"}),e.jsx("div",{className:"container mx-auto px-4 relative",children:e.jsxs(u.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-3 bg-white/20 backdrop-blur-xl px-6 py-3 rounded-2xl mb-6 border border-white/30 shadow-lg shadow-black/10",children:[e.jsx("div",{className:"w-10 h-10 bg-white/20 backdrop-blur-sm rounded-xl flex items-center justify-center",children:e.jsx(D,{className:"w-5 h-5 text-white"})}),e.jsx("span",{className:"text-white font-semibold",children:"Centro de NotÃcias"})]}),e.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-white mb-4",children:"Ãltimas NotÃcias"}),e.jsx("p",{className:"text-white/90 max-w-2xl mx-auto mb-6",children:"Acompanhe todas as novidades do futebol angolano, desde a seleção nacional até as competições locais."}),(d==null?void 0:d.role)==="admin"&&e.jsxs(C,{onClick:B,disabled:p,className:"bg-white/20 hover:bg-white/30 text-white border border-white/30 backdrop-blur-xl shadow-lg",children:[p?e.jsx(J,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(K,{className:"w-4 h-4 mr-2"}),"Atualizar NotÃcias Verificadas"]})]})})]}),e.jsx("section",{className:"py-10",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-lg p-6 md:p-8",children:[e.jsx("h2",{className:"text-lg font-bold text-faf-blue mb-5",children:"Filtrar Resultados"}),e.jsxs("div",{className:"relative mb-5",children:[e.jsx(g,{placeholder:"Pesquisar notÃcia",value:s.search,onChange:a=>i("search",a.target.value),className:"h-12 rounded-xl border-gray-300 focus:border-faf-blue pr-12"}),e.jsx(O,{className:"w-5 h-5 text-gray-400 absolute right-4 top-1/2 -translate-y-1/2"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mb-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"De"}),e.jsxs("div",{className:"relative",children:[e.jsx(g,{type:"date",value:s.from,onChange:a=>i("from",a.target.value),className:"h-12 rounded-xl border-gray-300 focus:border-faf-blue pr-10"}),e.jsx(n,{className:"w-4 h-4 text-gray-400 absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"Até"}),e.jsxs("div",{className:"relative",children:[e.jsx(g,{type:"date",value:s.to,onChange:a=>i("to",a.target.value),className:"h-12 rounded-xl border-gray-300 focus:border-faf-blue pr-10"}),e.jsx(n,{className:"w-4 h-4 text-gray-400 absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none"})]})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mb-6",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"Categoria"}),e.jsxs(Q,{value:s.category,onValueChange:a=>i("category",a),children:[e.jsx(V,{className:"h-12 rounded-xl border-gray-300",children:e.jsx(X,{placeholder:"Todas as categorias"})}
1),e.jsxs(H,{children:[e.jsx(F,{value:"all",children:"Todas as categorias"}),ae.map(a=>e.jsx(F,{value:a.value,children:a.label},a.value))]})]})]})}),e.jsxs("div",{className:"flex items-center justify-end gap-6",children:[e.jsx("button",{onClick:Y,className:"text-sm font-medium text-gray-600 hover:text-faf-blue transition-colors",children:"Limpar Filtros"}),e.jsxs(C,{onClick:P,className:"bg-green-500 hover:bg-green-600 text-white rounded-xl px-6 h-11",children:["Aplicar Filtros",e.jsx(U,{className:"w-4 h-4 ml-1"})]})]})]})})}),e.jsx("section",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:R?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3,4,5,6].map(a=>e.jsx(E,{className:"h-80 rounded-2xl"},a))}):y.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:y.map((a,r)=>e.jsx(ee,{news:a,index:r},a.id))}):e.jsxs("div",{className:"text-center py-20",children:[e.jsx(D,{className:"w-20 h-20 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Nenhuma notÃcia encontrada"}),e.jsx("p",{className:"text-gray-500",children:"Tente ajustar os filtros ou a pesquisa"})]})})})]})}export{ge 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.