add tokens menuitem
This commit is contained in:
parent
e158f85c65
commit
61c98a9ab3
|
@ -20,13 +20,12 @@ const SelectInput = ({
|
||||||
}: SelectFieldProps) => {
|
}: SelectFieldProps) => {
|
||||||
const showError = ((meta.submitError && !meta.dirtySinceLastSubmit) || meta.error) && meta.touched
|
const showError = ((meta.submitError && !meta.dirtySinceLastSubmit) || meta.error) && meta.touched
|
||||||
const inputProps = { ...restInput, name }
|
const inputProps = { ...restInput, name }
|
||||||
const inputRootProps = { style: { borderRadius: '5px' } }
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormControl {...formControlProps} error={showError} style={style}>
|
<FormControl {...formControlProps} error={showError} style={style}>
|
||||||
<InputLabel htmlFor={name}>{label}</InputLabel>
|
<InputLabel htmlFor={name}>{label}</InputLabel>
|
||||||
{/* eslint-disable-next-line */}
|
{/* eslint-disable-next-line */}
|
||||||
<Select {...rest} onChange={onChange} inputProps={inputProps} InputProps={inputRootProps} value={value} />
|
<Select {...rest} onChange={onChange} inputProps={inputProps} value={value} />
|
||||||
{showError && <FormHelperText>{meta.error || meta.submitError}</FormHelperText>}
|
{showError && <FormHelperText>{meta.error || meta.submitError}</FormHelperText>}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
import { List } from 'immutable'
|
||||||
|
import { type Token } from '~/logic/tokens/store/model/token'
|
||||||
import cn from 'classnames'
|
import cn from 'classnames'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import Modal from '~/components/Modal'
|
import Modal from '~/components/Modal'
|
||||||
|
@ -14,6 +16,7 @@ type Props = {
|
||||||
etherScanLink: string,
|
etherScanLink: string,
|
||||||
safeName: string,
|
safeName: string,
|
||||||
ethBalance: string,
|
ethBalance: string,
|
||||||
|
tokens: List<Token>,
|
||||||
}
|
}
|
||||||
type ActiveScreen = 'chooseTxType' | 'sendFunds'
|
type ActiveScreen = 'chooseTxType' | 'sendFunds'
|
||||||
|
|
||||||
|
@ -25,7 +28,7 @@ const styles = () => ({
|
||||||
})
|
})
|
||||||
|
|
||||||
const Send = ({
|
const Send = ({
|
||||||
onClose, isOpen, classes, safeAddress, etherScanLink, safeName, ethBalance,
|
onClose, isOpen, classes, safeAddress, etherScanLink, safeName, ethBalance, tokens,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const [activeScreen, setActiveScreen] = useState<ActiveScreen>('sendFunds')
|
const [activeScreen, setActiveScreen] = useState<ActiveScreen>('sendFunds')
|
||||||
const smallerModalSize = activeScreen === 'chooseTxType'
|
const smallerModalSize = activeScreen === 'chooseTxType'
|
||||||
|
@ -56,6 +59,7 @@ const Send = ({
|
||||||
etherScanLink={etherScanLink}
|
etherScanLink={etherScanLink}
|
||||||
safeName={safeName}
|
safeName={safeName}
|
||||||
ethBalance={ethBalance}
|
ethBalance={ethBalance}
|
||||||
|
tokens={tokens}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
import { List } from 'immutable'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import Close from '@material-ui/icons/Close'
|
import Close from '@material-ui/icons/Close'
|
||||||
import IconButton from '@material-ui/core/IconButton'
|
import IconButton from '@material-ui/core/IconButton'
|
||||||
import OpenInNew from '@material-ui/icons/OpenInNew'
|
import OpenInNew from '@material-ui/icons/OpenInNew'
|
||||||
import MenuItem from '@material-ui/core/MenuItem'
|
import MenuItem from '@material-ui/core/MenuItem'
|
||||||
|
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
||||||
|
import ListItemText from '@material-ui/core/ListItemText'
|
||||||
import Identicon from '~/components/Identicon'
|
import Identicon from '~/components/Identicon'
|
||||||
import Paragraph from '~/components/layout/Paragraph'
|
import Paragraph from '~/components/layout/Paragraph'
|
||||||
import Row from '~/components/layout/Row'
|
import Row from '~/components/layout/Row'
|
||||||
import GnoForm from '~/components/forms/GnoForm'
|
import GnoForm from '~/components/forms/GnoForm'
|
||||||
import Link from '~/components/layout/Link'
|
import Link from '~/components/layout/Link'
|
||||||
|
import Img from '~/components/layout/Img'
|
||||||
import Col from '~/components/layout/Col'
|
import Col from '~/components/layout/Col'
|
||||||
import Field from '~/components/forms/Field'
|
import Field from '~/components/forms/Field'
|
||||||
import TextField from '~/components/forms/TextField'
|
import TextField from '~/components/forms/TextField'
|
||||||
|
@ -20,7 +24,9 @@ import Hairline from '~/components/layout/Hairline'
|
||||||
import {
|
import {
|
||||||
lg, md, sm, secondary, xs,
|
lg, md, sm, secondary, xs,
|
||||||
} from '~/theme/variables'
|
} from '~/theme/variables'
|
||||||
|
import { type Token } from '~/logic/tokens/store/model/token'
|
||||||
import { composeValidators, required, mustBeEthereumAddress } from '~/components/forms/validator'
|
import { composeValidators, required, mustBeEthereumAddress } from '~/components/forms/validator'
|
||||||
|
import { setImageToPlaceholder } from '~/routes/safe/components/Balances/utils'
|
||||||
import { copyToClipboard } from '~/utils/clipboard'
|
import { copyToClipboard } from '~/utils/clipboard'
|
||||||
import ArrowDown from './assets/arrow-down.svg'
|
import ArrowDown from './assets/arrow-down.svg'
|
||||||
|
|
||||||
|
@ -65,10 +71,11 @@ type Props = {
|
||||||
etherScanLink: string,
|
etherScanLink: string,
|
||||||
safeName: string,
|
safeName: string,
|
||||||
ethBalance: string,
|
ethBalance: string,
|
||||||
|
tokens: List<Token>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const SendFunds = ({
|
const SendFunds = ({
|
||||||
classes, onClose, safeAddress, etherScanLink, safeName, ethBalance,
|
classes, onClose, safeAddress, etherScanLink, safeName, ethBalance, tokens,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const handleSubmit = () => {}
|
const handleSubmit = () => {}
|
||||||
|
|
||||||
|
@ -138,12 +145,14 @@ ETH
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
<Field name="token" component={SelectField} validate={composeValidators(required)}>
|
<Field name="token" component={SelectField} validate={composeValidators(required)}>
|
||||||
<MenuItem>
|
{tokens.map(token => (
|
||||||
1
|
<MenuItem key={token.address}>
|
||||||
</MenuItem>
|
<ListItemIcon>
|
||||||
<MenuItem>
|
<Img src={token.logoUri} height={28} alt={token.name} onError={setImageToPlaceholder} />
|
||||||
2
|
</ListItemIcon>
|
||||||
</MenuItem>
|
<ListItemText primary={token.name} secondary={`${token.balance} ${token.symbol}`} />
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
</Field>
|
</Field>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
@ -167,6 +167,7 @@ class Balances extends React.Component<Props, State> {
|
||||||
safeAddress={safeAddress}
|
safeAddress={safeAddress}
|
||||||
safeName={safeName}
|
safeName={safeName}
|
||||||
ethBalance={ethBalance}
|
ethBalance={ethBalance}
|
||||||
|
tokens={activeTokens}
|
||||||
/>
|
/>
|
||||||
<Modal
|
<Modal
|
||||||
title="Receive Tokens"
|
title="Receive Tokens"
|
||||||
|
|
Loading…
Reference in New Issue