import type { ReactNode } from "react"; import { Box, CircularProgress, Paper } from "@mui/material"; import { QueryErrorPanel } from "@/components/ui/query-error-panel"; import { Text } from "@/components/ui/text"; interface DashboardCardProps { title: string; /** Optional scope caption shown beside the title (e.g. SH-349's all-time note). */ caption?: string; isLoading?: boolean; error?: unknown; isEmpty: boolean; emptyMessage: string; children: ReactNode; } export function DashboardCard({ title, caption, isLoading = false, error, isEmpty, emptyMessage, children, }: DashboardCardProps) { return ( {title} {!!caption && ( {caption} )} {isLoading && ( )} {!isLoading && Boolean(error) && } {!isLoading && !error && isEmpty && ( {emptyMessage} )} {!isLoading && !error && !isEmpty && {children}} ); }