1import{r as x,s as q,b as v,t as M,j as e,L as g,an as E}from"./vendor-react-core-_0sZDOLQ.js";import{B as n,b as h,c as y,u}from"./index-j07E1qHv.js";import{B as F}from"./badge-BXqwvh8U.js";import{S as c}from"./skeleton-ClHfYp06.js";import{I as b}from"./input-rti45mgP.js";import{C as L,b as D,c as B,a as P}from"./card-DHmBnTdH.js";import{t as U}from"./index-CDqomOa1.js";import{h as z,D as Y,E as H}from"./vendor-utils-BRu4i-LD.js";import{V as j,a as K,_ as O,Z as Q,p as N,a$ as V,F as A,bc as R,bd as T}from"./vendor-lucide-Ddz0eB7N.js";import{m as r}from"./vendor-framer-motion-C1oRD-X5.js";import"./vendor-radix-CFmJ1img.js";import"./vendor-supabase-Ca6cp8v2.js";function $({newsId:i}){const[t,a]=x.useState(""),[o,l]=x.useState(""),[m,p]=x.useState(""),w=q(),{data:d=[],isLoading:_}=v({queryKey:["comments",i],queryFn:async()=>await h.entities.Comment.filter({news_id:i,approved:!0},"-created_date"),enabled:!!i}),C=M({mutationFn:s=>h.entities.Comment.create(s),onSuccess:()=>{w.invalidateQueries({queryKey:["comments",i]}),p(""),a(""),l(""),U.success("Comentário enviado! Será publicado após aprovação.")}}),S=s=>{s.preventDefault(),C.mutate({news_id:i,user_name:t,user_email:o,content:m,approved:!1})};return e.jsxs(L,{className:"border-0 shadow-lg",children:[e.jsx(D,{className:"bg-gradient-to-r from-gray-900 to-gray-800",children:e.jsxs(B,{className:"text-white flex items-center gap-2",children:[e.jsx(j,{className:"w-5 h-5"}),"Comentários (",d.length,")"]})}),e.jsxs(P,{className:"p-6",children:[e.jsxs("form",{onSubmit:S,className:"mb-8 p-6 bg-gray-50 rounded-xl",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Deixe o seu comentário"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[e.jsx(b,{placeholder:"Seu nome *",value:t,onChange:s=>a(s.target.value),required:!0}),e.jsx(b,{type:"email",placeholder:"Seu email *",value:o,onChange:s=>l(s.target.value),required:!0})]}),e.jsx("textarea",{placeholder:"Escreva o seu comentário... *",value:m,onChange:s=>p(s.target.value),className:"w-full p-3 border rounded-lg h-24 mb-4",required:!0}),e.jsxs(n,{type:"submit",className:"bg-red-600 hover:bg-red-700",children:[e.jsx(K,{className:"w-4 h-4 mr-2"}),"Enviar Comentário"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"O seu comentário será publicado após aprovação do administrador."})]}),_?e.jsx("p",{className:"text-center text-gray-500 py-8",children:"A carregar comentários..."}):d.length>0?e.jsx("div",{className:"space-y-4",children:d.map((s,k)=>e.jsxs(r.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:k*.1},className:"p-4 bg-white border border-gray-200 rounded-xl",children:[e.jsx("div",{className:"flex items-start justify-between mb-2",children:e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-gray-900",children:s.user_name||"Utilizador"}),e.jsx("p",{className:"text-xs text-gray-500",children:z(s.created_date).format("DD/MM/YYYY HH:mm")})]})}),e.jsx("p",{className:"text-gray-700 leading-relaxed",children:s.content})]},s.id))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(j,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500",children:"Seja o primeiro a comentar esta notÃcia"})]})]})]})}const f={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-gray-100 text-gray-700"},G={selecao:"Seleção",girabola:"Girabola",feminino:"Feminino",formacao:"Formação",institucional:"Institucional"};function le(){const t=new URLSearchParams(window.location.search).get("id"),{data:a,isLoading:o}=v({queryKey:["news",t],queryFn:async()=>{const l=u(t);if(l)return l;try{return(await h.entities.News.filter({id:t}))[0]||u(t)}catch{return u(t)}},enabled:!!t});return o?e.jsx("main",{className:"min-h-screen bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsx(c,{className:"h-[400px] rounded-3xl mb-8"}),e.jsx(c,{className:"h-8 w-3/4 mb-4"}),e.jsx(c,{className:"h-4 w-1/2 mb-8"}),e.jsx(c,{className:"h-40"})]})}):a?e.jsxs("main",{className:"min-h-screen bg-white",children:[e.jsxs("section",{className:"relative min-h-[420px] overflow-hidden bg-gradient-to-br from-faf-blue via-faf-blue-light to-faf-blue-dark",children:[e.jsx("div",{className:"absolute inset-0 opacity-30 [background-image:radial-gradient(circle_at_80%_20%,#dc2626_0,transparent_35%),radial-gradient(circle_at_15%_80%,#eab308_0,transparent_28%)]"}),e.jsx("div",{className:"absolute top-6 left-6",children:e.jsx(g,{to:y("News"),children:e.jsxs(n,{variant:"ghost",className:"bg-white/10 backdrop-blur-lg text-white hover:bg-white/20 rounded-full",children:[e.jsx(O,{className:"w-4 h-4 mr-2"}),"Voltar"]})})}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-6 md:p-12",children:e.jsx("div",{className:"container mx-auto",children:e.jsxs(r.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},children:[e.jsx(F,{className:`${f[a.category]||f.institucional} mb-4`,children:G[a.category]||"NotÃcia"}),e.jsx("h1",{className:"text-3xl md:text-5xl font-bold text-white mb-4 max-w-4xl",children:a.title}),e.jsxs("div",{className:"flex items-center text-white/80 text-sm",children:[e.jsx(Q,{className:"w-4 h-4 mr-2"}),a.created_date&&Y(new Date(a.created_date),"d 'de' MMMM 'de' yyyy",{locale:H})]}),a.source_url&&e.jsxs("a",{href:a.source_url,target:"_blank",rel:"noreferrer",className:"mt-4 inline-flex items-center gap-2 rounded-full bg-white/15 px-4 py-2 text-sm font-semibold text-white backdrop-blur-lg hover:bg-white/25",children:[e.jsx(N,{className:"w-4 h-4"}),"Fonte: ",a.source_name||"Oficial",e.jsx(V,{className:"w-3 h-3"})]})]})})})]}),e.jsx("section",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx(r.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"text-xl text-gray-600 leading-relaxed mb-8 font-medium",children:a.summary}),a.verification_status&&e.jsx(r.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-8 rounded-xl border border-green-200 bg-green-50 p-4 text-sm text-green-900",children:e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(N,{className:"h-4 w-4"}),a.verification_status]})}),e.jsx(r.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"prose prose-lg max-w-none",children:e.jsx(E,{children:a.content||""})}),e.jsx(r.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"mt-12 pt-8 border-t border-gray-200",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600 font-medium",children:"Partilhar esta notÃcia:"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(n,{size:"icon",variant:"outline",className:"rounded-full",children:e.jsx(A,{className:"w-4 h-4"})}),e.jsx(n,{size:"icon",variant:"outline",className:"rounded-full",children:e.jsx(R,{className:"w-4 h-4"})}),e.jsx(n,{size:"icon",variant:"outline",className:"rounded-full",children:e.jsx(T,{className:"w-4 h-4"})})]})]})}),e.jsx(r.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"mt-12",children:e.jsx($,{newsId:t})})]})})})]}):e.jsx("main",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"NotÃcia não encontrada"}),e.jsx(g,{to:y("News"),children:e.jsx(n,{children:"Voltar à s notÃcias"})})]})})}export{le 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.