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
Account
This page will reload in {countdown} seconds.