import type { ReactNode } from "react"; import { RefreshCw, AlertTriangle } from "lucide-react"; import { useTranslation } from "react-i18next"; import { Button } from "@/components/button"; import { MetricCard } from "@/components/metric-card"; import type { ManagerError } from "./useManagerData"; export function ManagerCardShell({ title, icon, loading, error, onRefresh, empty, emptyMessage, children, headerExtra, }: { title: string; icon: ReactNode; loading: boolean; error: ManagerError | null; onRefresh: () => void; empty?: boolean; emptyMessage?: string; children: ReactNode; headerExtra?: ReactNode; }) { const { t } = useTranslation(); return ( {headerExtra} } > {error ? (
{error.message} {error.code === "SUDO_REQUIRED" && ( {t("hostMetrics.managers.sudoHint")} )}
) : empty ? (
{emptyMessage ?? t("hostMetrics.managers.noData")}
) : ( children )}
); }