Files
GMW/services/frontend/src/components/shell/nav-rail.tsx
T
asepharyanaandClaude Opus 5 (Nous Research) a4abe3abea fix(frontend): remove duplicate Dashboard entry in nav rail
The sidebar rendered /dashboard twice: once as a hardcoded NavItem
(lines 45-50) and again via navItems.map() (navItems[0] is also
/dashboard). Dropped the hardcoded item so the single source of truth
(navItems in lib/navigation.ts) drives the rail. Removed the now-unused
LayoutDashboard import.

tsc + biome green.

Co-Authored-By: Claude Opus 5 (Nous Research)
2026-08-16 09:25:07 +07:00

58 lines
1.4 KiB
TypeScript

"use client";
import { usePathname } from "next/navigation";
import { isActivePath, navItems } from "@/lib/navigation";
import { cn } from "@/lib/utils";
function NavItem({
href,
label,
active,
Icon,
}: {
href: string;
label: string;
active: boolean;
Icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;
}) {
return (
<a
href={href}
aria-label={label}
aria-current={active ? "page" : undefined}
className={cn(
"group relative flex size-11 items-center justify-center rounded-[13px] transition-all",
active
? "bg-signal/15 text-signal"
: "text-ink-faint hover:bg-white/5 hover:text-ink-soft",
)}
>
{active && (
<span className="absolute -left-3 h-6 w-1 rounded-full bg-signal shadow-[0_0_12px_var(--color-signal-glow)]" />
)}
<Icon className="size-[18px]" strokeWidth={active ? 2.4 : 2} />
</a>
);
}
export function NavRail() {
const pathname = usePathname();
const path = pathname ?? "/";
return (
<nav className="glass m-3 mr-0 flex w-[68px] flex-col items-center gap-1 rounded-[18px] py-4">
<div className="flex flex-1 flex-col gap-1">
{navItems.map((item) => (
<NavItem
key={item.href}
href={item.href}
label={item.label}
active={isActivePath(path, item.matchPrefix)}
Icon={item.icon}
/>
))}
</div>
</nav>
);
}