Browse Source

Merge pull request #1667 from juan-cortes/LL-460

Moves the account exporter from the experimental to a top level tab
gre-patch-1
Meriadec Pillet 6 years ago
committed by GitHub
parent
commit
6fc6bb5c37
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/components/EnsureDeviceApp.js
  2. 8
      src/components/GenuineCheck.js
  3. 13
      src/components/Onboarding/helperComponents.js
  4. 6
      src/components/SettingsPage/index.js
  5. 148
      src/components/SettingsPage/sections/Export.js
  6. 59
      src/components/SettingsPage/sections/Tools.js
  7. 24
      static/i18n/en/app.json

4
src/components/EnsureDeviceApp.js

@ -77,7 +77,7 @@ class EnsureDeviceApp extends Component<{
const cur = account ? account.currency : currency
invariant(cur, 'No currency given')
return (
<Trans i18nKey="deviceConnect.step2.open" parent="div">
<Trans i18nKey="deviceConnect.step2" parent="div">
{'Open the '}
<Bold>{cur.managerAppName}</Bold>
{' app on your device'}
@ -97,7 +97,7 @@ class EnsureDeviceApp extends Component<{
{
id: 'device',
title: (
<Trans i18nKey="deviceConnect.step1.connect" parent="div">
<Trans i18nKey="deviceConnect.step1" parent="div">
{'Connect and unlock your '}
<Bold>{'Ledger device'}</Bold>
</Trans>

8
src/components/GenuineCheck.js

@ -124,7 +124,7 @@ class GenuineCheck extends PureComponent<Props> {
{
id: 'device',
title: (
<Trans i18nKey="deviceConnect.step1.connect" parent="div">
<Trans i18nKey="deviceConnect.step1" parent="div">
{'Connect and unlock your '}
<Bold>{'Ledger device'}</Bold>
</Trans>
@ -135,10 +135,10 @@ class GenuineCheck extends PureComponent<Props> {
{
id: 'deviceInfo',
title: (
<Trans i18nKey="deviceConnect:dashboard.open" parent="div">
<Trans i18nKey="deviceConnect.step2" parent="div">
{'Navigate to the '}
<Bold>{'dashboard'}</Bold>
{' on your device'}
{' app on your device'}
</Trans>
),
icon: homeIcon,
@ -147,7 +147,7 @@ class GenuineCheck extends PureComponent<Props> {
{
id: 'isGenuine',
title: (
<Trans i18nKey="deviceConnect:stepGenuine.open" parent="div">
<Trans i18nKey="deviceConnect.step3" parent="div">
{'Allow '}
<Bold>{'Ledger Manager'}</Bold>
{' on your device'}

13
src/components/Onboarding/helperComponents.js

@ -69,6 +69,19 @@ export function OptionRow({ step, ...p }: { step: StepType }) {
</Box>
)
}
export function BulletRow({ step, ...p }: { step: StepType }) {
const { icon, desc } = step
return (
<Box horizontal my="7px">
<Box {...p} mr="7px">
{icon}
</Box>
<Box justify="center" shrink>
<OptionRowDesc>{desc}</OptionRowDesc>
</Box>
</Box>
)
}
export const OptionRowDesc = styled(Box).attrs({
ff: 'Open Sans|Regular',
fontSize: 4,

6
src/components/SettingsPage/index.js

@ -15,7 +15,7 @@ import SectionDisplay from './sections/Display'
import SectionCurrencies from './sections/Currencies'
import SectionHelp from './sections/Help'
import SectionAbout from './sections/About'
import SectionTools from './sections/Tools'
import SectionExport from './sections/Export'
const mapStateToProps = state => ({
accountsCount: accountsSelector(state).length,
@ -61,10 +61,10 @@ class SettingsPage extends PureComponent<Props, State> {
]
if (EXPERIMENTAL_TOOLS_SETTINGS) {
this._items.push({
this._items.splice(2, 0, {
key: 'tool',
label: 'Experimental Tools',
value: SectionTools,
value: SectionExport,
})
}

148
src/components/SettingsPage/sections/Export.js

@ -0,0 +1,148 @@
// @flow
import React, { PureComponent } from 'react'
import { Trans, translate } from 'react-i18next'
import type { T } from 'types/common'
import TrackPage from 'analytics/TrackPage'
import styled from 'styled-components'
import { SettingsSection as Section, SettingsSectionHeader as Header } from '../SettingsSection'
import IconShare from '../../../icons/Share'
import Button from '../../base/Button'
import Modal, { ModalBody, ModalContent, ModalFooter, ModalTitle } from '../../base/Modal'
import Box from '../../base/Box'
import QRCodeExporter from '../../QRCodeExporter'
import { BulletRow } from '../../Onboarding/helperComponents'
import Text from '../../base/Text'
const BulletRowIcon = styled(Box).attrs({
ff: 'Rubik|Regular',
fontSize: 10,
textAlign: 'center',
color: 'wallet',
pl: 2,
})`
background-color: rgba(100, 144, 241, 0.1);
border-radius: 12px;
display: inline-flex;
height: 18px;
width: 18px;
padding: 0px;
padding-top: 2px;
`
type Props = {
t: T,
}
type State = {
isModalOpened: boolean,
}
class SectionExport extends PureComponent<Props, State> {
state = {
isModalOpened: false,
}
onModalOpen = () => {
this.setState({ isModalOpened: true })
}
onModalClose = () => {
this.setState({ isModalOpened: false })
}
renderModal = ({ onClose }: any) => {
const { t } = this.props
const stepsImportMobile = [
{
key: 'step1',
icon: <BulletRowIcon>{'1'}</BulletRowIcon>,
desc: (
<Box style={{ display: 'block' }}>
<Trans i18nKey="settings.export.modal.step1">
{'Tap the'}
<Text ff="Open Sans|SemiBold" color="dark">
{'+'}
</Text>
{'button in Accounts'}
</Trans>
</Box>
),
},
{
key: 'step2',
icon: <BulletRowIcon>{'2'}</BulletRowIcon>,
desc: (
<Box style={{ display: 'block' }}>
<Trans i18nKey="settings.export.modal.step2">
{'Tap'}
<Text ff="Open Sans|SemiBold" color="dark">
{'Import desktop accounts'}
</Text>
</Trans>
</Box>
),
},
{
key: 'step3',
icon: <BulletRowIcon>{'3'}</BulletRowIcon>,
desc: (
<Box style={{ display: 'block' }}>
<Trans i18nKey="settings.export.modal.step3" />
</Box>
),
},
]
return (
<ModalBody onClose={onClose}>
<ModalTitle>{t('settings.export.modal.title')}</ModalTitle>
<ModalContent flow={2} justify="center" align="center">
<Box flow={2}>
<QRCodeExporter size={330} />
</Box>
<Box shrink style={{ width: 330, fontSize: 13, marginTop: 20 }}>
<Text ff="Open Sans|SemiBold" color="dark">
{t('settings.export.modal.listTitle')}
</Text>
</Box>
<Box style={{ width: 330 }}>
{stepsImportMobile.map(step => <BulletRow key={step.key} step={step} />)}
</Box>
</ModalContent>
<ModalFooter horizontal align="center" justify="flex-end" flow={2}>
<Button small onClick={onClose} primary>
{t('settings.export.modal.button')}
</Button>
</ModalFooter>
</ModalBody>
)
}
render() {
const { t } = this.props
const { isModalOpened } = this.state
return (
<Section style={{ flowDirection: 'column' }}>
<TrackPage category="Settings" name="Export" />
<Header
icon={<IconShare size={16} />}
title={t('settings.tabs.export')}
desc={t('settings.export.desc')}
renderRight={
<Button small onClick={this.onModalOpen} primary>
{t('settings.export.button')}
</Button>
}
/>
<Modal isOpened={isModalOpened} onClose={this.onModalClose} render={this.renderModal} />
</Section>
)
}
}
export default translate()(SectionExport)

59
src/components/SettingsPage/sections/Tools.js

@ -1,59 +0,0 @@
// @flow
/* eslint-disable react/jsx-no-literals */
import React, { PureComponent } from 'react'
import liveCommonPkg from '@ledgerhq/live-common/package.json'
import { translate } from 'react-i18next'
import Box, { Card } from 'components/base/Box'
import Modal, { ModalBody, ModalContent, ModalTitle } from 'components/base/Modal'
import Button from 'components/base/Button'
import QRCodeExporter from 'components/QRCodeExporter'
class TabProfile extends PureComponent<*, *> {
state = {
qrcodeMobileExportModal: false,
}
onQRCodeMobileExport = () => {
this.setState({ qrcodeMobileExportModal: true })
}
onRequestClose = () => {
this.setState({ qrcodeMobileExportModal: false })
}
renderQRCodeModal = ({ onClose }: any) => (
<ModalBody onClose={onClose} justify="center" align="center">
<ModalTitle>{'QRCode Mobile Export'}</ModalTitle>
<ModalContent flow={2}>
<Box>Scan this animated QRCode with Ledger Live Mobile App</Box>
<Box flow={2}>
<QRCodeExporter />
</Box>
<Box style={{ textAlign: 'right' }}>{liveCommonPkg.version}</Box>
</ModalContent>
</ModalBody>
)
render() {
const { qrcodeMobileExportModal } = this.state
return (
<Card flow={3}>
<Box horizontal>
<Button small onClick={this.onQRCodeMobileExport} primary>
QRCode Mobile Export
</Button>
<Modal
isOpened={qrcodeMobileExportModal}
onClose={this.onRequestClose}
render={this.renderQRCodeModal}
/>
</Box>
</Card>
)
}
}
export default translate()(TabProfile)

24
static/i18n/en/app.json

@ -138,12 +138,9 @@
"messageIfSkipped": "Your {{currencyName}} address has not been confirmed on your Ledger device. Please verify it for optimal security."
},
"deviceConnect": {
"step1": {
"connect": "Connect and unlock your <1>Ledger device</1>"
},
"step2": {
"open": "Open the <1><0>{{managerAppName}}</0></1> app on your device"
}
"step1": "Connect and unlock your <1>Ledger device</1>",
"step2": "Navigate to the <1><0>{{managerAppName}}</0></1> app on your device",
"step3": "Allow <1><0>Ledger Manager</0></1> on your device"
},
"emptyState": {
"sidebar": {
@ -347,10 +344,23 @@
"title": "Settings",
"tabs": {
"display": "General",
"export": "Export accounts",
"currencies": "Currencies",
"help": "Help",
"about": "About"
},
"export": {
"desc": "Import accounts on your Ledger Live Mobile app",
"button": "Export",
"modal":{
"button": "Done",
"title": "Scan to export to mobile",
"listTitle": "To import accounts on your Ledger Live Mobile app:",
"step1": "Tap the <1><0>+</0></1> button in Accounts",
"step2": "Tap <1><0>Import desktop accounts</0></1>",
"step3": "Scan until the loader hits 100%"
}
},
"display": {
"desc": "Configure general Ledger Live settings.",
"language": "Display language",
@ -619,7 +629,7 @@
"step2": {
"title": "Did you save your recovery phrase by yourself?"
},
"step3": {
"step3":{
"title": "Is your Ledger device genuine?"
},
"isGenuinePassed": "Your device is genuine",

Loading…
Cancel
Save