import { LuActivity, LuGithub, LuHardDrive, LuLifeBuoy, LuList, LuMoon, LuPenSquare, LuRotateCw, LuSettings, LuSun, LuSunMoon, } from "react-icons/lu"; import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "../ui/dropdown-menu"; import { Button } from "../ui/button"; import { Link } from "react-router-dom"; import { CgDarkMode } from "react-icons/cg"; import { VscAccount } from "react-icons/vsc"; import { colorSchemes, friendlyColorSchemeName, useTheme, } from "@/context/theme-provider"; import { IoColorPalette } from "react-icons/io5"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../ui/alert-dialog"; import { useEffect, useState } from "react"; import { useRestart } from "@/api/ws"; import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "../ui/sheet"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import ActivityIndicator from "../ui/activity-indicator"; type SettingsNavItemsProps = { className?: string; }; export default function SettingsNavItems({ className }: SettingsNavItemsProps) { const { theme, colorScheme, setTheme, setColorScheme } = useTheme(); const [restartDialogOpen, setRestartDialogOpen] = useState(false); const [restartingSheetOpen, setRestartingSheetOpen] = useState(false); const [countdown, setCountdown] = useState(60); const { send: sendRestart } = useRestart(); useEffect(() => { let countdownInterval: NodeJS.Timeout; if (restartingSheetOpen) { countdownInterval = setInterval(() => { setCountdown((prevCountdown) => prevCountdown - 1); }, 1000); } return () => { clearInterval(countdownInterval); }; }, [restartingSheetOpen]); useEffect(() => { if (countdown === 0) { window.location.href = "/"; } }, [countdown]); const handleForceReload = () => { window.location.href = "/"; }; return ( <>

Settings

System Storage System metrics System logs Configuration Settings Configuration editor Appearance Dark Mode setTheme("light")}> {theme === "light" ? ( <> Light ) : ( Light )} setTheme("dark")}> {theme === "dark" ? ( <> Dark ) : ( Dark )} setTheme("system")}> {theme === "system" ? ( <> System ) : ( System )} Theme {colorSchemes.map((scheme) => ( setColorScheme(scheme)} > {scheme === colorScheme ? ( <> {friendlyColorSchemeName(scheme)} ) : ( {friendlyColorSchemeName(scheme)} )} ))} Help Documentation GitHub setRestartDialogOpen(true)}> Restart Frigate

Account

{restartDialogOpen && ( setRestartDialogOpen(false)} > Are you sure you want to restart Frigate? Cancel { setRestartingSheetOpen(true); sendRestart("restart"); }} > Restart )} {restartingSheetOpen && ( <> setRestartingSheetOpen(false)} > e.preventDefault()} >
Frigate is Restarting

This page will reload in {countdown} seconds.

)} ); }