From 1373a90e27cdb3744d5ce5df8e764aae35a39089 Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Wed, 28 Oct 2020 13:36:52 -0700 Subject: [PATCH] Hide network form buttons when form is viewOnly --- .../network-form/network-form.component.js | 60 ++++++++----------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/ui/app/pages/settings/networks-tab/network-form/network-form.component.js b/ui/app/pages/settings/networks-tab/network-form/network-form.component.js index 78eda5194..e32801fda 100644 --- a/ui/app/pages/settings/networks-tab/network-form/network-form.component.js +++ b/ui/app/pages/settings/networks-tab/network-form/network-form.component.js @@ -329,7 +329,6 @@ export default class NetworkForm extends PureComponent { viewOnly, isCurrentRpcTarget, networksTabIsInAddMode, - isFullScreen, } = this.props const { networkName, @@ -343,25 +342,12 @@ export default class NetworkForm extends PureComponent { const deletable = !networksTabIsInAddMode && !isCurrentRpcTarget && !viewOnly const isSubmitDisabled = ( - viewOnly || this.stateIsUnchanged() || !rpcUrl || !chainId || Object.values(errors).some((x) => x) ) - // The secondary button is either the form cancel button, or a "back" - // button. It is never disabled in the popup, and sometimes disabled in - // the fullscreen UI. - const secondaryButtonDisabled = ( - isFullScreen && (viewOnly || this.stateIsUnchanged()) - ) - const secondaryButtonMessageKey = ( - !isFullScreen && viewOnly - ? 'back' - : 'cancel' - ) - return (
{viewOnly ? null : this.renderWarning()} @@ -400,30 +386,34 @@ export default class NetworkForm extends PureComponent { 'optionalBlockExplorerUrl', )}
- { - deletable && ( + {!viewOnly && ( + <> + { + deletable && ( + + ) + } - ) - } - - + + + )}
)