1import{c as X,s as N,a as B,e as D,f as J,r as S,j as e,M as v,h as y,B as p,S as H,L as k,T as Z,l as F,m as I,n as A,g as M,t as $,b as ee}from"./index-CK3vutSl.js";import{L as R,C as se,N as z}from"./Navbar-BUpDNnzb.js";import{F as E}from"./Footer-FFVJjLyw.js";import{a as re}from"./useCommunityProjects-q1P2bBWE.js";import{B as g}from"./badge-DSpRzzed.js";import{C as f,b as te,c as ae,a as j}from"./card-DZ0L_26S.js";import{u as ne}from"./useQuery-Cmekee7_.js";import{u as O}from"./useMutation-CVx1DYW2.js";import{T as oe}from"./textarea-CymhbYJ8.js";import{A as ie,a as le,b as ce}from"./avatar-C3uy22Nn.js";import{L as C}from"./loader-circle-XW1Y8Qce.js";import{L as de}from"./log-in-Djh5qItX.js";import{T as me}from"./trash-2-BxXxfsBm.js";import{M as G}from"./map-pin-BOiT9jNc.js";import{T as pe}from"./trending-up-B_bw7jAu.js";import{W as he}from"./wrench-De9D5oXM.js";import{U as K}from"./users-yySNN4BJ.js";import{f as ue}from"./formatDistanceToNow-Cz9rA30t.js";import{L as xe}from"./link-2-BNr-27Ip.js";import{L as Q}from"./linkedin-BLNvW6g9.js";import{S as ge}from"./SEOHead-CON3zavc.js";import{B as _}from"./building-Px5rtxev.js";import{A as U}from"./arrow-left-BUIXgTrn.js";import{C as fe}from"./calendar-DiVt_6eG.js";import{E as je}from"./external-link-Iw7g49f4.js";import{G as be}from"./user-COEoZknB.js";import{I as Ne}from"./instagram-DeBoCUzc.js";import{T as ve}from"./twitter-BxJ1g8dL.js";import{H as we}from"./hammer-BOIYV71c.js";import{H as ye}from"./house-DvWMWEH7.js";import"./useIsAdmin-BuXYVmKR.js";import"./useProfile-B5IlLGJw.js";import"./index-BsnkaMDn.js";import"./Combination-CMXmbd7n.js";import"./index-0mbE7Hqp.js";import"./chevron-right-CWRhAgdX.js";import"./settings-CZ-FKz03.js";import"./log-out-BwoLdbKR.js";import"./message-square-bZ_BbvsG.js";import"./plus-D178_5fr.js";import"./calendar-days-Bm2AhvK-.js";import"./sparkles-ubwtpnfR.js";import"./heart-CV_CSns9.js";import"./star-DA5biP6Q.js";import"./zap-BjYdfLPn.js";import"./building-2-tZ3PgJs7.js";import"./constructNow-Ns6dv8Vy.js";import"./en-US-CulqtCeB.js";import"./endOfMonth-BUxpEBTO.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const ke=X("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]),b=[{type:"idea",label:"Idea",icon:"Lightbulb",description:"Concept & vision feedback"},{type:"location",label:"Location",icon:"MapPin",description:"Location & site advice"},{type:"business",label:"Business",icon:"TrendingUp",description:"Business model tips"},{type:"technical",label:"Technical",icon:"Wrench",description:"Technical suggestions"},{type:"connection",label:"Connection",icon:"Users",description:"I can help connect you"},{type:"question",label:"Question",icon:"HelpCircle",description:"Ask the project creator"},{type:"general",label:"General",icon:"MessageCircle",description:"General feedback"}],Ce=a=>ne({queryKey:["project-comments",a],queryFn:async()=>{const{data:s,error:r}=await N.from("project_comments").select(` 7 *, 8 profiles:user_id ( 9 full_name, 10 avatar_url 11 ) 12 `).eq("project_id",a).order("created_at",{ascending:!0});if(r)throw r;return(s||[]).map(o=>{var n,l;return{...o,user_name:((n=o.profiles)==null?void 0:n.full_name)||"Anonymous",user_avatar:(l=o.profiles)==null?void 0:l.avatar_url}})},enabled:!!a}),_e=()=>{const a=B(),{toast:s}=D();return O({mutationFn:async({projectId:r,content:o,feedbackType:n})=>{const{data:{user:l}}=await N.auth.getUser();
12if(!l)throw new Error("Must be logged in to comment");const{data:c,error:d}=await N.from("project_comments").insert({project_id:r,user_id:l.id,content:o,feedback_type:n}).select().single();if(d)throw d;return c},onSuccess:(r,o)=>{a.invalidateQueries({queryKey:["project-comments",o.projectId]}),s({title:"Comment added",description:"Your feedback has been posted successfully."})},onError:r=>{s({title:"Error",description:r.message||"Failed to post comment. Please try again.",variant:"destructive"})}})},Le=()=>{const a=B(),{toast:s}=D();return O({mutationFn:async({commentId:r,projectId:o})=>{const{error:n}=await N.from("project_comments").delete().eq("id",r);if(n)throw n;return{projectId:o}},onSuccess:r=>{a.invalidateQueries({queryKey:["project-comments",r.projectId]}),s({title:"Comment deleted",description:"Your comment has been removed."})},onError:r=>{s({title:"Error",description:r.message||"Failed to delete comment.",variant:"destructive"})}})},L={idea:e.jsx(R,{className:"w-3.5 h-3.5"}),location:e.jsx(G,{className:"w-3.5 h-3.5"}),business:e.jsx(pe,{className:"w-3.5 h-3.5"}),technical:e.jsx(he,{className:"w-3.5 h-3.5"}),connection:e.jsx(K,{className:"w-3.5 h-3.5"}),question:e.jsx(se,{className:"w-3.5 h-3.5"}),general:e.jsx(v,{className:"w-3.5 h-3.5"})},T={idea:"bg-yellow-500/10 text-yellow-600 border-yellow-500/30",location:"bg-green-500/10 text-green-600 border-green-500/30",business:"bg-blue-500/10 text-blue-600 border-blue-500/30",technical:"bg-purple-500/10 text-purple-600 border-purple-500/30",connection:"bg-pink-500/10 text-pink-600 border-pink-500/30",question:"bg-orange-500/10 text-orange-600 border-orange-500/30",general:"bg-muted text-muted-foreground border-border"},Te=({projectId:a})=>{var P;const{user:s}=J(),{data:r,isLoading:o}=Ce(a),n=_e(),l=Le(),[c,d]=S.useState(""),[i,h]=S.useState("general"),m=t=>{t.preventDefault(),c.trim()&&n.mutate({projectId:a,content:c.trim(),feedbackType:i},{onSuccess:()=>{d(""),h("general")}})},w=t=>{window.confirm("Are you sure you want to delete this comment?")&&l.mutate({commentId:t,projectId:a})},W=t=>t.split(" ").map(u=>u[0]).join("").toUpperCase().slice(0,2),V=(r==null?void 0:r.reduce((t,u)=>{const x=u.feedback_type||"general";return t[x]=(t[x]||0)+1,t},{}))||{};return e.jsxs(f,{className:"bg-background border-border/50",children:[e.jsxs(te,{children:[e.jsxs(ae,{className:"font-heading text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(v,{className:"w-6 h-6"}),"Community Feedback",r&&r.length>0&&e.jsxs("span",{className:"text-base font-normal text-muted-foreground",children:["(",r.length,")"]})]}),r&&r.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:Object.entries(V).map(([t,u])=>{const x=b.find(Y=>Y.type===t);return x?e.jsxs(g,{variant:"outline",className:y("text-xs gap-1",T[t]),children:[L[t],u," ",x.label]},t):null})})]}),e.jsxs(j,{className:"space-y-6",children:[s?e.jsxs("form",{onSubmit:m,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"What type of feedback are you sharing?"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map(t=>e.jsxs("button",{type:"button",onClick:()=>h(t.type),className:y("flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-all border",i===t.type?T[t.type]+" ring-2 ring-offset-2 ring-offset-background ring-primary/50":"bg-muted/50 text-muted-foreground border-border hover:bg-muted"),children:[L[t.type],t.label]},t.type))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(P=b.find(t=>t.type===i))==null?void 0:P.description})]}),e.jsx(oe,{value:c,onChange:t=>d(t.target.value),placeholder:i==="question"?"Ask a question about this project...":i==="connection"?"Describe how you can help connect this project...":"Share your thoughts, advice, or encouragement for this project...",className:"min-h-[100px] resize-none"}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(p,{type:"submit",disabled:!c.trim()||n.isPending,children:[n.isPending?e.jsx(C,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(H,{className:"w-4 h-4 mr-2"}),"Post Feedback"]})})]}):e.jsxs("div",{className:"text-center py-6 bg-muted/30 rounded-lg",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"Sign in to share your feedback and support this project"}),e.jsx(k,{to:"/auth",children:e.jsxs(p,{variant:"outline",children:[e.jsx(de,{className:"w-4 h-4 mr-2"}),"Sign In to Comment"]})})]}),e.jsx("div",{className:"space-y-4",children:o?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(C,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):r&&r.length>0?r.map(t=>e.jsx(Pe,{comment:t,currentUserId:s==null?void 0:s.id,onDelete:w,isDeleting:l.isPending,getInitials:W},t.id)):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(v,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No feedback yet. Be the first to share your thoughts!"})]})})]})]})},Pe=({comment:a,currentUserId:s,onDelete:r,isDeleting:o,getInitials:n})=>{const l=s===a.user_id,c=a.feedback_type||"general",d=b.find(i=>i.type===c);return e.jsxs("div",{className:"flex gap-4 p-4 rounded-lg bg-muted/20 border border-border/50",children:[e.jsxs(ie,{className:"w-10 h-10 flex-shrink-0",children:[e.jsx(le,{src:a.user_avatar}),e.jsx(ce,{className:"bg-primary/10 text-primary text-sm",children:n(a.user_name||"A")})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-foreground",children:a.user_name}),e.jsxs(g,{variant:"outline",className:y("text-xs gap-1",T[c]),children:[L[c],d==null?void 0:d.label]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ue(new Date(a.created_at),{addSuffix:!0})})]}),l&&e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>r(a.id),disabled:o,children:e.jsx(me,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:a.content})]})]})},Se=({url:a,title:s,description:r=""})=>{const o=encodeURIComponent(a),n=encodeURIComponent(s),l=encodeURIComponent(r),c=encodeURIComponent(`Check out ${s}: ${a}`),d=[{name:"WhatsApp",icon:v,url:`https://wa.me/?text=${c}`,color:"hover:text-green-500"},{name:"Facebook",icon:ke,url:`https://www.facebook.com/sharer/sharer.php?u=${o}`,color:"hover:text-blue-600"},{name:"X (Twitter)",icon:()=>e.jsx("svg",{viewBox:"0 0 24 24",className:"h-4 w-4 fill-current",children:e.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),url:`https://twitter.com/intent/tweet?text=${n}&url=${o}`,color:"hover:text-foreground"},{name:"LinkedIn",icon:Q,url:`https://www.linkedin.com/sharing/share-offsite/?url=${o}`,color:"hover:text-blue-700"},{name:"Telegram",icon:H,url:`https://t.me/share/url?url=${o}&text=${n}`,color:"hover:text-sky-500"},{name:"Email",icon:M,url:`mailto:?subject=${n}&body=${l}%0A%0A${o}`,color:"hover:text-orange-500"}],i=m=>{window.open(m,"_blank","noopener,noreferrer,width=600,height=400")},h=async()=>{try{await navigator.clipboard.writeText(a),$({title:"Link copied!",description:"Project link copied to clipboard"})}catch{$({title:"Failed to copy",description:"Please copy the URL manually",variant:"destructive"})}};return e.jsx(Z,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Share Project"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.map(m=>{const w=m.icon;return e.jsxs(F,{children:[e.jsx(I,{asChild:!0,children:e.jsxs(p,{variant:"outline",size:"icon",className:`h-9 w-9 ${m.color} transition-colors`,onClick:()=>i(m.url),children:[e.jsx(w,{className:"h-4 w-4"}),e.jsxs("span",{className:"sr-only",children:["Share on ",m.name]})]})}),e.jsx(A,{children:e.jsxs("p",{children:["Share on ",m.name]})})]},m.name)}),e.jsxs(F,{children:[e.jsx(I,{asChild:!0,children:e.jsxs(p,{variant:"outline",size:"icon",className:"h-9 w-9 hover:text-primary transition-colors",onClick:h,children:[e.jsx(xe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Copy link"})]})}),e.jsx(A,{children:e.jsx("p",{children:"Copy link"})})]})]})]})})}
12,Fe={idea:e.jsx(R,{className:"w-5 h-5"}),planning:e.jsx(K,{className:"w-5 h-5"}),fundraising:e.jsx(_,{className:"w-5 h-5"}),building:e.jsx(we,{className:"w-5 h-5"}),operating:e.jsx(ye,{className:"w-5 h-5"})},Ie={idea:"Idea Stage",planning:"Planning Phase",fundraising:"Fundraising",building:"Under Construction",operating:"Now Operating"},q={mentorship:{label:"Mentorship",description:"Looking for experienced advisors"},volunteers:{label:"Volunteers",description:"Need helping hands"},knowledge:{label:"Knowledge",description:"Seeking resources and expertise"},"co-founders":{label:"Co-founders",description:"Looking for partners"},residents:{label:"Future Residents",description:"Building a waitlist"},investors:{label:"Investors",description:"Seeking funding"},partners:{label:"Partners",description:"Looking for collaborators"}},Ts=()=>{var l,c,d;const{slug:a}=ee(),{data:s,isLoading:r,error:o}=re(a||""),n=(l=s==null?void 0:s.images)!=null&&l.length?s.images:s!=null&&s.image_url?[s.image_url]:[];return r?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(C,{className:"w-8 h-8 animate-spin text-primary"})}):o||!s?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(z,{}),e.jsxs("div",{className:"container px-4 py-32 text-center",children:[e.jsx(_,{className:"w-16 h-16 text-muted-foreground/50 mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Project Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-8",children:"This project may have been removed or is pending approval."}),e.jsx(k,{to:"/community-projects",children:e.jsxs(p,{children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),"Back to Projects"]})})]}),e.jsx(E,{})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(ge,{title:s.title,description:((c=s.description)==null?void 0:c.slice(0,160))||`Discover the ${s.title} coliving project.`}),e.jsx(z,{}),e.jsxs("section",{className:"relative",children:[e.jsxs("div",{className:"h-64 md:h-96 relative",children:[n.length>0?e.jsx("img",{src:n[0],alt:s.title,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-primary/20 to-secondary/20 flex items-center justify-center",children:e.jsx(_,{className:"w-24 h-24 text-muted-foreground/30"})}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background via-background/50 to-transparent pointer-events-none"})]}),e.jsx("div",{className:"absolute top-24 left-4 md:left-8",children:e.jsx(k,{to:"/community-projects",children:e.jsxs(p,{variant:"secondary",size:"sm",className:"rounded-full",children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),"All Projects"]})})})]}),e.jsx("section",{className:"relative -mt-20 pb-20",children:e.jsx("div",{className:"container px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[e.jsx(f,{className:"overflow-hidden bg-background border-border/50",children:e.jsxs(j,{className:"p-6 md:p-8",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsxs(g,{className:"bg-primary/10 text-primary border-primary/20 flex items-center gap-1.5",children:[Fe[s.project_stage],Ie[s.project_stage]]}),e.jsx(g,{variant:"outline",className:"capitalize",children:s.project_type.replace("_"," ")}),s.featured&&e.jsx(g,{className:"bg-primary text-primary-foreground",children:"Featured"})]}),e.jsx("h1",{className:"font-heading text-3xl md:text-4xl font-bold text-foreground mb-4",children:s.title}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-muted-foreground mb-6",children:[s.location&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(G,{className:"w-4 h-4"}),e.jsx("span",{children:s.location})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(fe,{className:"w-4 h-4"}),e.jsxs("span",{children:["Posted ",new Date(s.created_at).toLocaleDateString()]})]})]}),e.jsx("div",{className:"space-y-4 text-muted-foreground",children:s.description.split(` 13`).filter(i=>i.trim()).map((i,h)=>e.jsx("p",{className:"leading-relaxed",children:i},h))}),n.length>1&&e.jsxs("div",{className:"pt-6 border-t border-border mt-6",children:[e.jsx("h3",{className:"font-heading text-lg font-semibold text-foreground mb-4",children:"Photos"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:n.slice(1).map((i,h)=>e.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"aspect-square rounded-lg overflow-hidden hover:ring-2 hover:ring-primary/50 transition-all",children:e.jsx("img",{src:i,alt:`${s.title} - Photo ${h+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})},h))})]})]})}),s.looking_for.length>0&&e.jsx(f,{className:"bg-background border-border/50",children:e.jsxs(j,{className:"p-6 md:p-8",children:[e.jsx("h2",{className:"font-heading text-2xl font-bold text-foreground mb-6",children:"Looking For"}),e.jsx("div",{className:"grid sm:grid-cols-2 gap-4",children:s.looking_for.map(i=>{var h,m;return e.jsxs("div",{className:"p-4 rounded-lg bg-primary/5 border border-primary/10",children:[e.jsx("div",{className:"font-semibold text-foreground",children:((h=q[i])==null?void 0:h.label)||i}),e.jsx("div",{className:"text-sm text-muted-foreground",children:(m=q[
13i])==null?void 0:m.description})]},i)})})]})}),e.jsx(Te,{projectId:s.id})]}),e.jsx("div",{className:"space-y-6",children:e.jsx(f,{className:"sticky top-24 bg-background border-border/50",children:e.jsxs(j,{className:"p-6 space-y-4",children:[s.external_link&&e.jsx("a",{href:s.external_link,target:"_blank",rel:"noopener noreferrer",className:"block",children:e.jsxs(p,{className:"w-full",size:"lg",children:[e.jsx(je,{className:"w-5 h-5 mr-2"}),"Visit Project Page"]})}),s.contact_email&&e.jsx("a",{href:`mailto:${s.contact_email}`,className:"block",children:e.jsxs(p,{variant:"outline",className:"w-full",size:"lg",children:[e.jsx(M,{className:"w-5 h-5 mr-2"}),"Contact Project"]})}),Object.keys(s.social_links).length>0&&e.jsxs("div",{className:"pt-4 border-t border-border",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-3",children:"Follow Project"}),e.jsxs("div",{className:"flex gap-2",children:[s.social_links.website&&e.jsx("a",{href:s.social_links.website,target:"_blank",rel:"noopener noreferrer",children:e.jsx(p,{variant:"outline",size:"icon",children:e.jsx(be,{className:"w-4 h-4"})})}),s.social_links.instagram&&e.jsx("a",{href:s.social_links.instagram,target:"_blank",rel:"noopener noreferrer",children:e.jsx(p,{variant:"outline",size:"icon",children:e.jsx(Ne,{className:"w-4 h-4"})})}),s.social_links.linkedin&&e.jsx("a",{href:s.social_links.linkedin,target:"_blank",rel:"noopener noreferrer",children:e.jsx(p,{variant:"outline",size:"icon",children:e.jsx(Q,{className:"w-4 h-4"})})}),s.social_links.twitter&&e.jsx("a",{href:s.social_links.twitter,target:"_blank",rel:"noopener noreferrer",children:e.jsx(p,{variant:"outline",size:"icon",children:e.jsx(ve,{className:"w-4 h-4"})})})]})]}),e.jsx("div",{className:"pt-4 border-t border-border",children:e.jsx(Se,{url:window.location.href,title:s.title,description:(d=s.description)==null?void 0:d.slice(0,200)})}),s.funding_goal&&e.jsxs("div",{className:"pt-4 border-t border-border",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Funding Progress"}),e.jsxs("div",{className:"text-2xl font-bold text-foreground",children:["â¬",(s.funding_current||0).toLocaleString(),e.jsxs("span",{className:"text-muted-foreground text-base font-normal",children:[" ","/ â¬",s.funding_goal.toLocaleString()]})]}),e.jsx("div",{className:"mt-2 h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full",style:{width:`${Math.min(100,(s.funding_current||0)/s.funding_goal*100)}%`}})})]})]})})})]})})}),e.jsx(E,{})]})};export{Ts 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.