Fix: review prompt banner appearing in all games

This commit is contained in:
Moyasee
2025-10-06 15:41:12 +03:00
parent 063e97e0ec
commit 055be6b10a
2 changed files with 12 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -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 && (
<ReviewPromptBanner
onYesClick={handleReviewPromptYes}
onLaterClick={handleReviewPromptLater}