diff --git a/app/src/app/docs/layout.tsx b/app/src/app/docs/layout.tsx index aca029e..be47bed 100644 --- a/app/src/app/docs/layout.tsx +++ b/app/src/app/docs/layout.tsx @@ -1,29 +1,39 @@ -import { readdirSync } from "fs"; +import { readdir } from "fs/promises"; import { join } from "path"; import { IoDocumentText } from "react-icons/io5"; import { getMetadata } from "../../lib/getMetadata"; import { ListDisplay } from "./ListDisplay"; +export const dynamic = "force-static"; +export const dynamicParams = false; + export const metadata = getMetadata({ title: "Docs", pathName: "/docs", description: "Official documentation", }); -const DIR = "./src/app/docs"; +const DIR = "src/app/docs"; const sharedPadding = "py-8 lg:py-12 xl:py-16"; -export default function MdxLayout({ children }: { children: React.ReactNode }) { - const firstLevel = readdirSync(join(process.cwd(), DIR)).filter( +export default async function MdxLayout({ + children, +}: { + children: React.ReactNode; +}) { + const firstLevel = (await readdir(join(process.cwd(), DIR))).filter( (v) => !v.includes(".") ); - const slugs = firstLevel.map((category) => ({ - category, - pages: readdirSync(join(process.cwd(), DIR, category)).filter( - (v) => !v.includes(".") - ), - })); + const slugs = await Promise.all( + firstLevel.map(async (category) => ({ + category, + pages: ( + await readdir(join(process.cwd(), DIR, category)) + ).filter((v) => !v.includes(".")), + })) + ); + console.log(firstLevel, slugs); return (
diff --git a/app/src/app/layout.tsx b/app/src/app/layout.tsx index 1767814..9f98521 100644 --- a/app/src/app/layout.tsx +++ b/app/src/app/layout.tsx @@ -3,7 +3,6 @@ import { Roboto } from "next/font/google"; import { AppLayout } from "../components/AppLayout"; import { PageProgressBarProvider } from "../components/contexts/ProgressProvider"; import SessionProvider from "../components/contexts/SessionProvider"; -import { getServerSession } from "../lib/authoptions"; import { getMetadata } from "../lib/getMetadata"; import { TRPCProvider } from "../trpc/Provider"; import "./globals.css"; @@ -23,8 +22,6 @@ export default async function RootLayout({ }: { children: React.ReactNode; }) { - const session = await getServerSession(); - return ( - + - {children} + {children} diff --git a/app/src/components/AppLayout.tsx b/app/src/components/AppLayout.tsx index 2947add..9ea96b0 100644 --- a/app/src/components/AppLayout.tsx +++ b/app/src/components/AppLayout.tsx @@ -1,6 +1,5 @@ "use client"; -import { Session } from "next-auth"; import { FC, ReactNode, useState } from "react"; import { Footer } from "./basis/footer"; import { Nav } from "./basis/nav"; @@ -8,19 +7,17 @@ import { SideBar } from "./basis/sidebar"; interface AppLayoutProps { children: ReactNode; - session: Session | null; } const barsBG = "bg-primary-bg"; const barTransDuration = "duration-300"; -export const AppLayout: FC = ({ children, session }) => { +export const AppLayout: FC = ({ children }) => { const [sidebarOpen, setSidebarOpen] = useState(false); return (