From b3c375d26d6029b0cb1588d040d204cd3af8cfb6 Mon Sep 17 00:00:00 2001 From: repi Date: Mon, 1 Jan 2001 00:00:00 +0000 Subject: [PATCH] feat: add docs viewer page --- apps/web/src/app/docs/[id]/page.tsx | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 apps/web/src/app/docs/[id]/page.tsx diff --git a/apps/web/src/app/docs/[id]/page.tsx b/apps/web/src/app/docs/[id]/page.tsx new file mode 100644 index 0000000..2601358 --- /dev/null +++ b/apps/web/src/app/docs/[id]/page.tsx @@ -0,0 +1,54 @@ +import type { GeneratedDocs } from "@codeboard/shared"; +import { notFound } from "next/navigation"; +import { Github, ArrowLeft } from "lucide-react"; +import Link from "next/link"; + +async function fetchDocs(id: string): Promise { + try { + const baseUrl = process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000"; + const response = await fetch(`${baseUrl}/api/docs/${id}`, { + cache: "no-store", + }); + + if (!response.ok) { + return null; + } + + return response.json(); + } catch { + return null; + } +} + +export default async function DocsPage({ + params, +}: { + params: { id: string }; +}) { + const docs = await fetchDocs(params.id); + + if (!docs) { + notFound(); + } + + return ( +
+
+
+
+

+ Analyzing Repository +

+

+ {docs.repoName || repoUrl || "Unknown repository"} +

+
+ +
+ +
+
+
+
+ ); +}