From 16259b539965531626bb06ac8776aae704c9da92 Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Tue, 31 Dec 2024 05:10:03 +0000 Subject: [PATCH] fix: fixing backups per game limit as conditional --- .../game-details/cloud-sync-modal/cloud-sync-modal.tsx | 9 +++++---- src/types/index.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx b/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx index b4665f15..3e8cc7f1 100644 --- a/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx +++ b/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx @@ -88,6 +88,9 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) { } }, [getGameBackupPreview, visible]); + const userDetails = useAppSelector((state) => state.userDetails.userDetails); + const backupsPerGameLimit = userDetails?.quirks?.backupsPerGameLimit ?? 0; + const backupStateLabel = useMemo(() => { if (uploadingBackup) { return ( @@ -120,7 +123,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) { ); } - if (artifacts.length >= 2) { + if (artifacts.length >= backupsPerGameLimit) { return t("max_number_of_artifacts_reached"); } @@ -140,14 +143,12 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) { restoringBackup, loadingPreview, artifacts, + backupsPerGameLimit, t, ]); const disableActions = uploadingBackup || restoringBackup || deletingArtifact; - const userDetails = useAppSelector((state) => state.userDetails.userDetails); - const backupsPerGameLimit = userDetails?.quirks.backupsPerGameLimit ?? 0; - return (