WA-238 Fixing flow errors

This commit is contained in:
apanizo 2018-05-16 15:38:45 +02:00
parent 140d393e54
commit c997bb4473
8 changed files with 18 additions and 11 deletions

View File

@ -15,6 +15,7 @@ import WithdrawnComponent, { SEE_TXS_BUTTON_TEXT } from '~/routes/safe/component
import { getBalanceInEtherOf } from '~/wallets/getWeb3'
import { sleep } from '~/utils/timer'
import { getDailyLimitFrom } from '~/routes/safe/component/Withdrawn/withdrawn'
import { type DailyLimitProps } from '~/routes/safe/store/model/dailyLimit'
describe('React DOM TESTS > Withdrawn funds from safe', () => {
let SafeDom

View File

@ -5,6 +5,7 @@ import Avatar from 'material-ui/Avatar'
import NotificationsPaused from 'material-ui-icons/NotificationsPaused'
import Button from '~/components/layout/Button'
import ListItemText from '~/components/List/ListItemText'
import { type DailyLimit } from '~/routes/safe/store/model/dailyLimit'
type Props = {
dailyLimit: DailyLimit,

View File

@ -1,9 +1,9 @@
// @flow
import { storiesOf } from '@storybook/react'
import * as React from 'react'
import Stepper from '~/components/Stepper'
import styles from '~/components/layout/PageFrame/index.scss'
import { makeDailyLimit, type DailyLimit } from '~/routes/safe/store/model/dailyLimit'
import Component from './index'
import WithdrawnForm from './index'
const FrameDecorator = story => (
@ -14,10 +14,8 @@ const FrameDecorator = story => (
storiesOf('Components', module)
.addDecorator(FrameDecorator)
.add('WitdrawnForm', () => {
const dailyLimit: DailyLimit = makeDailyLimit({ value: 10, spentToday: 6 })
return (
<Component dailyLimit={dailyLimit} safeAddress="" />
)
})
.add('WitdrawnForm', () => (
<Stepper.Page>
{ WithdrawnForm }
</Stepper.Page>
))

View File

@ -34,7 +34,7 @@ export const inLimit = (limit: number, spentToday: number) => (value: string) =>
return `Should not exceed ${max} ETH (amount to reach daily limit)`
}
export default ({ limit, spentToday }: Props) => () => (
const WithdrawnForm = ({ limit, spentToday }: Props) => () => (
<Block margin="md">
<Heading tag="h2" margin="lg">
Withdrawn Funds
@ -65,3 +65,4 @@ export default ({ limit, spentToday }: Props) => () => (
</Block>
)
export default WithdrawnForm

View File

@ -4,6 +4,7 @@ import { connect } from 'react-redux'
import Stepper from '~/components/Stepper'
import { SAFELIST_ADDRESS } from '~/routes/routes'
import { sleep } from '~/utils/timer'
import { type DailyLimit } from '~/routes/safe/store/model/dailyLimit'
import actions, { type Actions } from './actions'
import selector, { type SelectorProps } from './selector'
import withdrawn from './withdrawn'

View File

@ -18,7 +18,10 @@ class SafeView extends React.PureComponent<Props> {
fetchBalance(safeAddress)
}, 1500)
this.props.fetchDailyLimit(this.props.safe.get('address'))
const { fetchDailyLimit, safe } = this.props
if (safe) {
fetchDailyLimit(safe.get('address'))
}
}
componentWillUnmount() {

View File

@ -2,6 +2,7 @@
import type { Dispatch as ReduxDispatch } from 'redux'
import { type GlobalState } from '~/store/index'
import { getDailyLimitFrom } from '~/routes/safe/component/Withdrawn/withdrawn'
import { type DailyLimitProps } from '~/routes/safe/store/model/dailyLimit'
import updateDailyLimit from './updateDailyLimit'
export default (safeAddress: string) => async (dispatch: ReduxDispatch<GlobalState>) => {

View File

@ -1,5 +1,6 @@
// @flow
import { createAction } from 'redux-actions'
import { type DailyLimitProps } from '~/routes/safe/store/model/dailyLimit'
export const UPDATE_DAILY_LIMIT = 'UPDATE_DAILY_LIMIT'