diff --git a/client/src/javascript/components/modals/move-torrents-modal/MoveTorrentsModal.tsx b/client/src/javascript/components/modals/move-torrents-modal/MoveTorrentsModal.tsx index 25ea2fce..a37f87c4 100644 --- a/client/src/javascript/components/modals/move-torrents-modal/MoveTorrentsModal.tsx +++ b/client/src/javascript/components/modals/move-torrents-modal/MoveTorrentsModal.tsx @@ -4,6 +4,7 @@ import {useIntl} from 'react-intl'; import FilesystemBrowserTextbox from '../../general/filesystem/FilesystemBrowserTextbox'; import {Form} from '../../../ui'; import Modal from '../Modal'; +import ModalActions from '../ModalActions'; import TorrentActions from '../../../actions/TorrentActions'; import TorrentStore from '../../../stores/TorrentStore'; import UIStore from '../../../stores/UIStore'; @@ -65,42 +66,44 @@ const MoveTorrents: FC = () => { )} showBasePathToggle /> + } - actions={[ - { - checked: true, - content: intl.formatMessage({ - id: 'torrents.move.data.label', - }), - id: 'moveFiles', - type: 'checkbox', - }, - { - checked: false, - content: intl.formatMessage({ - id: 'torrents.move.check_hash.label', - }), - id: 'isCheckHash', - type: 'checkbox', - }, - { - content: intl.formatMessage({ - id: 'button.cancel', - }), - triggerDismiss: true, - type: 'tertiary', - }, - { - content: intl.formatMessage({ - id: 'torrents.move.button.set.location', - }), - isLoading: isSettingDownloadPath, - submit: true, - type: 'primary', - }, - ]} /> ); }; diff --git a/client/src/javascript/components/modals/remove-torrents-modal/RemoveTorrentsModal.tsx b/client/src/javascript/components/modals/remove-torrents-modal/RemoveTorrentsModal.tsx index 11eea718..a3eb37c3 100644 --- a/client/src/javascript/components/modals/remove-torrents-modal/RemoveTorrentsModal.tsx +++ b/client/src/javascript/components/modals/remove-torrents-modal/RemoveTorrentsModal.tsx @@ -1,16 +1,18 @@ -import {FC, useRef} from 'react'; +import {FC, useState} from 'react'; import {FormattedMessage, useIntl} from 'react-intl'; import {Form, FormRow} from '../../../ui'; import Modal from '../Modal'; +import ModalActions from '../ModalActions'; import {saveDeleteTorrentsUserPreferences} from '../../../util/userPreferences'; import SettingStore from '../../../stores/SettingStore'; import TorrentActions from '../../../actions/TorrentActions'; import TorrentStore from '../../../stores/TorrentStore'; +import UIStore from '../../../stores/UIStore'; const RemoveTorrentsModal: FC = () => { - const formRef = useRef
(null); const intl = useIntl(); + const [isRemoving, setIsRemoving] = useState(false); const {selectedTorrents} = TorrentStore; if (selectedTorrents.length === 0) { @@ -48,52 +50,56 @@ const RemoveTorrentsModal: FC = () => { id: 'torrents.remove', })} content={ -
- +
+ { + setIsRemoving(true); + + const deleteData = formData.deleteData as boolean; + + TorrentActions.deleteTorrents({ + hashes: TorrentStore.selectedTorrents, + deleteData, + }).then(() => { + setIsRemoving(false); + saveDeleteTorrentsUserPreferences({deleteData}); + UIStore.dismissModal(); + }); + }}> +
} - actions={[ - { - checked: SettingStore.floodSettings.deleteTorrentData, - content: intl.formatMessage({ - id: 'torrents.remove.delete.data', - }), - id: 'deleteData', - type: 'checkbox', - }, - { - clickHandler: null, - content: intl.formatMessage({ - id: 'button.no', - }), - triggerDismiss: true, - type: 'tertiary', - }, - { - clickHandler: () => { - let deleteData = false; - if (formRef.current != null) { - deleteData = formRef.current.getFormData().deleteData as boolean; - } - - TorrentActions.deleteTorrents({ - hashes: TorrentStore.selectedTorrents, - deleteData, - }); - - saveDeleteTorrentsUserPreferences({deleteData}); - }, - content: intl.formatMessage({ - id: 'button.yes', - }), - triggerDismiss: true, - type: 'primary', - }, - ]} /> ); };