Skip to content

Commit b17a75c

Browse files
committed
fix: sidebar redirect via pathname
1 parent 07a3c09 commit b17a75c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

apps/dashboard/components/layout/navigation/navigation-item.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ArrowSquareOutIcon } from '@phosphor-icons/react';
22
import Link from 'next/link';
3+
import { usePathname } from 'next/navigation';
34
import { useMemo } from 'react';
45
import { FaviconImage } from '@/components/analytics/favicon-image';
56
import { cn } from '@/lib/utils';
@@ -26,15 +27,29 @@ export function NavigationItem({
2627
domain,
2728
disabled,
2829
}: NavigationItemProps) {
30+
const pathname = usePathname();
31+
2932
const fullPath = useMemo(() => {
3033
if (isRootLevel) {
3134
return href;
3235
}
3336
if (currentWebsiteId === 'sandbox') {
3437
return href === '' ? '/sandbox' : `/sandbox${href}`;
3538
}
39+
40+
// Check if we're on a database page
41+
if (
42+
pathname.startsWith('/observability/database/') &&
43+
pathname !== '/observability/database' &&
44+
pathname !== '/observability/database/'
45+
) {
46+
return href === ''
47+
? `/observability/database/${currentWebsiteId}`
48+
: `/observability/database/${currentWebsiteId}${href}`;
49+
}
50+
3651
return `/websites/${currentWebsiteId}${href}`;
37-
}, [href, isRootLevel, currentWebsiteId]);
52+
}, [href, isRootLevel, currentWebsiteId, pathname]);
3853

3954
const LinkComponent = isExternal ? 'a' : Link;
4055

0 commit comments

Comments
 (0)