diff --git a/src/routes/safe/component/Withdrawn/Review.jsx b/src/routes/safe/component/Withdrawn/Review/index.jsx similarity index 60% rename from src/routes/safe/component/Withdrawn/Review.jsx rename to src/routes/safe/component/Withdrawn/Review/index.jsx index ce73827b..303d0588 100644 --- a/src/routes/safe/component/Withdrawn/Review.jsx +++ b/src/routes/safe/component/Withdrawn/Review/index.jsx @@ -1,16 +1,22 @@ // @flow import * as React from 'react' +import { CircularProgress } from 'material-ui/Progress' import Block from '~/components/layout/Block' import Bold from '~/components/layout/Bold' import Heading from '~/components/layout/Heading' import Paragraph from '~/components/layout/Paragraph' -import { DESTINATION_PARAM, VALUE_PARAM } from './withdrawn' +import { DESTINATION_PARAM, VALUE_PARAM } from '~/routes/safe/component/Withdrawn/withdrawn' type FormProps = { values: Object, + submitting: boolean, } -const Review = () => ({ values }: FormProps) => ( +const spinnerStyle = { + minHeight: '50px', +} + +const Review = () => ({ values, submitting }: FormProps) => ( Review the Withdrawn Operation @@ -19,6 +25,9 @@ const Review = () => ({ values }: FormProps) => ( Value in ETH: {values[VALUE_PARAM]} + + { submitting && } + ) diff --git a/src/routes/safe/component/Withdrawn/Withdrawn.stories.js b/src/routes/safe/component/Withdrawn/WithdrawnForm/WithdrawnForm.stories.js similarity index 100% rename from src/routes/safe/component/Withdrawn/Withdrawn.stories.js rename to src/routes/safe/component/Withdrawn/WithdrawnForm/WithdrawnForm.stories.js diff --git a/src/routes/safe/component/Withdrawn/WithdrawnForm.jsx b/src/routes/safe/component/Withdrawn/WithdrawnForm/index.jsx similarity index 95% rename from src/routes/safe/component/Withdrawn/WithdrawnForm.jsx rename to src/routes/safe/component/Withdrawn/WithdrawnForm/index.jsx index 875c209e..a3767d09 100644 --- a/src/routes/safe/component/Withdrawn/WithdrawnForm.jsx +++ b/src/routes/safe/component/Withdrawn/WithdrawnForm/index.jsx @@ -5,7 +5,7 @@ import TextField from '~/components/forms/TextField' import { composeValidators, mustBeNumber, required, greaterThan, mustBeEthereumAddress } from '~/components/forms/validator' import Block from '~/components/layout/Block' import Heading from '~/components/layout/Heading' -import { DESTINATION_PARAM, VALUE_PARAM } from './withdrawn' +import { DESTINATION_PARAM, VALUE_PARAM } from '~/routes/safe/component/Withdrawn/withdrawn' export const CONFIRMATIONS_ERROR = 'Number of confirmations can not be higher than the number of owners' diff --git a/src/routes/safe/component/Withdrawn/actions.js b/src/routes/safe/component/Withdrawn/actions.js new file mode 100644 index 00000000..8caf6dff --- /dev/null +++ b/src/routes/safe/component/Withdrawn/actions.js @@ -0,0 +1,10 @@ +// @flow +import fetchDailyLimit from '~/routes/safe/store/actions/fetchDailyLimit' + +export type Actions = { + fetchDailyLimit: typeof fetchDailyLimit, +} + +export default { + fetchDailyLimit, +} diff --git a/src/routes/safe/component/Withdrawn/index.jsx b/src/routes/safe/component/Withdrawn/index.jsx index 546f04a8..28d41d91 100644 --- a/src/routes/safe/component/Withdrawn/index.jsx +++ b/src/routes/safe/component/Withdrawn/index.jsx @@ -3,6 +3,8 @@ import * as React from 'react' import { connect } from 'react-redux' import Stepper from '~/components/Stepper' import { SAFELIST_ADDRESS } from '~/routes/routes' +import { sleep } from '~/utils/timer' +import actions, { type Actions } from './actions' import selector, { type SelectorProps } from './selector' import withdrawn from './withdrawn' import WithdrawnForm from './WithdrawnForm' @@ -12,7 +14,7 @@ const getSteps = () => [ 'Fill Withdrawn Form', 'Review Withdrawn', ] -type Props = SelectorProps & { +type Props = SelectorProps & Actions & { safeAddress: string, dailyLimit: DailyLimit, } @@ -32,6 +34,8 @@ class Withdrawn extends React.Component { try { const { safeAddress, userAddress } = this.props await withdrawn(values, safeAddress, userAddress) + await sleep(5000) + this.props.fetchDailyLimit(safeAddress) this.setState({ done: true }) } catch (error) { this.setState({ done: false }) @@ -66,5 +70,5 @@ class Withdrawn extends React.Component { } } -export default connect(selector)(Withdrawn) +export default connect(selector, actions)(Withdrawn) diff --git a/src/routes/safe/component/Withdrawn/withdrawn.test.js b/src/routes/safe/component/Withdrawn/withdrawn.test.js index b5fafd1a..e1bfe738 100644 --- a/src/routes/safe/component/Withdrawn/withdrawn.test.js +++ b/src/routes/safe/component/Withdrawn/withdrawn.test.js @@ -24,6 +24,3 @@ describe('Safe Blockchain Test', () => { expect(executeWithdrawnOn(safeAddress, value)).rejects.toThrow('VM Exception while processing transaction: revert') }) }) -// } - -// export default updateDailyLimitReducerTests diff --git a/src/routes/safe/container/actions.js b/src/routes/safe/container/actions.js index e489176c..4c0e607f 100644 --- a/src/routes/safe/container/actions.js +++ b/src/routes/safe/container/actions.js @@ -1,10 +1,13 @@ // @flow import fetchBalance from '~/routes/safe/store/actions/fetchBalance' +import fetchDailyLimit from '~/routes/safe/store/actions/fetchDailyLimit' export type Actions = { fetchBalance: typeof fetchBalance, + fetchDailyLimit: typeof fetchDailyLimit, } export default { fetchBalance, + fetchDailyLimit, } diff --git a/src/routes/safe/container/index.jsx b/src/routes/safe/container/index.jsx index e4575fac..095d3402 100644 --- a/src/routes/safe/container/index.jsx +++ b/src/routes/safe/container/index.jsx @@ -17,6 +17,8 @@ class SafeView extends React.PureComponent { const safeAddress: string = safe.get('address') fetchBalance(safeAddress) }, 1500) + + this.props.fetchDailyLimit(this.props.safe.get('address')) } componentWillUnmount() {