diff --git a/src/components/analytics/AcademyAnalyticsOverview.tsx b/src/components/analytics/AcademyAnalyticsOverview.tsx
new file mode 100644
index 0000000..d71e6a3
--- /dev/null
+++ b/src/components/analytics/AcademyAnalyticsOverview.tsx
@@ -0,0 +1,98 @@
+import { ArrowUpRight, BookOpen, CreditCard, Users } from "lucide-react"
+import { Link } from "react-router-dom"
+import { Area, Bar, BarChart, CartesianGrid, ComposedChart, Line, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"
+import type { ReactNode } from "react"
+import { SensitiveChart, SensitiveValue } from "../ui/sensitive-value"
+import { formatAnalyticsSeriesDate, formatRevenueAxisTick, getSubscriptionMetrics } from "../../lib/analytics"
+import type { DashboardData } from "../../types/analytics.types"
+
+const tooltipStyle = { background: "var(--analytics-panel)", border: "1px solid var(--analytics-line)", borderRadius: 4, color: "var(--gs-900)", fontSize: 12 }
+
+function Metric({ label, value, detail }: { label: string; value: ReactNode; detail: string }) {
+ return
+}
+
+export function AcademyAnalyticsOverview({ dashboard, periodLabel, revenuePoints, revenueLabel, monthly }: {
+ dashboard: DashboardData
+ periodLabel: string
+ revenuePoints: { revenue: number; month?: string; date?: string }[]
+ revenueLabel: string
+ monthly: boolean
+}) {
+ const { users, subscriptions, payments, courses, content } = dashboard
+ const metrics = getSubscriptionMetrics(subscriptions)
+ const active = subscriptions.snapshot?.active_learners ?? metrics.active
+ const expiring = subscriptions.snapshot?.expiring_within_7_days
+ const successRate = payments.total_payments > 0 ? payments.successful_payments / payments.total_payments * 100 : null
+ const activity = new Map()
+ for (const row of users.registrations_last_30_days) activity.set(row.date, { date: row.date, registrations: row.count, subscriptions: 0 })
+ for (const row of subscriptions.new_subscriptions_last_30_days) {
+ const current = activity.get(row.date) ?? { date: row.date, registrations: 0, subscriptions: 0 }
+ current.subscriptions = row.count; activity.set(row.date, current)
+ }
+ const activityData = [...activity.values()].sort((a, b) => a.date.localeCompare(b.date))
+ const catalogCount = courses.exam_prep?.catalog_courses ?? courses.total_courses
+ const lessonCount = courses.exam_prep?.lessons ?? courses.total_videos
+ return
+
+
+
+ {payments.total_revenue.toLocaleString()} ETB } detail="Successful payments in period" />
+
+
+
+
+
+
+
+
Academy pulse Current snapshot
+ Learners with active access
+ {active.toLocaleString()}
+ {expiring === undefined ? "Subscription access reflects the latest academy snapshot." : `${expiring.toLocaleString()} subscriptions expire within the next 7 days.`}
+
+
+
New learners today
{users.new_today.toLocaleString()}
+
New subscriptions today
{subscriptions.new_today.toLocaleString()}
+
+
+
+ Learner activity Registrations and new subscriptions / {periodLabel}
Registrations Subscriptions
+
+ {activityData.length ?
+
+
+
+
+
+ formatAnalyticsSeriesDate(String(label))} />
+
+
+
+ :
No learner activity in this period.
}
+
+
+
+
+
+ Revenue overview Successful payments / ETB / {revenueLabel}
{monthly ? "Monthly" : "Daily"}
+
+ {revenuePoints.some(point=>point.revenue>0) ?
+
+
+
+
+ [`ETB ${Number(value).toLocaleString()}`,"Revenue"]} />
+
+
+ : No revenue recorded in this period.
}
+
+
+
+ Academy at a glance Your teaching workspace
+
+ {[{label:"Makeup curriculum",detail:`${catalogCount.toLocaleString()} courses / ${lessonCount.toLocaleString()} lessons`,path:"/new-content/courses",icon:BookOpen},{label:"Learner community",detail:`${users.total_users.toLocaleString()} registered learners`,path:"/users/list",icon:Users},{label:"Payments",detail:`${payments.successful_payments.toLocaleString()} successful transactions`,path:"/payments",icon:CreditCard}].map(({label,detail,path,icon:Icon})=>
{label} {detail} )}
+
+
+
+
+}
diff --git a/src/index.css b/src/index.css
index cef4158..4877fb0 100644
--- a/src/index.css
+++ b/src/index.css
@@ -936,3 +936,36 @@
@media (min-width: 1600px) { .academy-login-brand { padding-left: 28%; } }
@media (max-width: 1023px) { .academy-login { grid-template-columns: 1fr; } .academy-login-art { display: none; } .academy-login-panel { min-height: 100dvh; padding: 48px 24px; } }
@media (max-width: 359px) { .academy-login-panel { padding: 32px 20px; } }
+
+/* Analytics workspace: compact metrics, restrained panels and readable chart accents. */
+.academy-analytics { --analytics-panel: #fff; --analytics-line: #eceef3; color: var(--gs-900); }
+.academy-analytics .analytics-page-heading h1 { font-family: "DM Sans", sans-serif; font-size: 24px; font-weight: 500; }
+.analytics-tabs { padding: 0 0 2px; }
+.analytics-tabs + .space-y-5 { padding-top: 4px; }
+.analytics-metric-strip { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); padding: 22px 0; border-bottom: 1px solid var(--analytics-line); }
+.analytics-strip-metric { min-width: 0; padding: 0 18px; border-right: 1px solid var(--analytics-line); }
+.analytics-strip-metric:first-child { padding-left: 0; }
+.analytics-strip-metric:last-child { border-right: 0; }
+.analytics-strip-metric > p { font-size: 11px; color: var(--gs-500); }
+.analytics-strip-metric > strong { display: block; margin-top: 7px; font-size: 21px; font-weight: 600; line-height: 1.3; letter-spacing: -.04em; overflow-wrap: anywhere; }
+.analytics-strip-metric small { font-size: 10px; font-weight: 500; letter-spacing: 0; }
+.analytics-strip-metric > span { display: block; margin-top: 6px; font-size: 10px; color: var(--gs-500); line-height: 1.6; }
+.analytics-panel { border: 1px solid var(--analytics-line); border-radius: 5px; background: var(--analytics-panel); box-shadow: 0 2px 5px rgb(20 24 60 / .015); }
+.academy-analytics .analytics-panel h2, .academy-analytics .analytics-status-panel h2 { font-family: "DM Sans", sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 0; }
+.analytics-panel-caption { font-size: 11px; color: var(--gs-500); margin-top: 5px; line-height: 1.6; }
+.analytics-status-panel { padding: 22px; color: white; background: linear-gradient(115deg,#3836b0,#282878); border-radius: 5px; }
+.analytics-live-label { font-size: 9px; color: rgb(255 255 255 / .65); }
+.analytics-chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 10px; color: var(--gs-500); }
+.analytics-chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
+.analytics-chart-legend i { width: 6px; height: 6px; border-radius: 50%; }
+.analytics-period-badge { font-size: 10px; background: var(--gs-100); color: var(--gs-600); padding: 5px 9px; border-radius: 3px; }
+.analytics-shortcut-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 4px; color: #5755af; background: #f0effb; flex-shrink: 0; }
+.analytics-empty { display: grid; height: 100%; place-content: center; font-size: 12px; color: var(--gs-500); text-align: center; padding: 20px; }
+.academy-analytics .analytics-detail-section { border-radius: 5px; }
+html.dark .academy-analytics { --analytics-panel: #202124; --analytics-line: #36373c; }
+html.dark .analytics-shortcut-icon { background: #32304a; color: #bab6fb; }
+@media(max-width:1199px) { .analytics-metric-strip { grid-template-columns: repeat(3,minmax(0,1fr)); row-gap: 22px; } .analytics-strip-metric:nth-child(3) { border-right: 0; } .analytics-strip-metric:nth-child(4) { padding-left: 0; } }
+@media(max-width:539px) { .analytics-metric-strip { grid-template-columns: repeat(2,minmax(0,1fr)); } .analytics-strip-metric:nth-child(odd) { padding-left: 0; border-right: 1px solid var(--analytics-line); } .analytics-strip-metric:nth-child(even) { padding-left: 16px; border-right: 0; } .analytics-strip-metric > strong { font-size: 20px; } }
+
+.academy-analytics .analytics-detail-section h3 { font-family: "DM Sans", sans-serif; font-size: 13px; font-weight: 600; }
+.academy-analytics .analytics-kpi { border-radius: 5px; }
diff --git a/src/pages/analytics/AnalyticsPage.tsx b/src/pages/analytics/AnalyticsPage.tsx
index 23e1916..c66902a 100644
--- a/src/pages/analytics/AnalyticsPage.tsx
+++ b/src/pages/analytics/AnalyticsPage.tsx
@@ -36,6 +36,7 @@ import {
import { getDashboard } from "../../api/analytics.api";
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png";
import alertSrc from "../../assets/Alert.svg";
+import { AcademyAnalyticsOverview } from "../../components/analytics/AcademyAnalyticsOverview";
import { AnalyticsTimeRangeFilter } from "../../components/analytics/AnalyticsTimeRangeFilter";
import { getDashboardFilterLabel } from "../../components/analytics/AnalyticsTimeRangeFilter.shared";
@@ -48,7 +49,6 @@ import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/ca
import {
SensitiveChart,
SensitiveRevealProvider,
- SensitiveValue,
} from "../../components/ui/sensitive-value";
import {
aggregateRevenueByMonth,
@@ -120,7 +120,7 @@ function KpiCard({
return (
@@ -311,11 +311,12 @@ function Section({
const [open, setOpen] = useState(defaultOpen)
return (
-
+
setOpen((v) => !v)}
- className="flex w-full items-center gap-3 px-6 py-4 text-left transition-colors hover:bg-grayScale-50/80"
+ aria-expanded={open}
+ className="flex w-full items-center gap-3 px-5 py-3 text-left transition-colors hover:bg-grayScale-50/80"
>
@@ -472,12 +473,12 @@ export function AnalyticsPage() {
return (
-
+
{/* Header */}
-
+
Analytics
-
Platform Overview
+
Academy performance
@@ -498,87 +499,21 @@ export function AnalyticsPage() {
)}
- {/* Summary Tabs */}
-
-
- setActiveSummaryTab("key")}
- className={cn(
- "relative px-1 pb-3.5 pt-1 text-sm font-semibold transition-all",
- activeSummaryTab === "key" ? "text-brand-600" : "text-grayScale-400 hover:text-grayScale-700",
- )}
- >
- Key Metrics
- {activeSummaryTab === "key" && (
-
- )}
-
- setActiveSummaryTab("content")}
- className={cn(
- "relative px-1 pb-3.5 pt-1 text-sm font-semibold transition-all",
- activeSummaryTab === "content" ? "text-brand-600" : "text-grayScale-400 hover:text-grayScale-700",
- )}
- >
- Content & Platform
- {activeSummaryTab === "content" && (
-
- )}
-
- setActiveSummaryTab("operations")}
- className={cn(
- "relative px-1 pb-3.5 pt-1 text-sm font-semibold transition-all",
- activeSummaryTab === "operations" ? "text-brand-600" : "text-grayScale-400 hover:text-grayScale-700",
- )}
- >
- Operations
- {activeSummaryTab === "operations" && (
-
- )}
-
-
-
-
+
+ {([{key:"key", label:"Overview"}, {key:"content", label:"Content & Platform"}, {key:"operations", label:"Operations"}] as const).map(tab => setActiveSummaryTab(tab.key)}
+ className={cn("relative px-1 pb-3.5 pt-1 text-xs font-medium transition-colors",activeSummaryTab === tab.key ? "text-brand-600" : "text-grayScale-400 hover:text-grayScale-700")}>
+ {tab.label}{activeSummaryTab === tab.key && }
+ )}
+
- {activeSummaryTab === "key" && (
-
-
- 0 ? "up" : "neutral"}
- />
- 0 ? "up" : "neutral"}
- />
-
- {`ETB ${formatNumber(payments.total_revenue)}`}
-
- }
- sub={
- <>
- {payments.successful_payments}/{payments.total_payments} successful · Avg{" "}
-
- ETB {payments.avg_transaction_value.toLocaleString()}
-
- >
- }
- trend={payments.total_revenue > 0 ? "up" : "neutral"}
- />
-
-
- )}
+ {activeSummaryTab === "key" &&
}
{activeSummaryTab === "operations" && (
<>