import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { FaTriangleExclamation } from "react-icons/fa6"; import { LuBell, LuBellOff, LuCheck, LuExternalLink, LuEye, LuInfo, LuSlidersHorizontal, LuX, } from "react-icons/lu"; import { TooltipPortal } from "@radix-ui/react-tooltip"; import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import { CameraNameLabel } from "@/components/camera/FriendlyNameLabel"; import ActivityIndicator from "@/components/indicators/activity-indicator"; import { useDocDomain } from "@/hooks/use-doc-domain"; import type { HealthProblem } from "@/types/health"; type HealthProblemRowProps = { problem: HealthProblem; }; const ICON_BUTTON_CLASS = "size-6 shrink-0 text-muted-foreground hover:text-primary"; function RowAction({ label, children, }: { label: string; children: React.ReactNode; }) { return ( {children} {label} ); } export default function HealthProblemRow({ problem }: HealthProblemRowProps) { const { t } = useTranslation(["views/system", "common"]); const { getLocaleDocUrl } = useDocDomain(); const hasDetails = problem.scope || problem.meta; const hasActions = problem.link || problem.docLink || problem.externalLink || problem.onAcknowledge || problem.onMute || problem.onUnhide; const unhideLabel = problem.hidden === "muted" ? t("health.notices.unmute") : t("health.notices.showAgain"); return (
{problem.pending ? ( ) : ( <> {problem.severity === "error" && ( )} {problem.severity === "warning" && ( )} {problem.severity === "info" && ( )} )}
{problem.text}
{hasDetails && (
{problem.scope && ( {problem.scopeIsCamera ? ( ) : ( problem.scope )} )} {problem.meta && {problem.meta}}
)}
{hasActions && (
{problem.link && ( )} {problem.docLink && ( )} {problem.externalLink && ( )} {problem.onAcknowledge && ( )} {problem.onMute && ( )} {problem.onUnhide && ( )}
)}
); }