From 7e30950fed2133291ce977d0d0037b239fb957b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Sun, 28 Jul 2024 01:04:08 +0200 Subject: [PATCH] fix: render markdown --- assets/App.tsx | 14 ++++---------- assets/pages/TextPage.tsx | 17 ++++++++++++++--- {assets => public}/content/.gitignore | 0 webpack.config.js | 10 ---------- 4 files changed, 18 insertions(+), 23 deletions(-) rename {assets => public}/content/.gitignore (100%) diff --git a/assets/App.tsx b/assets/App.tsx index 1d06849..17947af 100644 --- a/assets/App.tsx +++ b/assets/App.tsx @@ -32,12 +32,6 @@ import ConnectorsPage from "./pages/tracking/ConnectorsPage"; import NotFoundPage from "./pages/NotFoundPage"; import {ItemType, MenuItemType} from "antd/lib/menu/interface"; -import tos from "./content/tos.md"; -import privacy from "./content/privacy.md"; -import home from './content/home.md' -import faq from './content/faq.md' - - export default function App() { const { token: {colorBgContainer, borderRadiusLG}, @@ -222,7 +216,7 @@ export default function App() { }/> - }/> + }/> }/> }/> @@ -236,9 +230,9 @@ export default function App() { }/> - }/> - }/> - }/> + }/> + }/> + }/> }/> diff --git a/assets/pages/TextPage.tsx b/assets/pages/TextPage.tsx index 54f215c..7355891 100644 --- a/assets/pages/TextPage.tsx +++ b/assets/pages/TextPage.tsx @@ -1,6 +1,17 @@ -import React from "react"; +import React, {useEffect, useState} from "react"; import snarkdown from "snarkdown" +import {Skeleton} from "antd"; +import axios from "axios"; -export default function TextPage({markdown}: { markdown: string }) { - return
+export default function TextPage({resource}: { resource: string }) { + const [markdown, setMarkdown] = useState() + + useEffect(() => { + console.log('heyyy') + axios.get('/content/' + resource).then(res => setMarkdown(res.data)) + }, [resource]) + + return + {markdown !== undefined &&
} +
} \ No newline at end of file diff --git a/assets/content/.gitignore b/public/content/.gitignore similarity index 100% rename from assets/content/.gitignore rename to public/content/.gitignore diff --git a/webpack.config.js b/webpack.config.js index fbba28d..e3d324f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -61,16 +61,6 @@ Encore // uncomment if you use React .enableReactPreset() - - .addLoader({ - test: /\.md$/, - use: [ - { - loader: "html-loader", - } - ], - }) - // uncomment to get integrity="..." attributes on your script & link tags // requires WebpackEncoreBundle 1.4 or higher //.enableIntegrityHashes(Encore.isProduction())