|
@ -1,8 +1,9 @@ |
|
|
// @flow
|
|
|
// @flow
|
|
|
|
|
|
|
|
|
import React, { Fragment, PureComponent } from 'react' |
|
|
import React, { PureComponent } from 'react' |
|
|
import { translate } from 'react-i18next' |
|
|
import { translate } from 'react-i18next' |
|
|
import get from 'lodash/get' |
|
|
import get from 'lodash/get' |
|
|
|
|
|
import { getDefaultUnitByCoinType } from '@ledgerhq/currencies' |
|
|
|
|
|
|
|
|
import type { T } from 'types/common' |
|
|
import type { T } from 'types/common' |
|
|
|
|
|
|
|
@ -12,11 +13,11 @@ import Box from 'components/base/Box' |
|
|
import Button from 'components/base/Button' |
|
|
import Button from 'components/base/Button' |
|
|
import Input from 'components/base/Input' |
|
|
import Input from 'components/base/Input' |
|
|
import Label from 'components/base/Label' |
|
|
import Label from 'components/base/Label' |
|
|
import Modal, { ModalBody } from 'components/base/Modal' |
|
|
import Modal, { ModalBody, ModalTitle, ModalFooter, ModalContent } from 'components/base/Modal' |
|
|
import Breadcrumb from 'components/Breadcrumb' |
|
|
import Breadcrumb from 'components/Breadcrumb' |
|
|
import RecipientAddress from 'components/RecipientAddress' |
|
|
import RecipientAddress from 'components/RecipientAddress' |
|
|
import SelectAccount from 'components/SelectAccount' |
|
|
import SelectAccount from 'components/SelectAccount' |
|
|
import Text from 'components/base/Text' |
|
|
import FormattedVal from 'components/base/FormattedVal' |
|
|
|
|
|
|
|
|
const Steps = { |
|
|
const Steps = { |
|
|
'1': ({ t, ...props }: Object) => ( |
|
|
'1': ({ t, ...props }: Object) => ( |
|
@ -29,9 +30,8 @@ const Steps = { |
|
|
} |
|
|
} |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
<Box flow={5}> |
|
|
<Box flow={4}> |
|
|
<Text fontSize={6}>{t('send:title')}</Text> |
|
|
<Box flow={1}> |
|
|
<Box flow={2}> |
|
|
|
|
|
<Label>Account to debit</Label> |
|
|
<Label>Account to debit</Label> |
|
|
<SelectAccount onChange={props.onChangeInput('account')} value={props.value.account} /> |
|
|
<SelectAccount onChange={props.onChangeInput('account')} value={props.value.account} /> |
|
|
</Box> |
|
|
</Box> |
|
@ -43,16 +43,6 @@ const Steps = { |
|
|
<Label>Amount</Label> |
|
|
<Label>Amount</Label> |
|
|
<Input onChange={props.onChangeInput('amount')} value={props.value.amount} /> |
|
|
<Input onChange={props.onChangeInput('amount')} value={props.value.amount} /> |
|
|
</Box> |
|
|
</Box> |
|
|
<Box horizontal alignItems="center"> |
|
|
|
|
|
<Box grow> |
|
|
|
|
|
<Text>Cancel</Text> |
|
|
|
|
|
</Box> |
|
|
|
|
|
<Box justifyContent="flex-end"> |
|
|
|
|
|
<Button type="submit" primary disabled={!props.canSubmit}> |
|
|
|
|
|
Next |
|
|
|
|
|
</Button> |
|
|
|
|
|
</Box> |
|
|
|
|
|
</Box> |
|
|
|
|
|
</Box> |
|
|
</Box> |
|
|
</form> |
|
|
</form> |
|
|
), |
|
|
), |
|
@ -157,25 +147,35 @@ class Send extends PureComponent<Props, State> { |
|
|
|
|
|
|
|
|
render() { |
|
|
render() { |
|
|
const { step } = this.state |
|
|
const { step } = this.state |
|
|
|
|
|
const { t } = this.props |
|
|
|
|
|
const Step = Steps[step] |
|
|
return ( |
|
|
return ( |
|
|
<Modal |
|
|
<Modal |
|
|
name={MODAL_SEND} |
|
|
name={MODAL_SEND} |
|
|
onHide={this.handleHide} |
|
|
onHide={this.handleHide} |
|
|
render={({ data, onClose }) => { |
|
|
render={({ data, onClose }) => ( |
|
|
const Step = Steps[step] |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
<Fragment> |
|
|
|
|
|
<ModalBody p={3}> |
|
|
|
|
|
<Breadcrumb currentStep={step} items={this._items} /> |
|
|
|
|
|
</ModalBody> |
|
|
|
|
|
<ModalBody onClose={onClose}> |
|
|
<ModalBody onClose={onClose}> |
|
|
|
|
|
<ModalTitle>{t('send:title')}</ModalTitle> |
|
|
|
|
|
<ModalContent> |
|
|
|
|
|
<Box mb={6} mt={2}> |
|
|
|
|
|
<Breadcrumb currentStep={step} items={this._items} /> |
|
|
|
|
|
</Box> |
|
|
<Step {...this.getStepProps(data)} /> |
|
|
<Step {...this.getStepProps(data)} /> |
|
|
|
|
|
</ModalContent> |
|
|
|
|
|
<ModalFooter horizontal align="center"> |
|
|
|
|
|
<Box grow> |
|
|
|
|
|
<Label>{'Total spent'}</Label> |
|
|
|
|
|
<FormattedVal |
|
|
|
|
|
color="dark" |
|
|
|
|
|
val={15496420404} |
|
|
|
|
|
unit={getDefaultUnitByCoinType(0)} |
|
|
|
|
|
showCode |
|
|
|
|
|
/> |
|
|
|
|
|
</Box> |
|
|
|
|
|
<Button primary>{'Next'}</Button> |
|
|
|
|
|
</ModalFooter> |
|
|
</ModalBody> |
|
|
</ModalBody> |
|
|
</Fragment> |
|
|
)} |
|
|
) |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
/> |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|