From 4832c4654880295d30680250795960f07085e735 Mon Sep 17 00:00:00 2001 From: enes Date: Wed, 15 Jan 2025 19:32:06 +0100 Subject: [PATCH] fix(report): available only to logged in users Closes #179 --- src/pages/blog/index.tsx | 35 ++++++++++++++++++--------------- src/pages/mod/index.tsx | 39 ++++++++++++++++++++----------------- src/pages/profile/index.tsx | 35 ++++++++++++++++++--------------- 3 files changed, 59 insertions(+), 50 deletions(-) diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx index 836ad7b..60927ff 100644 --- a/src/pages/blog/index.tsx +++ b/src/pages/blog/index.tsx @@ -35,6 +35,7 @@ export const BlogPage = () => { const isAdmin = userState.user?.npub && userState.user.npub === import.meta.env.VITE_REPORTING_NPUB + const isLoggedIn = userState.auth && userState.user?.pubkey !== 'undefined' const navigation = useNavigation() const [commentCount, setCommentCount] = useState(0) @@ -172,23 +173,25 @@ export const BlogPage = () => { Share - setShowReportPopUp(Date.now())} - > - setShowReportPopUp(Date.now())} > - - - Report - + + + + Report + + )} { const { mod, isAddedToNSFW, isBlocked, isRepost } = useLoaderData() as ModPageLoaderResult const userState = useAppSelector((state) => state.user) + const isLoggedIn = userState.auth && userState.user?.pubkey !== 'undefined' const [showReportPopUp, setShowReportPopUp] = useState() useBodyScrollDisable(!!showReportPopUp) @@ -336,25 +337,27 @@ const Game = () => { Share - { - setShowReportPopUp(Date.now()) - }} - > - { + setShowReportPopUp(Date.now()) + }} > - - - Report - + + + + Report + + )} { const displayName = profile?.displayName || profile?.name || '[name not set up]' const [showReportPopUp, setShowReportPopUp] = useState(false) + const isLoggedIn = userState.auth && userState.user?.pubkey !== 'undefined' const isOwnProfile = userState.auth && userState.user?.pubkey && @@ -376,23 +377,25 @@ export const ProfilePage = () => { {!isOwnProfile && ( <> - setShowReportPopUp(true)} - > - setShowReportPopUp(true)} > - - - Report - + + + + Report + + )}