From 2bb316f3b9fbee88c0a2ec518fe4f8cb888c46cd Mon Sep 17 00:00:00 2001 From: Christopher Hight Date: Fri, 5 Jun 2026 13:38:35 -0700 Subject: [PATCH] Update sidebar changes made for function and look. removed some extras --- client/src/components/Sidebar/Sidebar.jsx | 125 ++++++++++------------ 1 file changed, 58 insertions(+), 67 deletions(-) diff --git a/client/src/components/Sidebar/Sidebar.jsx b/client/src/components/Sidebar/Sidebar.jsx index bea4228..590f909 100644 --- a/client/src/components/Sidebar/Sidebar.jsx +++ b/client/src/components/Sidebar/Sidebar.jsx @@ -1,83 +1,74 @@ import { useSlotRecipe, Box, Button, IconButton } from "@chakra-ui/react"; -import { ColorModeButton, useColorMode } from "@/components/ui/color-mode"; +import { ColorModeButton } from "@/components/ui/color-mode"; import { useState } from "react"; import { NavLink } from "react-router-dom"; import Tooltip from "../Canvas/CanvasComponents/Tooltip.jsx"; -import { Mountain, House, Earth, MapPin, ShieldUser, Menu, CircleUserRound, KeyRound } from 'lucide-react'; +import { Mountain, House, Earth, MapPin, ShieldUser, Menu } from 'lucide-react'; + +const SIDEBAR_DEFAULT_BUTTONS = [ + { icon: House, name: "Home", url: "/home" }, + { icon: Earth, name: "Global Map", url: "/global-map" }, + { icon: MapPin, name: "Regional Map", url: "/regional-map" }, + { icon: Mountain, name: "Volcano", url: "/volcano" }, + { icon: ShieldUser, name: "Admin", url: "/admin" } // TODO remove in the future as default should not have admin +]; export default function Sidebar() { - const { toggleColorMode } = useColorMode(); const [isOpen, setIsOpen] = useState(true); const recipe = useSlotRecipe({ key: "sidebar" }); const styles = recipe(); - // const buttons = useMemo(() => { - // if (["settings", "personal", "security"].includes(view)) { - // return [ - // {icon: CircleUserRound, name: "Personal Info", url: "/personal"}, - // {icon: KeyRound, name: "Security", url: "/security"}, - // ]; - // } - // return [ - // {icon: House, name: "Home", url: "/mydashboard"}, - // {icon: Earth, name: "Global Map", url: "/global"}, - // {icon: MapPin, name: "Regional Map", url: "/regional"}, - // {icon: Mountain, name: "Volcano", url: "/volcanohome"}, - // {icon: ShieldUser, name: "Admin", url: "/medataentry"} - // ]; - // }, [view]); + // TODO we will need to call buttons here by authorized user, for now we update the visible buttons as simply the default buttons + const visibleButtons = SIDEBAR_DEFAULT_BUTTONS; - const buttons = [ - {icon: House, name: "Home", url: "/home"}, - {icon: Earth, name: "Global Map", url: "/global-map"}, - {icon: MapPin, name: "Regional Map", url: "/regional-map"}, - {icon: Mountain, name: "Volcano", url: "/volcano"}, - {icon: ShieldUser, name: "Admin", url: "/admin"} - ]; - - const toggleSidebar = () => { - setIsOpen((prev) => !prev); - }; + const toggleSidebar = () => setIsOpen((prev) => !prev); return ( - - - - + + {/* Menu Trigger */} + + + - {buttons.map((button, idx) => { - const Icon = button.icon; - return ( // TODO: don't use idx as a key - - - - ) - })} - toggleColorMode()} - position="absolute" - bottom="2" - /> - + {/* Navigation Buttons */} + {visibleButtons.map((button) => { + const Icon = button.icon; + return ( + + + + ); + })} + + {/* Theme Toggler */} + + ); } \ No newline at end of file