mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
Fix: review prompt banner appearing in all games
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user