PageSourceSearch

https://crystalheartradio.com/assets/Communities-BI_l0JFW.js

js crystalheartradio.com collected 2026-10-04 07:49:55 UTC 6,386 bytes, 1 lines download raw bytes

1import{u as S,r as j,b as p,h as _,j as e,B as l,e as c,N as d,O as m,ar as x,f as b,o as D,ao as k,D as I,l as T,m as A,n as E,E as P,I as C}from"./index-N0wys5lg.js";import{T as O}from"./textarea-CxO7Mvaz.js";import{S as $,a as q,b as z,c as F,d as f}from"./select-DZWRa5aR.js";import{P as H}from"./plus-DdrBQJ9E.js";import{S as N}from"./settings-D8ZHVwGz.js";import"./index-CfnEu8Sg.js";import"./chevron-up-C1laQmVo.js";function Q(){const r=S(),[u,v]=j.useState(!1),[y,h]=j.useState(!1),[a,o]=j.useState({name:"",description:"",type:"general",icon_emoji:"✨"});j.useEffect(()=>{p.auth.isAuthenticated().then(async s=>{if(s){const n=await p.auth.me();v((n==null?void 0:n.role)==="admin")}})},[]);const{data:g=[]}=_({queryKey:["communities"],queryFn:()=>p.entities.Community.filter({is_public:!0})}),w=async s=>{s.preventDefault();try{await p.entities.Community.create({...a,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}),h(!1),o({name:"",description:"",type:"general",icon_emoji:"✨"})}catch(n){console.error("Failed to create community:",n)}},i=g.find(s=>s.type==="aura"),t=g.find(s=>s.type==="spiritual");return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"border-b border-border bg-card/50 backdrop-blur-sm",children:e.jsx("div",{className:"max-w-6xl mx-auto px-6 py-8",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-heading font-bold text-foreground mb-2",children:"Communities"}),e.jsx("p",{className:"text-muted-foreground",children:"Join spiritual discussions and connect with others"})]}),u&&e.jsxs(l,{onClick:()=>h(!0),className:"bg-primary hover:bg-primary/90 gap-2",children:[e.jsx(H,{className:"w-4 h-4"}),"New Community"]})]})})}),e.jsx("div",{className:"max-w-6xl mx-auto px-6 py-12",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[i?e.jsxs(c,{className:"hover:shadow-lg transition-shadow cursor-pointer",onClick:()=>r("/communities/aura"),children:[e.jsxs(d,{className:"pb-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("span",{className:"text-4xl",children:i.icon_emoji||"✨"}),u&&e.jsx(l,{variant:"ghost",size:"icon",onClick:s=>{s.stopPropagation(),r(`/admin?edit_community=${i.id}`)},children:e.jsx(N,{className:"w-4 h-4"})})]}),e.jsx(m,{children:i.name}),e.jsx(x,{children:i.description})]}),e.jsx(b,{children:e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[i.member_count||0," members"]}),e.jsxs("span",{children:[i.discussion_count||0," discussions"]})]})})]}):e.jsx(c,{className:"border-dashed",children:e.jsxs(d,{children:[e.jsx(D,{className:"w-8 h-8 text-muted-foreground mb-2"}),e.jsx(m,{children:"Aura Community"}),e.jsx(x,{children:"Coming soon"})]})}),t?e.jsxs(c,{className:"hover:shadow-lg transition-shadow cursor-pointer",onClick:()=>r("/communities/spiritual"),children:[e.jsxs(d,{className:"pb-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("span",{className:"text-4xl",children:t.icon_emoji||"🙏"}),u&&e.jsx(l,{variant:"ghost",size:"icon",onClick:s=>{s.stopPropagation(),r(`/admin?edit_community=${t.id}`)},children:e.jsx(N,{className:"w-4 h-4"})})]}),e.jsx(m,{children:t.name}),e.jsx(x,{children:t.description})]}),e.jsx(b,{children:e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[t.member_count||0," members"]}),e.jsxs("span",{children:[t.discussion_count||0," discussions"]})]})})]}):e.jsx(c,{className:"border-dashed",children:e.jsxs(d,{children:[e.jsx(k,{className:"w-8 h-8 text-muted-foreground mb-2"}),e.jsx(m,{children:"Spiritual Community"}),e.jsx(x,{children:"Coming soon"})]})}),g.filter(s=>!["aura","spiritual"].includes(s.type)).map(s=>e.jsxs(c,{className:"hover:shadow-lg transition-shadow cursor-pointer",onClick:()=>r(`/communities/${s.id}`),children:[e.jsxs(d,{className:"pb-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("span",{className:"text-4xl",children:s.icon_emoji||"💫"}),u&&e.jsx(l,{variant:"ghost",size:"icon",onClick:n=>{n.stopPropagation(),r(`/admin?edit_community=${s.id}`)},children:e.jsx(N,{className:"w-4 h-4"})})]}),e.jsx(m,{children:s.name}),e.jsx(x,{children:s.description})]}),e.jsx(b,{children:e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[s.member_count||0," members"]}),e.jsxs("span",{children:[s.discussion_count||0," discussions"]})]})})]},s.id))]})}),e.jsx(I,{open:y,onOpenChange:h,children:e.jsxs(T,{className:"bg-card border-border",children:[e.jsxs(A,{children:[e.jsx(E,{children:"Create New Community"}),e.jsx(P,{children:"Set up a new community for spiritual discussions"})]}),e.jsxs("form",{onSubmit:w,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Community Name"}),e.jsx(C,{placeholder:"e.g., Chakra Healing",value:a.name,onChange:s=>o({...a,name:s.target.value}),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Description"}),e.jsx(O,{placeholder:"Describe the community's purpose...",value:a.description,onChange:s=>o({...a,description:s.target.value}),className:"h-24"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Type"}),e.jsxs($,{value:a.type,onValueChange:s=>o({...a,type:s}),children:[e.jsx(q,{className:"w-full bg-background border-border",children:e.jsx(z,{})}),e.jsxs(F,{children:[e.jsx(f,{value:"general",children:"General"}),e.jsx(f,{value:"aura",children:"Aura"}),e.jsx(f,{value:"spiritual",children:"Spiritual"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Icon Emoji"}),e.jsx(C,{placeholder:"✨",value:a.icon_emoji,onChange:s=>o({...a,icon_emoji:s.target.value}),maxLength:"2"})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx(l,{type:"button",variant:"outline",onClick:()=>h(!1),children:"Cancel"}),e.jsx(l,{type:"submit",className:"bg-primary hover:bg-primary/90",children:"Create Community"})]})]})]})})]})}export{Q 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.