import { StatusBarMessagesContext, StatusMessage, } from "@/context/statusbar-provider"; import useStats, { useAutoFrigateStats } from "@/hooks/use-stats"; import { useContext, useEffect, useMemo } from "react"; import { FaCheck } from "react-icons/fa"; import { IoIosWarning } from "react-icons/io"; import { MdCircle } from "react-icons/md"; import { Link } from "react-router-dom"; export default function Statusbar() { const { messages, addMessage, clearMessages } = useContext( StatusBarMessagesContext, )!; const stats = useAutoFrigateStats(); const cpuPercent = useMemo(() => { const systemCpu = stats?.cpu_usages["frigate.full_system"]?.cpu; if (!systemCpu || systemCpu == "0.0") { return null; } return parseInt(systemCpu); }, [stats]); const { potentialProblems } = useStats(stats); useEffect(() => { clearMessages("stats"); potentialProblems.forEach((problem) => { addMessage( "stats", problem.text, problem.color, undefined, problem.relevantLink, ); }); }, [potentialProblems, addMessage, clearMessages]); return (