47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
// components/PortalTabs.tsx
|
|
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { usePathname } from "next/navigation";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
const tabs = [
|
|
{ href: "/portal", label: "Home" },
|
|
{ href: "/portal/rigs", label: "Rigs" },
|
|
{ href: "/portal/laser-settings", label: "Laser Settings" },
|
|
{ href: "/portal/laser-sources", label: "Laser Sources" },
|
|
{ href: "/portal/materials", label: "Materials" },
|
|
{ href: "/portal/projects", label: "Projects" },
|
|
{ href: "/portal/buying-guide", label: "Buying Guide" }, // ⬅️ NEW
|
|
{ href: "/portal/utilities", label: "Utilities" },
|
|
{ href: "/portal/account", label: "Account" },
|
|
];
|
|
|
|
export default function PortalTabs() {
|
|
const pathname = usePathname() || "/portal";
|
|
|
|
return (
|
|
<nav className="flex flex-wrap items-center gap-1 rounded-md border bg-background p-1">
|
|
{tabs.map((t) => {
|
|
const active =
|
|
pathname === t.href ||
|
|
(t.href !== "/portal" && pathname.startsWith(t.href));
|
|
|
|
return (
|
|
<Link
|
|
key={t.href}
|
|
href={t.href}
|
|
className={cn(
|
|
"px-3 py-1.5 text-sm rounded-md transition",
|
|
active ? "bg-primary text-primary-foreground" : "hover:bg-muted"
|
|
)}
|
|
>
|
|
{t.label}
|
|
</Link>
|
|
);
|
|
})}
|
|
|
|
<div className="ml-auto px-3 py-1.5 text-xs opacity-60">MakerDash</div>
|
|
</nav>
|
|
);
|
|
}
|