|
@ -2,45 +2,47 @@ |
|
|
|
|
|
|
|
|
import React, { Fragment } from 'react' |
|
|
import React, { Fragment } from 'react' |
|
|
|
|
|
|
|
|
|
|
|
import type { Unit } from '@ledgerhq/currencies' |
|
|
import type { Account, T } from 'types/common' |
|
|
import type { Account, T } from 'types/common' |
|
|
import type { DoubleVal } from 'components/RequestAmount' |
|
|
import type { DoubleVal } from 'components/RequestAmount' |
|
|
|
|
|
|
|
|
import Box from 'components/base/Box' |
|
|
import Box from 'components/base/Box' |
|
|
import SelectAccount from 'components/SelectAccount' |
|
|
import CheckBox from 'components/base/CheckBox' |
|
|
|
|
|
import { Textarea } from 'components/base/Input' |
|
|
|
|
|
import InputCurrency from 'components/base/InputCurrency' |
|
|
import Label from 'components/base/Label' |
|
|
import Label from 'components/base/Label' |
|
|
import LabelInfoTooltip from 'components/base/LabelInfoTooltip' |
|
|
import LabelInfoTooltip from 'components/base/LabelInfoTooltip' |
|
|
import RecipientAddress from 'components/RecipientAddress' |
|
|
import RecipientAddress from 'components/RecipientAddress' |
|
|
import RequestAmount from 'components/RequestAmount' |
|
|
import RequestAmount from 'components/RequestAmount' |
|
|
import Select from 'components/base/Select' |
|
|
import Select from 'components/base/Select' |
|
|
import Input, { Textarea } from 'components/base/Input' |
|
|
import SelectAccount from 'components/SelectAccount' |
|
|
import Spoiler from 'components/base/Spoiler' |
|
|
import Spoiler from 'components/base/Spoiler' |
|
|
import CheckBox from 'components/base/CheckBox' |
|
|
|
|
|
|
|
|
|
|
|
type Props = { |
|
|
type PropsStepAmount = { |
|
|
account: Account | null, |
|
|
account: Account | null, |
|
|
onChange: Function, |
|
|
onChange: Function, |
|
|
recipientAddress: string, |
|
|
recipientAddress: string, |
|
|
amount: DoubleVal, |
|
|
amount: DoubleVal, |
|
|
|
|
|
fees: { |
|
|
|
|
|
value: number, |
|
|
|
|
|
unit: Unit | null, |
|
|
|
|
|
}, |
|
|
isRBF: boolean, |
|
|
isRBF: boolean, |
|
|
t: T, |
|
|
t: T, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function StepAmount(props: Props) { |
|
|
function StepAmount(props: PropsStepAmount) { |
|
|
const { onChange, account, recipientAddress, t, amount, isRBF } = props |
|
|
const { onChange, fees, account, recipientAddress, t, amount, isRBF } = props |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<Box flow={4}> |
|
|
<Box flow={4}> |
|
|
{/* */} |
|
|
{/* ACCOUNT SELECTION */} |
|
|
{/* ACCOUNT SELECTION */} |
|
|
|
|
|
{/* */} |
|
|
|
|
|
<Box flow={1}> |
|
|
<Box flow={1}> |
|
|
<Label>{t('send:steps.amount.selectAccountDebit')}</Label> |
|
|
<Label>{t('send:steps.amount.selectAccountDebit')}</Label> |
|
|
<SelectAccount onChange={onChange('account')} value={account} /> |
|
|
<SelectAccount onChange={onChange('account')} value={account} /> |
|
|
</Box> |
|
|
</Box> |
|
|
|
|
|
|
|
|
{/* */} |
|
|
{/* RECIPIENT ADDRESS */} |
|
|
{/* RECIPIENT ADDRESS */} |
|
|
|
|
|
{/* */} |
|
|
|
|
|
<Box flow={1}> |
|
|
<Box flow={1}> |
|
|
<Label> |
|
|
<Label> |
|
|
<span>{t('send:steps.amount.recipientAddress')}</span> |
|
|
<span>{t('send:steps.amount.recipientAddress')}</span> |
|
@ -55,41 +57,31 @@ function StepAmount(props: Props) { |
|
|
|
|
|
|
|
|
{account && ( |
|
|
{account && ( |
|
|
<Fragment> |
|
|
<Fragment> |
|
|
{/* */} |
|
|
{/* AMOUNT */} |
|
|
{/* AMOUNT */} |
|
|
|
|
|
{/* */} |
|
|
|
|
|
<Box flow={1}> |
|
|
<Box flow={1}> |
|
|
<Label>{t('send:steps.amount.amount')}</Label> |
|
|
<Label>{t('send:steps.amount.amount')}</Label> |
|
|
<RequestAmount account={account} onChange={onChange('amount')} value={amount} /> |
|
|
<RequestAmount account={account} onChange={onChange('amount')} value={amount} /> |
|
|
</Box> |
|
|
</Box> |
|
|
|
|
|
|
|
|
{/* */} |
|
|
{/* FEES */} |
|
|
{/* FEES */} |
|
|
|
|
|
{/* */} |
|
|
|
|
|
<Box flow={1}> |
|
|
<Box flow={1}> |
|
|
<Label> |
|
|
<Label> |
|
|
<span>{t('send:steps.amount.fees')}</span> |
|
|
<span>{t('send:steps.amount.fees')}</span> |
|
|
<LabelInfoTooltip ml={1} text={t('send:steps.amount.fees')} /> |
|
|
<LabelInfoTooltip ml={1} text={t('send:steps.amount.fees')} /> |
|
|
</Label> |
|
|
</Label> |
|
|
<Box horizontal flow={5}> |
|
|
<Box horizontal flow={5}> |
|
|
<Select |
|
|
<Fees |
|
|
style={{ width: 200 }} |
|
|
amount={fees.value} |
|
|
items={[{ key: 'custom', name: 'Custom' }]} |
|
|
unit={fees.unit} |
|
|
value={{ key: 'custom', name: 'Custom' }} |
|
|
account={account} |
|
|
renderSelected={item => item.name} |
|
|
onChange={(value, unit) => onChange('fees')({ value, unit })} |
|
|
onChange={onChange('fees')} |
|
|
|
|
|
/> |
|
|
/> |
|
|
<Input containerProps={{ grow: true }} /> |
|
|
|
|
|
</Box> |
|
|
</Box> |
|
|
</Box> |
|
|
</Box> |
|
|
|
|
|
|
|
|
{/* */} |
|
|
{/* ADVANCED OPTIONS */} |
|
|
{/* ADVANCED OPTIONS */} |
|
|
|
|
|
{/* */} |
|
|
|
|
|
<Spoiler title="Advanced options"> |
|
|
<Spoiler title="Advanced options"> |
|
|
{/* */} |
|
|
|
|
|
{/* RBF transaction */} |
|
|
{/* RBF transaction */} |
|
|
{/* */} |
|
|
|
|
|
<Box horizontal align="center" flow={5}> |
|
|
<Box horizontal align="center" flow={5}> |
|
|
<Box style={{ width: 200 }}> |
|
|
<Box style={{ width: 200 }}> |
|
|
<Label> |
|
|
<Label> |
|
@ -102,9 +94,7 @@ function StepAmount(props: Props) { |
|
|
</Box> |
|
|
</Box> |
|
|
</Box> |
|
|
</Box> |
|
|
|
|
|
|
|
|
{/* */} |
|
|
|
|
|
{/* Message */} |
|
|
{/* Message */} |
|
|
{/* */} |
|
|
|
|
|
<Box horizontal align="flex-start" flow={5}> |
|
|
<Box horizontal align="flex-start" flow={5}> |
|
|
<Box style={{ width: 200 }}> |
|
|
<Box style={{ width: 200 }}> |
|
|
<Label> |
|
|
<Label> |
|
@ -122,4 +112,35 @@ function StepAmount(props: Props) { |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type PropsFees = { |
|
|
|
|
|
account: Account, |
|
|
|
|
|
amount: number, |
|
|
|
|
|
onChange: Function, |
|
|
|
|
|
unit: Unit | null, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function Fees(props: PropsFees) { |
|
|
|
|
|
const { onChange, account, unit, amount } = props |
|
|
|
|
|
const { units } = account.currency |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
<Fragment> |
|
|
|
|
|
<Select |
|
|
|
|
|
style={{ width: 200 }} |
|
|
|
|
|
items={[{ key: 'custom', name: 'Custom' }]} |
|
|
|
|
|
value={{ key: 'custom', name: 'Custom' }} |
|
|
|
|
|
renderSelected={item => item.name} |
|
|
|
|
|
onChange={() => onChange(amount, unit)} |
|
|
|
|
|
/> |
|
|
|
|
|
<InputCurrency |
|
|
|
|
|
units={units} |
|
|
|
|
|
unit={unit || units[0]} |
|
|
|
|
|
containerProps={{ grow: true }} |
|
|
|
|
|
value={amount} |
|
|
|
|
|
onChange={onChange} |
|
|
|
|
|
/> |
|
|
|
|
|
</Fragment> |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
export default StepAmount |
|
|
export default StepAmount |
|
|