diff --git a/src/components/dialogs/RestartDialog.tsx b/src/components/dialogs/RestartDialog.tsx index d02657337..f62888f8d 100644 --- a/src/components/dialogs/RestartDialog.tsx +++ b/src/components/dialogs/RestartDialog.tsx @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/react'; -import { useCallback } from 'react'; +import { useCallback, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { invoke } from '@tauri-apps/api/tauri'; import { Dialog, DialogContent } from '@app/components/elements/dialog/Dialog.tsx'; @@ -13,10 +13,12 @@ import { Divider } from '@app/components/elements/Divider.tsx'; import { TextButton } from '@app/components/elements/buttons/TextButton.tsx'; import { IconButton } from '@app/components/elements/buttons/IconButton.tsx'; import { useTheme } from 'styled-components'; +import { CircularProgress } from '../elements/CircularProgress'; export default function RestartDialog() { const dialogToShow = useUIStore((s) => s.dialogToShow); const setDialogToShow = useUIStore((s) => s.setDialogToShow); + const [isRestarting, setIsRestarting] = useState(false); const { t } = useTranslation('settings', { useSuspense: false }); const showRestartModal = dialogToShow === 'restart'; @@ -28,6 +30,7 @@ export default function RestartDialog() { const handleRestart = useCallback(async () => { try { + setIsRestarting(true); console.info('Restarting application.'); await invoke('restart_application', { shouldStopMiners: true }); } catch (error) { @@ -54,16 +57,22 @@ export default function RestartDialog() { - - {t('restart-later')} - - + {isRestarting ? ( + + ) : ( + <> + + {t('restart-later')} + + + + )}