diff --git a/Frontend/docs/player/bob.md b/Frontend/docs/player/query.md similarity index 75% rename from Frontend/docs/player/bob.md rename to Frontend/docs/player/query.md index 8c48765..4a3590d 100644 --- a/Frontend/docs/player/bob.md +++ b/Frontend/docs/player/query.md @@ -1,5 +1,5 @@ --- -title: 'option utinam malorum tempor sapien.' +title: 'Query a player' published: '04-19-2024' summary: 'utinam delicata nominavi ornare eirmod pharetra decore interesset necessitatibus.' --- diff --git a/Frontend/src/app/(pages)/docs/[[...slug]]/layout.tsx b/Frontend/src/app/(pages)/docs/[[...slug]]/layout.tsx new file mode 100644 index 0000000..f20181f --- /dev/null +++ b/Frontend/src/app/(pages)/docs/[[...slug]]/layout.tsx @@ -0,0 +1,34 @@ +import { ReactElement, ReactNode } from "react"; +import Sidebar from "@/components/docs/sidebar"; + +/** + * Force the layout to be static. + */ +export const dynamic = "force-static"; + +/** + * The layout for the docs page. + * + * @param children the children of this layout + * @returns the layout jsx + */ +const DocumentationLayout = ({ + params, + children, +}: Readonly<{ + params: any; + children: ReactNode; +}>): ReactElement => { + const activeSlug: string = ((params.slug as string[]) || undefined)?.join( + "/" + ); // The active slug of this page + return ( +
+
+ + {children} +
+
+ ); +}; +export default DocumentationLayout; diff --git a/Frontend/src/app/(pages)/docs/layout.tsx b/Frontend/src/app/(pages)/docs/layout.tsx deleted file mode 100644 index b1caec2..0000000 --- a/Frontend/src/app/(pages)/docs/layout.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { ReactElement, ReactNode } from "react"; -import Sidebar from "@/components/docs/sidebar"; - -/** - * Force the layout to be static. - */ -export const dynamic = "force-static"; - -/** - * The layout for the docs page. - * - * @param children the children of this layout - * @returns the layout jsx - */ -const DocumentationLayout = ({ - children, -}: Readonly<{ - children: ReactNode; -}>): ReactElement => ( -
-
- - {children} -
-
-); -export default DocumentationLayout; diff --git a/Frontend/src/app/components/docs/sidebar.tsx b/Frontend/src/app/components/docs/sidebar.tsx index 1c5bc97..72611ca 100644 --- a/Frontend/src/app/components/docs/sidebar.tsx +++ b/Frontend/src/app/components/docs/sidebar.tsx @@ -1,35 +1,85 @@ import { ReactElement } from "react"; import { Input } from "@/components/ui/input"; import { getDocsContent } from "@/lib/mdxUtils"; +import Link from "next/link"; +import { cn } from "@/lib/utils"; +import { capitalize } from "@/lib/stringUtils"; +import { minecrafter } from "@/font/fonts"; /** * The sidebar for the docs page. * * @returns the sidebar jsx */ -const Sidebar = (): ReactElement => ( -
-
- {/* Search */} - +const Sidebar = ({ activeSlug }: { activeSlug: string }): ReactElement => { + const groupedContent: Record = {}; + for (let content of getDocsContent()) { + const categoryKey: string = content.slug?.split("/")[0] || "home"; // The key of the category + if (!groupedContent[categoryKey]) { + groupedContent[categoryKey] = []; + } + groupedContent[categoryKey].push(content); + } + return ( +
+
+ {/* Search */} + - {/* Links */} -
- {getDocsContent().map( - ( - content: DocsContentMetadata, - index: number - ): ReactElement => ( -
{content.title}
- ) - )} + {/* Links */} +
+ {Object.entries(groupedContent).map( + ( + [category, categoryContent]: [ + string, + DocsContentMetadata[], + ], + index: number + ): ReactElement => ( +
+ {/* Category */} +

+ {capitalize(category)} +

+ + {/* Links */} +
+ {categoryContent.map( + (content, contentIndex) => ( + + {content.title} + + ) + )} +
+
+ ) + )} +
-
-); + ); +}; export default Sidebar;