mirror of
https://github.com/DerTyp7/explainegy-nextjs.git
synced 2025-10-29 04:42:12 +01:00
removed pg
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -19,6 +19,8 @@
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
|
||||
@@ -56,7 +56,7 @@ export default function Nav() {
|
||||
alt="Nav bar logo"
|
||||
/>
|
||||
<div className={styles.links}>
|
||||
<Link href={"/tutorials"}>Tutorials</Link>
|
||||
<Link href={"/articles/tutorials"}>Tutorials</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.containerCenter}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import prisma from "../../../lib/prisma";
|
||||
import styles from "../../../styles/TutorialContentTable.module.scss";
|
||||
import prisma from "../../../../lib/prisma";
|
||||
import styles from "../../../../styles/TutorialContentTable.module.scss";
|
||||
import { Article, ContentTableEntry } from "@prisma/client";
|
||||
|
||||
export default function ContentTable({
|
||||
@@ -3,7 +3,7 @@ import React from "react";
|
||||
import { useEffect } from "react";
|
||||
|
||||
import Prism from "prismjs";
|
||||
import "../../../styles/prism_themes/prism-one-dark.css";
|
||||
import "../../../../styles/prism_themes/prism-one-dark.css";
|
||||
//import "../../../styles/prism_themes/prism-one-light.css";
|
||||
|
||||
export default function LoadMarkdown() {
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import styles from "../../../styles/Sidebar.module.scss";
|
||||
import styles from "../../../../styles/Sidebar.module.scss";
|
||||
export default function Sidebar() {
|
||||
return (
|
||||
<div className={styles.sidebar}>
|
||||
@@ -4,7 +4,7 @@ import { GetArticle } from "./page";
|
||||
export default async function Head({
|
||||
params,
|
||||
}: {
|
||||
params: { articleName: string };
|
||||
params: { articleName: string; categoryName: string };
|
||||
}) {
|
||||
const articleName: string = params.articleName;
|
||||
const article: Article = await GetArticle(articleName);
|
||||
@@ -1,4 +1,4 @@
|
||||
import "../../../styles/markdown.scss";
|
||||
import "../../../../styles/markdown.scss";
|
||||
export default function Layout({ children }) {
|
||||
return <div>{children}</div>;
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import { marked } from "marked";
|
||||
import ContentTable from "./ContentTable";
|
||||
import Sidebar from "./Sidebar";
|
||||
import styles from "../../../styles/Tutorial.module.scss";
|
||||
import styles from "../../../../styles/Tutorial.module.scss";
|
||||
import LoadMarkdown from "./LoadMarkdown";
|
||||
import prisma from "../../../lib/prisma";
|
||||
import { Article, ContentTableEntry } from "@prisma/client";
|
||||
import prisma from "../../../../lib/prisma";
|
||||
import { Article, Category, ContentTableEntry } from "@prisma/client";
|
||||
|
||||
export async function GetContentTableEntries(
|
||||
article: Article
|
||||
@@ -35,7 +35,7 @@ function ParseMarkdown(markdown: string): string {
|
||||
export default async function Tutorial({
|
||||
params,
|
||||
}: {
|
||||
params: { articleName: string };
|
||||
params: { articleName: string; categoryName: string };
|
||||
}) {
|
||||
const articleName: string = params.articleName;
|
||||
const article: Article = await GetArticle(articleName);
|
||||
@@ -67,7 +67,14 @@ export default async function Tutorial({
|
||||
export async function generateStaticParams() {
|
||||
const articles = await prisma.article.findMany();
|
||||
|
||||
return articles.map((article) => ({
|
||||
articleName: article.name ?? "",
|
||||
}));
|
||||
async function GetCategory(categoryId: number): Promise<Category> {
|
||||
return await prisma.category.findUnique({ where: { id: categoryId } });
|
||||
}
|
||||
|
||||
return await Promise.all(
|
||||
articles.map(async (article) => ({
|
||||
categoryName: (await GetCategory(article.categoryId)).name ?? "",
|
||||
articleName: article.name ?? "",
|
||||
}))
|
||||
);
|
||||
}
|
||||
3
app/articles/[categoryName]/page.tsx
Normal file
3
app/articles/[categoryName]/page.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function Category() {
|
||||
return <h1>List all articles in a category</h1>;
|
||||
}
|
||||
3
app/articles/page.tsx
Normal file
3
app/articles/page.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function Article() {
|
||||
return <h1>List all article</h1>;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export default function Tutorials() {
|
||||
return <h1>List all tutorials</h1>;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
15
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user