diff --git a/package-lock.json b/package-lock.json
index 5c0482a..ff9f6ae 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -29,7 +29,7 @@
"husky": "^9.0.11",
"lint-staged": "^15.2.5",
"prettier": "^3.2.5",
- "typescript": "5.4.5"
+ "typescript": "5.5.4"
}
},
"node_modules/@babel/runtime": {
@@ -4345,9 +4345,9 @@
}
},
"node_modules/typescript": {
- "version": "5.4.5",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
- "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
+ "version": "5.5.4",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
+ "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
diff --git a/package.json b/package.json
index 8eb4f12..e405286 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"husky": "^9.0.11",
"lint-staged": "^15.2.5",
"prettier": "^3.2.5",
- "typescript": "5.4.5"
+ "typescript": "5.5.4"
},
"lint-staged": {
"src/**/*.{ts,tsx}": "npm run lint:fix"
diff --git a/src/pages/advice/[pid].tsx b/src/pages/advice/[pid].tsx
new file mode 100644
index 0000000..5a30de6
--- /dev/null
+++ b/src/pages/advice/[pid].tsx
@@ -0,0 +1,29 @@
+import Markdown from 'react-markdown'
+import { promises as fs } from 'fs';
+import 'katex/dist/katex.min.css'
+
+
+
+
+export default function Article(props:any) {
+ return (
+ {props.article}
+ );
+}
+
+export async function getStaticProps({params}:{params:any}) {
+ const article = await fs.readFile("./src/markdown-pages/articles/"+params.pid, "utf8");
+ console.log(article)
+ return {props: {article}};
+
+ }
+
+ export async function getStaticPaths() {
+ let paths = (await fs.readdir("./src/markdown-pages/articles")).map(p => "/articles/"+p)
+ console.log("psths to render:", paths);
+ return { paths, fallback: true }
+
+ }
+
+
+
diff --git a/src/pages/advice/index.tsx b/src/pages/advice/index.tsx
new file mode 100644
index 0000000..4c60078
--- /dev/null
+++ b/src/pages/advice/index.tsx
@@ -0,0 +1,49 @@
+import ArticleListItem from "../../components/ArticleListItem";
+import { promises as fs } from 'fs';
+
+
+export default function ArticlesList(props: any) {
+ // eslint-disable-next-line react/prop-types
+ const {articles} = props;
+ return (
+ <>
+
+
+
+
+
+
+ {" "}
+ #{" "}
+ |
+ article Name |
+ Created Date |
+
+
+
+ {articles.map((article: any, index: any) => (
+
+ ))}
+
+
+
+
+ >
+ );
+}
+// This function gets called at build time on server-side.
+// It won't be called on client-side, so you can even do
+// direct database queries. See the "Technical details" section.
+export async function getStaticProps() {
+ return {props: {articles: await readDirectory("./src/markdown-pages/articles")}};
+}
+
+async function readDirectory(path: any) {
+ try {
+ // const data = await fs.readFile(path, 'utf8');
+ return await fs.readdir(path);
+
+ } catch (err) {
+ console.error(err);
+ }
+ }
\ No newline at end of file
diff --git a/src/pages/articles/index.tsx b/src/pages/articles/index.tsx
index 4c60078..d345dd5 100644
--- a/src/pages/articles/index.tsx
+++ b/src/pages/articles/index.tsx
@@ -35,7 +35,7 @@ export default function ArticlesList(props: any) {
// It won't be called on client-side, so you can even do
// direct database queries. See the "Technical details" section.
export async function getStaticProps() {
- return {props: {articles: await readDirectory("./src/markdown-pages/articles")}};
+ return {props: {articles: await readDirectory("./src/markdown-pages/advice")}};
}
async function readDirectory(path: any) {