Skip to main content

apps/web/components/top-nav.tsx

Metadata

Indexed Symbols

  • TopNav (line 17, function) - Implements top nav for module behavior.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

import Link from "next/link";
import type { Route } from "next";

type TopNavProps = {
workspaceId: string;
current: "console" | "ops" | "portal" | "admin";
returnToPath?: string;
};

const navItems: Array<{ id: TopNavProps["current"]; label: string; href: Route }> = [
{ id: "console", label: "Console", href: "/" },
{ id: "ops", label: "Ops", href: "/ops" },
{ id: "portal", label: "Portal", href: "/portal" },
{ id: "admin", label: "Admin Settings", href: "/admin/settings" }
];

export function TopNav({ workspaceId, current, returnToPath = "/" }: TopNavProps) {
const returnTo = `${returnToPath}${returnToPath.includes("?") ? "&" : "?"}workspaceId=${encodeURIComponent(workspaceId)}`;

return (
<nav className="flex flex-wrap items-center gap-2 text-sm">
{navItems.map((item) => {
const active = item.id === current;
return (
<Link