import type { ReactNode } from "react";
import { Col, Descriptions, Divider, Row, Skeleton, Space, Statistic } from "tdesign-react";
import type { TargetMetricsResponse, TargetStatus } from "../../shared/api";
import { formatDurationUnit } from "../utils/time";
import { TrendChart } from "./TrendChart";
interface OverviewStatItemProps {
color?: string;
suffix?: ReactNode;
title: string;
value: number;
}
interface OverviewTabProps {
metricsData: null | TargetMetricsResponse;
metricsLoading: boolean;
target: TargetStatus;
}
export function OverviewTab({ metricsData, metricsLoading, target }: OverviewTabProps) {
const stats = metricsData?.stats ?? null;
const mttr = formatDurationUnit(stats?.mttr ?? null);
const longestOutage = formatDurationUnit(stats?.longestOutage ?? null);
const currentUpStreak = stats?.currentStreak?.up ? stats.currentStreak.count : 0;
return (