send funds modal wip

This commit is contained in:
mmv 2019-04-29 19:58:47 +04:00
parent e0c70551ee
commit 1d25492e68
6 changed files with 65 additions and 21 deletions

View File

@ -1,5 +0,0 @@
// @flow
import AssetTableCell from './AssetTableCell'
export default AssetTableCell

View File

@ -1,5 +1,5 @@
// @flow // @flow
import React, { useState, useEffect } from 'react' import React, { useState } from 'react'
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'
@ -10,6 +10,9 @@ type Props = {
onClose: () => void, onClose: () => void,
classes: Object, classes: Object,
isOpen: boolean, isOpen: boolean,
safeAddress: string,
etherScanLink: string,
safeName: string,
} }
type ActiveScreen = 'chooseTxType' | 'sendFunds' type ActiveScreen = 'chooseTxType' | 'sendFunds'
@ -20,16 +23,19 @@ const styles = () => ({
}, },
}) })
const Send = ({ onClose, isOpen, classes }: Props) => { const Send = ({
const [activeScreen, setActiveScreen] = useState<ActiveScreen>('chooseTxType') onClose, isOpen, classes, safeAddress, etherScanLink, safeName,
}: Props) => {
const [activeScreen, setActiveScreen] = useState<ActiveScreen>('sendFunds')
const smallerModalSize = activeScreen === 'chooseTxType' const smallerModalSize = activeScreen === 'chooseTxType'
useEffect( // Uncomment when we add custom txs
() => () => { // useEffect(
setActiveScreen('chooseTxType') // () => () => {
}, // setActiveScreen('chooseTxType')
[isOpen], // },
) // [isOpen],
// )
return ( return (
<Modal <Modal
@ -41,7 +47,15 @@ const Send = ({ onClose, isOpen, classes }: Props) => {
> >
<React.Fragment> <React.Fragment>
{activeScreen === 'chooseTxType' && <ChooseTxType onClose={onClose} setActiveScreen={setActiveScreen} />} {activeScreen === 'chooseTxType' && <ChooseTxType onClose={onClose} setActiveScreen={setActiveScreen} />}
{activeScreen === 'sendFunds' && <SendFunds onClose={onClose} setActiveScreen={setActiveScreen} />} {activeScreen === 'sendFunds' && (
<SendFunds
onClose={onClose}
setActiveScreen={setActiveScreen}
safeAddress={safeAddress}
etherScanLink={etherScanLink}
safeName={safeName}
/>
)}
</React.Fragment> </React.Fragment>
</Modal> </Modal>
) )

View File

@ -41,7 +41,7 @@ type Props = {
const ChooseTxType = ({ classes, onClose, setActiveScreen }: Props) => ( const ChooseTxType = ({ classes, onClose, setActiveScreen }: Props) => (
<React.Fragment> <React.Fragment>
<Row align="center" grow className={classes.heading}> <Row align="center" grow className={classes.heading}>
<Paragraph className={classes.manage} noMargin> <Paragraph weight="bolder" className={classes.manage} noMargin>
Send Send
</Paragraph> </Paragraph>
<IconButton onClick={onClose} disableRipple> <IconButton onClick={onClose} disableRipple>

View File

@ -3,10 +3,16 @@ import * as React from 'react'
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 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 Link from '~/components/layout/Link'
import Col from '~/components/layout/Col'
import Block from '~/components/layout/Block'
import Hairline from '~/components/layout/Hairline' import Hairline from '~/components/layout/Hairline'
import { lg, sm } from '~/theme/variables' import { lg, sm, secondary } from '~/theme/variables'
import { copyToClipboard } from '~/utils/clipboard'
const styles = () => ({ const styles = () => ({
heading: { heading: {
@ -24,16 +30,25 @@ const styles = () => ({
}, },
}) })
const openIconStyle = {
height: '16px',
color: secondary,
}
type Props = { type Props = {
onClose: () => void, onClose: () => void,
classes: Object, classes: Object,
setActiveScreen: Function, safeAddress: string,
etherScanLink: string,
safeName: string,
} }
const Send = ({ classes, onClose, setActiveScreen }: Props) => ( const Send = ({
classes, onClose, safeAddress, etherScanLink, safeName,
}: Props) => (
<React.Fragment> <React.Fragment>
<Row align="center" grow className={classes.heading}> <Row align="center" grow className={classes.heading}>
<Paragraph className={classes.manage} noMargin> <Paragraph weight="bolder" className={classes.manage} noMargin>
Send Funds Send Funds
</Paragraph> </Paragraph>
<IconButton onClick={onClose} disableRipple> <IconButton onClick={onClose} disableRipple>
@ -41,6 +56,20 @@ const Send = ({ classes, onClose, setActiveScreen }: Props) => (
</IconButton> </IconButton>
</Row> </Row>
<Hairline /> <Hairline />
<Row>
<Col layout="column" middle="xs">
<Identicon address={safeAddress} diameter={32} />
</Col>
<Col layout="column">
<Paragraph weight="bolder">{safeName}</Paragraph>
<Paragraph weight="bolder" onClick={copyToClipboard}>
{safeAddress}
<Link to={etherScanLink} target="_blank">
<OpenInNew style={openIconStyle} />
</Link>
</Paragraph>
</Col>
</Row>
</React.Fragment> </React.Fragment>
) )

View File

@ -159,7 +159,13 @@ class Balances extends React.Component<Props, State> {
)) ))
} }
</Table> </Table>
<SendModal onClose={this.onHide('Send')} isOpen={showSend} /> <SendModal
onClose={this.onHide('Send')}
isOpen={showSend}
etherScanLink={etherScanLink}
safeAddress={safeAddress}
safeName={safeName}
/>
<Modal <Modal
title="Receive Tokens" title="Receive Tokens"
description="Receive Tokens Form" description="Receive Tokens Form"