-
Trending
+
+
+
+ Ask an answer question
+ with Forum
+
+
+ Start today
+
+
+
+
+
+
+ Talk about your
+
+ favorite topics
+
+
+ Start now
+ *An account is required.
+
+
+
+
+
{quotes[currentQuoteIndex]["author"]}
+
+
+
+ {/*
*/}
+
+
+
+
Hot topics
+
+
+
{
+ window.location.href = '/topic/2';
+ }}
+ >
+ Topic 1
{/* TODO: make it update with the latest topic */}
+
+
{
+ window.location.href = '/topic/2';
+ }}
+ >
+ Topic 2
{/* TODO: make it update with the latest topic */}
+
+
+
+
+
+
+ Customise{' '}
+
+ your
+ {' '}
+
+ experience
+
+
With themes
+
+ {
+ setSelectedTheme('black');
+ }}
+ >
+ {
+ setSelectedTheme('white');
+ }}
+ >
+ {
+ setSelectedTheme('brand');
+ }}
+ >
+ {
+ setSelectedTheme('cozy');
+ }}
+ >
+
+
+
+
);
}
diff --git a/src/app/post/[slug]/Comment.module.scss b/src/app/post/[slug]/Comment.module.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/post/[slug]/Comment.tsx b/src/app/post/[slug]/Comment.tsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/post/[slug]/page.module.scss b/src/app/post/[slug]/page.module.scss
new file mode 100644
index 0000000..bd209ae
--- /dev/null
+++ b/src/app/post/[slug]/page.module.scss
@@ -0,0 +1,103 @@
+.main{
+ height: 100vh;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+
+ .wrapper{
+ display: flex;
+ flex-direction: column;
+ background-color: var(--off-white);
+ border-radius: 16px;
+
+ .loading{
+ font-size: 10rem;
+ }
+
+ .topinfo{
+ width: 1200px;
+ margin-left: 10px;
+ margin-top: 15px;
+
+ h1{
+ font-size: 3rem;
+ font-weight: bold;
+ color: var(--black);
+ }
+
+ .metadata{
+ display: flex;
+ align-items: center;
+
+ .author{
+ font-size: 1.5rem;
+ color: var(--brand);
+ font-weight: 600;
+ }
+
+ p{
+ margin-right: 15px;
+ }
+ }
+
+ p{
+ font-size: 1.2rem;
+ color: var(--black);
+ }
+ }
+
+ .content{
+ margin-top: 15px;
+ margin-left: 10px;
+ margin-right: 10px;
+ margin-bottom: 15px;
+
+ pre{
+ font-size: 1.4rem;
+ color: var(--black);
+ line-height: 1.5;
+ max-width: 1150px;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+ overflow: auto;
+ }
+ }
+
+ .bottominfo{
+ margin-left: 10px;
+ margin-right: 10px;
+ margin-bottom: 15px;
+
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+
+ .button {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ margin: 4rem 0 2rem;
+ background-color: var(--brand);
+ border-radius: 8px;
+ border: none;
+
+ p{
+ font-size: 1.3rem;
+ color: var(--black);
+ }
+ }
+
+ .button:hover{
+ //chance cursor
+ cursor: pointer;
+ //change color
+ background-color: var(--brand-dark);
+ }
+ }
+
+ .comments{
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/app/post/[slug]/page.tsx b/src/app/post/[slug]/page.tsx
new file mode 100644
index 0000000..6e0f9d1
--- /dev/null
+++ b/src/app/post/[slug]/page.tsx
@@ -0,0 +1,111 @@
+'use client'
+import Link from 'next/link';
+import styles from './page.module.scss';
+import { useState, useEffect } from 'react';
+
+type Post = {
+ title: string;
+ author: string;
+ comments: [];
+ likes: number;
+ saves: number;
+ content: string;
+ category: string;
+ date: string;
+ viewcount: number;
+};
+
+export default function Page({ params }: { params: { slug: string } }) {
+
+ //fetch the data
+ const [post, setPost] = useState
({ title: '', author: '', comments: [], likes: 0, saves: 0, content: '', category: '', date: '', viewcount: 0 });
+ const [loading, setLoading] = useState(true);
+ useEffect(() => {
+ async function fetchPostsCategory() {
+ try {
+ const response = await fetch('/api/post/' + params.slug);
+ if (!response.ok) {
+ throw new Error('Failed to fetch categories');
+ }
+ const data = await response.json();
+ setPost(data['post'][0]);
+ setLoading(false); // Set loading to false once data is fetched
+ } catch (error) {
+ console.error('Error fetching categories:', error);
+ }
+ }
+
+ fetchPostsCategory();
+ }, []);
+
+ async function likePost() {
+ try {
+ const response = await fetch('/api/post/like/' + params.slug, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({}),
+ });
+ if (!response.ok) {
+ throw new Error('Failed to like post');
+ }
+ const data = await response.json();
+
+ //set post likes to data.likes
+ setPost({ ...post, likes: data.likes });
+ } catch (error) {
+ console.error('Error liking post:', error);
+ }
+ }
+
+ async function savePost() {
+ try {
+ const response = await fetch('/api/post/save/' + params.slug , {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({}),
+ });
+ if (!response.ok) {
+ throw new Error('Failed to save post');
+ }
+ const data = await response.json();
+ setPost({ ...post, saves: data.saves });
+ } catch (error) {
+ console.error('Error saving post:', error);
+ }
+ }
+
+ return (
+
+
+ {loading ? (
+
Loading...
+ ) : (
+
+
+
{post.title}
+
+
{post.author}
+
created on: {post.date}
+
{post.viewcount} views
+
+
+
+
{post.content} to see how good it is
+
+
+
+
+
+
+
+
+
+ )}
+
+
+ );
+}
diff --git a/src/app/register/page.tsx b/src/app/register/page.tsx
index c4aa4b2..a0243a6 100644
--- a/src/app/register/page.tsx
+++ b/src/app/register/page.tsx
@@ -12,7 +12,7 @@ export const metadata: Metadata = {
openGraph: {
...openGraphMetadata,
title: 'Create an account',
- url: 'https://quiztimes.nl/register',
+ url: 'https://Forum.nl/register',
},
};
diff --git a/src/styles/_colors.scss b/src/styles/_colors.scss
index 5225f92..af55770 100644
--- a/src/styles/_colors.scss
+++ b/src/styles/_colors.scss
@@ -4,6 +4,8 @@
$colors: (
brand: hsl(237, 100%, 70%),
+ brand-dark: hsl(237, 100%, 60%),
+ brand-light: hsl(237, 100%, 80%),
white: hsl(0, 0%, 100%),
off-white: hsl(0, 0%, 96%),
gray: hsl(0, 0%, 50%),