From 7c94672d1268798ff23a6a8398043839d28b1465 Mon Sep 17 00:00:00 2001 From: Pico2x Date: Fri, 23 Sep 2022 15:08:57 -0400 Subject: [PATCH] Show "Add Post" button only to users --- web/pages/group/[...slugs]/index.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/web/pages/group/[...slugs]/index.tsx b/web/pages/group/[...slugs]/index.tsx index d6c8d38c..b5a28299 100644 --- a/web/pages/group/[...slugs]/index.tsx +++ b/web/pages/group/[...slugs]/index.tsx @@ -448,6 +448,7 @@ function GroupLeaderboard(props: { function GroupPosts(props: { posts: Post[]; group: Group }) { const { posts, group } = props const [showCreatePost, setShowCreatePost] = useState(false) + const user = useUser() const createPost = @@ -458,12 +459,14 @@ function GroupPosts(props: { posts: Post[]; group: Group }) { </Col> <Col> - <Button - className="btn-md" - onClick={() => setShowCreatePost(!showCreatePost)} - > - Add a Post - </Button> + {user && ( + <Button + className="btn-md" + onClick={() => setShowCreatePost(!showCreatePost)} + > + Add a Post + </Button> + )} </Col> </Row>