diff --git a/src/photos/ducks/backup/components/BackupActions.jsx b/src/photos/ducks/backup/components/BackupActions.jsx index 56a23ff7c..ea3a7bf39 100644 --- a/src/photos/ducks/backup/components/BackupActions.jsx +++ b/src/photos/ducks/backup/components/BackupActions.jsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useState, useEffect } from 'react' import Button from 'cozy-ui/transpiled/react/Buttons' import Icon from 'cozy-ui/transpiled/react/Icon' @@ -11,6 +11,23 @@ import { useBackupActions } from '../hooks/useBackupActions' import { useBackupData } from '../hooks/useBackupData' import OpenBackupButton from 'photos/ducks/backup/components/OpenBackupButton' +const DisabledLoadingBackupButton = () => { + const { t } = useI18n() + + return ( +
+
+ ) +} + const BackupActions = () => { const { t } = useI18n() @@ -23,6 +40,14 @@ const BackupActions = () => { requestBackupPermissions } = useBackupActions() + const [statusToIgnore, setStatusToIgnore] = useState('') + + useEffect(() => { + if (backupInfo?.currentBackup?.status !== statusToIgnore) { + setStatusToIgnore('') + } + }, [backupInfo?.currentBackup?.status, statusToIgnore]) + if (!backupPermissions) return null if (backupPermissions.granted) { @@ -82,17 +107,22 @@ const BackupActions = () => { ) - } else { + } else if (mediasToBackupCount > 0 && status !== statusToIgnore) { return (
) + } else { + return } } else { return (