Enhance overall status metadata
cgen-270d85a0b1cd4d4a84154bdf485d684a
This commit is contained in:
parent
3c9996b4ad
commit
9099b72a41
1 changed files with 28 additions and 6 deletions
|
|
@ -317,12 +317,34 @@ export default function Admin() {
|
|||
);
|
||||
|
||||
const overallStatus = useMemo(() => {
|
||||
const hasOutage = statusSnapshot.some((service) => service.status === "outage");
|
||||
if (hasOutage) return { label: "Service disruption", tone: "bg-red-500", Icon: XCircle };
|
||||
const hasDegraded = statusSnapshot.some((service) => service.status === "degraded");
|
||||
if (hasDegraded)
|
||||
return { label: "Partial degradation", tone: "bg-yellow-500", Icon: AlertTriangle };
|
||||
return { label: "All systems operational", tone: "bg-emerald-500", Icon: CheckCircle };
|
||||
const base = {
|
||||
label: "All systems operational",
|
||||
accentClass: "text-emerald-300",
|
||||
badgeClass: "border-emerald-500/40 bg-emerald-500/10 text-emerald-200",
|
||||
Icon: CheckCircle,
|
||||
} as const;
|
||||
|
||||
if (!statusSnapshot.length) return base;
|
||||
|
||||
if (statusSnapshot.some((service) => service.status === "outage")) {
|
||||
return {
|
||||
label: "Service disruption",
|
||||
accentClass: "text-red-300",
|
||||
badgeClass: "border-red-500/40 bg-red-500/10 text-red-200",
|
||||
Icon: XCircle,
|
||||
};
|
||||
}
|
||||
|
||||
if (statusSnapshot.some((service) => service.status === "degraded")) {
|
||||
return {
|
||||
label: "Partial degradation",
|
||||
accentClass: "text-yellow-300",
|
||||
badgeClass: "border-yellow-500/40 bg-yellow-500/10 text-yellow-200",
|
||||
Icon: AlertTriangle,
|
||||
};
|
||||
}
|
||||
|
||||
return base;
|
||||
}, [statusSnapshot]);
|
||||
|
||||
const blogReach = useMemo(
|
||||
|
|
|
|||
Loading…
Reference in a new issue