From 9235117aee6660135caf59fa0d1cda4b50bb2422 Mon Sep 17 00:00:00 2001 From: Arthur Belleville Date: Sun, 6 Apr 2025 21:36:55 +0200 Subject: [PATCH] Improve Navigation + ThemeSwitcher --- ui/src/components/NavigationBar.tsx | 44 +++++++++++++++-------------- ui/src/components/ThemeSwitcher.tsx | 8 ++++-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/ui/src/components/NavigationBar.tsx b/ui/src/components/NavigationBar.tsx index 261f2e4..f850334 100644 --- a/ui/src/components/NavigationBar.tsx +++ b/ui/src/components/NavigationBar.tsx @@ -5,7 +5,6 @@ import { HelpCircleIcon, SendIcon, ChevronRightIcon, - Settings, ConstructionIcon, PlusIcon, MinusIcon, @@ -40,6 +39,7 @@ import { import { useState, useRef } from "react"; import logo from "../assets/icon.jpg"; import { ThemeSwitcher } from "./ThemeSwitcher"; +import { useSession } from "../contexts/SessionContext"; type NavLinkItem = { isActive?: boolean; @@ -97,37 +97,39 @@ function NavLink(props: NavLinkProps) { ); } -export function ControlledOpenState({ isCollapsed }: { isCollapsed: boolean }) { - const [isOpen, setIsOpen] = useState(false); +export function UserMenuPopover({ isCollapsed }: { isCollapsed: boolean }) { + const { session } = useSession(); + const [isPopoverOpen, setIsPopoverOpen] = useState(false); const ref = useRef(null); return ( <> @@ -209,14 +211,14 @@ export const SideNavigation = ({ }) => { const isCollapsable = !isMobileMenuOpen; - const [isCollapsed, setIsCollapsed] = useState(isCollapsable ? true : false); + const [isCollapsed, setIsCollapsed] = useState(isCollapsable ? false : true); return (
- -
- + {!isCollapsed ? : null} +
+
); @@ -327,7 +329,7 @@ export function MainNavigation({ isCollapsed }: { isCollapsed: boolean }) { ))} -
    +
    • diff --git a/ui/src/components/ThemeSwitcher.tsx b/ui/src/components/ThemeSwitcher.tsx index 1bff4f1..c9f5cfa 100644 --- a/ui/src/components/ThemeSwitcher.tsx +++ b/ui/src/components/ThemeSwitcher.tsx @@ -10,7 +10,7 @@ export function ThemeSwitcher() { isSelected={theme === "dark"} onChange={() => setTheme(theme === "dark" ? "light" : "dark")} className={twMerge( - "p-2 rounded-full", + "py-2 px-2 mx-4 rounded-full", "bg-slate-100 dark:bg-slate-800", "border border-slate-200 dark:border-slate-700", "hover:bg-slate-200 dark:hover:bg-slate-700", @@ -47,7 +47,11 @@ export function ThemeSwitcher() { /> )} - + {theme === "dark" ? "Mode sombre" : theme === "light"