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