diff --git a/src/app/(app)/guide/PointGuide.tsx b/src/app/(app)/guide/PointGuide.tsx index 7d74b75..36869d4 100644 --- a/src/app/(app)/guide/PointGuide.tsx +++ b/src/app/(app)/guide/PointGuide.tsx @@ -20,10 +20,10 @@ const tableData = [ bonus: "0 pts after 400mg caffeine", }, { - drink: "Earl Grey Tea", + drink: "Tea", volume: "8", caffeine: "55", - sugar: "0", + sugar: "?", points: "50", bonus: "0 pts after 400mg caffeine", }, diff --git a/src/app/(app)/posts/page.tsx b/src/app/(app)/posts/page.tsx new file mode 100644 index 0000000..fd62a42 --- /dev/null +++ b/src/app/(app)/posts/page.tsx @@ -0,0 +1,116 @@ +"use client"; + +import { useDevice } from "@/lib/context/DeviceContext"; +import React, { useEffect, useState } from "react"; + +export default function PostsPage() { + const [postText, setPostText] = useState(""); + const [posts, setPosts] = useState([]); // type of post?? + const { isAuthenticated, session } = useDevice(); + + useEffect(() => { + if (isAuthenticated && session?.username) { + fetch(`/api/user/${session.username}`) + .then((res) => res.json()) + } + }, [isAuthenticated, session?.username]); + + const handlePostSubmit = (e: React.FormEvent) => { + e.preventDefault(); + const newPost = { + text: postText, + date: new Date().toLocaleString(), + likes: 0, + warnings: 0, + imageUrl: "", // placeholder for image logic + }; + setPosts([newPost, ...posts]); + setPostText(""); + }; + + const handleLike = (index: number) => { + const updatedPosts = [...posts]; + updatedPosts[index].likes += 1; + setPosts(updatedPosts); + }; + + const handleWarning = (index: number) => { + const updatedPosts = [...posts]; + updatedPosts[index].warnings += 1; + setPosts(updatedPosts); + }; + + return ( +
+
+

+ Posts +

+
+ +
+
+