PageSourceSearch

https://www.instaloops.com/_next/static/chunks/27443.f0ddfcc3f9ceeabf.js

js instaloops.com collected 2026-10-09 22:43:27 UTC 11,654 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[27443],{6034:function(e,t,s){s.d(t,{Z:function(){return a}});let a=(0,s(45802).Z)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]])},9588:function(e,t,s){s.d(t,{Z:function(){return a}});let a=(0,s(45802).Z)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]])},27443:function(e,t,s){s.r(t),s.d(t,{default:function(){return C}});var a=s(65724),r=s(50543),i=s(76988),l=s(9588),n=s(32599),c=s(68089),o=s(22579),m=s(6034),d=s(5225),x=s(67582),u=s(8879),h=s(43937),g=s(61763),y=s(54704),b=s(2512),j=s(79449);let v=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toLocaleString(),p=e=>e?new Date(e).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}):"Unknown",f=e=>{if(!e)return 0;let t=new Date(e);return Math.floor((new Date().getTime()-t.getTime())/864e5)},N=e=>{let{label:t,value:s,subtext:i,icon:l,trend:n}=e;return(0,a.jsxs)("div",{className:"group relative rounded-2xl border border-gray-200/60 bg-white p-6 transition-all duration-200 hover:border-gray-300 hover:shadow-sm",children:[(0,a.jsxs)("div",{className:"mb-4 flex items-start justify-between",children:[(0,a.jsx)("div",{className:"rounded-xl bg-gray-50 p-2.5 transition-colors group-hover:bg-gray-100",children:(0,a.jsx)(l,{className:"h-5 w-5 text-gray-600"})}),n&&n.value>0&&(0,a.jsxs)("div",{className:"flex items-center gap-1 rounded-full bg-emerald-50 px-2 py-1 text-emerald-600",children:[(0,a.jsx)(r.Z,{className:"h-3 w-3"}),(0,a.jsxs)("span",{className:"text-xs font-medium",children:["+",n.value]})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("div",{className:"text-3xl font-semibold tracking-tight text-gray-900",children:"number"==typeof s?v(s):s}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:t}),i&&(0,a.jsx)("div",{className:"mt-2 text-xs text-gray-400",children:i})]})]})},w=e=>{let{value:t,max:s,label:r}=e,i=Math.min(t/s*100,100);return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,a.jsx)("span",{className:"text-gray-600",children:r}),(0,a.jsxs)("span",{className:"font-medium text-gray-900",children:[Math.round(i),"%"]})]}),(0,a.jsx)("div",{className:"h-2 overflow-hidden rounded-full bg-gray-100",children:(0,a.jsx)("div",{className:"h-full rounded-full bg-gray-900 transition-all duration-700 ease-out",style:{width:"".concat(i,"%")}})})]})},k=e=>{let{title:t,description:s,timeEstimate:r,completed:n=!1,onClick:c}=e;return(0,a.jsx)("button",{onClick:c,className:"w-full rounded-xl border p-4 text-left transition-all duration-200 ".concat(n?"border-gray-200 bg-gray-50 opacity-60":"border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm"),children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"mt-0.5 rounded-full p-1 ".concat(n?"bg-emerald-100":"bg-gray-100"),children:n?(0,a.jsx)(i.Z,{className:"h-4 w-4 text-emerald-600"}):(0,a.jsx)(l.Z,{className:"h-4 w-4 text-gray-400"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("h4",{className:"font-medium ".concat(n?"text-gray-500 line-through":"text-gray-900"),children:t}),(0,a.jsx)("span",{className:"shrink-0 text-xs text-gray-400",children:r})]}),(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:s})]})]})})},M=e=>{let{title:t,value:s,context:r,positive:i=!0}=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-100 py-4 last:border-0",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("div",{className:"text-sm text-gray-500",children:t}),(0,a.jsx)("div",{className:"text-lg font-medium text-gray-900",children:s})]}),(0,a.jsx)("div",{className:"rounded-full px-2.5 py-1 text-xs ".concat(i?"bg-emerald-50 text-emerald-700":"bg-gray-100 text-gray-600"),children:r})]})},_=()=>(0,a.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-[#fafafa]",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 text-gray-500",children:[(0,a.jsx)(n.Z,{className:"h-5 w-5 animate-spin"}),(0,a.jsx)("span",{children:"Loading stats..."})]})}),S=e=>{let{onRetry:t}=e;return(0,a.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-[#fafafa]",children:(0,a.jsxs)("div",{className:"space-y-4 text-center",children:[(0,a.jsx)("div",{className:"text-gray-500",children:"Failed to load community stats"}),(0,a.jsx)("button",{onClick:t,className:"rounded-lg bg-gray-900 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-gray-800",children:"Try again"})]})})};function C(){let e=(0,y.useParams)(),t=null==e?void 0:e.communityId,s=(0,b.useMemo)(()=>(0,j.N)(),[]),[r,i]=(0,b.useState)(null),[l,v]=(0,b.useState)(null),[C,Z]=(0,b.useState)(!0),[T,P]=(0,b.useState)(!1),[D,E]=(0,b.useState)(!1),F=async()=>
1{if(!t){P(!0),Z(!1);return}try{Z(!0),P(!1);let{data:e,error:a}=await s.from("community").select("name, logo, created_at").eq("community_id",t).single();if(a||!e)throw Error("Community not found");i(e);let{count:r}=await s.from("community_user").select("*",{count:"exact",head:!0}).eq("community_id",t),l=new Date,n=new Date(l.getFullYear(),l.getMonth(),1),c=new Date(l);c.setDate(l.getDate()-l.getDay()),c.setHours(0,0,0,0);let{count:o}=await s.from("community_user").select("*",{count:"exact",head:!0}).eq("community_id",t).gte("created_at",n.toISOString()),{count:m}=await s.from("community_user").select("*",{count:"exact",head:!0}).eq("community_id",t).gte("created_at",c.toISOString()),{data:d}=await s.from("posts").select("view_count, comment_count, likes, love_count").eq("community_id",t),x=(null==d?void 0:d.reduce((e,t)=>e+(t.view_count||0),0))||0,u=(null==d?void 0:d.reduce((e,t)=>e+(t.comment_count||0),0))||0,h=(null==d?void 0:d.reduce((e,t)=>e+(t.likes||0),0))||0,g=(null==d?void 0:d.reduce((e,t)=>e+(t.love_count||0),0))||0;v({totalMembers:r||0,totalViews:x,totalPosts:(null==d?void 0:d.length)||0,totalComments:u,totalLikes:h,totalLoves:g,communityCreatedAt:e.created_at,newMembersThisMonth:o||0,newMembersThisWeek:m||0})}catch(e){console.error("Error fetching community stats:",e),P(!0)}finally{Z(!1)}};(0,b.useEffect)(()=>{F()},[t]);let q=async()=>{E(!0),await F(),E(!1)},A=l&&l.totalPosts>0?((l.totalComments+l.totalLikes+l.totalLoves)/l.totalPosts).toFixed(1):"0",L=l&&l.totalPosts>0?Math.round(l.totalViews/l.totalPosts):0,W=(null==l?void 0:l.communityCreatedAt)?f(l.communityCreatedAt):0;return C?(0,a.jsx)(_,{}):!T&&r&&l?(0,a.jsxs)("div",{className:"min-h-screen bg-[#fafafa]",children:[(0,a.jsx)("div",{className:"border-b border-gray-200 bg-white",children:(0,a.jsx)("div",{className:"mx-auto max-w-5xl px-6 py-8",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Community Stats"}),(0,a.jsxs)("p",{className:"text-gray-500",children:[r.name," \xb7 Started"," ",p(l.communityCreatedAt)]})]}),(0,a.jsxs)("button",{onClick:q,disabled:D,className:"flex items-center gap-2 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-50",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 ".concat(D?"animate-spin":"")}),"Refresh"]})]})})}),(0,a.jsxs)("div",{className:"mx-auto max-w-5xl space-y-8 px-6 py-8",children:[(0,a.jsxs)("section",{children:[(0,a.jsx)("h2",{className:"mb-4 text-sm font-medium uppercase tracking-wider text-gray-500",children:"Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,a.jsx)(N,{label:"Total Members",value:l.totalMembers,icon:c.Z,trend:l.newMembersThisWeek>0?{value:l.newMembersThisWeek,label:"this week"}:void 0}),(0,a.jsx)(N,{label:"Total Views",value:l.totalViews,icon:o.Z,subtext:"".concat(L," avg per post")}),(0,a.jsx)(N,{label:"Posts",value:l.totalPosts,icon:m.Z,subtext:"".concat(l.totalComments," comments")}),(0,a.jsx)(N,{label:"Reactions",value:l.totalLikes+l.totalLoves,icon:d.Z,subtext:"".concat(A," per post avg")})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-8 lg:grid-cols-3",children:[(0,a.jsxs)("section",{className:"lg:col-span-2",children:[(0,a.jsx)("h2",{className:"mb-4 text-sm font-medium uppercase tracking-wider text-gray-500",children:"Growth Insights"}),(0,a.jsx)("div",{className:"rounded-2xl border border-gray-200/60 bg-white p-6",children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(w,{value:l.totalMembers,max:100,label:"Progress to 100 members"}),(0,a.jsx)(w,{value:l.totalPosts,max:50,label:"Progress to 50 posts"})]}),(0,a.jsx)("div",{className:"border-t border-gray-100"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(M,{title:"New members this month",value:"+".concat(l.newMembersThisMonth),context:l.newMembersThisMonth>10?"Great growth":"Keep going",positive:l.newMembersThisMonth>0}),(0,a.jsx)(M,{title:"New members this week",value:"+".concat(l.newMembersThisWeek),context:l.newMembersThisWeek>5?"Hot streak":"Steady",positive:l.newMembersThisWeek>0}),(0,a.jsx)(M,{title:"Days since launch",value:W.toString(),context:"Building momentum",positive:!0}),(0,a.jsx)(M,{title:"Engagement rate",value:"".concat(A,"x"),context:parseFloat(A)>5?"Excellent":"Room to grow",positive:parseFloat(A)>3})]})]})})]}),(0,a.jsxs)("section",{children:[(0,a.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-sm font-medium uppercase tracking-wider text-gray-500",children:"Today's Focus"}),(0,a.jsx)(x.Z,{className:"h-4 w-4 text-gray-400"})]}),(0,a.jsx)("div",{className:"space-y-3",children:[{title:"Welcome new members",description:"Send a personal message to members who joined this week",timeEstimate:"5 min",completed:!1},{title:"Share valuable content",description:"Post something that helps your community today",timeEstimate:"10 min",completed:!1},{title:"Spark a conversation",description:"Ask an engaging question to boost discussion",timeEstimate:"2 min",completed:!1}].map((e,t)=>(0,a.jsx)(k,{...e},t))}),(0,a.jsx)("div",{className:"mt-6 rounded-xl border border-gray-100 bg-gray-50 p-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"rounded-lg border border-gray-200 bg-white p-1.5",children:(0,a.jsx)(u.Z,{className:"h-4 w-4 text-gray-600"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Qu
1ick tip"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"Communities that post daily see 3x more engagement. Consistency builds trust."})]})]})})]})]}),(0,a.jsx)("section",{className:"pt-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-gray-200 py-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,a.jsx)(h.Z,{className:"h-4 w-4"}),(0,a.jsxs)("span",{children:["Community created ",p(l.communityCreatedAt)]})]}),(0,a.jsxs)("button",{className:"flex items-center gap-1 text-sm font-medium text-gray-600 transition-colors hover:text-gray-900",children:["View detailed analytics",(0,a.jsx)(g.Z,{className:"h-4 w-4"})]})]})})]})]}):(0,a.jsx)(S,{onRetry:F})}}}]);

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.