From 093febb8dbf68af6c474336a96cbbc4ab70097c6 Mon Sep 17 00:00:00 2001 From: Cezar Augusto Date: Mon, 16 Dec 2019 16:09:35 -0300 Subject: [PATCH] Modify Sync UI to allow only one device in chain Close https://github.com/brave/brave-browser/issues/6941 --- .../commonDialogs/cancelDeviceSyncing.tsx | 36 -------------- .../ui/containers/disabledContent.tsx | 19 +++++--- .../ui/containers/modals/deviceType.tsx | 9 ---- .../ui/containers/modals/scanCode.tsx | 47 ++----------------- .../ui/containers/modals/viewSyncCode.tsx | 47 ++----------------- .../brave_sync/ui/stories/disabledContent.tsx | 8 +--- 6 files changed, 24 insertions(+), 142 deletions(-) delete mode 100644 components/brave_sync/ui/containers/commonDialogs/cancelDeviceSyncing.tsx diff --git a/components/brave_sync/ui/containers/commonDialogs/cancelDeviceSyncing.tsx b/components/brave_sync/ui/containers/commonDialogs/cancelDeviceSyncing.tsx deleted file mode 100644 index bc8fd9d13f4b..000000000000 --- a/components/brave_sync/ui/containers/commonDialogs/cancelDeviceSyncing.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -import * as React from 'react' - -// Components -import { AlertBox } from 'brave-ui' - -// Feature-specific components -import { Title, Paragraph } from 'brave-ui/features/sync' - -// Utils -import { getLocale } from '../../../../common/locale' - -interface Props { - onClickOk: () => void - onClickCancel: () => void -} - -export default class AreYouSure extends React.PureComponent { - render () { - const { onClickOk, onClickCancel } = this.props - return ( - - {getLocale('areYouSure')} - {getLocale('cancelDeviceSyncing')} - - ) - } -} diff --git a/components/brave_sync/ui/containers/disabledContent.tsx b/components/brave_sync/ui/containers/disabledContent.tsx index 1bd22eb60fb5..718a0a3e61f1 100644 --- a/components/brave_sync/ui/containers/disabledContent.tsx +++ b/components/brave_sync/ui/containers/disabledContent.tsx @@ -6,6 +6,7 @@ import * as React from 'react' // Components import { Button } from 'brave-ui' +import { LoaderIcon } from 'brave-ui/components/icons' // Component-specific components import { @@ -22,7 +23,6 @@ import { import { SyncStartIcon } from 'brave-ui/features/sync/images' // Modals -import DeviceTypeModal from './modals/deviceType' import EnterSyncCodeModal from './modals/enterSyncCode' // Utils @@ -49,6 +49,12 @@ export default class SyncDisabledContent extends React.PureComponent { this.setState({ newToSync: !this.state.newToSync }) + // once the screen is rendered, create a sync chain. + // this allow us to request the qr code and sync words immediately + const { thisDeviceName } = this.props.syncData + if (thisDeviceName === '') { + this.props.actions.onSetupNewToSync('') + } } onClickEnterSyncChainCodeButton = () => { @@ -66,11 +72,6 @@ export default class SyncDisabledContent extends React.PureComponent
- { - newToSync - ? - : null - } { existingSyncCode ? @@ -89,6 +90,12 @@ export default class SyncDisabledContent extends React.PureComponent + : null + }} />