diff --git a/web/src/components/navigation/NavItem.tsx b/web/src/components/navigation/NavItem.tsx index 48004c684..0aa3205dc 100644 --- a/web/src/components/navigation/NavItem.tsx +++ b/web/src/components/navigation/NavItem.tsx @@ -6,10 +6,9 @@ import { TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; -import { useCallback, useState } from "react"; +import { useState } from "react"; import { isDesktop } from "react-device-detect"; import { TooltipPortal } from "@radix-ui/react-tooltip"; -import { CameraGroupSelector } from "../filter/CameraGroupSelector"; const variants = { primary: { @@ -43,58 +42,36 @@ export default function NavItem({ }: NavItemProps) { const shouldRender = dev ? ENV !== "production" : true; - const [showTooltip, setShowTooltip] = useState(false); - const [timeoutId, setTimeoutId] = useState(); - const showTooltipTimer = useCallback( - (showTooltip: boolean) => { - if (!showTooltip) { - setShowTooltip(showTooltip); + if (!shouldRender) { + return; + } - if (timeoutId) { - clearTimeout(timeoutId); - } - } else { - setTimeoutId(setTimeout(() => setShowTooltip(showTooltip), 500)); + const content = ( + + `${className} flex flex-col justify-center items-center rounded-lg ${ + variants[variant][isActive ? "active" : "inactive"] + }` } - }, - [timeoutId], + > + + ); - return ( - shouldRender && ( - - - {({ isActive }) => ( - <> - - - isDesktop ? showTooltipTimer(true) : null - } - onMouseLeave={() => - isDesktop ? showTooltipTimer(false) : null - } - /> - - {isDesktop && title == "Live" && isActive && ( - - )} - - )} - + if (isDesktop) { + return ( + + {content}

{title}

- ) - ); + ); + } + + return content; } diff --git a/web/src/components/navigation/Sidebar.tsx b/web/src/components/navigation/Sidebar.tsx index 450e75bce..1956a8562 100644 --- a/web/src/components/navigation/Sidebar.tsx +++ b/web/src/components/navigation/Sidebar.tsx @@ -2,22 +2,30 @@ import Logo from "../Logo"; import { navbarLinks } from "@/pages/site-navigation"; import SettingsNavItems from "../settings/SettingsNavItems"; import NavItem from "./NavItem"; +import { CameraGroupSelector } from "../filter/CameraGroupSelector"; +import { useLocation } from "react-router-dom"; function Sidebar() { + const location = useLocation(); + return (