"use client"; import React, { useState, useEffect } from "react"; import { cmsApi } from "@/lib/api"; import { Building2, Users, BookOpen, Zap, Server, Clock, ShieldAlert } from "lucide-react"; export default function AdminDashboard() { const [stats, setStats] = useState({ orgs: 0, users: 0, courses: 0 }); const [loading, setLoading] = useState(true); useEffect(() => { const fetchStats = async () => { try { // In a real app we'd have a specific stats endpoint, // but for now we'll calculate from lists const [org, users] = await Promise.all([ cmsApi.getOrganization(), cmsApi.getAllUsers() ]); setStats({ orgs: 1, // Single tenant architecture users: users.length, courses: 0 // We'd need a global courses count }); } catch (err) { console.error("Failed to load admin stats", err); } finally { setLoading(false); } }; fetchStats(); }, []); const cards = [ { label: "Organizations", value: stats.orgs, icon: Building2, color: "text-blue-600 dark:text-blue-400", bg: "bg-blue-500/10", desc: "Active institutional tenants" }, { label: "Total Users", value: stats.users, icon: Users, color: "text-purple-600 dark:text-purple-400", bg: "bg-purple-500/10", desc: "Registered globally" }, { label: "Global Courses", value: stats.courses, icon: BookOpen, color: "text-green-600 dark:text-green-400", bg: "bg-green-500/10", desc: "Managed across all orgs" }, ]; return (
Holistic view of the OpenCCB ecosystem.
{card.desc}