WA-238 Logic for showing Withdrawn form after clicking on Safe's button

This commit is contained in:
apanizo 2018-05-07 15:50:52 +02:00
parent 9f2ea3d4e6
commit 88795cf890
3 changed files with 41 additions and 7 deletions

View File

@ -3,18 +3,27 @@ import * as React from 'react'
import { ListItem } from 'material-ui/List' import { ListItem } from 'material-ui/List'
import Avatar from 'material-ui/Avatar' import Avatar from 'material-ui/Avatar'
import NotificationsPaused from 'material-ui-icons/NotificationsPaused' import NotificationsPaused from 'material-ui-icons/NotificationsPaused'
import Button from '~/components/layout/Button'
import ListItemText from '~/components/List/ListItemText' import ListItemText from '~/components/List/ListItemText'
type Props = { type Props = {
limit: number, limit: number,
onWithdrawn: () => void,
} }
const DailyLimit = ({ limit }: Props) => ( const DailyLimit = ({ limit, onWithdrawn }: Props) => (
<ListItem> <ListItem>
<Avatar> <Avatar>
<NotificationsPaused /> <NotificationsPaused />
</Avatar> </Avatar>
<ListItemText primary="Daily Limit" secondary={`${limit} ETH`} /> <ListItemText primary="Daily Limit" secondary={`${limit} ETH`} />
<Button
variant="raised"
color="primary"
onClick={onWithdrawn}
>
Withdrawn
</Button>
</ListItem> </ListItem>
) )

View File

@ -9,6 +9,8 @@ import Row from '~/components/layout/Row'
import { type Safe } from '~/routes/safe/store/model/safe' import { type Safe } from '~/routes/safe/store/model/safe'
import List from 'material-ui/List' import List from 'material-ui/List'
import Withdrawn from '~/routes/safe/component/Withdrawn'
import Address from './Address' import Address from './Address'
import Balance from './Balance' import Balance from './Balance'
import Owners from './Owners' import Owners from './Owners'
@ -22,33 +24,46 @@ type SafeProps = {
balance: string, balance: string,
} }
type State = {
component: React$Node,
}
const listStyle = { const listStyle = {
width: '100%', width: '100%',
} }
class GnoSafe extends React.PureComponent<SafeProps> { class GnoSafe extends React.PureComponent<SafeProps, State> {
state = {
component: undefined,
}
onWithdrawn = () => {
this.setState({ component: <Withdrawn /> })
}
render() { render() {
const { safe, balance } = this.props const { safe, balance } = this.props
const { component } = this.state
return ( return (
<Row grow> <Row grow>
<Col sm={12} top="xs" md={4} margin="xl" overflow> <Col sm={12} top="xs" md={6} margin="xl" overflow>
<List style={listStyle}> <List style={listStyle}>
<Balance balance={balance} /> <Balance balance={balance} />
<Owners owners={safe.owners} /> <Owners owners={safe.owners} />
<Confirmations confirmations={safe.get('confirmations')} /> <Confirmations confirmations={safe.get('confirmations')} />
<Address address={safe.get('address')} /> <Address address={safe.get('address')} />
<DailyLimit limit={safe.get('dailyLimit')} /> <DailyLimit limit={safe.get('dailyLimit')} onWithdrawn={this.onWithdrawn} />
</List> </List>
</Col> </Col>
<Col sm={12} center="xs" md={8} margin="xl" layout="column"> <Col sm={12} center="xs" md={6} margin="xl" layout="column">
<Block margin="xl"> <Block margin="xl">
<Paragraph size="lg" noMargin align="right"> <Paragraph size="lg" noMargin align="right">
<Bold>{safe.name.toUpperCase()}</Bold> <Bold>{safe.name.toUpperCase()}</Bold>
</Paragraph> </Paragraph>
</Block> </Block>
<Row grow align="center"> <Row grow align={component ? undefined : 'center'}>
<Img alt="Safe Icon" src={safeIcon} height={330} /> { component || <Img alt="Safe Icon" src={safeIcon} height={330} /> }
</Row> </Row>
</Col> </Col>
</Row> </Row>

View File

@ -0,0 +1,10 @@
// @flow
import * as React from 'react'
const Withdrawn = () => (
<div>
Withdrawn form
</div>
)
export default Withdrawn