From 4aaad48b245f6478c2a52eef2421571de30bd471 Mon Sep 17 00:00:00 2001 From: MacRimi <123239993+MacRimi@users.noreply.github.com> Date: Sat, 15 Feb 2025 11:54:33 +0100 Subject: [PATCH] Update page.tsx --- web/app/guides/[slug]/page.tsx | 49 +++------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/web/app/guides/[slug]/page.tsx b/web/app/guides/[slug]/page.tsx index 5ba3862..c44fd05 100644 --- a/web/app/guides/[slug]/page.tsx +++ b/web/app/guides/[slug]/page.tsx @@ -1,11 +1,8 @@ -"use client" - -import { useState, useEffect } from "react" import fs from "fs" import path from "path" import { remark } from "remark" import html from "remark-html" -import CopyableCode from "@/components/CopyableCode" +import GuideContent from "./GuideContent" const guidesDirectory = path.join(process.cwd(), "..", "guides") @@ -38,50 +35,12 @@ export async function generateStaticParams() { } } -function processContent(content: string) { - const codeBlockRegex = /
([\s\S]*?)<\/code><\/pre>/g
-  return content.replace(codeBlockRegex, (match, code) => {
-    return ``
-  })
-}
-
-export default function GuidePage({ params }: { params: { slug: string } }) {
-  const [guideContent, setGuideContent] = useState("")
-
-  useEffect(() => {
-    async function fetchContent() {
-      const content = await getGuideContent(params.slug)
-      setGuideContent(processContent(content))
-    }
-    fetchContent()
-  }, [params.slug])
-
-  useEffect(() => {
-    const placeholders = document.querySelectorAll("CopyableCodePlaceholder")
-    placeholders.forEach((placeholder, index) => {
-      // Added index for key
-      const code = decodeURIComponent(placeholder.getAttribute("code") || "")
-      const codeElement =  // Added key prop
-      placeholder.replaceWith(codeElement)
-    })
-  }, []) // Removed guideContent from dependencies
+export default async function GuidePage({ params }: { params: { slug: string } }) {
+  const guideContent = await getGuideContent(params.slug)
 
   return (
     
-
+
) } -