"use client"; import Link from "next/link"; import Grid from "@mui/material/Grid"; import { Card, CardActionArea, CardContent, Paper, Stack, Typography, Box } from "@mui/material"; import BarChartIcon from "@mui/icons-material/BarChart"; import { ReactNode } from "react"; type StatCard = { label: string; icon: ReactNode; count: number; href: string; }; type RecentEvent = { summary: string; created_at: string; }; type TrafficSummary = { totalRequests: number; blockedPercent: number; } | null; export default function OverviewClient({ userName, stats, trafficSummary, recentEvents }: { userName: string; stats: StatCard[]; trafficSummary: TrafficSummary; recentEvents: RecentEvent[]; }) { return ( Control Center Welcome back, {userName} Everything you need to orchestrate Caddy proxies, certificates, and secure edge services lives here. {stats.map((stat) => ( {stat.icon} {stat.count} {stat.label} ))} {/* Traffic (24h) card */} {trafficSummary ? ( <> {trafficSummary.totalRequests.toLocaleString()} Traffic (24h) {trafficSummary.totalRequests > 0 && ( 0 ? "error.light" : "text.secondary", fontSize: "0.8em" }}> · {trafficSummary.blockedPercent}% blocked )} ) : ( <> Traffic (24h) )} Recent Activity {recentEvents.length === 0 ? ( No activity recorded yet. ) : ( {recentEvents.map((event, index) => ( {event.summary} {new Date(event.created_at).toLocaleString()} ))} )} ); }