1import{aa as a,a9 as e}from"./ui-radix-CoNKfMy3.js";import{u as l}from"./index-BFO-s8yJ.js";import{al as b,B as x,aG as y}from"./ui-anim-D8fHVsVz.js";import{f as u}from"./formatDistanceToNow-Cgxttm8N.js";import"./supabase-JOBST33U.js";import"./charts-DIaacQTb.js";import"./tanstack-DOw5FfaS.js";import"./react-core-DgufG4j5.js";import"./qr-dpwtPpaW.js";import"./en-US-BddybvhD.js";const r={Important:{bg:"hsl(var(--crimson) / 0.1)",text:"hsl(var(--crimson))"},Travel:{bg:"hsl(var(--heritage-green) / 0.1)",text:"hsl(var(--heritage-green))"},Schedule:{bg:"hsl(var(--gold) / 0.12)",text:"hsl(var(--gold-dark))"},General:{bg:"hsl(var(--muted))",text:"hsl(var(--muted-foreground))"},Food:{bg:"hsl(var(--heritage-green) / 0.1)",text:"hsl(var(--heritage-green))"}};function j(){return e.jsx("div",{className:"bg-card rounded-2xl p-6 shadow-card border border-border animate-pulse",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-muted flex-shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-muted rounded w-full"}),e.jsx("div",{className:"h-3 bg-muted rounded w-2/3"})]})]})})}function P(){const[n,g]=a.useState([]),[o,f]=a.useState(!0),[d,h]=a.use
1State("All"),p=["All","Important","Travel","Schedule","General","Food"];a.useEffect(()=>{const s=async()=>{const{data:m}=await l.from("announcements").select("*").order("is_pinned",{ascending:!1}).order("created_at",{ascending:!1});m&&g(m),f(!1)};s();const t=l.channel("announcements").on("postgres_changes",{event:"*",schema:"public",table:"announcements"},s).subscribe();return()=>{l.removeChannel(t)}},[]);const c=n.filter(s=>s.is_pinned),i=n.filter(s=>!s.is_pinned&&(d==="All"||s.category===d));return e.jsxs("div",{className:"p-6 md:p-8 max-w-3xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"font-display text-3xl font-bold text-foreground",children:"Announcements"}),e.jsx("p",{className:"text-muted-foreground text-sm font-body mt-1",children:"Family news and important updates"})]}),e.jsx("div",{className:"flex gap-2 flex-wrap mb-8",children:p.map(s=>e.jsx("button",{onClick:()=>h(s),className:`px-3 py-1.5 rounded-full text-sm font-body font-medium transition-all ${d===s?"bg-primary text-primary-foreground":"bg-secondary text-muted-foreground hover:bg-muted"}`,children:s},s))}),o?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>e.jsx(j,{},s))}):e.jsxs("div",{className:"space-y-4",children:[c.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-body uppercase tracking-widest text-muted-foreground",children:[e.jsx(b,{className:"w-3 h-3"})," Pinned"]}),c.map(s=>{const t=r[s.category]||r.General;return e.jsxs("div",{className:"bg-card rounded-2xl p-6 shadow-elegant border-2 border-gold/30 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 rounded-full opacity-5",style:{background:"hsl(var(--gold))",transform:"translate(30%, -30%)"}}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:t.bg},children:e.jsx(x,{className:"w-4 h-4",style:{color:t.text}})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[e.jsx("span",{className:"text-xs bg-gold/15 text-gold-dark px-2 py-0.5 rounded-full font-body font-semibold",children:"ð Pinned"}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-body",style:{background:t.bg,color:t.text},children:s.category})]}),e.jsx("h3",{className:"font-display font-semibold text-foreground text-lg mb-2",children:s.title}),e.jsx("p",{className:"text-muted-foreground font-body text-sm leading-relaxed",children:s.body}),e.jsx("div",{className:"text-muted-foreground text-xs font-body mt-3",children:u(new Date(s.created_at),{addSuffix:!0})})]})]})]},s.id)}),e.jsx("div",{className:"h-px bg-border my-2"})]}),i.map(s=>{const t=r[s.category]||r.General;return e.jsx("div",{className:"bg-card rounded-2xl p-6 shadow-card border border-border hover:shadow-elegant hover:-translate-y-0.5 transition-all",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:t.bg},children:e.jsx(y,{className:"w-4 h-4",style:{color:t.text}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-body",style:{background:t.bg,color:t.text},children:s.category})}),e.jsx("h3",{className:"font-display font-semibold text-foreground mb-2",children:s.title}),e.jsx("p",{className:"text-muted-foreground font-body text-sm leading-relaxed",children:s.body}),e.jsx("div",{className:"text-muted-foreground text-xs font-body mt-3",children:u(new Date(s.created_at),{addSuffix:!0})})]})]})},s.id)}),i.length===0&&!o&&e.jsxs("div",{className:"text-center py-16 text-muted-foreground font-body",children:[e.jsx(x,{className:"w-12 h-12 mx-auto mb-4 opacity-20"}),e.jsx("p",{className:"text-lg font-display font-semibold text-foreground mb-2",children:"No announcements"}),e.jsx("p",{className:"text-sm",children:"Check back soon for family news and updates."})]})]})]})}export{P 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.