apps/web/components/top-nav.tsx
Metadata
- Purpose: Reusable frontend UI component used by web routes.
- Domain:
applications - Language:
tsx - Bytes: 1739
- Lines: 48
- Content hash (short):
8f8d3c96 - Source (start): apps/web/components/top-nav.tsx:1
- Source (end): apps/web/components/top-nav.tsx:48
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