PageSourceSearch

https://startup-gate.net/assets/CommunityFeedAnalyticsSection-C_KXFe2i.js

js startup-gate.net collected 2026-10-08 16:30:42 UTC 7,627 bytes, 1 lines download raw bytes

1import{r as A,j as e}from"./vendor-radix-DLGwGdby.js";import{aZ as D,D as d,C as n,e as c,b as m,c as x,M as S,E as T,F as B,G as R,s as h}from"./index-Cz1Nuibl.js";import{D as F}from"./DateRangeSelector-T4jK1nys.js";import{P as L}from"./PeriodDeltaBadge-B_hobRj_.js";import{U,F as $,ab as g,bj as u,bk as j,T as E,ao as M}from"./vendor-lucide-BWW0XcuW.js";import{R as f,k as z,l as H,m as K,T as v,B as G,C as O,X as V,Y as X,b as Y}from"./vendor-recharts-dzgay_RI.js";import"./vendor-datefns-CU7NMMYW.js";const i=["hsl(var(--primary))","hsl(var(--destructive))","hsl(var(--warning))","hsl(var(--success))","hsl(var(--accent-foreground))"];function N(l){return l?l.charAt(0).toUpperCase()+l.slice(1):"Unknown"}function se(){const[l,y]=A.useState(180),{data:a,isLoading:b}=D(l);if(b)return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[1,2,3,4].map(s=>e.jsx(d,{className:"h-28 rounded-xl"},s))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsx(d,{className:"h-80 rounded-xl"}),e.jsx(d,{className:"h-80 rounded-xl"})]})]});if(!a)return e.jsx(n,{className:"border-dashed",children:e.jsxs(c,{className:"py-16 text-center",children:[e.jsx(U,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/30"}),e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"No community data available"}),e.jsx("p",{className:"text-sm text-muted-foreground/70 mt-1",children:"Community feed activity will appear here once members begin posting."})]})});const C=a.total_posts>0?((a.total_reactions+a.total_comments)/a.total_posts).toFixed(1):"0",r=a.posts_by_type.map((s,t)=>({name:N(s.post_type),value:s.count,fill:i[t%i.length]})),p=a.monthly_posts.map(s=>({month:s.month.slice(5),posts:s.count})),_=a.period_comparison,w=[{icon:$,value:a.total_posts,label:"Total Posts",sublabel:`${a.posts_by_type.length} post types`,iconBg:"bg-primary/10",iconColor:"text-primary",changePct:_?.change_pct},{icon:g,value:a.total_reactions,label:"Reactions",sublabel:`${C} avg per post`,iconBg:"bg-destructive/10",iconColor:"text-destructive",changePct:void 0},{icon:u,value:a.total_comments,label:"Comments",sublabel:a.total_posts>0?`${(a.total_comments/a.total_posts).toFixed(1)} per post`:"—",iconBg:"bg-warning/10",iconColor:"text-warning",changePct:void 0},{icon:j,value:a.total_poll_votes,label:"Poll Votes",sublabel:"across all polls",iconBg:"bg-success/10",iconColor:"text-success",changePct:void 0}];return e.jsxs("div",{className:"space-y-6",children:[e.jsx(F,{value:l,onChange:y}),e.jsx("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:w.map((s,t)=>e.jsx(n,{className:"relative overflow-hidden",children:e.jsxs(c,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`h-10 w-10 rounded-xl ${s.iconBg} flex items-center justify-center shrink-0`,children:e.jsx(s.icon,{className:`h-5 w-5 ${s.iconColor}`})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-2xl font-bold tracking-tight",children:s.value.toLocaleString()}),e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:s.label})]}),s.changePct!==void 0&&e.jsx(L,{changePct:s.changePct})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 mt-2 truncate",children:s.sublabel})]})},t))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs(n,{children:[e.jsx(m,{className:"pb-2",children:e.jsxs(x,{className:"text-sm flex items-center gap-2",children:[e.jsx(j,{className:"h-4 w-4 text-primary"}),"Posts by Type"]})}),e.jsx(c,{children:r.length>0?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(f,{width:"50%",height:150,children:e.jsxs(z,{children:[e.jsx(H,{data:r,cx:"50%",cy:"50%",innerRadius:38,outerRadius:60,paddingAngle:4,dataKey:"value",children:r.map((s,t)=>e.jsx(K,{fill:s.fill},t))}),e.jsx(v,{formatter:s=>s.toLocaleString()})]})}),e.jsx("div",{className:"space-y-2 flex-1",children:r.map((s,t)=>{const o=r.reduce((P,k)=>P+k.value,0);return e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:i[t%i.length]}}),s.name]}),e.jsx("span",{className:"font-semibold",children:s.value.toLocaleStr
1ing()})]}),e.jsx(S,{value:o>0?s.value/o*100:0,className:"h-1","aria-label":`${s.name}: ${o>0?Math.round(s.value/o*100):0}% of posts`})]},s.name)})})]}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No post type data"})})]}),e.jsxs(n,{className:"lg:col-span-2",children:[e.jsx(m,{className:"pb-2",children:e.jsxs(x,{className:"text-sm flex items-center gap-2",children:[e.jsx(E,{className:"h-4 w-4 text-primary"}),"Monthly Post Volume",e.jsxs("span",{className:"ms-auto text-[10px] text-muted-foreground font-normal",children:["Last ",l," days"]})]})}),e.jsx(c,{children:p.length>0?e.jsx(f,{width:"100%",height:170,children:e.jsxs(G,{data:p,margin:{left:-10},children:[e.jsx(O,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",vertical:!1}),e.jsx(V,{dataKey:"month",tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"}}),e.jsx(X,{allowDecimals:!1,tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"}}),e.jsx(v,{}),e.jsx(Y,{dataKey:"posts",name:"Posts",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No monthly data"})})]})]}),e.jsxs(n,{children:[e.jsx(m,{className:"pb-3",children:e.jsxs(x,{className:"text-sm flex items-center gap-2",children:[e.jsx(M,{className:"h-4 w-4 text-warning"}),"Top Community Posts by Engagement"]})}),e.jsx(c,{children:a.top_posts.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No posts yet"}):e.jsx("div",{className:"space-y-2",children:a.top_posts.map((s,t)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-muted/40",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsxs(T,{className:"h-8 w-8 ring-2 ring-background",children:[e.jsx(B,{src:s.author_avatar||void 0}),e.jsx(R,{className:"text-xs bg-primary/10 text-primary font-bold",children:(s.author_name||"?").substring(0,2).toUpperCase()})]}),t<3&&e.jsx("span",{className:"absolute -top-1 -end-1 h-4 w-4 rounded-full bg-warning text-[9px] font-bold text-warning-foreground flex items-center justify-center",children:t+1})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("p",{className:"text-xs font-semibold truncate",children:s.author_name||"Unknown"}),s.post_type&&e.jsx(h,{variant:"secondary",className:"text-[10px] px-1.5 h-4",children:N(s.post_type)}),e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:new Date(s.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),s.headline&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:s.headline}),e.jsxs("div",{className:"flex items-center gap-3 mt-1.5",children:[e.jsxs(h,{variant:"outline",className:"h-5 px-1.5 text-[10px] gap-1 text-destructive border-destructive/20 bg-destructive/5",children:[e.jsx(g,{className:"h-2.5 w-2.5"})," ",s.reaction_count]}),e.jsxs(h,{variant:"outline",className:"h-5 px-1.5 text-[10px] gap-1 text-primary border-primary/20 bg-primary/5",children:[e.jsx(u,{className:"h-2.5 w-2.5"})," ",s.comment_count]})]})]})]},s.id))})})]})]})}export{se as CommunityFeedAnalyticsSection};

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.