Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: dataroom navigation active state

Marc Seitz9bca455de76a
diff --git a/components/datarooms/dataroom-navigation.tsx b/components/datarooms/dataroom-navigation.tsx
index 6c0455fb..b66a5a4f 100644
--- a/components/datarooms/dataroom-navigation.tsx
+++ b/components/datarooms/dataroom-navigation.tsx
@@ -10,7 +10,7 @@ export const DataroomNavigation = ({ dataroomId }: { dataroomId?: string }) => {
{
label: "Overview",
href: `/datarooms/${dataroomId}`,
- segment: `${dataroomId}`,
+ segment: `/datarooms/[id]`,
},
{
label: "Documents",
diff --git a/components/navigation-menu.tsx b/components/navigation-menu.tsx
index 052a0cc8..9c84c414 100644
--- a/components/navigation-menu.tsx
+++ b/components/navigation-menu.tsx
@@ -52,7 +52,14 @@ const NavItem: React.FC<Props["navigation"][0]> = ({
tag,
}) => {
const router = useRouter();
- const active = router.pathname.includes(segment as string);
+ // active is true if the segment included in the pathname, but not if it's the root pathname. unless the segment is the root pathname.
+ let active =
+ router.pathname.includes(segment as string) &&
+ segment !== "/datarooms/[id]";
+
+ if (segment === "/datarooms/[id]") {
+ active = router.pathname === "/datarooms/[id]";
+ }
return (
<li