diff --git a/client/src/components/MenuItemLabel.js b/client/src/components/MenuItemLabel.js index c11b9a2d2..ab0826f73 100644 --- a/client/src/components/MenuItemLabel.js +++ b/client/src/components/MenuItemLabel.js @@ -3,5 +3,5 @@ import React from 'react'; export default function MenuItemLabel({ text }) { - return ({ text }); + return ({ text }); } \ No newline at end of file diff --git a/client/src/components/Sidebar/SidebarMenu.js b/client/src/components/Sidebar/SidebarMenu.js index 4354e9e5e..6a41f891d 100644 --- a/client/src/components/Sidebar/SidebarMenu.js +++ b/client/src/components/Sidebar/SidebarMenu.js @@ -1,5 +1,5 @@ -import React from 'react'; -import { Menu, MenuDivider } from '@blueprintjs/core'; +import React, { useMemo } from 'react'; +import { Menu, MenuDivider, Button } from '@blueprintjs/core'; import { useHistory, useLocation } from 'react-router-dom'; import sidebarMenuList from 'config/sidebarMenu'; import Icon from 'components/Icon'; @@ -16,16 +16,31 @@ export default function SidebarMenu() { const children = Array.isArray(item.children) ? menuItemsMapper(item.children) : null; - const isActive = - (item.href && item.href === location.pathname) || - (item.children && - item.children.some((c) => c.href === location.pathname)); + + const matchPath = (pathname, path) => { + return item.matchExact ? pathname === path : pathname.indexOf(path) !== -1; + }; + const isActive = (item.children) ? + item.children.some((c) => matchPath(location.pathname, c.href)) : + (item.href && matchPath(location.pathname, item.href)); const handleItemClick = () => { if (item.href) { history.push(item.href); } }; + + const maybeRenderLabel = (item) => item.newTabHref ? ( +