From 94a8ef63044f47b615facbb6e04200bdd3797189 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 5 Jul 2021 13:12:06 -0400 Subject: [PATCH] New: Advanced settings toggle in indexer edit/add modal (cherry picked from commit a570fd2a8f138fb89c5b0ae43ddb7919f6bf26e3) --- .../src/Settings/AdvancedSettingsButton.js | 27 +++++++++++++------ .../Indexers/EditIndexerModalContent.js | 9 +++++++ .../EditIndexerModalContentConnector.js | 11 ++++++-- src/NzbDrone.Core/Localization/Core/en.json | 8 ++++-- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/frontend/src/Settings/AdvancedSettingsButton.js b/frontend/src/Settings/AdvancedSettingsButton.js index 2650dcc8a..6ba40f6d7 100644 --- a/frontend/src/Settings/AdvancedSettingsButton.js +++ b/frontend/src/Settings/AdvancedSettingsButton.js @@ -4,18 +4,20 @@ import React from 'react'; import Icon from 'Components/Icon'; import Link from 'Components/Link/Link'; import { icons } from 'Helpers/Props'; +import translate from 'Utilities/String/translate'; import styles from './AdvancedSettingsButton.css'; function AdvancedSettingsButton(props) { const { advancedSettings, - onAdvancedSettingsPress + onAdvancedSettingsPress, + showLabel } = props; return ( -
-
- {advancedSettings ? 'Hide Advanced' : 'Show Advanced'} -
-
+ { + showLabel ? +
+
+ {advancedSettings ? translate('HideAdvanced') : translate('ShowAdvanced')} +
+
: + null + } ); } AdvancedSettingsButton.propTypes = { advancedSettings: PropTypes.bool.isRequired, - onAdvancedSettingsPress: PropTypes.func.isRequired + onAdvancedSettingsPress: PropTypes.func.isRequired, + showLabel: PropTypes.bool.isRequired +}; + +AdvancedSettingsButton.defaultProps = { + showLabel: true }; export default AdvancedSettingsButton; diff --git a/frontend/src/Settings/Indexers/Indexers/EditIndexerModalContent.js b/frontend/src/Settings/Indexers/Indexers/EditIndexerModalContent.js index abfeb2e04..8e491f081 100644 --- a/frontend/src/Settings/Indexers/Indexers/EditIndexerModalContent.js +++ b/frontend/src/Settings/Indexers/Indexers/EditIndexerModalContent.js @@ -13,6 +13,7 @@ import ModalContent from 'Components/Modal/ModalContent'; import ModalFooter from 'Components/Modal/ModalFooter'; import ModalHeader from 'Components/Modal/ModalHeader'; import { inputTypes, kinds } from 'Helpers/Props'; +import AdvancedSettingsButton from 'Settings/AdvancedSettingsButton'; import styles from './EditIndexerModalContent.css'; function EditIndexerModalContent(props) { @@ -30,6 +31,7 @@ function EditIndexerModalContent(props) { onSavePress, onTestPress, onDeleteIndexerPress, + onAdvancedSettingsPress, ...otherProps } = props; @@ -215,6 +217,12 @@ function EditIndexerModalContent(props) { } + + { + this.props.toggleAdvancedSettings(); + }; + // // Render @@ -65,6 +70,7 @@ class EditIndexerModalContentConnector extends Component { {...this.props} onSavePress={this.onSavePress} onTestPress={this.onTestPress} + onAdvancedSettingsPress={this.onAdvancedSettingsPress} onInputChange={this.onInputChange} onFieldChange={this.onFieldChange} /> @@ -80,6 +86,7 @@ EditIndexerModalContentConnector.propTypes = { item: PropTypes.object.isRequired, setIndexerValue: PropTypes.func.isRequired, setIndexerFieldValue: PropTypes.func.isRequired, + toggleAdvancedSettings: PropTypes.func.isRequired, saveIndexer: PropTypes.func.isRequired, testIndexer: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 7497a6dc6..d9af60071 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -1,6 +1,10 @@ { + "Browser Reload Required": "Browser Reload Required", + "HiddenClickToShow": "Hidden, click to show", + "HideAdvanced": "Hide Advanced", "Language": "Language", - "UI Language": "UI Language", "Language that Sonarr will use for UI": "Language that Sonarr will use for UI", - "Browser Reload Required": "Browser Reload Required" + "ShowAdvanced": "Show Advanced", + "ShownClickToHide": "Shown, click to hide", + "UI Language": "UI Language" }