{showHero && (
{t("averageUptime")}
{formatNumber(uptimeValue, 1)}%
{options.showUptimeRing && (
{formatNumber(uptimeValue, 0)}%
}
/>
)}
)}
{!hasContent && (
—
)}
{visibleStatKeys.length > 0 && (
{visibleStatKeys.map((statKey) => {
const Icon = statIcons[statKey];
const color = statColorByKey[statKey];
return (
{formatNumber(combined[statKey], 0)}
{t(`stats.${statKey}`)}
);
})}
)}
);
}
function clampPercent(value: number): number {
return Math.min(100, Math.max(0, value));
}
function getUptimeTier(uptime: number): keyof typeof uptimeColorByTier {
const match = uptimeTierByThreshold.find(([min]) => uptime >= min);
const tier = match?.[1] ?? "poor";
return tier;
}
function getUptimeColor(uptime: number): string {
return uptimeColorByTier[getUptimeTier(uptime)];
}
function getGridCols(width: number): number {
const match = gridColsByWidth.find(({ minWidth }) => width >= minWidth);
return match?.cols ?? 2;
}
function getRingSize(width: number): number {
const match = ringSizeByWidth.find(({ minWidth }) => width >= minWidth);
return match?.size ?? 44;
}
function getIconSize(width: number): number {
const match = iconSizeByWidth.find(({ minWidth }) => width >= minWidth);
return match?.size ?? 16;
}