fix(sidebar): highlight active feature in nested route (#1929)

Co-authored-by: Pranay Prateek <pranay@signoz.io>
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
Yash Joshi 2022-12-30 01:10:02 +05:30 committed by GitHub
parent 742ceac32c
commit f0e13784e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,12 +89,14 @@ function SideNav(): JSX.Element {
},
];
const currentMenu = menus.find((menu) => pathname.startsWith(menu.to));
return (
<Sider collapsible collapsed={collapsed} onCollapse={onCollapse} width={200}>
<Menu
theme="dark"
defaultSelectedKeys={[ROUTES.APPLICATION]}
selectedKeys={[pathname]}
selectedKeys={currentMenu ? [currentMenu?.to] : []}
mode="inline"
>
{menus.map(({ to, Icon, name, tags }) => (