| 1 | "use client"; |
| 2 | |
| 3 | import Link from "next/link"; |
| 4 | import { useParams } from "next/navigation"; |
| 5 | import { CollabLogo } from "@/app/components/collab-logo"; |
| 6 | import { NavBar } from "@/app/components/ui/navbar"; |
| 7 | import { CollabNavActionsSlot } from "./collab-nav-actions"; |
| 8 | import { useAppSwitcherItems } from "@/lib/use-app-switcher"; |
| 9 | |
| 10 | export function CollabNav() { |
| 11 | const params = useParams<{ owner?: string; repo?: string }>(); |
| 12 | const owner = params?.owner; |
| 13 | const repo = params?.repo; |
| 14 | const appSwitcherItems = useAppSwitcherItems("collab", { owner, repo }); |
| 15 | |
| 16 | return ( |
| 17 | <NavBar |
| 18 | logo={<CollabLogo size={28} />} |
| 19 | appSwitcherItems={appSwitcherItems} |
| 20 | productName="Collab" |
| 21 | showProductName={!owner} |
| 22 | breadcrumbs={ |
| 23 | <> |
| 24 | {owner && ( |
| 25 | <> |
| 26 | <span style={{ color: "var(--text-faint)" }}>/</span> |
| 27 | <Link |
| 28 | href={`/${owner}`} |
| 29 | className="hover:underline truncate" |
| 30 | style={{ color: "var(--text-muted)" }} |
| 31 | > |
| 32 | {owner} |
| 33 | </Link> |
| 34 | </> |
| 35 | )} |
| 36 | {owner && repo && ( |
| 37 | <> |
| 38 | <span style={{ color: "var(--text-faint)" }}>/</span> |
| 39 | <span className="truncate" style={{ color: "var(--text-primary)" }}> |
| 40 | {repo} |
| 41 | </span> |
| 42 | </> |
| 43 | )} |
| 44 | </> |
| 45 | } |
| 46 | actions={<CollabNavActionsSlot />} |
| 47 | /> |
| 48 | ); |
| 49 | } |
| 50 | |