From 1ea2765ab0dfc2c8518fb7f96b46c70c6f6dfd8b Mon Sep 17 00:00:00 2001 From: Matthieu MALVACHE Date: Thu, 2 Oct 2025 02:02:15 +0200 Subject: [PATCH] feat: Implement minimalistic sliding menu with submenu navigation - Created sliding menu panel that slides up from bottom - Added two-level navigation: main menu and settings submenu - Replaced emoji flags with text-based language selection (EN/FR) - Simplified theme selector with compact button design - Added smooth transitions between menu states - Organized menu items: Storage, Settings, Sign Out - Implemented back navigation in settings submenu - Clean, minimalistic design with subtle borders and hover states --- components/layout/sidebar.tsx | 234 ++++++++++++++++++++-------------- 1 file changed, 138 insertions(+), 96 deletions(-) diff --git a/components/layout/sidebar.tsx b/components/layout/sidebar.tsx index 59dc134..5e9e801 100644 --- a/components/layout/sidebar.tsx +++ b/components/layout/sidebar.tsx @@ -2,11 +2,12 @@ import { useState, useEffect } from "react"; import { useTranslations } from "next-intl"; -import { useParams } from "next/navigation"; +import { useParams, useRouter, usePathname } from "next/navigation"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { LanguageSwitcher } from "@/components/ui/language-switcher"; import { useThemeStore } from "@/stores/theme-store"; +import { locales } from "@/i18n/request"; import { Inbox, Send, @@ -20,6 +21,7 @@ import { LogOut, ChevronRight, ChevronDown, + ChevronLeft, Folder, FolderOpen, Sun, @@ -184,10 +186,13 @@ export function Sidebar({ const [isCollapsed, setIsCollapsed] = useState(false); const [searchQuery, setSearchQuery] = useState(""); const [expandedFolders, setExpandedFolders] = useState>(new Set()); - const [showSettings, setShowSettings] = useState(false); + const [showMenu, setShowMenu] = useState(false); + const [menuView, setMenuView] = useState<'main' | 'settings'>('main'); const { theme, setTheme, resolvedTheme } = useThemeStore(); const t = useTranslations('sidebar'); const params = useParams(); + const router = useRouter(); + const pathname = usePathname(); // Load expanded folders from localStorage on mount useEffect(() => { @@ -340,109 +345,146 @@ export function Sidebar({ {/* Footer */} {!isCollapsed && ( <> - {/* Storage Quota - Always visible */} - {quota && quota.total > 0 && ( -
-
- {t("storage")} - - {formatFileSize(quota.used)} / {formatFileSize(quota.total)} - -
-
-
-
-
- )} - - {/* Settings Panel - Sliding */} + {/* Sliding Menu Panel */}
-
- {/* Theme Selector */} -
- -
+ {/* Main Menu View */} + {menuView === 'main' && ( +
+ {/* Storage Info */} + {quota && quota.total > 0 && ( +
+
+ {t("storage")} + + {formatFileSize(quota.used)} / {formatFileSize(quota.total)} + +
+
+
+
+
+ )} + +
+ {/* Settings */} - - + + {/* Sign Out */} + {onLogout && ( + + )}
+ )} - {/* Language Switcher */} -
- - -
- - {/* Logout Button */} - {onLogout && ( - - )} -
+ + {t("settings")} + + + {/* Theme */} +
+
Theme
+
+ + + +
+
+ + {/* Language */} +
+
Language
+
+ {locales.map((locale) => ( + + ))} +
+
+
+ )}
- {/* Settings Toggle Button */} -
+ {/* Menu Toggle Button */} +