diff --git a/web/src/components/navigation/Bottombar.tsx b/web/src/components/navigation/Bottombar.tsx index d4e1e0760..68b28d22a 100644 --- a/web/src/components/navigation/Bottombar.tsx +++ b/web/src/components/navigation/Bottombar.tsx @@ -1,6 +1,13 @@ import { navbarLinks } from "@/pages/site-navigation"; import NavItem from "./NavItem"; import SettingsNavItems from "../settings/SettingsNavItems"; +import { IoIosWarning } from "react-icons/io"; +import { Drawer, DrawerContent, DrawerTrigger } from "../ui/drawer"; +import useSWR from "swr"; +import { FrigateStats } from "@/types/stats"; +import { useFrigateStats } from "@/api/ws"; +import { useMemo } from "react"; +import useStats from "@/hooks/use-stats"; function Bottombar() { return ( @@ -17,10 +24,46 @@ function Bottombar() { /> ))} + ); } -// +function StatusAlertNav() { + const { data: initialStats } = useSWR("stats", { + revalidateOnFocus: false, + }); + const { payload: latestStats } = useFrigateStats(); + const stats = useMemo(() => { + if (latestStats) { + return latestStats; + } + + return initialStats; + }, [initialStats, latestStats]); + const { potentialProblems } = useStats(stats); + + if (!potentialProblems || potentialProblems.length == 0) { + return; + } + + return ( + + + + + + + {potentialProblems.map((prob) => ( + + + {prob.text} + + ))} + + + + ); +} export default Bottombar;