1import{a as l,j as e}from"./vendor-react-ENHvEyzB.js";import{d as ge,u as pe,a as fe,B as m,h as q,m as je,z as S,A as z,E as F,F as k,H,I as x,T as V,_ as y,w as ve}from"./index-Dx1N3dkQ.js";import{L as o}from"./label-BXMhBVWb.js";import{A as be,a as ye,b as we,c as Ne,d as Ce,e as Se,f as ze,g as Fe,h as ke}from"./alert-dialog-9803o8rr.js";import{S as W,a as _,b as Y,c as G,d as g}from"./select-fS4_k9YF.js";import{C as Pe}from"./checkbox-2pSc2QfW.js";import{L as P,aA as Ae,y as w,an as De,T as Ee,cg as Q,_ as K,a0 as Z,aM as Oe,k as Ie,aB as Te,H as Ue,ch as Re,v as Le}from"./vendor-misc-CDjl58uC.js";import"./vendor-query-DLUw_TCP.js";import"./vendor-ui-DrkNuLck.js";const J={name:"",description:"",logo:"",websiteUrl:"",tagsRaw:"",eventId:"",displayOrder:0,published:!0},Be=[{icon:e.jsx(Q,{size:22,className:"text-primary"}),title:"Partnerships that make an impact",body:"We collaborate in meaningful ways that support women and build stronger communities."},{icon:e.jsx(Re,{size:22,className:"text-primary"}),title:"Flexible and purposeful",body:"From sharing resources to co-hosting events or creating content, we'll find what works best together."},{icon:e.jsx(Le,{size:22,className:"text-primary"}),title:"Get in touch",body:"Let's start a conversation and explore how we can support more women, together."}];function Ke(){ge({title:"Community Partners | Meno Square",description:"Meno Square works with organizations and communities across Canada that share our commitment to improving access to trusted information, resources and support."});const{user:X}=pe(),{toast:d}=fe(),h=X?.role==="admin",[A,D]=l.useState([]),[ee,se]=l.useState([]),[te,ae]=l.useState(!0),[ie,p]=l.useState(!1),[j,E]=l.useState(null),[a,c]=l.useState({...J}),[v,O]=l.useState(!1),[I,T]=l.useState(!1),[U,ne]=l.useState(!1),[n,N]=l.useState(null),R=l.useRef(null),L=9,[le,C]=l.useState(!1),[re,b]=l.useState(!1),[B,M]=l.useState(!1),[r,u]=l.useState({name:"",organization:"",email:"",interest:"",message:""}),oe=async()=>{if(!r.name.trim()||!r.email.trim()||!r.interest){d({title:"Please fill in all required fields",variant:"destructive"});return}M(!0);try{const s=[`Organization: ${r.organization||"â"}`,`Interest: ${r.interest}`,r.message?`Message: ${r.message}`:null].filter(Boolean).join(` 2`);await y("POST","/api/contact",{name:r.name.trim(),email:r.email.trim(),subject:"Partnership Inquiry",message:s}),b(!0)}catch{d({title:"Something went wrong â please try again.",variant:"destructive"})}finally{M(!1)}},$=async()=>{try{const s=await fetch("/api/community-partners");s.ok&&D(await s.json())}catch{}ae(!1)},ce=async()=>{try{const s=await fetch("/api/events");if(s.ok){const t=await s.json();se(t.filter(i=>i.published&&!i.isArchived).map(i=>({id:i.id,title:i.title,slug:i.slug})))}}catch{}};l.useEffect(()=>{$(),h&&ce()},[h]);const de=()=>{E(null),c({...J}),p(!0)},me=s=>{E(s),c({name:s.name,description:s.description,logo:s.logo,websiteUrl:s.websiteUrl,tagsRaw:(s.tags??[]).join(", "),eventId:s.eventId?String(s.eventId):"",displayOrder:s.displayOrder,published:s.published}),p(!0)},he=async s=>{O(!0);try{const t=await ve(s);c(i=>({...i,logo:t}))}catch{d({title:"Upload failed",variant:"destructive"})}finally{O(!1)}},xe=async()=>{if(!a.name.trim()){d({title:"Name is required",variant:"destructive"});return}T(!0);try{const s={name:a.name.trim(),description:a.description.trim(),logo:a.logo,websiteUrl:a.websiteUrl.trim(),tags:a.tagsRaw.split(",").map(t=>t.trim()).filter(Boolean),eventId:a.eventId?Number(a.eventId):null,displayOrder:Number(a.displayOrder)||0,published:a.published};j?(await y("PATCH",`/api/community-partners/${j.id}`,s),d({title:"Partner updated"})):(await y("POST","/api/community-partners",s),d({title:"Partner added"})),p(!1),$()}catch{d({title:"Save failed",variant:"destructive"})}finally{T(!1)}},ue=async s=>{try{await y("DELETE",`/api/community-partners/${s}`),d({title:"Partner removed"}),D(t=>t.filter(i=>i.id!==s))}catch{d({title:"Delete failed",variant:"destructive"})}},f=h?A:A.filter(s=>s.published);return e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx("section",{className:"bg-[#2F6451] text-white",children:e.jsxs("div",{className:"container mx-auto px-4 md:px-8 pt-5 pb-7",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("p",{className:"text-xs text-white/50",children:[e.jsx(P,{href:"/",className:"hover:text-white/80 transition-colors",children:"Home"}),e.jsx("span",{className:"mx-1",children:"/"}),e.jsx("span",{children:"Community Partners"})]}),h&&e.jsxs(m,{onClick:de,size:"sm",className:"gap-1.5 bg-white/15 hover:bg-white/25 text-white border-0 text-xs -mt-1",children:[e.jsx(Ae,{size:13})," Add Partner"]})]}),e.jsxs("h1",{className:"font-serif font-bold text-2xl md:text-3xl text-white leading-tight mb-2",children:[e.jsx("span",{style:{color:"#FBAFB0"},children:"Together"})," we're making menopause and midlife support"," ",e.jsx("span",{style:{color:"#FFFFFF"},children:"easier to find."})]}),e.jsx("p",{className:"text-white/90 text-base max-w-2xl leading-relaxed",children:"Meno Square is proud to connect with organizations across Canada that are helping improve education, awareness, care and community for women in midlife."})]})}),e.jsx("section",{className:"py-8 bg-[#f5f5f3]",children:e.jsx("div",{className:"container mx-auto px-4 md:px-8",children:te?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(w,{className:"animate-spin text-muted-foreground",size:32})}):f.length===0?e.jsx("div",{className:"text-center py-20 text-muted-foreground",children:h?'No partners yet. Click "Add Partner" to get started.':"No partners listed yet."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:(U?f:f.slice(0,L)).map(s=>{const t=s.eventSlug?`/events/${s.eventSlug}`:s.eventId?`/events/${s.eventId}`:null;return e.jsxs("div",{role:"button",tabIndex:0,"aria-label":`Read more about ${s.name}`,onClick:()=>N(s),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),N(s))},className:je("relative bg-white border-2 border-border/60 rounded-lg flex flex-col overflow-hidden h-full hover:border-primary hover:shadow-lg transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",!s.published&&"opacity-60 ring-2 ring-amber-300"),children:[h&&e.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 z-10",children:[e.jsx("button",{onClick:i=>{i.stopPropagation(),me(s)},className:"p-1.5 rounded-full bg-white/90 hover:bg-muted border shadow-sm text-muted-foreground hover:text-primary transition-colors",title:"Edit",children:e.jsx(De,{size:13})}),e.jsxs(be,{children:[e.jsx(ye,{asChild:!0,children:e.jsx("button",{onClick:i=>i.stopPropagation(),className:"p-1.5 rounded-full bg-white/90 hover:bg-muted border shadow-sm text-muted-foreground hover:text-destructive transition-colors",title:"Delete",children:e.jsx(Ee,{size:13})})}),e.jsxs(we,{children:[e.jsxs(Ne,{children:[e.jsx(Ce,{children:"Remove partner?"}),e.jsxs(Se,{children:["This will permanently remove ",e.jsx("strong",{children:s.name})," from the page."]})]}),e.jsxs(ze,{children:[e.jsx(Fe,{children:"Cancel"}),e.jsx(ke,{className:"bg-destructive hover:bg-destructive/90",onClick:()=>ue(s.id),children:"Remove"})]})]})]})]}),e.jsx("div",{className:"flex h-[190px] items-center justify-center overflow-hidden p-2 border-b border-border/50 bg-[#fafafa]",children:s.logo?e.jsx("img",{src:s.logo,alt:s.name,className:"h-full w-full object-contain"}):e.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(Q,{size:22,className:"text-primary/50"})})}),e.jsxs("div",{className:"flex flex-col flex-1 px-4 py-3 gap-2",children:[e.jsx("h3",{className:"font-semibold text-sm text-center text-foreground leading-snug",children:s.name}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground text-center leading-relaxed line-clamp-3",children:s.description}),t&&e.jsxs(P,{href:t,onClick:i=>i.stopPropagation(),className:"flex items-center justify-center gap-1 text-xs font-medium text-primary hover:text-primary/80 transition-colors",children:[e.jsx(K,{size:11}),s.eventTitle||"View Event"]}),e.jsx("div",{className:"flex-1"}),s.websiteUrl&&e.jsxs("a",{href:s.websiteUrl,target:"_blank",rel:"noopener noreferrer",onClick:i=>i.stopPropagation(),className:"inline-flex w-full items-center justify-center gap-1.5 text-xs font-semibold text-primary border border-primary/40 rounded px-3 py-1.5 hover:bg-primary hover:text-white hover:border-primary transition-colors",children:["Visit Website",e.jsx(Z,{size:11})]})]}),h&&!s.published&&e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx(q,{variant:"secondary",className:"text-[10px] bg-amber-100 text-amber-700 border-0",children:"Draft"})})]},s.id)})}),f.length>L&&e.jsx("div",{className:"flex justify-center mt-8",children:e.jsx("button",{onClick:()=>ne(s=>!s),className:"inline-flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-primary border border-border rounded-full px-5 py-2 hover:border-primary transition-colors",children:U?e.jsxs(e.Fragment,{children:[e.jsx(Oe,{size:15})," Show fewer"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ie,{size:15})," Show all ",f.length," partners"]})})})]})})}),e.jsx(S,{open:!!n,onOpenChange:s=>{s||N(null)},children:e.jsx(z,{className:"sm:max-w-lg max-h-[85vh] overflow-y-auto",children:n&&e.jsxs(e.Fragment,{children:[e.jsxs(F,{children:[n.logo&&e.jsx("div",{className:"mx-auto mb-3 flex h-28 w-full items-center justify-center rounded-lg border bg-[#fafafa] p-3",children:e.jsx("img",{src:n.logo,alt:n.name,className:"h-full w-full object-contain"})}),e.jsx(k,{className:"text-center text-xl",children:n.name})]}),n.description&&e.jsx("p",{className:"whitespace-pre-line text-sm leading-7 text-muted-foreground",children:n.description}
2),e.jsxs(H,{className:"gap-2 sm:justify-center",children:[(n.eventSlug||n.eventId)&&e.jsx(m,{variant:"outline",asChild:!0,children:e.jsxs(P,{href:n.eventSlug?`/events/${n.eventSlug}`:`/events/${n.eventId}`,children:[e.jsx(K,{size:14}),n.eventTitle||"View Event"]})}),n.websiteUrl&&e.jsx(m,{asChild:!0,children:e.jsxs("a",{href:n.websiteUrl,target:"_blank",rel:"noopener noreferrer",children:["Visit Website",e.jsx(Z,{size:14})]})})]})]})})}),e.jsx("section",{className:"bg-gradient-to-br from-[#2F6451] via-[#2F6451] to-[#1e4535] text-white",children:e.jsx("div",{className:"container mx-auto px-4 md:px-8 py-10",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-8 items-start",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"font-serif font-bold text-2xl md:text-3xl leading-tight mb-3",children:["Interested in partnering with"," ",e.jsx("span",{className:"text-emerald-300",children:"Meno Square"}),"?"]}),e.jsx("div",{className:"h-1 w-10 bg-emerald-300 rounded-full mb-4"}),e.jsx("p",{className:"text-white/80 text-sm leading-relaxed mb-6 max-w-sm",children:"We're always open to partnering with organizations and communities that align with our mission to support women in midlife."}),e.jsx(m,{size:"default",onClick:()=>{b(!1),u({name:"",organization:"",email:"",interest:"",message:""}),C(!0)},className:"bg-rose-400 hover:bg-rose-500 text-white font-semibold rounded-full px-7 border-0",children:"Let's Connect"})]}),e.jsx("div",{className:"flex flex-col gap-4",children:Be.map(s=>e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-emerald-300/20 border border-emerald-300/30 flex items-center justify-center flex-shrink-0 mt-0.5",children:s.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-emerald-200 text-sm mb-0.5",children:s.title}),e.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:s.body})]})]},s.title))})]})})}),e.jsx(S,{open:ie,onOpenChange:p,children:e.jsxs(z,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsx(F,{children:e.jsx(k,{children:j?"Edit Partner":"Add Partner"})}),e.jsxs("div",{className:"flex flex-col gap-4 py-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o,{htmlFor:"cp-name",children:"Name *"}),e.jsx(x,{id:"cp-name",value:a.name,onChange:s=>c(t=>({...t,name:s.target.value})),placeholder:"Organization name"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o,{htmlFor:"cp-desc",children:"Description"}),e.jsx(V,{id:"cp-desc",value:a.description,onChange:s=>c(t=>({...t,description:s.target.value})),placeholder:"Brief description of the organization's mission",rows:3})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o,{children:"Logo"}),e.jsxs("div",{className:"flex items-center gap-3",children:[a.logo&&e.jsx("img",{src:a.logo,alt:"logo preview",className:"h-20 w-auto max-w-[160px] object-contain rounded border"}),e.jsxs(m,{type:"button",variant:"outline",size:"sm",className:"gap-2",onClick:()=>R.current?.click(),disabled:v,children:[v?e.jsx(w,{size:14,className:"animate-spin"}):e.jsx(Te,{size:14}),v?"Uploadingâ¦":"Upload Logo"]}),a.logo&&e.jsx("button",{className:"text-xs text-muted-foreground hover:text-destructive",onClick:()=>c(s=>({...s,logo:""})),children:"Remove"})]}),e.jsx("input",{ref:R,type:"file",accept:"image/*",className:"hidden",onChange:s=>{const t=s.target.files?.[0];t&&he(t),s.target.value=""}})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o,{htmlFor:"cp-url",children:"Website URL"}),e.jsx(x,{id:"cp-url",value:a.websiteUrl,onChange:s=>c(t=>({...t,websiteUrl:s.target.value})),placeholder:"https://example.org"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o,{htmlFor:"cp-tags",children:"Tags"}),e.jsx(x,{id:"cp-tags",value:a.tagsRaw,onChange:s=>c(t=>({...t,tagsRaw:s.target.value})),placeholder:"Education, Community, Advocacy (comma-separated)"}),a.tagsRaw&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:a.tagsRaw.split(",").map(s=>s.trim()).filter(Boolean).map(s=>e.jsx(q,{variant:"secondary",className:"text-[11px] bg-primary/10 text-primary border-0",children:s},s))})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o,{children:"Link to Event (optional)"}),e.jsxs(W,{value:a.eventId||"none",onValueChange:s=>c(t=>({...t,eventId:s==="none"?"":s})),children:[e.jsx(_,{children:e.jsx(Y,{placeholder:"Select an eventâ¦"})}),e.jsxs(G,{children:[e.jsx(g,{value:"none",children:"â No event â"}),ee.map(s=>e.jsx(g,{value:String(s.id),children:s.title},s.id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o,{htmlFor:"cp-order",children:"Display Order"}),e.jsx(x,{id:"cp-order",type:"number",value:a.displayOrder,onChange:s=>c(t=>({...t,displayOrder:Number(s.target.value)})),className:"w-24"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{id:"cp-published",checked:a.published,onCheckedChange:s=>c(t=>({...t,published:!!s}))}),e.jsx(o,{htmlFor:"cp-published",className:"cursor-pointer",children:"Published (visible to all visitors)"})]})]}
2),e.jsxs(H,{children:[e.jsx(m,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),e.jsxs(m,{onClick:xe,disabled:I||v,children:[I?e.jsx(w,{size:15,className:"animate-spin mr-2"}):null,j?"Save Changes":"Add Partner"]})]})]})}),e.jsx(S,{open:le,onOpenChange:s=>{C(s),s||b(!1)},children:e.jsxs(z,{className:"max-w-md",children:[e.jsx(F,{children:e.jsx(k,{className:"font-serif text-2xl text-[#2F6451]",children:"Let's Connect"})}),re?e.jsxs("div",{className:"py-8 text-center space-y-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-emerald-50 border border-emerald-200 flex items-center justify-center mx-auto",children:e.jsx(Ue,{size:20,className:"text-[#2F6451]"})}),e.jsx("p",{className:"font-semibold text-[#2F6451]",children:"Thank you for reaching out!"}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"We've received your message and will be in touch soon."}),e.jsx(m,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>{C(!1),b(!1)},children:"Close"})]}):e.jsxs("div",{className:"flex flex-col gap-4 py-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Interested in partnering with Meno Square? Tell us a little about your organization and we'll be in touch."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(o,{htmlFor:"lc-name",children:["Name ",e.jsx("span",{className:"text-rose-400",children:"*"})]}),e.jsx(x,{id:"lc-name",value:r.name,onChange:s=>u(t=>({...t,name:s.target.value})),placeholder:"Your name"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o,{htmlFor:"lc-org",children:"Organization"}),e.jsx(x,{id:"lc-org",value:r.organization,onChange:s=>u(t=>({...t,organization:s.target.value})),placeholder:"Your organization"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(o,{htmlFor:"lc-email",children:["Email ",e.jsx("span",{className:"text-rose-400",children:"*"})]}),e.jsx(x,{id:"lc-email",type:"email",value:r.email,onChange:s=>u(t=>({...t,email:s.target.value})),placeholder:"[email protected]"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(o,{htmlFor:"lc-interest",children:["What are you interested in? ",e.jsx("span",{className:"text-rose-400",children:"*"})]}),e.jsxs(W,{value:r.interest,onValueChange:s=>u(t=>({...t,interest:s})),children:[e.jsx(_,{id:"lc-interest",children:e.jsx(Y,{placeholder:"Select an option"})}),e.jsxs(G,{children:[e.jsx(g,{value:"Community Partnership",children:"Community Partnership"}),e.jsx(g,{value:"Collaboration",children:"Collaboration"}),e.jsx(g,{value:"Events or Content",children:"Events or Content"}),e.jsx(g,{value:"Other",children:"Other"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(o,{htmlFor:"lc-message",children:["Anything you'd like us to know? ",e.jsx("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),e.jsx(V,{id:"lc-message",value:r.message,onChange:s=>u(t=>({...t,message:s.target.value})),placeholder:"Share a bit more about your organization or what you have in mindâ¦",rows:3})]}),e.jsxs(m,{onClick:oe,disabled:B,className:"w-full bg-[#2F6451] hover:bg-[#245240] text-white rounded-full mt-1",children:[B?e.jsx(w,{size:15,className:"animate-spin mr-2"}):null,"Send"]})]})]})})]})}export{Ke 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.