From 4a6a471345117d33f37f4397de26ed33c04a1120 Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Wed, 6 May 2020 16:15:47 +0200 Subject: [PATCH] Fix theme warnings Changelog-entry: Fix theme warnings Change-type: patch --- lib/gui/app/pages/main/MainPage.tsx | 263 ++++++++++++++-------------- 1 file changed, 135 insertions(+), 128 deletions(-) diff --git a/lib/gui/app/pages/main/MainPage.tsx b/lib/gui/app/pages/main/MainPage.tsx index 257d1a04..9207c929 100644 --- a/lib/gui/app/pages/main/MainPage.tsx +++ b/lib/gui/app/pages/main/MainPage.tsx @@ -130,146 +130,153 @@ export class MainPage extends React.Component< }); } - public render() { + private renderMain() { const shouldDriveStepBeDisabled = !this.state.hasImage; const shouldFlashStepBeDisabled = !this.state.hasImage || !this.state.hasDrive; - - if (this.state.current === 'main') { - return ( - -
+
+ + openExternal('https://www.balena.io/etcher?ref=etcher_footer') + } + tabIndex={100} + > + + + + - - openExternal('https://www.balena.io/etcher?ref=etcher_footer') - } - tabIndex={100} - > - - - - - } - plain - tabIndex={5} - onClick={() => this.setState({ hideSettings: false })} - /> - {!settings.getSync('disableExternalLinks') && ( - } - onClick={() => - openExternal( - selectionState.getImageSupportUrl() || - 'https://github.com/balena-io/etcher/blob/master/SUPPORT.md', - ) - } - tabIndex={6} - /> - )} - -
- {this.state.hideSettings ? null : ( - { - this.setState({ hideSettings: !value }); - }} + } + plain + tabIndex={5} + onClick={() => this.setState({ hideSettings: false })} /> + {!settings.getSync('disableExternalLinks') && ( + } + onClick={() => + openExternal( + selectionState.getImageSupportUrl() || + 'https://github.com/balena-io/etcher/blob/master/SUPPORT.md', + ) + } + tabIndex={6} + /> + )} + +
+ {this.state.hideSettings ? null : ( + { + this.setState({ hideSettings: !value }); + }} + /> + )} + + +
+ + this.setState({ source }) + } + /> +
+ +
+ +
+ + {this.state.isFlashing && ( +
+ { + this.setState({ isWebviewShowing }); + }} + /> +
)} - -
- - this.setState({ source }) - } - /> -
+
+ +
-
- -
+
+ this.setState({ current: 'success' })} + shouldFlashStepBeDisabled={shouldFlashStepBeDisabled} + source={this.state.source} + /> +
+
+ + ); + } - {this.state.isFlashing && ( -
- { - this.setState({ isWebviewShowing }); - }} - /> -
- )} + private renderSuccess() { + return ( +
+ this.setState({ current: 'main' })} /> + +
+ ); + } -
- -
- -
- this.setState({ current: 'success' })} - shouldFlashStepBeDisabled={shouldFlashStepBeDisabled} - source={this.state.source} - /> -
-
-
- ); - } else if (this.state.current === 'success') { - return ( -
- this.setState({ current: 'main' })} /> - -
- ); - } + public render() { + return ( + + {this.state.current === 'main' + ? this.renderMain() + : this.renderSuccess()} + + ); } }