WA-232 updating new Flow token property in Safe component
This commit is contained in:
parent
2049c39ff4
commit
3919834f6d
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { storiesOf } from '@storybook/react'
|
import { storiesOf } from '@storybook/react'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { Map } from 'immutable'
|
import { List } from 'immutable'
|
||||||
import styles from '~/components/layout/PageFrame/index.scss'
|
import styles from '~/components/layout/PageFrame/index.scss'
|
||||||
import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder'
|
import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder'
|
||||||
import { makeToken } from '~/routes/tokens/store/model/token'
|
import { makeToken } from '~/routes/tokens/store/model/token'
|
||||||
|
@ -30,7 +30,7 @@ storiesOf('Routes /safe:address', module)
|
||||||
userAddress="foo"
|
userAddress="foo"
|
||||||
safe={undefined}
|
safe={undefined}
|
||||||
provider="METAMASK"
|
provider="METAMASK"
|
||||||
activeTokens={Map()}
|
activeTokens={List([])}
|
||||||
fetchBalance={() => {}}
|
fetchBalance={() => {}}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
@ -39,7 +39,7 @@ storiesOf('Routes /safe:address', module)
|
||||||
userAddress="foo"
|
userAddress="foo"
|
||||||
safe={undefined}
|
safe={undefined}
|
||||||
provider=""
|
provider=""
|
||||||
activeTokens={Map()}
|
activeTokens={List([])}
|
||||||
fetchBalance={() => {}}
|
fetchBalance={() => {}}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
@ -51,7 +51,7 @@ storiesOf('Routes /safe:address', module)
|
||||||
userAddress="foo"
|
userAddress="foo"
|
||||||
safe={safe}
|
safe={safe}
|
||||||
provider="METAMASK"
|
provider="METAMASK"
|
||||||
activeTokens={Map().set('ETH', ethBalance)}
|
activeTokens={List([]).push(ethBalance)}
|
||||||
fetchBalance={() => {}}
|
fetchBalance={() => {}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
@ -64,7 +64,7 @@ storiesOf('Routes /safe:address', module)
|
||||||
userAddress="foo"
|
userAddress="foo"
|
||||||
safe={safe}
|
safe={safe}
|
||||||
provider="METAMASK"
|
provider="METAMASK"
|
||||||
activeTokens={Map().set('ETH', ethBalance)}
|
activeTokens={List([]).push(ethBalance)}
|
||||||
fetchBalance={() => {}}
|
fetchBalance={() => {}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import List from '@material-ui/core/List'
|
import ListComponent from '@material-ui/core/List'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { Map } from 'immutable'
|
import { List } from 'immutable'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
import Col from '~/components/layout/Col'
|
import Col from '~/components/layout/Col'
|
||||||
import Bold from '~/components/layout/Bold'
|
import Bold from '~/components/layout/Bold'
|
||||||
|
@ -30,7 +30,7 @@ const safeIcon = require('./assets/gnosis_safe.svg')
|
||||||
|
|
||||||
type SafeProps = {
|
type SafeProps = {
|
||||||
safe: Safe,
|
safe: Safe,
|
||||||
tokens: Map<string, Token>,
|
tokens: List<Token>,
|
||||||
userAddress: string,
|
userAddress: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,12 +43,17 @@ const listStyle = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getEthBalanceFrom = (tokens: List<Token>) => {
|
const getEthBalanceFrom = (tokens: List<Token>) => {
|
||||||
const ethToken = tokens.filter(token => token.get('symbol') === 'ETH')
|
const filteredTokens = tokens.filter(token => token.get('symbol') === 'ETH')
|
||||||
if (ethToken.count() === 0) {
|
if (filteredTokens.count() === 0) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return Number(ethToken.get(0).get('funds'))
|
const ethToken = filteredTokens.get(0)
|
||||||
|
if (!ethToken) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return Number(ethToken.get('funds'))
|
||||||
}
|
}
|
||||||
|
|
||||||
class GnoSafe extends React.PureComponent<SafeProps, State> {
|
class GnoSafe extends React.PureComponent<SafeProps, State> {
|
||||||
|
@ -115,7 +120,7 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
|
||||||
return (
|
return (
|
||||||
<Row grow>
|
<Row grow>
|
||||||
<Col sm={12} top="xs" md={5} margin="xl" overflow>
|
<Col sm={12} top="xs" md={5} margin="xl" overflow>
|
||||||
<List style={listStyle}>
|
<ListComponent style={listStyle}>
|
||||||
<BalanceInfo tokens={tokens} onMoveFunds={this.onMoveTokens} safeAddress={address} />
|
<BalanceInfo tokens={tokens} onMoveFunds={this.onMoveTokens} safeAddress={address} />
|
||||||
<Owners
|
<Owners
|
||||||
owners={safe.owners}
|
owners={safe.owners}
|
||||||
|
@ -127,7 +132,7 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
|
||||||
<Address address={address} />
|
<Address address={address} />
|
||||||
<DailyLimit balance={ethBalance} dailyLimit={safe.get('dailyLimit')} onWithdraw={this.onWithdraw} onEditDailyLimit={this.onEditDailyLimit} />
|
<DailyLimit balance={ethBalance} dailyLimit={safe.get('dailyLimit')} onWithdraw={this.onWithdraw} onEditDailyLimit={this.onEditDailyLimit} />
|
||||||
<MultisigTx onSeeTxs={this.onListTransactions} />
|
<MultisigTx onSeeTxs={this.onListTransactions} />
|
||||||
</List>
|
</ListComponent>
|
||||||
</Col>
|
</Col>
|
||||||
<Col sm={12} center="xs" md={7} margin="xl" layout="column">
|
<Col sm={12} center="xs" md={7} margin="xl" layout="column">
|
||||||
<Block margin="xl">
|
<Block margin="xl">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { List, Map } from 'immutable'
|
import { List } from 'immutable'
|
||||||
import { createSelector, createStructuredSelector, type Selector } from 'reselect'
|
import { createSelector, createStructuredSelector, type Selector } from 'reselect'
|
||||||
import { safeSelector, type RouterProps, type SafeSelectorProps } from '~/routes/safe/store/selectors'
|
import { safeSelector, type RouterProps, type SafeSelectorProps } from '~/routes/safe/store/selectors'
|
||||||
import { providerNameSelector, userAccountSelector } from '~/wallets/store/selectors/index'
|
import { providerNameSelector, userAccountSelector } from '~/wallets/store/selectors/index'
|
||||||
|
@ -13,7 +13,7 @@ import { type Token } from '~/routes/tokens/store/model/token'
|
||||||
export type SelectorProps = {
|
export type SelectorProps = {
|
||||||
safe: SafeSelectorProps,
|
safe: SafeSelectorProps,
|
||||||
provider: string,
|
provider: string,
|
||||||
activeTokens: Map<string, Token>,
|
activeTokens: List<Token>,
|
||||||
userAddress: string,
|
userAddress: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { type Token } from '~/routes/tokens/store/model/token'
|
||||||
|
|
||||||
export type SelectorProps = {
|
export type SelectorProps = {
|
||||||
tokens: List<Token>,
|
tokens: List<Token>,
|
||||||
addresses: List<String>,
|
addresses: List<string>,
|
||||||
safe: Safe,
|
safe: Safe,
|
||||||
safeAddress: string,
|
safeAddress: string,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue