From 1d34622b39b0a8f3acf5383a1e240bf489ae3ac0 Mon Sep 17 00:00:00 2001 From: Robin Schanbacher Date: Tue, 25 Aug 2026 11:54:10 +0200 Subject: [PATCH 1/4] feat: create wikiIndexPage --- app/wiki/page.tsx | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 app/wiki/page.tsx diff --git a/app/wiki/page.tsx b/app/wiki/page.tsx new file mode 100644 index 0000000..b1f514d --- /dev/null +++ b/app/wiki/page.tsx @@ -0,0 +1,7 @@ +export default function WikiIndexPage() { + return ( +
+

hi

+
+ ) +} \ No newline at end of file -- 2.54.1 From 675c046029c4196569d5aadc7b1d5e86d7277e1d Mon Sep 17 00:00:00 2001 From: Robin Schanbacher Date: Tue, 25 Aug 2026 12:34:47 +0200 Subject: [PATCH 2/4] feat: list all wikiPages on the index page --- app/wiki/page.tsx | 12 ++++++--- lib/wiki.ts | 69 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/app/wiki/page.tsx b/app/wiki/page.tsx index b1f514d..73ea2aa 100644 --- a/app/wiki/page.tsx +++ b/app/wiki/page.tsx @@ -1,7 +1,11 @@ +import Article from "@/components/wiki/Article"; +import { getAllWikiPages } from "@/lib/wiki"; + export default function WikiIndexPage() { + const allPages = getAllWikiPages(); return ( -
-

hi

-
- ) +
+

hi

+
+ ); } \ No newline at end of file diff --git a/lib/wiki.ts b/lib/wiki.ts index df5e4df..2313f46 100644 --- a/lib/wiki.ts +++ b/lib/wiki.ts @@ -11,6 +11,11 @@ export type WikiArticle = { updatedAt?: string; }; +export type WikiPage = { + title: string; + path: string; +} + const wikiDirectory = path.join(process.cwd(), "data/wiki/pages"); export async function getWikiPageBySlug(slug: string): Promise { @@ -32,23 +37,34 @@ export async function getWikiPageBySlug(slug: string): Promise { - const filePath = path.join(dirPath, file); - const stat = fs.statSync(filePath); + // withFileTypes: true spart zusätzliche fs.statSync Aufrufe + const entries = fs.readdirSync(dirPath, { withFileTypes: true }); - if (stat && stat.isDirectory()) { - results = results.concat(getAllTsFiles(filePath)); - } else if (filePath.endsWith('.ts') && !filePath.endsWith('.d.ts')) { - results.push(filePath); + for (const entry of entries) { + const fullPath = path.join(dirPath, entry.name); + + if (entry.isDirectory()) { + results = results.concat(getAllFiles(fullPath, targetExt)); + } else if (!targetExt || entry.name.endsWith(targetExt)) { + results.push(fullPath); } - }); + } return results; } @@ -149,7 +165,7 @@ export function filterMethods( export async function getAllApis(): Promise { try { const apiBasePath = path.join(process.cwd(), "app/api"); - const allTsFiles = getAllTsFiles(apiBasePath); + const allTsFiles = getAllFiles(apiBasePath, ".ts"); const routes: ApiRoute[] = []; allTsFiles.forEach((filePath) => { @@ -182,4 +198,31 @@ export async function getAllApis(): Promise { console.error("Fehler beim Auslesen der API-Dateien:", error); return []; } +} + +export async function getAllWikiPages(): Promise { + try { + const pagesBasePath = path.join(process.cwd(), "data/wiki/pages"); + const allPaths = getAllFiles(pagesBasePath, ".mdx"); + const allPages: WikiPage[] = []; + + for (const filePath of allPaths) { + // extract filename of the path (e. g. "test" at "data/wiki/pages/test.mdx") + const slug = path.parse(filePath).name; + + const wikiPage = await getWikiPageBySlug(slug); + + if (wikiPage) { + allPages.push({ + path: slug, + title: wikiPage.title, + }); + } + } + console.log(allPages); + return allPages; + } catch (error) { + console.error("Fehler beim Auslesen der Wiki-Seiten:", error); + return []; + } } \ No newline at end of file -- 2.54.1 From 96108847032781303a46f4dec5e4534249fc199d Mon Sep 17 00:00:00 2001 From: Robin Schanbacher Date: Tue, 25 Aug 2026 12:35:28 +0200 Subject: [PATCH 3/4] previous --- app/wiki/page.tsx | 13 ++++++++++--- data/wiki/pages/test.mdx | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/wiki/page.tsx b/app/wiki/page.tsx index 73ea2aa..ec626ca 100644 --- a/app/wiki/page.tsx +++ b/app/wiki/page.tsx @@ -1,11 +1,18 @@ import Article from "@/components/wiki/Article"; import { getAllWikiPages } from "@/lib/wiki"; -export default function WikiIndexPage() { - const allPages = getAllWikiPages(); +export default async function WikiIndexPage() { + const allPages = await getAllWikiPages(); return (
-

hi

+ {allPages.map(({ title, path }) => ( + <> + + {title} + +
+ + ))}
); } \ No newline at end of file diff --git a/data/wiki/pages/test.mdx b/data/wiki/pages/test.mdx index 7b4b6fc..ca02016 100644 --- a/data/wiki/pages/test.mdx +++ b/data/wiki/pages/test.mdx @@ -1,5 +1,5 @@ --- -title: Projekt Starten +title: Test Page updatedAt: "2026-08-04" --- -- 2.54.1 From ee6169d94835ab1b3d0c51d88fb213d1781dfedb Mon Sep 17 00:00:00 2001 From: Robin Schanbacher Date: Wed, 26 Aug 2026 14:46:22 +0200 Subject: [PATCH 4/4] fix: small issue --- app/wiki/page.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/wiki/page.tsx b/app/wiki/page.tsx index ec626ca..b479453 100644 --- a/app/wiki/page.tsx +++ b/app/wiki/page.tsx @@ -5,14 +5,13 @@ export default async function WikiIndexPage() { const allPages = await getAllWikiPages(); return ( ); } \ No newline at end of file -- 2.54.1