PageSourceSearch

https://kolabo.co.id/assets/SocmedDashboard-BYcamnqr.js

js kolabo.co.id collected 2026-10-05 01:05:24 UTC 15,404 bytes, 1 lines download raw bytes

1import{w as L,aa as W,D as b,Q as p,u as $,j as e,m as Y,e as J,f as n,g as i,Y as y,F as I,l as M,T as O,I as m,J as h,B as _,n as U,K as j,q as D,O as X,cQ as V,cR as Z,bT as ee,ai as se,v as F}from"./index-CxTzo_i5.js";import{u as ae}from"./use-socmed-contents-zY83vss0.js";import{u as te}from"./useQuery-BujisQX_.js";import{u as q}from"./useMutation-nYJy1ouO.js";import{A as v}from"./animated-counter-DooJslZW.js";import{F as x}from"./fade-in-CuY8YHK5.js";import{S as N}from"./stagger-list-BxqUgk-D.js";import{S as w}from"./sparkline-DVm0GDvH.js";import{H as C}from"./hover-card-3d-CpUkPLe-.js";import{G as re}from"./gradient-text-CRbrcK7y.js";import{R as le}from"./reveal-on-scroll-D57ZBaCT.js";import{F as ne}from"./floating-particles-DCMp4rdB.js";import{C as ie}from"./cyber-grid-D-aVvX7o.js";import{R as B,T as K,C as E,B as oe}from"./generateCategoricalChart-I8otIP11.js";import{A as ce,a as G}from"./AreaChart-AKPbz3Cu.js";import{C as Q}from"./CartesianGrid--5oP9_oo.js";import{X as H,Y as z}from"./YAxis-Bgv3PCMe.js";import{P as de,a as me}from"./PieChart-DMcW0I7J.js";import{B as he}from"./BarChart-Dl5CdQ90.js";import"./PolarAngleAxis-CRWV0Vkv.js";function xe(){const{currentBrand:c}=L(),l=c==null?void 0:c.id,r=W(),{data:t,isLoading:P,error:u,refetch:f}=te({queryKey:["content_plans",l],queryFn:async()=>{let a=b.from("content_plans").select("*").order("created_at",{ascending:!1});l&&(a=a.eq("brand_id",l));const{data:o,error:d}=await a;if(d)throw d;return o},enabled:!!l,staleTime:2*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1}),g=q({mutationFn:async a=>{const{data:o,error:d}=await b.from("content_plans").insert({...a,brand_id:l}).select().single();if(d)throw d;return o},onSuccess:()=>{r.invalidateQueries({queryKey:["content_plans",l]}),p.success("Content Plan berhasil dibuat")},onError:a=>{console.error("Error creating plan:",a),p.error("Gagal membuat Content Plan")}}),T=q({mutationFn:async({id:a,...o})=>{const{data:d,error:A}=await b.from("content_plans").update(o).eq("id",a).select().single();if(A)throw A;return d},onSuccess:()=>{r.invalidateQueries({queryKey:["content_plans",l]}),p.success("Content Plan berhasil diupdate")},onError:a=>{console.error("Error updating plan:",a),p.error("Gagal mengupdate Content Plan")}}),S=q({mutationFn:async a=>{const{error:o}=await b.from("content_plans").delete().eq("id",a);if(o)throw o},onSuccess:()=>{r.invalidateQueries({queryKey:["content_plans",l]}),p.success("Content Plan berhasil dihapus")},onError:a=>{console.error("Error deleting plan:",a),p.error("Gagal menghapus Content Plan")}}),s={total:(t==null?void 0:t.length)??0,planning:(t==null?void 0:t.filter(a=>a.status==="Planning").length)??0,inProgress:(t==null?void 0:t.filter(a=>a.status==="In Progress").length)??0,completed:(t==null?void 0:t.filter(a=>a.status==="Completed").length)??0};return{plans:t??[],isLoading:P,error:u,refetch:f,createPlan:g,updatePlan:T,deletePlan:S,stats:s}}const k=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))"],R={TikTok:"🎵",Instagram:"📸",Twitter:"🐦",Facebook:"👤"},ue={TikTok:"from-pink-500/20 to-pink-600/5",Instagram:"from-purple-500/20 to-purple-600/5",Twitter:"from-blue-400/20 to-blue-500/5",Facebook:"from-blue-600/20 to-blue-700/5"};function Re(){const c=$(),{contents:l,stats:r}=ae(),{plans:t,stats:P}=xe(),u=[{name:"TikTok",value:r.byPlatform.TikTok},{name:"Instagram",value:r.byPlatform.Instagram},{name:"Twitter",value:r.byPlatform.Twitter},{name:"Facebook",value:r.byPlatform.Facebook}].filter(s=>s.value>0),f=[{name:"Draft",value:r.draft,color:"hsl(var(--muted-foreground))"},{name:"Scheduled",value:r.scheduled,color:"hsl(var(--chart-1))"},{name:"Published",value:r.published,color:"hsl(var(--chart-2))"}].filter(s=>s.value>0),g=l.filter(s=>s.scheduled_at&&new Date(s.scheduled_at)>new Date).sort((s,a)=>new Date(s.scheduled_at).getTime()-new Date(a.scheduled_at).getTime()).slice(0,5),T=[{day:"Sen",posts:3,engagement:4.2},{day:"Sel",posts:5,engagement:5.1},{day:"Rab",posts:2,engagement:3.8},{day:"Kam",posts:7,engagement:6.2},{day:"Jum",posts:4,engagement:4.9},{day:"Sab",posts:8,engagement:7.1},{day:"Min",posts:6,engagement:5.8}],S=[{icon:Z,label:"Content Studio",path:"/socmed/studio",color:"text-pink-500"},{icon:y,label:"Calendar",path:"/socmed/calendar",color:"text-blue-500"},{icon:ee,label:"Hashtags",path:"/socmed/hashtags",color:"text-purple-500"},{icon:se,label:"Queue",path:"/socmed/queue",color:"text-orange-500"}];return e.jsxs("div",{className:"space-y-6 relative",children:[e.jsxs("div",{className:"fixed inset-0 pointer-events-none overflow-hidden -z-10",children:[e.jsx(ie,{className:"opacity-20",animated:!0}),e.jsx(ne,{particleCount:25,className:"opacity-20"})]}),e.jsx(le,{children:e.jsxs("div",{className:"relative overflow-hidden rounded-3xl p-8 bg-gradient-to-br from-brand/15 via-brand-bright/5 to-background border border-border/50",children:[e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-gradient-to-br from-brand/20 to-transparent roun
1ded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),e.jsx("div",{className:"relative z-10",children:e.jsxs(Y.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(J,{className:"h-5 w-5 text-purple-500 animate-pulse"}),e.jsx("span",{className:"text-sm font-medium text-purple-500",children:"Social Media Hub"})]}),e.jsx("h1",{className:"text-3xl sm:text-4xl font-bold mb-2",children:e.jsx(re,{variant:"secondary",children:"Socmed Dashboard"})}),e.jsx("p",{className:"text-muted-foreground",children:"Overview manajemen social media"})]})})]})}),e.jsxs(N,{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(C,{children:e.jsx(n,{className:"border-0 bg-gradient-to-br from-orange-500/10 to-orange-600/5",children:e.jsxs(i,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/20 flex items-center justify-center",children:e.jsx(y,{className:"h-5 w-5 text-orange-500"})}),e.jsx(w,{data:[2,4,3,5,7,6,8],color:"hsl(var(--chart-1))",height:30,width:60})]}),e.jsx("p",{className:"text-3xl font-bold text-orange-500",children:e.jsx(v,{value:r.scheduled})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Scheduled Posts"})]})})}),e.jsx(C,{children:e.jsx(n,{className:"border-0 bg-gradient-to-br from-blue-500/10 to-blue-600/5",children:e.jsxs(i,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(I,{className:"h-5 w-5 text-blue-500"})}),e.jsx(w,{data:[5,3,6,4,7,5,4],color:"hsl(var(--chart-2))",height:30,width:60})]}),e.jsx("p",{className:"text-3xl font-bold text-blue-500",children:e.jsx(v,{value:r.draft})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Draft Content"})]})})}),e.jsx(C,{children:e.jsx(n,{className:"border-0 bg-gradient-to-br from-green-500/10 to-green-600/5",children:e.jsxs(i,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-green-500/20 flex items-center justify-center",children:e.jsx(M,{className:"h-5 w-5 text-green-500"})}),e.jsx(w,{data:[10,12,15,14,18,20,22],color:"hsl(var(--chart-3))",height:30,width:60})]}),e.jsx("p",{className:"text-3xl font-bold text-green-500",children:e.jsx(v,{value:r.published})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Published"})]})})}),e.jsx(C,{children:e.jsx(n,{className:"border-0 bg-gradient-to-br from-purple-500/10 to-purple-600/5",children:e.jsxs(i,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-purple-500/20 flex items-center justify-center",children:e.jsx(O,{className:"h-5 w-5 text-purple-500"})}),e.jsx(w,{data:[1,2,2,3,4,3,5],color:"hsl(var(--chart-4))",height:30,width:60})]}),e.jsx("p",{className:"text-3xl font-bold text-purple-500",children:e.jsx(v,{value:P.total})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Content Plans"})]})})})]}),e.jsx(x,{delay:.2,children:e.jsxs(n,{children:[e.jsx(m,{className:"pb-3",children:e.jsx(h,{className:"text-lg",children:"Quick Actions"})}),e.jsx(i,{children:e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:S.map(s=>e.jsxs(_,{variant:"outline",className:"h-auto py-4 flex flex-col items-center gap-2 hover:bg-muted",onClick:()=>c(s.path),children:[e.jsx(s.icon,{className:`h-6 w-6 ${s.color}`}),e.jsx("span",{className:"text-sm",children:s.label})]},s.path))})})]})}),e.jsx(x,{delay:.3,children:e.jsxs(n,{children:[e.jsxs(m,{children:[e.jsxs(h,{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-5 w-5"}),"Weekly Activity"]}),e.jsx(j,{children:"Posts dan engagement minggu ini"})]}),e.jsx(i,{children:e.jsx(B,{width:"100%",height:250,children:e.jsxs(ce,{data:T,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"colorPosts",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",
1stopColor:"hsl(var(--chart-1))",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"hsl(var(--chart-1))",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorEngagement",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"hsl(var(--chart-2))",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"hsl(var(--chart-2))",stopOpacity:0})]})]}),e.jsx(Q,{strokeDasharray:"3 3",className:"stroke-border"}),e.jsx(H,{dataKey:"day",className:"text-xs"}),e.jsx(z,{className:"text-xs"}),e.jsx(K,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"8px"}}),e.jsx(G,{type:"monotone",dataKey:"posts",stroke:"hsl(var(--chart-1))",fillOpacity:1,fill:"url(#colorPosts)",strokeWidth:2}),e.jsx(G,{type:"monotone",dataKey:"engagement",stroke:"hsl(var(--chart-2))",fillOpacity:1,fill:"url(#colorEngagement)",strokeWidth:2})]})})})]})}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsx(x,{delay:.4,children:e.jsxs(n,{className:"h-full",children:[e.jsxs(m,{children:[e.jsxs(h,{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-5 w-5"}),"Upcoming Posts"]}),e.jsx(j,{children:"Posts scheduled for this week"})]}),e.jsx(i,{children:g.length>0?e.jsx(N,{className:"space-y-3",children:g.map(s=>e.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-lg bg-gradient-to-r ${ue[s.platform||""]||"from-muted/50 to-muted/30"}`,children:[e.jsx("span",{className:"text-lg",children:R[s.platform||""]||"📱"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.scheduled_at&&D(new Date(s.scheduled_at),"dd MMM, HH:mm",{locale:F})})]}),e.jsx(X,{variant:"secondary",className:"text-xs",children:s.status})]},s.id))}):e.jsxs("div",{className:"h-[200px] flex flex-col items-center justify-center text-muted-foreground gap-3",children:[e.jsx(y,{className:"h-10 w-10 opacity-50"}),e.jsx("p",{children:"Belum ada post terjadwal"}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>c("/socmed/studio"),children:"Buat Konten"})]})})]})}),e.jsx(x,{delay:.5,children:e.jsxs(n,{className:"h-full",children:[e.jsxs(m,{children:[e.jsxs(h,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-5 w-5"}),"Recent Content"]}),e.jsx(j,{children:"Latest published content"})]}),e.jsx(i,{children:l.filter(s=>s.status==="Published").length>0?e.jsx(N,{className:"space-y-3",children:l.filter(s=>s.status==="Published").slice(0,5).map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[e.jsx("span",{className:"text-lg",children:R[s.platform||""]||"📱"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.platform})]})]},s.id))}):e.jsxs("div",{className:"h-[200px] flex flex-col items-center justify-center text-muted-foreground gap-3",children:[e.jsx(M,{className:"h-10 w-10 opacity-50"}),e.jsx("p",{children:"Belum ada konten terpublish"})]})})]})}),e.jsx(x,{delay:.6,children:e.jsxs(n,{className:"h-full",children:[e.jsxs(m,{children:[e.jsxs(h,{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-5 w-5"}),"Active Plans"]}),e.jsx(j,{children:"Content plans in progress"})]}),e.jsx(i,{children:t.filter(s=>s.status==="In Progress").length>0?e.jsx(N,{className:"space-y-3",children:t.filter(s=>s.status==="In Progress").slice(0,5).map(s=>e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[e.jsx("p",{className:"font-medium",children:s.title}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.start_date&&D(new Date(s.start_date),"dd MMM",{locale:F})," -",s.end_date&&D(new Date(s.end_date),"dd MMM yyyy",{locale:F})]})]},s.id))}):e.jsxs("div",{className:"h-[200px] flex flex-col items-center justify-center text-muted-foreground gap-3",children:[e.jsx(I,{className:"h-10 w-10 opacity-50"}),e.jsx("p",{children:"Belum ada plan aktif"}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>c("/socmed/plan"),children:"Buat Plan"})]})})]})})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsx(x,{delay:.7,children:e.jsxs(n,{children:[e.jsxs(m,{children:[e.jsx(h,{children:"Content by Platform"}),e.jsx(j,{children:"Distribution across platforms"})]}),e.jsx(i,{children:u.length>0?e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(B,{width:"50%",height:200,children:e.jsxs(de,{children:[e.jsx(me,{data:u,cx:"50%",cy:"50%",innerRadius:40,outerRadius:70,paddingAngle:5,dataKey:"value",children:u.map((s,a)=>e.jsx(E,{fill:k[a%k.length]},`cell-${a}`))}),e.jsx(K,{})]})}),e.jsx("div",{className:"flex-1 space-y-3",children:u.map((s,a)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:k[a%k.length]}}),e.jsxs("span",{className:"text-sm flex items-center gap-1",children:[R[s.name]," ",s.name]})]}),e.jsx("span",{className:"font-semibold",children:s.value})]},s.name))})]}):e.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted-foreground",children:"Tambahkan konten untuk melihat chart"})})]})}),e.jsx(x,{delay:.8,children:e.jsxs(n,{children:[e.jsxs(m,{children:[e.jsx(h,{children:"Content Status"}),e.jsx(j,{children:"Content by status"})]}),e.jsx(i,{children:f.length>0?e.jsx(B,{width:"100%",height:200,children:e.jsxs(he,{data:f,children:[e.jsx(Q,{strokeDasharray:"3 3",className:"stroke-border"}),e.jsx(H,{dataKey:"name",className:"text-xs"}),e.jsx(z,{className:"text-xs"}),e.jsx(K,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"8px"}}),e.jsx(oe,{dataKey:"value",radius:[4,4,0,0],children:f.map((s,a)=>e.jsx(E,{fill:s.color},`cell-${a}`))})]})}):e.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted-foreground",children:"Tambahkan konten untuk melihat chart"})})]})})]})]})}export{Re 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.