All files / src/app/admin/components/_components CriticalBanner.tsx

100% Statements 8/8
100% Branches 4/4
100% Functions 3/3
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 391x                             46x 46x 44x 88x 44x   44x                                  
"use client";
 
import { AlertTriangle } from "lucide-react";
import type { TopoParticipant } from "./types";
import { useT } from "@/lib/i18n/translate";
 
export function CriticalBanner({
  degraded,
  total,
  participants,
}: {
  degraded: number;
  total: number;
  participants: TopoParticipant[];
}) {
  const t = useT("admin");
  if (degraded === 0) return null;
  const names = participants
    .filter((p) => p.health === "critical" || p.health === "warning")
    .map((p) => p.displayName);
 
  return (
    <div className="flex items-center gap-3 border border-red-500/40 bg-red-900/15 rounded-xl px-4 py-3 mb-6">
      <AlertTriangle size={18} className="text-(--danger-text) shrink-0" />
      <div className="text-sm">
        <span className="font-semibold text-(--danger-text)">
          {t("{degraded} of {total} participants degraded", {
            degraded,
            total,
          })}
        </span>
        <span className="text-(--text-secondary) ml-2">
          ({names.join(", ")})
        </span>
      </div>
    </div>
  );
}