From 2c30926891ab76e7f8cd71fd40b18587a631a79f Mon Sep 17 00:00:00 2001 From: chimpdev Date: Fri, 20 Sep 2024 03:20:31 +0300 Subject: [PATCH] Add conditional rendering for UserAvatar to show placeholder Image based on login status & only show rating required error when logged in --- .../bots/[id]/components/Tabs/Reviews.jsx | 54 ++++++++++++------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/client/app/(bots)/bots/[id]/components/Tabs/Reviews.jsx b/client/app/(bots)/bots/[id]/components/Tabs/Reviews.jsx index da6ef24b..cf73bc7e 100644 --- a/client/app/(bots)/bots/[id]/components/Tabs/Reviews.jsx +++ b/client/app/(bots)/bots/[id]/components/Tabs/Reviews.jsx @@ -15,6 +15,7 @@ import config from '@/config'; import useLanguageStore, { t } from '@/stores/language'; import UserAvatar from '@/app/components/ImageFromHash/UserAvatar'; import ReportableArea from '@/app/components/ReportableArea'; +import Image from 'next/image'; export default function Reviews({ bot }) { const [page, setPage] = useState(1); @@ -137,14 +138,25 @@ export default function Reviews({ bot }) { <>
- + {loggedIn ? ( + + + ) : ( + Placeholder Avatar + )}

@@ -181,18 +193,20 @@ export default function Reviews({ bot }) {

- - {selectedRating === 0 ? ( - t('botPage.tabs.reviews.ratingRequired') - ) : ( - t('botPage.tabs.reviews.ratingSelected', { count: selectedRating }) - )} - + {loggedIn && ( + + {selectedRating === 0 ? ( + t('botPage.tabs.reviews.ratingRequired') + ) : ( + t('botPage.tabs.reviews.ratingSelected', { count: selectedRating }) + )} + + )}