remove accesing owner props via .get() since it's a record

This commit is contained in:
Mikhail Mikheev 2019-06-28 14:24:20 +04:00
parent 6dba23242c
commit 93678064d9
9 changed files with 22 additions and 22 deletions

View File

@ -11,7 +11,7 @@ type Props = {
bordered?: boolean,
className?: string,
style?: Object,
testId? : string,
testId?: string,
}
const Img = ({

View File

@ -28,7 +28,7 @@ export const saveSafes = async (safes: Object) => {
export const setOwners = async (safeAddress: string, owners: List<Owner>) => {
try {
const ownersAsMap = Map(owners.map((owner: Owner) => [owner.get('address').toLowerCase(), owner.get('name')]))
const ownersAsMap = Map(owners.map((owner: Owner) => [owner.address.toLowerCase(), owner.name]))
await saveToStorage(`${OWNERS_KEY}-${safeAddress}`, ownersAsMap)
} catch (err) {
// eslint-disable-next-line

View File

@ -98,21 +98,21 @@ const ReviewAddOwner = ({
</Row>
<Hairline />
{owners.map(owner => (
<React.Fragment key={owner.get('address')}>
<React.Fragment key={owner.address}>
<Row className={classes.owner}>
<Col xs={1} align="center">
<Identicon address={owner.get('address')} diameter={32} />
<Identicon address={owner.address} diameter={32} />
</Col>
<Col xs={11}>
<Block className={classNames(classes.name, classes.userName)}>
<Paragraph weight="bolder" size="lg" noMargin>
{owner.get('name')}
{owner.name}
</Paragraph>
<Block align="center" className={classes.user}>
<Paragraph size="md" color="disabled" noMargin>
{owner.get('address')}
{owner.address}
</Paragraph>
<Link className={classes.open} to={getEtherScanLink(owner.get('address'), network)} target="_blank">
<Link className={classes.open} to={getEtherScanLink(owner.address, network)} target="_blank">
<OpenInNew style={openIconStyle} />
</Link>
</Block>

View File

@ -109,23 +109,23 @@ const ReviewRemoveOwner = ({
<Hairline />
{owners.map(
owner => owner.address !== ownerAddress && (
<React.Fragment key={owner.get('address')}>
<React.Fragment key={owner.address}>
<Row className={classes.owner}>
<Col xs={1} align="center">
<Identicon address={owner.get('address')} diameter={32} />
<Identicon address={owner.address} diameter={32} />
</Col>
<Col xs={11}>
<Block className={classNames(classes.name, classes.userName)}>
<Paragraph weight="bolder" size="lg" noMargin>
{owner.get('name')}
{owner.name}
</Paragraph>
<Block align="center" className={classes.user}>
<Paragraph size="md" color="disabled" noMargin>
{owner.get('address')}
{owner.address}
</Paragraph>
<Link
className={classes.open}
to={getEtherScanLink(owner.get('address'), network)}
to={getEtherScanLink(owner.address, network)}
target="_blank"
>
<OpenInNew style={openIconStyle} />

View File

@ -111,23 +111,23 @@ const ReviewRemoveOwner = ({
<Hairline />
{owners.map(
owner => owner.address !== ownerAddress && (
<React.Fragment key={owner.get('address')}>
<React.Fragment key={owner.address}>
<Row className={classes.owner}>
<Col xs={1} align="center">
<Identicon address={owner.get('address')} diameter={32} />
<Identicon address={owner.address} diameter={32} />
</Col>
<Col xs={11}>
<Block className={classNames(classes.name, classes.userName)}>
<Paragraph weight="bolder" size="lg" noMargin>
{owner.get('name')}
{owner.name}
</Paragraph>
<Block align="center" className={classes.user}>
<Paragraph size="md" color="disabled" noMargin>
{owner.get('address')}
{owner.address}
</Paragraph>
<Link
className={classes.open}
to={getEtherScanLink(owner.get('address'), network)}
to={getEtherScanLink(owner.address, network)}
target="_blank"
>
<OpenInNew style={openIconStyle} />

View File

@ -17,8 +17,8 @@ export type OwnerRow = SortRow<OwnerData>
export const getOwnerData = (owners: List<Owner>): List<OwnerRow> => {
const rows = owners.map((owner: Owner) => ({
[OWNERS_TABLE_NAME_ID]: owner.get('name'),
[OWNERS_TABLE_ADDRESS_ID]: owner.get('address'),
[OWNERS_TABLE_NAME_ID]: owner.name,
[OWNERS_TABLE_ADDRESS_ID]: owner.address,
}))
return rows

View File

@ -46,7 +46,7 @@ export const grantedSelector: Selector<GlobalState, RouterProps, boolean> = crea
return false
}
return owners.find((owner: Owner) => sameAddress(owner.get('address'), userAccount)) !== undefined
return owners.find((owner: Owner) => sameAddress(owner.address, userAccount)) !== undefined
},
)

View File

@ -39,4 +39,4 @@ const reducers: Reducer<GlobalState> = combineReducers({
export const store: Store<GlobalState> = createStore(reducers, finalCreateStore)
export const aNewStore = (localState?: Object): Store<GlobalState> => createStore(reducers, localState, finalCreateStore)
export const aNewStore = (localState?: Object): Store<GlobalState> => createStore(reducers, localState, finalCreateStore)

View File

@ -119,4 +119,4 @@ describe('DOM > Feature > Funds', () => {
const receiverFunds = await calculateBalanceOf(tokenAddress, tokenReceiver, 18)
expect(receiverFunds).toBe(tokensAmount)
})
})
})