parent
a48088765a
commit
72907d2583
1 changed files with 5 additions and 2 deletions
|
@ -44,12 +44,15 @@ export const PageNav: React.FunctionComponent = () => {
|
||||||
(route) => route.path.substr("/:realm".length) === path
|
(route) => route.path.substr("/:realm".length) === path
|
||||||
);
|
);
|
||||||
if (!route || !hasAccess(route.access)) return <></>;
|
if (!route || !hasAccess(route.access)) return <></>;
|
||||||
const activeItem = history.location.pathname;
|
//remove "/realm-name" from the start of the path
|
||||||
|
const activeItem = history.location.pathname.substr(realm.length + 1);
|
||||||
return (
|
return (
|
||||||
<NavItem
|
<NavItem
|
||||||
id={"nav-item" + path.replace("/", "-")}
|
id={"nav-item" + path.replace("/", "-")}
|
||||||
to={`/${realm}${path}`}
|
to={`/${realm}${path}`}
|
||||||
isActive={activeItem.substr(activeItem.indexOf("/", 1)) === path}
|
isActive={
|
||||||
|
path === activeItem || (path !== "/" && activeItem.startsWith(path))
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t(title)}
|
{t(title)}
|
||||||
</NavItem>
|
</NavItem>
|
||||||
|
|
Loading…
Reference in a new issue