PageSourceSearch

https://gobytv.com/assets/AdminDashboard-DgIa9z9l.js

js gobytv.com collected 2026-10-05 19:23:53 UTC 16,100 bytes, 1 lines download raw bytes

1import{k as W,r as Z,a as f,l as ee,F as se,j as e,g as i,B as c,x as d,y as v,z as w,e as te,D as o,M as ae,an as le,n as ne,a6 as ie,a7 as re,a8 as ce,a9 as de,t as oe,h as u}from"./index-C4LWZPK9.js";import{E as xe}from"./eye-BuNnJwN2.js";import{M as H}from"./megaphone-DPCoeefa.js";import{T as me}from"./trending-up-B3ptUmW-.js";import{U as he}from"./users-DL5nkPsl.js";import{C as ue}from"./chart-column-CBt9MBM2.js";import{P as je}from"./plus-Nk5sUbpA.js";import{R as x,P as p,a as g,C as y,T as m,B as R,b as D,X as z,Y as T,c as K}from"./PieChart-BAs6tSg3.js";import"./tiny-invariant-BaFNuDhB.js";const a=["hsl(25,95%,53%)","hsl(172,66%,50%)","hsl(38,92%,50%)","hsl(340,82%,52%)","hsl(200,98%,39%)","hsl(262,83%,58%)"];function Se(){const X=W(),[n,q]=Z.useState(null),{data:Y=[]}=f({queryKey:["app-settings"],queryFn:()=>u.entities.AppSettings.filter({key:"global"})}),l=Y[0],M=ee({mutationFn:s=>u.entities.AppSettings.update(l.id,s),onSuccess:()=>{X.invalidateQueries({queryKey:["app-settings"]}),oe.success("Setting updated")}}),{data:r=[]}=f({queryKey:["admin-content"],queryFn:()=>u.entities.VideoContent.list("-created_date",200)}),{data:b=[]}=f({queryKey:["admin-ads"],queryFn:()=>u.entities.AdCampaign.list("-created_date",100)}),{data:k=[]}=f({queryKey:["admin-impressions"],queryFn:()=>u.entities.AdImpression.list("-created_date",500)}),{data:S=[]}=f({queryKey:["admin-subs"],queryFn:()=>u.entities.Subscription.list("-created_date",200)}),F=r.reduce((s,t)=>s+(t.view_count||0),0),I=b.filter(s=>s.status==="active").length,h=k.length,C=k.filter(s=>s.clicked).length,_=h>0?(C/h*100).toFixed(1):0,B=S.filter(s=>s.status==="active").length,G=[{key:"totalContent",label:"Total Content",value:r.length,icon:se,color:"text-primary"},{key:"totalViews",label:"Total Views",value:F.toLocaleString(),icon:xe,color:"text-accent"},{key:"activeAds",label:"Active Ads",value:I,icon:H,color:"text-chart-4"},{key:"adCTR",label:"Ad CTR",value:`${_}%`,icon:me,color:"text-chart-3"},{key:"subscribers",label:"Subscribers",value:B,icon:he,color:"text-chart-5"},{key:"adImpressions",label:"Ad Impressions",value:h,icon:ue,color:"text-chart-2"}],N=Object.entries(r.reduce((s,t)=>{var $;return(($=t.categories)!=null&&$.length?t.categories:["uncategorized"]).forEach(Q=>{s[Q]=(s[Q]||0)+1}),s},{})).map(([s,t])=>({name:s.replace(/_/g," "),value:t})),A=Object.entries(k.reduce((s,t)=>{const j=t.ad_type||"unknown";return s[j]=(s[j]||0)+1,s},{})).map(([s,t])=>({name:s.replace(/_/g," "),value:t})),O=Object.entries(r.reduce((s,t)=>(s[t.status||"unknown"]=(s[t.status||"unknown"]||0)+1,s),{})).map(([s,t])=>({name:s.replace(/_/g," "),value:t})),P=Object.entries(r.reduce((s,t)=>(s[t.access_tier||"unknown"]=(s[t.access_tier||"unknown"]||0)+1,s),{})).map(([s,t])=>({name:s.replace(/_/g," "),value:t})),V=[...r].sort((s,t)=>(t.view_count||0)-(s.view_count||0)).slice(0,10).map(s=>{var t;return{name:((t=s.title)==null?void 0:t.substring(0,25))||"Untitled",views:s.view_count||0}}),L=Object.entries(b.reduce((s,t)=>(s[t.status||"unknown"]=(s[t.status||"unknown"]||0)+1,s),{})).map(([s,t])=>({name:s.replace(/_/g," "),value:t})),E=Object.entries(S.reduce((s,t)=>(s[t.plan||"unknown"]=(s[t.plan||"unknown"]||0)+1,s),{})).map(([s,t])=>({name:s.replace(/_/g," "),value:t})),U=[...A],J=()=>{if(!n)return null;switch(n.key){case"totalContent":return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.length," total content items across all categories and statuses."]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"By Status"}),e.jsx(x,{width:"100%",height:220,children:e.jsxs(p,{children:[e.jsx(g,{data:O,cx:"50%",cy:"50%",innerRadius:45,outerRadius:80,dataKey:"value",children:O.map((s,t)=>e.jsx(y,{fill:a[t%a.length]},t))}),e.jsx(m,{contentStyle:{background:"hsl(222,47%,9%)",border:"1px solid hsl(222,30%,18%)",borderRadius:"8px",color:"#f0f4f8"},itemStyle:{color:"#f0f4f8"},labelStyle:{color:"#f0f4f8"}})]})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"By A
1ccess Tier"}),e.jsx(x,{width:"100%",height:220,children:e.jsxs(p,{children:[e.jsx(g,{data:P,cx:"50%",cy:"50%",innerRadius:45,outerRadius:80,dataKey:"value",children:P.map((s,t)=>e.jsx(y,{fill:a[t%a.length]},t))}),e.jsx(m,{contentStyle:{background:"hsl(222,47%,9%)",border:"1px solid hsl(222,30%,18%)",borderRadius:"8px",color:"#f0f4f8"},itemStyle:{color:"#f0f4f8"},labelStyle:{color:"#f0f4f8"}})]})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(i,{to:"/admin/content",children:e.jsx(c,{variant:"outline",size:"sm",children:"Manage Content"})})})]});case"totalViews":return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[F.toLocaleString()," total views across all content."]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"Top 10 Most Viewed"}),V.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-8 text-center",children:"No view data available yet."}):e.jsx(x,{width:"100%",height:300,children:e.jsxs(R,{data:V,layout:"vertical",margin:{left:100},children:[e.jsx(D,{strokeDasharray:"3 3",stroke:"hsl(222,30%,18%)"}),e.jsx(z,{type:"number",tick:{fill:"hsl(215,20%,55%)",fontSize:11}}),e.jsx(T,{type:"category",dataKey:"name",tick:{fill:"hsl(215,20%,55%)",fontSize:11},width:100}),e.jsx(m,{contentStyle:{background:"hsl(222,47%,9%)",border:"1px solid hsl(222,30%,18%)",borderRadius:"8px",color:"#f0f4f8"},itemStyle:{color:"#f0f4f8"},labelStyle:{color:"#f0f4f8"}}),e.jsx(K,{dataKey:"views",fill:"hsl(25,95%,53%)",radius:[0,4,4,0]})]})})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(i,{to:"/admin/content",children:e.jsx(c,{variant:"outline",size:"sm",children:"Manage Content"})})})]});case"activeAds":return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[I," active campaigns out of ",b.length," total."]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"Campaign Status"}),e.jsx(x,{width:"100%",height:220,children:e.jsxs(p,{children:[e.jsx(g,{data:L,cx:"50%",cy:"50%",innerRadius:45,outerRadius:80,dataKey:"value",children:L.map((s,t)=>e.jsx(y,{fill:a[t%a.length]},t))}),e.jsx(m,{contentStyle:{background:"hsl(222,47%,9%)",border:"1px solid hsl(222,30%,18%)",borderRadius:"8px",color:"#f0f4f8"},itemStyle:{color:"#f0f4f8"},labelStyle:{color:"#f0f4f8"}})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"Active Campaigns"}),b.filter(s=>s.status==="active").slice(0,6).map(s=>e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-secondary/30",children:[e.jsx("span",{className:"text-sm truncate flex-1",children:s.name}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0 ml-2",children:s.advertiser})]},s.id))]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(i,{to:"/admin/ads",children:e.jsx(c,{variant:"outline",size:"sm",children:"Manage Ads"})})})]});case"adCTR":return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[_,"% click-through rate — ",C," clicks from ",h," impressions."]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[e.jsx(d,{className:"bg-secondary/30",children:e.jsxs(o,{className:"p-4",children:[e.jsx("p",{className:"text-2xl font-bold text-primary",children:h}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Impressions"})]})}),e.jsx(d,{className:"bg-secondary/30",children:e.jsxs(o,{className:"p-4",children:[e.jsx("p",{className:"text-2xl font-bold text-accent",children:C}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Clicks"})]})}),e.jsx(d,{className:"bg-secondary/30",children:e.jsxs(o,{className:"p-4",children:[e.jsxs("p",{className:"text-2xl font-bold text-chart-3",children:[_,"%"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"CTR"})]})})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(i,{to:"/admin/ads",children:e.jsx(c,{variant:"outline",size:"sm",children:"Manage Ads"})})})]});case"subscribers":return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[B," active subscribers out of ",S.length," total."]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"By Plan"}),e.jsx(x,{width:"100%",height:250,children:e.jsxs(p,{children:[e.jsx(g,{data:E,cx:"50%",cy:"50%",innerRadius:55,outerRadius:100,dataKey:"value",children:E.map((s,t)=>e.jsx(y,{fill:a[t%a.length]},t))}),e.jsx(m,{contentStyle:{background:"hsl(222,47%,9%)",border:"1px solid hsl(222,30%,18%)",borderRadius:"8px",color:"#f0f4f8"},itemStyle:{color:"#f0f4f8"},labelStyle:{color:"#f0f4f8"}})]})})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(i,{to:"/admin/users",children:e.jsx(c,{variant:"outline",size:"sm",children:"Manage Users"})})})]});case"adImpressions":return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[h," total ad impressions recorded."]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"Impressions by Ad Type"}),U.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-8 text-center",children:"No impression data recorded yet."}):e.jsx(x,{width:"100%",height:250,children:e.jsxs(R,{data:U,children:[e.jsx(D,{strokeDasharray:"3 3",stroke:"hsl(222,30%,18%)"}),e.jsx(z,{dataKey:"name",tick:{fill:"hsl(215,20%,55%)",fontSize:12}}
1),e.jsx(T,{tick:{fill:"hsl(215,20%,55%)",fontSize:12}}),e.jsx(m,{contentStyle:{background:"hsl(222,47%,9%)",border:"1px solid hsl(222,30%,18%)",borderRadius:"8px",color:"#f0f4f8"},itemStyle:{color:"#f0f4f8"},labelStyle:{color:"#f0f4f8"}}),e.jsx(K,{dataKey:"value",fill:"hsl(262,83%,58%)",radius:[4,4,0,0]})]})})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(i,{to:"/admin/ads",children:e.jsx(c,{variant:"outline",size:"sm",children:"Manage Ads"})})})]});default:return null}};return e.jsxs("div",{className:"pb-12 max-w-[1440px] mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsx("h1",{className:"text-3xl font-display font-bold",children:"Admin Dashboard"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(i,{to:"/admin/content",children:e.jsxs(c,{className:"gap-2 bg-primary hover:bg-primary/90",size:"sm",children:[e.jsx(je,{className:"w-4 h-4"})," Add Content"]})}),e.jsx(i,{to:"/admin/ads",children:e.jsxs(c,{variant:"outline",className:"gap-2",size:"sm",children:[e.jsx(H,{className:"w-4 h-4"})," Manage Ads"]})})]})]}),e.jsxs(d,{className:"bg-secondary/30 border-border mb-8",children:[e.jsx(v,{className:"pb-3",children:e.jsxs(w,{className:"text-base font-display flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4 text-primary"})," Feature Flags"]})}),e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(ae,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold",children:"Speak to the Artist"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Deep Diver messaging feature in the Artist section"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("span",{className:`text-xs font-medium ${l!=null&&l.artist_messaging_enabled?"text-accent":"text-muted-foreground"}`,children:l!=null&&l.artist_messaging_enabled?"Live":"Coming Soon"}),e.jsx(le,{checked:!!(l!=null&&l.artist_messaging_enabled),onCheckedChange:s=>M.mutate({artist_messaging_enabled:s}),disabled:!l||M.isPending})]})]})})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-8",children:G.map((s,t)=>{const j=s.icon;return e.jsx(ne.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.05},children:e.jsx(d,{className:"bg-secondary/50 hover:bg-secondary/70 hover:border-primary/30 transition-all cursor-pointer",onClick:()=>q(s),children:e.jsxs(o,{className:"p-4",children:[e.jsx(j,{className:`w-5 h-5 ${s.color} mb-2`}),e.jsx("p",{className:"text-2xl font-bold",children:s.value}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.label})]})})},s.key)})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(d,{className:"bg-secondary/30",children:[e.jsx(v,{children:e.jsx(w,{className:"text-lg font-display",children:"Content by Category"})}),e.jsx(o,{children:N.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"No category data yet."}):e.jsxs(e.Fragment,{children:[e.jsx(x,{width:"100%",height:220,children:e.jsxs(p,{children:[e.jsx(g,{data:N,cx:"50%",cy:"50%",innerRadius:55,outerRadius:85,dataKey:"value",children:N.map((s,t)=>e.jsx(y,{fill:a[t%a.length]},t))}),e.jsx(m,{contentStyle:{background:"hsl(222,47%,9%)",border:"1px solid hsl(222,30%,18%)",borderRadius:"8px",color:"#f0f4f8"},itemStyle:{color:"#f0f4f8"},labelStyle:{color:"#f0f4f8"}})]})}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center mt-2",children:N.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-foreground",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{background:a[t%a.length]}}),e.jsxs("span",{className:"capitalize",children:[s.name," (",s.value,")"]})]},s.name))})]})})]}),e.jsxs(d,{className:"bg-secondary/30",children:[e.jsx(v,{children:e.jsx(w,{className:"text-lg font-display",children:"Ad Impressions by Type"})}),e.jsx(o,{children:A.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"No ad impressions recorded yet."}):e.jsx(x,{width:"100%",height:250,children:e.jsxs(R,{data:A,children:[e.jsx(D,{strokeDasharray:"3 3",stroke:"hsl(222,30%,18%)"}),e.jsx(z,{dataKey:"name",tick:{fill:"hsl(215,20%,55%)",fontSize:12}}
1),e.jsx(T,{tick:{fill:"hsl(215,20%,55%)",fontSize:12}}),e.jsx(m,{contentStyle:{background:"hsl(222,47%,9%)",border:"1px solid hsl(222,30%,18%)",borderRadius:"8px"}}),e.jsx(K,{dataKey:"value",fill:"hsl(262,83%,58%)",radius:[4,4,0,0]})]})})})]})]}),e.jsxs(d,{className:"bg-secondary/30 mt-6",children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(w,{className:"text-lg font-display",children:"Recent Content"}),e.jsx(i,{to:"/admin/content",className:"text-sm text-primary",children:"View All"})]})}),e.jsx(o,{children:e.jsx("div",{className:"space-y-2",children:r.slice(0,5).map(s=>{var t;return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-secondary/50 transition-colors",children:[e.jsx("img",{src:s.thumbnail_url||"https://images.unsplash.com/photo-1485846234645-a62644f84728?w=100&q=60",alt:s.title,className:"w-16 h-9 object-cover rounded"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e.jsxs("p",{className:"text-xs text-muted-foreground capitalize",children:[(((t=s.categories)==null?void 0:t[0])||"uncategorized").replace(/_/g," ")," · ",s.status]})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[(s.view_count||0).toLocaleString()," views"]})]},s.id)})})})]}),e.jsx(ie,{open:!!n,onOpenChange:s=>!s&&q(null),children:e.jsxs(re,{className:"max-w-2xl max-h-[85vh] overflow-y-auto bg-card text-foreground",children:[e.jsx(ce,{children:e.jsxs(de,{className:"font-display flex items-center gap-2 text-foreground",children:[n&&(()=>{const s=n.icon;return e.jsx(s,{className:`w-5 h-5 ${n.color}`})})(),n==null?void 0:n.label," Breakdown"]})}),J()]})})]})}export{Se 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.