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

@ -28,7 +28,7 @@ export const saveSafes = async (safes: Object) => {
export const setOwners = async (safeAddress: string, owners: List<Owner>) => { export const setOwners = async (safeAddress: string, owners: List<Owner>) => {
try { 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) await saveToStorage(`${OWNERS_KEY}-${safeAddress}`, ownersAsMap)
} catch (err) { } catch (err) {
// eslint-disable-next-line // eslint-disable-next-line

View File

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

View File

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

View File

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

View File

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

View File

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