From 54a96995f4e5f88d2415dc623fbf83fd36ba5663 Mon Sep 17 00:00:00 2001 From: Thibaut Boustany Date: Fri, 15 Jun 2018 11:10:39 +0200 Subject: [PATCH 1/6] Added width optional prop to Modal --- src/components/base/Modal/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/base/Modal/index.js b/src/components/base/Modal/index.js index 02fec5ba..ca2e45e1 100644 --- a/src/components/base/Modal/index.js +++ b/src/components/base/Modal/index.js @@ -37,6 +37,7 @@ type OwnProps = { preventBackdropClick?: boolean, render: Function, refocusWhenChange?: string, + width?: string, } type Props = OwnProps & { @@ -108,7 +109,7 @@ const Wrapper = styled(Box).attrs({ }), })` outline: none; - width: 500px; + width: ${p => (p.width ? p.width : '500px')}; z-index: 2; ` @@ -180,7 +181,7 @@ export class Modal extends Component { } render() { - const { preventBackdropClick, isOpened, onHide, render, data, onClose } = this.props + const { preventBackdropClick, isOpened, onHide, render, data, onClose, width } = this.props return ( { scale={m.scale} innerRef={n => (this._wrapper = n)} onClick={stopPropagation} + width={width} > From 668c1111dc2c9f8bfd1bea9c5a7202124849d354 Mon Sep 17 00:00:00 2001 From: Thibaut Boustany Date: Fri, 15 Jun 2018 11:11:08 +0200 Subject: [PATCH 2/6] Made release notes modal larger --- src/components/modals/ReleaseNotes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/modals/ReleaseNotes.js b/src/components/modals/ReleaseNotes.js index a003fc2c..0e5f51f9 100644 --- a/src/components/modals/ReleaseNotes.js +++ b/src/components/modals/ReleaseNotes.js @@ -233,7 +233,7 @@ class ReleaseNotes extends PureComponent { ) } - return + return } } From 8a3575244540ed3e012aa52b191d5de4ee4a1c2a Mon Sep 17 00:00:00 2001 From: Thibaut Boustany Date: Fri, 15 Jun 2018 17:39:21 +0200 Subject: [PATCH 3/6] Translation for default account names --- .../AddAccounts/steps/03-step-import.js | 28 +++++++++++++------ static/i18n/en/app.yml | 3 ++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/components/modals/AddAccounts/steps/03-step-import.js b/src/components/modals/AddAccounts/steps/03-step-import.js index f9fcb054..779d8242 100644 --- a/src/components/modals/AddAccounts/steps/03-step-import.js +++ b/src/components/modals/AddAccounts/steps/03-step-import.js @@ -28,6 +28,22 @@ class StepImport extends PureComponent { scanSubscription = null + translateName(account: Account) { + const { t } = this.props + let { name } = account + + if (name === 'New Account') { + name = t('app:addAccounts.newAccount') + } else if (name.indexOf('legacy') !== -1) { + name = t('app:addAccounts.legacyAccount', { accountName: name.replace(' (legacy)', '') }) + } + + return { + ...account, + name, + } + } + startScanAccountsDevice() { const { currency, currentDevice, setState } = this.props try { @@ -49,7 +65,7 @@ class StepImport extends PureComponent { const isNewAccount = account.operations.length === 0 if (!hasAlreadyBeenScanned) { setState({ - scannedAccounts: [...scannedAccounts, account], + scannedAccounts: [...scannedAccounts, this.translateName(account)], checkedAccountsIds: !hasAlreadyBeenImported && !isNewAccount ? uniq([...checkedAccountsIds, account.id]) @@ -144,9 +160,7 @@ class StepImport extends PureComponent { count: importableAccounts.length, }) - const importableAccountsEmpty = `We didnt find any ${ - currency ? ` ${currency.name}}` : '' - } account to import.` + const importableAccountsEmpty = t('app:addAccounts.noAccountToImport', { currencyName: currency ? ` ${currency.name}}` : ''}) return ( @@ -163,10 +177,8 @@ class StepImport extends PureComponent { isLoading={scanStatus === 'scanning'} /> Date: Fri, 15 Jun 2018 17:42:19 +0200 Subject: [PATCH 4/6] Select first account by default on receive funds modal --- src/components/modals/Receive/index.js | 33 +++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/components/modals/Receive/index.js b/src/components/modals/Receive/index.js index 63da15e7..836e2602 100644 --- a/src/components/modals/Receive/index.js +++ b/src/components/modals/Receive/index.js @@ -1,7 +1,12 @@ // @flow import React, { Fragment, PureComponent } from 'react' +import { compose } from 'redux' +import { connect } from 'react-redux' import { translate } from 'react-i18next' +import { createStructuredSelector } from 'reselect' + +import { accountsSelector } from 'reducers/accounts' import type { Account } from '@ledgerhq/live-common/lib/types' import type { T, Device } from 'types/common' @@ -26,6 +31,7 @@ import StepReceiveFunds from './04-step-receive-funds' type Props = { t: T, + accounts: Account[], } type State = { @@ -57,6 +63,10 @@ const INITIAL_STATE = { stepsErrors: [], } +const mapStateToProps = createStructuredSelector({ + accounts: accountsSelector, +}) + class ReceiveModal extends PureComponent { state = INITIAL_STATE @@ -178,11 +188,19 @@ class ReceiveModal extends PureComponent { handleBeforeOpenModal = ({ data }) => { const { account } = this.state - if (data && data.account && !account) { - this.setState({ - account: data.account, - stepIndex: 1, - }) + const { accounts } = this.props + + if (!account) { + if (data && data.account) { + this.setState({ + account: data.account, + stepIndex: 1, + }) + } else { + this.setState({ + account: accounts[0] + }) + } } } @@ -348,4 +366,7 @@ class ReceiveModal extends PureComponent { } } -export default translate()(ReceiveModal) +export default compose( + connect(mapStateToProps), + translate(), +)(ReceiveModal) From b2e07068dab9a5002be5061c78f37ea8f4d4d8c6 Mon Sep 17 00:00:00 2001 From: Thibaut Boustany Date: Fri, 15 Jun 2018 18:04:33 +0200 Subject: [PATCH 5/6] Fix update banner style --- src/components/UpdateNotifier/UpdateDownloaded.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/UpdateNotifier/UpdateDownloaded.js b/src/components/UpdateNotifier/UpdateDownloaded.js index 05c7f593..9fcbb051 100644 --- a/src/components/UpdateNotifier/UpdateDownloaded.js +++ b/src/components/UpdateNotifier/UpdateDownloaded.js @@ -62,8 +62,10 @@ class UpdateDownloaded extends PureComponent { return ( - {t('app:update.newVersionReady')} - + + {t('app:update.newVersionReady')} + + sendEvent('updater', 'quitAndInstall')} From 95bcf6ab88b4e1fc08d69d6d2a747b5d8ac99a58 Mon Sep 17 00:00:00 2001 From: Thibaut Boustany Date: Fri, 15 Jun 2018 18:28:05 +0200 Subject: [PATCH 6/6] Update banner also shows up on dashboard empty state --- src/components/DashboardPage/index.js | 160 +++++++++--------- .../UpdateNotifier/UpdateDownloaded.js | 1 + 2 files changed, 82 insertions(+), 79 deletions(-) diff --git a/src/components/DashboardPage/index.js b/src/components/DashboardPage/index.js index 5c3b7ee0..6894b765 100644 --- a/src/components/DashboardPage/index.js +++ b/src/components/DashboardPage/index.js @@ -95,93 +95,95 @@ class DashboardPage extends PureComponent { const displayOperations = accounts.some(displayOperationsHelper) return ( - - {totalAccounts > 0 ? ( - - - - - - {t(timeFrame)} - - - {t('app:dashboard.summary', { count: totalAccounts })} - - - - - - + + + + {totalAccounts > 0 ? ( - ( - - )} - /> - - - - {t('app:dashboard.accounts.title', { count: accounts.length })} + + + + {t(timeFrame)} + + + {t('app:dashboard.summary', { count: totalAccounts })} - - - - - {accounts - .concat(Array(3 - (accounts.length % 3)).fill(null)) - .map((account, i) => ( - - {account ? ( - - ) : null} - - ))} + + - {displayOperations && ( - + ( + + )} /> - )} - + + + + {t('app:dashboard.accounts.title', { count: accounts.length })} + + + + + + + {accounts + .concat(Array(3 - (accounts.length % 3)).fill(null)) + .map((account, i) => ( + + {account ? ( + + ) : null} + + ))} + + + {displayOperations && ( + + )} + + - - ) : ( - - )} - + ) : ( + + )} + + ) } } diff --git a/src/components/UpdateNotifier/UpdateDownloaded.js b/src/components/UpdateNotifier/UpdateDownloaded.js index 9fcbb051..5f0cb77a 100644 --- a/src/components/UpdateNotifier/UpdateDownloaded.js +++ b/src/components/UpdateNotifier/UpdateDownloaded.js @@ -35,6 +35,7 @@ const Container = styled(Box).attrs({ px: 3, bg: 'wallet', color: 'white', + mt: '-35px', style: p => ({ transform: `translate3d(0, ${p.offset}%, 0)`, }),