mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-10 13:15:25 +03:00
Add alert to mobile
This commit is contained in:
parent
056312fb74
commit
cfd2bb3fc1
@ -1,6 +1,13 @@
|
|||||||
import { navbarLinks } from "@/pages/site-navigation";
|
import { navbarLinks } from "@/pages/site-navigation";
|
||||||
import NavItem from "./NavItem";
|
import NavItem from "./NavItem";
|
||||||
import SettingsNavItems from "../settings/SettingsNavItems";
|
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() {
|
function Bottombar() {
|
||||||
return (
|
return (
|
||||||
@ -17,10 +24,46 @@ function Bottombar() {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<SettingsNavItems className="flex flex-shrink-0 justify-between gap-4" />
|
<SettingsNavItems className="flex flex-shrink-0 justify-between gap-4" />
|
||||||
|
<StatusAlertNav />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
function StatusAlertNav() {
|
||||||
|
const { data: initialStats } = useSWR<FrigateStats>("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 (
|
||||||
|
<Drawer>
|
||||||
|
<DrawerTrigger>
|
||||||
|
<IoIosWarning className="size-5 text-danger" />
|
||||||
|
</DrawerTrigger>
|
||||||
|
<DrawerContent className="max-h-[75dvh] px-2 mx-1 rounded-t-2xl overflow-hidden">
|
||||||
|
<div className="w-full h-auto py-4 overflow-y-auto overflow-x-hidden flex flex-col items-center gap-2">
|
||||||
|
{potentialProblems.map((prob) => (
|
||||||
|
<div className="w-full flex items-center text-xs gap-2 capitalize">
|
||||||
|
<IoIosWarning className={`size-5 ${prob.color}`} />
|
||||||
|
{prob.text}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</DrawerContent>
|
||||||
|
</Drawer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default Bottombar;
|
export default Bottombar;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user