From 5aeba0d539eed8a39ad9bd397459666dbb8d46b1 Mon Sep 17 00:00:00 2001 From: dogukanoksuz Date: Mon, 10 Jun 2024 11:51:51 +0300 Subject: [PATCH] chore: Sidebar UI consistency --- .../navigation/sidebar-selected.tsx | 104 ++++++++++++++---- 1 file changed, 80 insertions(+), 24 deletions(-) diff --git a/src/components/navigation/sidebar-selected.tsx b/src/components/navigation/sidebar-selected.tsx index 35f47a8..404a3c9 100644 --- a/src/components/navigation/sidebar-selected.tsx +++ b/src/components/navigation/sidebar-selected.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from "react" +import Link from "next/link" import { SIDEBARCTX_STATES, useSidebarContext, @@ -25,6 +26,7 @@ import { IServer } from "@/types/server" import { cn } from "@/lib/utils" import { useCurrentUser } from "@/hooks/auth/useCurrentUser" +import { Button } from "../ui/button" import { Collapsible, CollapsibleContent, @@ -39,7 +41,7 @@ import { TooltipTrigger, } from "../ui/tooltip" import ExtensionItem from "./extension-item" -import ServerItem, { DropdownServerItem } from "./server-item" +import ServerItem from "./server-item" export default function SidebarSelected() { const [ @@ -115,10 +117,35 @@ export default function SidebarSelected() { localStorage.setItem("serverSettingsCollapsed", (!isCollapsed).toString()) } + // Toggle user operations + const [isUserCollapsed, setIsUserCollapsed] = useState(true) + const toggleUserCollapsed = () => { + setIsUserCollapsed(!isUserCollapsed) + } + useEffect(() => { setIsCollapsed(localStorage.getItem("serverSettingsCollapsed") == "true") }, []) + const collapsibleUserData = [ + { + link: `/servers/${selected}/users/local`, + name: t("sidebar.user_management.local_users"), + exact: true, + }, + { + link: `/servers/${selected}/users/groups`, + name: t("sidebar.user_management.local_groups"), + exact: true, + }, + { + link: `/servers/${selected}/users/sudoers`, + name: t("sidebar.user_management.sudoers"), + exact: true, + disabled: selectedData.os === "windows", + }, + ] + return ( <> {selectedLoading ? ( @@ -264,30 +291,59 @@ export default function SidebarSelected() { {t("sidebar.updates")}
- - - {t("sidebar.user_management.title")} - + + + + +
+ {collapsibleUserData.map((item) => ( + + + + ))} +
+
+