From a570fd2a8f138fb89c5b0ae43ddb7919f6bf26e3 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 --- .../Indexer/Edit/EditIndexerModalContent.js | 9 +++++++ .../Edit/EditIndexerModalContentConnector.js | 11 ++++++++- .../src/Settings/AdvancedSettingsButton.js | 24 +++++++++++++------ 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/frontend/src/Indexer/Edit/EditIndexerModalContent.js b/frontend/src/Indexer/Edit/EditIndexerModalContent.js index 0f18a723e..98934e71c 100644 --- a/frontend/src/Indexer/Edit/EditIndexerModalContent.js +++ b/frontend/src/Indexer/Edit/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 translate from 'Utilities/String/translate'; import styles from './EditIndexerModalContent.css'; @@ -31,6 +32,7 @@ function EditIndexerModalContent(props) { onSavePress, onTestPress, onDeleteIndexerPress, + onAdvancedSettingsPress, ...otherProps } = props; @@ -165,6 +167,12 @@ function EditIndexerModalContent(props) { } + + { + console.log('settings'); + this.props.toggleAdvancedSettings(); + } + // // Render @@ -65,6 +72,7 @@ class EditIndexerModalContentConnector extends Component { {...this.props} onSavePress={this.onSavePress} onTestPress={this.onTestPress} + onAdvancedSettingsPress={this.onAdvancedSettingsPress} onInputChange={this.onInputChange} onFieldChange={this.onFieldChange} /> @@ -80,6 +88,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/frontend/src/Settings/AdvancedSettingsButton.js b/frontend/src/Settings/AdvancedSettingsButton.js index 15dcf2dd6..b441ce28a 100644 --- a/frontend/src/Settings/AdvancedSettingsButton.js +++ b/frontend/src/Settings/AdvancedSettingsButton.js @@ -10,7 +10,8 @@ import styles from './AdvancedSettingsButton.css'; function AdvancedSettingsButton(props) { const { advancedSettings, - onAdvancedSettingsPress + onAdvancedSettingsPress, + showLabel } = props; return ( @@ -43,18 +44,27 @@ function AdvancedSettingsButton(props) { /> -
-
- {advancedSettings ? translate('HideAdvanced') : translate('ShowAdvanced')} -
-
+ { + showLabel && +
+
+ {advancedSettings ? translate('HideAdvanced') : translate('ShowAdvanced')} +
+
+ } + ); } 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;