From 16b7caff39906f34affe1769f1bb0767e08d018d Mon Sep 17 00:00:00 2001 From: sbenmoussati <51402489+sbenmoussati@users.noreply.github.com> Date: Wed, 29 Mar 2023 11:19:05 +0200 Subject: [PATCH] SDA-4136 SDA-4137 SDA-4138 Welcome screen design fix --- spec/__snapshots__/welcome.spec.ts.snap | 2 - src/renderer/components/welcome.tsx | 49 +++++++++++++------------ src/renderer/styles/theme.less | 1 + src/renderer/styles/welcome.less | 24 ++++++++++-- 4 files changed, 47 insertions(+), 29 deletions(-) diff --git a/spec/__snapshots__/welcome.spec.ts.snap b/spec/__snapshots__/welcome.spec.ts.snap index 98ac31117..491524240 100644 --- a/spec/__snapshots__/welcome.spec.ts.snap +++ b/spec/__snapshots__/welcome.spec.ts.snap @@ -118,7 +118,6 @@ exports[`welcome should render correctly 1`] = ` data-testid="Welcome-main-container-podurl-box" disabled={false} onChange={[Function]} - tabIndex={0} type="url" value="https://[POD].symphony.com" /> @@ -160,7 +159,6 @@ exports[`welcome should render correctly 1`] = ` disabled={true} onClick={[Function]} style={Object {}} - tabIndex={1} > log in diff --git a/src/renderer/components/welcome.tsx b/src/renderer/components/welcome.tsx index 174746761..7fd842259 100644 --- a/src/renderer/components/welcome.tsx +++ b/src/renderer/components/welcome.tsx @@ -1,8 +1,8 @@ +import classnames from 'classnames'; import { ipcRenderer } from 'electron'; import * as React from 'react'; import { apiCmds, apiName } from '../../common/api-interface'; import { i18n } from '../../common/i18n-preload'; - interface IState { url: string; message: string; @@ -93,7 +93,6 @@ export default class Welcome extends React.Component<{}, IState> { disabled={isLoading} data-testid={'Welcome-main-container-podurl-box'} className='Welcome-main-container-podurl-box' - tabIndex={0} type='url' value={url} onChange={this.updatePodUrl.bind(this)} @@ -210,29 +209,29 @@ export default class Welcome extends React.Component<{}, IState> { public updateBrowserLoginAutoConnect(event) { const { urlValid } = this.state; const browserLoginAutoConnect = event.target.checked; - if (!browserLoginAutoConnect) { - if (this.browserLoginTimeoutId) { - clearTimeout(this.browserLoginTimeoutId); + if (browserLoginAutoConnect) { + if (urlValid) { + this.setState({ + browserLoginAutoConnect, + isLoading: true, + }); + const { url, isPodConfigured, isBrowserLoginEnabled } = this.state; + ipcRenderer.send(apiName.symphonyApi, { + cmd: apiCmds.browserLogin, + newPodUrl: url, + isPodConfigured, + isBrowserLoginEnabled, + browserLoginAutoConnect, + }); + return; } - this.setState({ - browserLoginAutoConnect, - }); } - - if (urlValid && browserLoginAutoConnect) { - this.setState({ - browserLoginAutoConnect, - isLoading: true, - }); - const { url, isPodConfigured, isBrowserLoginEnabled } = this.state; - ipcRenderer.send(apiName.symphonyApi, { - cmd: apiCmds.browserLogin, - newPodUrl: url, - isPodConfigured, - isBrowserLoginEnabled, - browserLoginAutoConnect, - }); + if (this.browserLoginTimeoutId) { + clearTimeout(this.browserLoginTimeoutId); } + this.setState({ + browserLoginAutoConnect, + }); } /** @@ -246,6 +245,9 @@ export default class Welcome extends React.Component<{}, IState> { isBrowserLoginEnabled, browserLoginAutoConnect, } = this.state; + const loginButtonClasses = classnames('Welcome-continue-button', { + 'Welcome-continue-button-loading': isLoading, + }); return ( {isBrowserLoginEnabled && ( @@ -271,8 +273,7 @@ export default class Welcome extends React.Component<{}, IState> { )}