From 981625e6300971c9535d9b78e5d671ce26513393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=9C=EB=8F=99=ED=98=84?= <hando1220@ajou.ac.kr> Date: Sun, 2 Mar 2025 13:53:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=82=AC=EC=9D=B4=EB=93=9C=EB=B0=94=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=20=ED=95=AD=EB=AA=A9=20=EA=B0=95=EC=A1=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/app-sidebar.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx index 2af12b1..d91a47b 100644 --- a/src/components/app-sidebar.tsx +++ b/src/components/app-sidebar.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Link } from 'react-router'; +import { Link, useLocation } from 'react-router'; import { useAuthStore } from '@/stores/authStore'; import { ArrowLeftRight, ShieldCheck, Server, TextSearch, CircleHelp } from 'lucide-react'; import { @@ -26,13 +26,11 @@ const data = { icon: ArrowLeftRight, title: '라우팅 설정', url: 'routing', - isActive: true, }, { icon: ShieldCheck, title: 'SSL 인증서', url: 'certificate', - isActive: false, }, ], }, @@ -43,7 +41,6 @@ const data = { icon: Server, title: 'SSH 설정', url: 'forwarding', - isActive: false, }, ], }, @@ -54,7 +51,6 @@ const data = { icon: TextSearch, title: '설정 변경 내역', url: 'log', - isActive: false, }, ], }, @@ -63,6 +59,8 @@ const data = { export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) { const { token } = useAuthStore(); + const location = useLocation(); + const selected = location.pathname.split('/')[1] || ''; return ( <Sidebar className="top-(--header-height) h-[calc(100svh-var(--header-height))]!" {...props}> @@ -81,7 +79,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) { <SidebarMenuItem key={item.title}> <SidebarMenuButton asChild - isActive={item.isActive} + isActive={selected === item.url} className={token ? '' : 'cursor-not-allowed opacity-50'} > <Link to={item.url}> -- GitLab