From 3f13bbdd199f810a13d8c836a10cb9e92d2a0559 Mon Sep 17 00:00:00 2001 From: Pete-Gerlach Date: Fri, 14 Jun 2024 16:27:02 +0200 Subject: [PATCH] show anonymousID in Posts and Comments --- src/App.js | 2 +- src/components/Post.js | 60 +++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/App.js b/src/App.js index 5b49d6f..ef5a1ae 100644 --- a/src/App.js +++ b/src/App.js @@ -23,7 +23,7 @@ const App = () => { if(selectedPost) { selectPost(posts.find(post => post.id === selectedPost.id)); } - }, [posts]); + }, [posts, selectedPost]); const reload = async () => { diff --git a/src/components/Post.js b/src/components/Post.js index 634a330..f60880e 100644 --- a/src/components/Post.js +++ b/src/components/Post.js @@ -7,7 +7,6 @@ import { faAngleUp, faAngleDown } from '@fortawesome/free-solid-svg-icons'; -import {faMessage} from "@fortawesome/free-solid-svg-icons/faMessage"; import {postApi} from "../api/posts.api"; const Post = ({ post, recursionDepth, selectPost, reload }) => { @@ -45,7 +44,10 @@ const Post = ({ post, recursionDepth, selectPost, reload }) => {
{if (!(click.target instanceof HTMLButtonElement)) setShowComments(!showComments)}}>
{post.id === post.parent &&
-

{post.title}

+

{post.title} von {post.anonymousID}

+
} + {post.id !== post.parent &&
+

Kommentar von {post.anonymousID}

}

{post.content}

@@ -57,37 +59,35 @@ const Post = ({ post, recursionDepth, selectPost, reload }) => {
}
- {post.date.slice(8, 10) + "." + post.date.slice(5, 7) + "." + post.date.slice(0, 4)} -
-
-
- - {post.reactions.positive - post.reactions.negative} - -
-
- {recursionDepth !== 0 && } + {post.date.slice(8, 10) + "." + post.date.slice(5, 7) + "." + post.date.slice(0, 4)}
-
-
- {recursionDepth !== 0 && showComments && post.comments.map(post => )} +
+
+ + {post.reactions.positive - post.reactions.negative} + +
+
+ {recursionDepth !== 0 && }
- ) - ; +
+ {recursionDepth !== 0 && showComments && post.comments.map(post => + + )} +
+ + ); }; export default Post;