fix: fixing backups per game limit as conditional

This commit is contained in:
Chubby Granny Chaser 2024-12-31 05:10:03 +00:00
parent 726c753568
commit 16259b5399
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View File

@ -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 (
<Modal
visible={visible}

View File

@ -268,7 +268,7 @@ export interface UserDetails {
profileVisibility: ProfileVisibility;
bio: string;
subscription: Subscription | null;
quirks: {
quirks?: {
backupsPerGameLimit: number;
};
}