PageSourceSearch

https://tashghil.pro/assets/AdminInsights-l5WFuMUG.js

js tashghil.pro collected 2026-10-02 02:07:35 UTC 6,417 bytes, 1 lines download raw bytes

1import{r as o,j as s}from"./react-vendor-mIvIP5bw.js";import{b8 as D}from"./vendor-CwbV_EoR.js";import{u as k,B as b,S as f,s as A}from"./index-BNNjvvkY.js";import{N as B}from"./Navbar-B409_3UI.js";import{S as z}from"./SEOHead-mgaf3-Wj.js";import{C as i}from"./card-I4Qj7J0i.js";import{B as K}from"./badge-DxoYb6uu.js";import{U as g,ab as E,aY as N,bf as L,ah as O,at as R}from"./icons-BbelcMSy.js";import{R as c,A as v,C as d,X as m,Y as x,T as u,b as y,B as T,a as G}from"./charts-Cq0rOvYH.js";import"./radix-Cfqx8M61.js";import"./supabase-DUCUMZUh.js";import"./motion-CxH9hQy0.js";import"./i18n-BrnJ0axY.js";import"./quranreels-mark-BLWlrgS6.js";const n="hsl(45 85% 48%)";function ss(){const{toast:w}=k(),[a,_]=o.useState(null),[h,p]=o.useState(!0),j=async()=>{p(!0);const{data:e,error:l}=await A.rpc("admin_insights");l?w({title:"تعذّر التحميل",description:l.message,variant:"destructive"}):_(e),p(!1)};o.useEffect(()=>{j()},[]);const C=o.useMemo(()=>{const e=new Map((a?.hourly??[]).map(l=>[Number(l.hr),Number(l.cnt)]));return Array.from({length:24},(l,r)=>({hour:`${r}:00`,count:e.get(r)??0}))},[a]),t=a?.totals??{},S=[{icon:g,label:"إجمالي المستخدمين",value:t.users,sub:`+${t.users_7d??0} آخر 7 أيام`},{icon:g,label:"نشطون (7 أيام)",value:t.active_7d,sub:"قاموا بعملية واحدة على الأقل"},{icon:E,label:"إجمالي الريلز",value:t.reels,sub:`+${t.reels_7d??0} آخر 7 أيام`},{icon:N,label:"كريدت مستهلك",value:t.credits_spent,sub:`+${t.credits_spent_7d??0} آخر 7 أيام`},{icon:N,label:"كريدت مشترى (كل الوقت)",value:t.purchased_credits,sub:`${t.orders_pending??0} طلب قيد المراجعة`},{icon:L,label:"الإيرادات المؤكدة",value:t.revenue_usd,sub:"دولار — طلبات معتمدة",money:!0}],$=a?[{title:"أشهر 10 آيات",rows:a.top_ayahs.map(e=>({label:`${e.surah} — ${e.ayah}`,value:Number(e.cnt)}))},{title:"أشهر 10 قرّاء",rows:a.top_reciters.map(e=>({label:e.reciter,value:Number(e.cnt)}))},{title:"أشهر 10 خلفيات",rows:a.top_backgrounds.map(e=>({label:e.background,value:Number(e.cnt)}))},{title:"أكثر 10 مستخدمين نشاطاً",rows:a.top_users.map(e=>({label:e.email,value:Number(e.cnt)}))},{title:"أكثر الميزات استخداماً",rows:a.features.map(e=>({label:e.feature,value:Number(e.cnt)}))}]:[];return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(z,{title:"المؤشرات | لوحة الإدارة",description:"مؤشرات ورؤى استخدام المنصة."}),s.jsx(B,{}),s.jsxs("main",{className:"container mx-auto max-w-6xl px-4 pt-24 pb-16",dir:"rtl",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl font-black flex items-center gap-2",children:[s.jsx(O,{className:"w-6 h-6 text-gold"})," المؤشرات والرؤى"]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"صورة كاملة عن استخدام المنصة والكريدت والإيرادات."})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(b,{variant:"outline",onClick:j,className:"rounded-full gap-1.5",children:[s.jsx(R,{className:"w-4 h-4"})," تحديث"]}),s.jsx(b,{asChild:!0,variant:"outline",className:"rounded-full",children:s.jsx(D,{to:"/admin/users",children:"العملاء"})})]})]}),h&&s.jsxs("div",{className:"mt-6 space-y-3",children:[s.jsx(f,{className:"h-28 w-full"}),s.jsx(f,{className:"h-72 w-full"})]}),!h&&a&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mt-5 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:S.map(e=>s.jsxs(i,{className:"p-4 bg-card/60",children:[s.jsx(e.icon,{className:"w-4 h-4 text-gold"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e.label}),s.jsx("p",{className:"text-2xl font-black text-gold",children:e.money?`$${Number(e.value??0).toFixed(2)}`:Number(e.value??0).toLocaleString("ar-EG")}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:e.sub})]},e.label))}),s.jsxs("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:[s.jsxs(i,{className:"p-4 bg-card/60",children:[s.jsx("p",{className:"text-sm font-bold mb-3",children:"الريلز اليومية (آخر 30 يوم)"}),s.jsx("div",{className:"h-64",dir:"ltr",children:s.jsx(c,{width:"100%",height:"100%",children:s.jsxs(v,{data:a.daily,children:[s.jsx(d,{strokeDasharray:"3 3",opacity:.15}),s.jsx(m,{dataKey:"day",fontSize:10}),s.jsx(x,{fontSize:10,allowDecimals:!1}),s.jsx(u,{}),s.jsx(y,{type:"monotone",dataKey:"reels",stroke:n,fill:n,fillOpacity:.25})]})})})]}),s.jsxs(i,{className:"p-4 bg-card/60",children:[s.jsx("p",{className:"text-sm font-bold mb-3",children:"التسجيلات اليومية (آخر 30 يوم)"}),s.jsx("div",{className:"h-64",dir:"ltr",children:s.jsx(c,{width:"100%",height:"100%",children:s.jsxs(v,{data:a.signups_daily,children:[s.jsx(d,{strokeDasharray:"3 3",opacity:.15}),s.jsx(m,{dataKey:"day",fontSize:10}),s.jsx(x,{fontSize:10,allowDecimals:!1}),s.jsx(u,{}),s.jsx(y,{type:"monotone",dataKey:"users",stroke:n,fill:n,fillOpacity:.25})]})})})]})]}),s.jsxs(i,{className:"mt-3 p-4 bg-card/60",children:[s.jsx("p",{className:"text-sm font-bold mb-3",children:"أفضل أوقات الاستخدام (حسب الساعة، UTC)"}),s.jsx("div",{className:"h-64",dir:"ltr",children:s.jsx(c,{width:"100%",height:"100%",children:s.jsxs(T,{data:C,children:[s.jsx(d,{strokeDasharray:"3 3",opacity:.15}),s.jsx(m,{dataKey:"hour",fontSize:10,interval:2}),s.jsx(x,{fontSize:10,allowDecimals:!1}),s.jsx(u,{}),s.jsx(G,{dataKey:"count",fill:n,radius:[4,4,0,0]})]})})})]}),s.jsx("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:$.map(e=>s.jsxs(i,{className:"p-4 bg-card/60",children:[s.jsx("p",{className:"text-sm font-bold mb-3",children:e.title}),e.rows.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"لا توجد بيانات بعد."}),s.jsx("ol",{className:"space-y-1.5",children:e.rows.map((l,r)=>s.jsxs("li",{className:"flex items-center justify-between gap-2 text-xs",children:[s.jsxs("span",{className:"truncate",children:[s.jsxs("span",{className:"text-gold font-bold ml-1",children:[r+1,"."]})," ",l.label||"—"]}),s.jsx(K,{variant:"outline",children:l.value})]},`${l.label}-${r}`))})]},e.title))})]})]})]})}export{ss 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.