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 f1dcb2ce..d70a833a 100644 --- a/client/src/javascript/components/modals/remove-torrents-modal/RemoveTorrentsModal.tsx +++ b/client/src/javascript/components/modals/remove-torrents-modal/RemoveTorrentsModal.tsx @@ -1,7 +1,7 @@ import {Component} from 'react'; import {FormattedMessage, injectIntl, WrappedComponentProps} from 'react-intl'; -import {Checkbox, Form, FormRow} from '../../../ui'; +import {Form, FormRow} from '../../../ui'; import Modal from '../Modal'; import {saveDeleteTorrentsUserPreferences} from '../../../util/userPreferences'; import SettingStore from '../../../stores/SettingStore'; @@ -14,63 +14,61 @@ class RemoveTorrentsModal extends Component { formRef?: Form | null; getActions(torrentCount: number): Array { - if (torrentCount === 0) { - return [ - { - clickHandler: null, - content: 'OK', - triggerDismiss: true, - type: 'primary', - }, - ]; - } + const {intl} = this.props; - return [ - { - clickHandler: null, - content: this.props.intl.formatMessage({ - id: 'button.no', - }), - triggerDismiss: true, - type: 'tertiary', - }, - { - clickHandler: this.handleRemovalConfirmation, - content: this.props.intl.formatMessage({ - id: 'button.yes', - }), - triggerDismiss: true, - type: 'primary', - }, - ]; + return torrentCount === 0 + ? [ + { + clickHandler: null, + content: intl.formatMessage({ + id: 'button.ok', + }), + triggerDismiss: true, + type: 'primary', + }, + ] + : [ + { + 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: this.handleRemovalConfirmation, + content: intl.formatMessage({ + id: 'button.yes', + }), + triggerDismiss: true, + type: 'primary', + }, + ]; } getContent(torrentCount: number) { - let modalContent = null; - let deleteDataContent = null; - - if (torrentCount === 0) { - modalContent = ; - } else { - modalContent = ; - - deleteDataContent = ( - - - - - - ); - } - return (
{ this.formRef = ref; }}> - {modalContent} - {deleteDataContent} + + {torrentCount === 0 ? ( + + ) : ( + + )} +
); diff --git a/client/src/javascript/i18n/strings.compiled.json b/client/src/javascript/i18n/strings.compiled.json index 72706c18..2f811f56 100644 --- a/client/src/javascript/i18n/strings.compiled.json +++ b/client/src/javascript/i18n/strings.compiled.json @@ -407,6 +407,12 @@ "value": "No" } ], + "button.ok": [ + { + "type": 0, + "value": "OK" + } + ], "button.retry": [ { "type": 0, diff --git a/client/src/javascript/i18n/strings.json b/client/src/javascript/i18n/strings.json index 7fdf07b7..0eaa3666 100644 --- a/client/src/javascript/i18n/strings.json +++ b/client/src/javascript/i18n/strings.json @@ -30,6 +30,7 @@ "button.cancel": "Cancel", "button.download": "Download", "button.no": "No", + "button.ok": "OK", "button.retry": "Retry", "button.save": "Save Settings", "button.save.feed": "Save",