WA-238 Withdrawn component

This commit is contained in:
apanizo 2018-05-08 13:47:14 +02:00
parent 2d63300e54
commit 48dcf7c040
2 changed files with 67 additions and 13 deletions

View File

@ -38,7 +38,9 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
} }
onWithdrawn = () => { onWithdrawn = () => {
this.setState({ component: <Withdrawn /> }) const { safe } = this.props
this.setState({ component: <Withdrawn safeAddress={safe.get('address')} /> })
} }
render() { render() {
@ -47,7 +49,7 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
return ( return (
<Row grow> <Row grow>
<Col sm={12} top="xs" md={6} margin="xl" overflow> <Col sm={12} top="xs" md={5} margin="xl" overflow>
<List style={listStyle}> <List style={listStyle}>
<Balance balance={balance} /> <Balance balance={balance} />
<Owners owners={safe.owners} /> <Owners owners={safe.owners} />
@ -56,7 +58,7 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
<DailyLimit limit={safe.get('dailyLimit')} onWithdrawn={this.onWithdrawn} /> <DailyLimit limit={safe.get('dailyLimit')} onWithdrawn={this.onWithdrawn} />
</List> </List>
</Col> </Col>
<Col sm={12} center="xs" md={6} margin="xl" layout="column"> <Col sm={12} center="xs" md={7} 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>
@ -71,8 +73,4 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
} }
} }
/*
<Paragraph size="lg">
<Bold>{safe.name.toUpperCase()}</Bold>
*/
export default GnoSafe export default GnoSafe

View File

@ -1,10 +1,66 @@
// @flow // @flow
import * as React from 'react' import * as React from 'react'
import { connect } from 'react-redux'
import Stepper from '~/components/Stepper'
import { TXS_ADDRESS } from '~/routes/routes'
import selector, { type SelectorProps } from './selector'
import withdrawn from './withdrawn'
import WithdrawnForm from './WithdrawnForm'
import Review from './Review'
const Withdrawn = () => ( const getSteps = () => [
<div> 'Fill Withdrawn Form', 'Review Withdrawn',
Withdrawn form ]
</div>
) type Props = SelectorProps & {
safeAddress: string,
}
type State = {
done: boolean,
}
class Withdrawn extends React.Component<Props, State> {
state = {
done: false,
}
onWithdrawn = async (values: Object) => {
try {
const { safeAddress, userAddress } = this.props
await withdrawn(values, safeAddress, userAddress)
this.setState({ done: true })
} catch (error) {
this.setState({ done: false })
// eslint-disable-next-line
console.log('Error while withdrawing funds ' + error)
}
}
render() {
const { done } = this.state
const steps = getSteps()
return (
<React.Fragment>
<Stepper
goPath={TXS_ADDRESS}
goTitle="SEE TXS"
onSubmit={this.onWithdrawn}
finishedTransaction={done}
steps={steps}
>
<Stepper.Page>
{ WithdrawnForm }
</Stepper.Page>
<Stepper.Page>
{ Review }
</Stepper.Page>
</Stepper>
</React.Fragment>
)
}
}
export default connect(selector)(Withdrawn)
export default Withdrawn