From 055be6b10a2c149bd3316cdf049192eb925c2ee9 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Mon, 6 Oct 2025 15:41:12 +0300 Subject: [PATCH] Fix: review prompt banner appearing in all games --- .../src/components/game-card/game-card.scss | 3 +-- .../src/pages/game-details/game-details-content.tsx | 13 +++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/components/game-card/game-card.scss b/src/renderer/src/components/game-card/game-card.scss index 1830762f..46c6bec9 100644 --- a/src/renderer/src/components/game-card/game-card.scss +++ b/src/renderer/src/components/game-card/game-card.scss @@ -73,8 +73,7 @@ color: globals.$muted-color; font-size: 12px; align-items: center; - - // Ensure star rating is properly aligned + .star-rating { align-items: center; } diff --git a/src/renderer/src/pages/game-details/game-details-content.tsx b/src/renderer/src/pages/game-details/game-details-content.tsx index 9060dc39..16ee7386 100644 --- a/src/renderer/src/pages/game-details/game-details-content.tsx +++ b/src/renderer/src/pages/game-details/game-details-content.tsx @@ -106,7 +106,7 @@ export function GameDetailsContent() { const { showHydraCloudModal } = useSubscription(); const { userDetails, hasActiveSubscription } = useUserDetails(); - const { updateLibrary } = useLibrary(); + const { updateLibrary, library } = useLibrary(); const { formatDistance } = useDate(); const { showSuccessToast, showErrorToast } = useToast(); @@ -159,6 +159,14 @@ export function GameDetailsContent() { const [hasUserReviewed, setHasUserReviewed] = useState(false); const [reviewCheckLoading, setReviewCheckLoading] = useState(false); + // Check if the current game is in the user's library + const isGameInLibrary = useMemo(() => { + if (!library || !shop || !objectId) return false; + return library.some( + (libItem) => libItem.shop === shop && libItem.objectId === objectId + ); + }, [library, shop, objectId]); + const editor = useEditor({ extensions: [ StarterKit.configure({ @@ -561,7 +569,8 @@ export function GameDetailsContent() { showReviewPrompt && userDetails && !hasUserReviewed && - !reviewCheckLoading && ( + !reviewCheckLoading && + isGameInLibrary && (