1import{m as p,j as e,L as r,A as h,s as a}from"./index-DTVw_I41.js";import{u as v}from"./useQuery-B54mRP7w.js";import{S as j,a as f}from"./SiteFooter-DN1IncgW.js";import"./index-BRp4hgpf.js";import"./useTranslation-DpJt2dO3.js";import"./index-Drs_jYv-.js";import"./index-DGMvxkJe.js";import"./index-BLZ16K8w.js";import"./bora-pro-role-logo.webp.asset-IGKqk89C.js";import"./chart-column-Crx5ZGN2.js";function R(){const{tag:l}=p.useParams(),o=decodeURIComponent(l).replace(/-/g," "),{data:t,isLoading:m}=v({queryKey:["tag-page",l],queryFn:async()=>{const{data:s}=await a.from("tags").select("id, name, slug").eq("slug",l).maybeSingle();if(!s)return{name:o,events:[],posts:[]};const[{data:c},{data:g}]=await Promise.all([a.from("event_tags").select("event_id").eq("tag_id",s.id),a.from("blog_post_tags").select("post_id").eq("tag_id",s.id)]),n=(c??[]).map(i=>i.event_id),d=(g??[]).map(i=>i.post_id),[{data:x},{data:u}]=await Promise.all([n.length?a.from("events").select("id, slug, title, city, image_url").in("id",n).order("event_date",{ascending:!0}):Promise.resolve({data:[]}),d.length?a.from("blog_posts").select("id, slug, title, excerpt, cover_image_url").in("id",d).eq("published",!0).order("published_at",{ascending:!1,nullsFirst:!1}).limit(48):Promise.resolve({data:[]})]);return{name:s.name,events:x??[],posts:u??[]}}});return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(j,{}),e.jsxs("main",{className:"mx-auto max-w-7xl px-4 py-12 sm:px-6 lg:px-8",children:[e.jsxs(r,{to:"/",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(h,{className:"h-4 w-4"})," voltar"]}),e.jsx("span",{className:"mt-8 block text-xs font-semibold uppercase tracking-[0.25em] text-primary",children:"/ tag"}),e.jsx("h1",{className:"mt-2 text-4xl font-bold capitalize sm:text-5xl",children:t?.name??o}),e.jsxs("p",{className:"mt-4 max-w-2xl text-muted-foreground",children:["Tudo o que rolou e vai rolar sobre ",e.jsx("strong",{children:t?.name??o}),": eventos, ingressos e matérias do Bora pro Rolê."]}),m?e.jsx("p",{className:"mt-10 text-muted-foreground",children:"Carregando..."}):e.jsxs(e.Fragment,{children:[t&&t.events.length>0&&e.jsxs("section",{className:"mt-12",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Eventos"}),e.jsx("div",{className:"mt-5 grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:t.events.map(s=>s.slug?e.jsxs(r,{to:"/evento/$slug",params:{slug:s.slug},className:"group overflow-hidden rounded-2xl border border-border bg-card transition hover:-translate-y-1",children:[s.image_url?e.jsx("img",{src:s.image_url,alt:s.title,loading:"lazy",className:"aspect-[3/4] w-full object-cover"}):e.jsx("div",{className:"aspect-[3/4] w-full bg-muted"}),e.jsxs("div",{className:"p-3",children:[e.jsx("h3",{className:"line-clamp-2 text-sm font-semibold",children:s.title}),s.city&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s.city})]})]},s.id):null)})]}),t&&t.posts.length>0&&e.jsxs("section",{className:"mt-14",children:[e.jsxs("h2",{className:"text-2xl font-bold",children:["Matérias sobre ",t.name]}),e.jsx("div",{className:"mt-5 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:t.posts.map(s=>e.jsxs(r,{to:"/$slug",params:{slug:s.slug},className:"group overflow-hidden rounded-2xl border border-border bg-card transition hover:shadow-md",children:[s.cover_image_url?e.jsx("img",{src:s.cover_image_url,alt:s.title,loading:"lazy",className:"h-40 w-full object-cover"}):e.jsx("div",{className:"h-40 w-full bg-muted"}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-sm font-semibold leading-snug group-hover:underline",children:s.title}),s.excerpt&&e.jsx("p",{className:"mt-2 line-clamp-2 text-xs text-muted-foreground",children:s.excerpt})]})]},s.id))})]}),t&&t.events.length===0&&t.posts.length===0&&e.jsxs("p",{className:"mt-10 text-muted-foreground",children:["Ainda não temos conteúdo com essa tag."," ",e.jsx(r,{to:"/materia",className:"font-semibold text-primary hover:underline",children:"Veja todas as matérias"}),"."]})]})]}),e.jsx(f,{})]})}
1export{R as component};
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.