diff --git a/website/src/app/(v2)/[section]/[[...page]]/components/subnav.tsx b/website/src/app/(v2)/[section]/[[...page]]/components/subnav.tsx new file mode 100644 index 0000000000..f27f8cd981 --- /dev/null +++ b/website/src/app/(v2)/[section]/[[...page]]/components/subnav.tsx @@ -0,0 +1,32 @@ +import { findPageForHref } from "@/lib/sitemap"; +import { sitemap } from "@/sitemap/mod"; +import { Button } from "@rivet-gg/components"; +import Link from "next/link"; + +export function Subnav({ path }: { path: string }) { + + return ( +
+ {sitemap.map((tab, i) => { + const isActive = findPageForHref(path, tab); + return ( + + ); + })} +
+ ); +} diff --git a/website/src/app/(v2)/[section]/[[...page]]/layout.tsx b/website/src/app/(v2)/[section]/[[...page]]/layout.tsx index d93586f18d..86856e16a0 100644 --- a/website/src/app/(v2)/[section]/[[...page]]/layout.tsx +++ b/website/src/app/(v2)/[section]/[[...page]]/layout.tsx @@ -1,40 +1,11 @@ import { Header } from "@/components/v2/Header"; -import { findActiveTab, findPageForHref, Sitemap } from "@/lib/sitemap"; +import { findActiveTab, type Sitemap } from "@/lib/sitemap"; import { sitemap } from "@/sitemap/mod"; -import { Button } from "@rivet-gg/components"; -import Link from "next/link"; import type { CSSProperties } from "react"; import { buildFullPath, buildPathComponents } from "./util"; import { NavigationStateProvider } from "@/providers/NavigationStateProvider"; import { Tree } from "@/components/DocsNavigation"; - -function Subnav({ path }: { path: string[] }) { - const fullPath = buildFullPath(path); - return ( -
- {sitemap.map((tab, i) => { - const isActive = findPageForHref(fullPath, tab); - return ( - - ); - })} -
- ); -} +import { Subnav } from "./components/subnav"; export default function Layout({ params: { section, page }, children }) { const path = buildPathComponents(section, page); @@ -45,7 +16,7 @@ export default function Layout({ params: { section, page }, children }) {
} + subnav={} variant="full-width" mobileSidebar={ foundTab?.tab.sidebar ? ( diff --git a/website/src/app/(v2)/[section]/[[...page]]/page.tsx b/website/src/app/(v2)/[section]/[[...page]]/page.tsx index d6505d2f84..e8b9431abc 100644 --- a/website/src/app/(v2)/[section]/[[...page]]/page.tsx +++ b/website/src/app/(v2)/[section]/[[...page]]/page.tsx @@ -13,7 +13,7 @@ import { faPencil, Icon } from "@rivet-gg/icons"; import clsx from "clsx"; import type { Metadata } from "next"; import { notFound } from "next/navigation"; -import { Comments } from "@/components/Comments"; +import { CommentsWrapper } from "@/components/CommentsWrapper"; import { DocsNavigation } from "@/components/DocsNavigation"; import { DocsPageDropdown } from "@/components/DocsPageDropdown"; import { DocsTableOfContents } from "@/components/DocsTableOfContents"; @@ -71,9 +71,9 @@ async function loadContent(path: string[]) { export async function generateMetadata({ params, }: { - params: { section: string; page?: string[] }; + params: Promise<{ section: string; page?: string[] }>; }): Promise { - const { section, page } = params; + const { section, page } = await params; const path = buildPathComponents(section, page); const { component: { title, description }, @@ -92,10 +92,11 @@ export async function generateMetadata({ } export default async function CatchAllCorePage({ - params: { section, page }, + params, }: { - params: { section: string; page?: string[] }; + params: Promise<{ section: string; page?: string[] }>; }) { + const { section, page } = await params; if (!VALID_SECTIONS.includes(section)) { return notFound(); } @@ -165,7 +166,7 @@ export default async function CatchAllCorePage({ Suggest changes to this page - + {tableOfContents && (