Add etherscan/copy buttons to replace owner flow
This commit is contained in:
parent
e583b041a0
commit
85151687e8
|
@ -5,7 +5,8 @@ import { List } from 'immutable'
|
|||
import { withStyles } from '@material-ui/core/styles'
|
||||
import Close from '@material-ui/icons/Close'
|
||||
import IconButton from '@material-ui/core/IconButton'
|
||||
import OpenInNew from '@material-ui/icons/OpenInNew'
|
||||
import EtherscanBtn from '~/components/EtherscanBtn'
|
||||
import CopyBtn from '~/components/CopyBtn'
|
||||
import Paragraph from '~/components/layout/Paragraph'
|
||||
import Row from '~/components/layout/Row'
|
||||
import GnoForm from '~/components/forms/GnoForm'
|
||||
|
@ -17,24 +18,16 @@ import Hairline from '~/components/layout/Hairline'
|
|||
import Field from '~/components/forms/Field'
|
||||
import TextField from '~/components/forms/TextField'
|
||||
import Identicon from '~/components/Identicon'
|
||||
import Link from '~/components/layout/Link'
|
||||
import { getEtherScanLink } from '~/logic/wallets/getWeb3'
|
||||
import { type Owner } from '~/routes/safe/store/models/owner'
|
||||
import {
|
||||
composeValidators, required, minMaxLength, uniqueAddress,
|
||||
} from '~/components/forms/validator'
|
||||
import { styles } from './style'
|
||||
import { secondary } from '~/theme/variables'
|
||||
|
||||
export const REPLACE_OWNER_NAME_INPUT_TEST_ID = 'replace-owner-name-input'
|
||||
export const REPLACE_OWNER_ADDRESS_INPUT_TEST_ID = 'replace-owner-address-testid'
|
||||
export const REPLACE_OWNER_NEXT_BTN_TEST_ID = 'replace-owner-next-btn'
|
||||
|
||||
const openIconStyle = {
|
||||
height: '16px',
|
||||
color: secondary,
|
||||
}
|
||||
|
||||
const formMutators = {
|
||||
setOwnerAddress: (args, state, utils) => {
|
||||
utils.changeValue(state, 'ownerAddress', () => args[0])
|
||||
|
@ -96,16 +89,11 @@ const OwnerForm = ({
|
|||
{ownerName}
|
||||
</Paragraph>
|
||||
<Block justify="center" className={classes.user}>
|
||||
<Paragraph size="md" color="disabled" noMargin>
|
||||
<Paragraph size="md" className={classes.address} color="disabled" noMargin>
|
||||
{ownerAddress}
|
||||
</Paragraph>
|
||||
<Link
|
||||
className={classes.open}
|
||||
to={getEtherScanLink('address', ownerAddress)}
|
||||
target="_blank"
|
||||
>
|
||||
<OpenInNew style={openIconStyle} />
|
||||
</Link>
|
||||
<CopyBtn content={ownerAddress} />
|
||||
<EtherscanBtn type="address" value={ownerAddress} />
|
||||
</Block>
|
||||
</Block>
|
||||
</Col>
|
||||
|
|
|
@ -16,6 +16,9 @@ export const styles = () => ({
|
|||
marginLeft: '20px',
|
||||
lineHeight: 'normal',
|
||||
},
|
||||
address: {
|
||||
marginRight: sm,
|
||||
},
|
||||
manage: {
|
||||
fontSize: '24px',
|
||||
},
|
||||
|
|
|
@ -3,11 +3,11 @@ import React from 'react'
|
|||
import { List } from 'immutable'
|
||||
import classNames from 'classnames'
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import OpenInNew from '@material-ui/icons/OpenInNew'
|
||||
import Close from '@material-ui/icons/Close'
|
||||
import IconButton from '@material-ui/core/IconButton'
|
||||
import EtherscanBtn from '~/components/EtherscanBtn'
|
||||
import CopyBtn from '~/components/CopyBtn'
|
||||
import Identicon from '~/components/Identicon'
|
||||
import Link from '~/components/layout/Link'
|
||||
import Paragraph from '~/components/layout/Paragraph'
|
||||
import Row from '~/components/layout/Row'
|
||||
import Col from '~/components/layout/Col'
|
||||
|
@ -15,17 +15,10 @@ import Button from '~/components/layout/Button'
|
|||
import Block from '~/components/layout/Block'
|
||||
import Hairline from '~/components/layout/Hairline'
|
||||
import type { Owner } from '~/routes/safe/store/models/owner'
|
||||
import { getEtherScanLink } from '~/logic/wallets/getWeb3'
|
||||
import { secondary } from '~/theme/variables'
|
||||
import { styles } from './style'
|
||||
|
||||
export const REPLACE_OWNER_SUBMIT_BTN_TEST_ID = 'replace-owner-submit-btn'
|
||||
|
||||
const openIconStyle = {
|
||||
height: '16px',
|
||||
color: secondary,
|
||||
}
|
||||
|
||||
type Props = {
|
||||
onClose: () => void,
|
||||
classes: Object,
|
||||
|
@ -50,165 +43,150 @@ const ReviewRemoveOwner = ({
|
|||
onClickBack,
|
||||
threshold,
|
||||
onSubmit,
|
||||
}: Props) => {
|
||||
const handleSubmit = () => {
|
||||
onSubmit()
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Row align="center" grow className={classes.heading}>
|
||||
<Paragraph weight="bolder" className={classes.manage} noMargin>
|
||||
}: Props) => (
|
||||
<>
|
||||
<Row align="center" grow className={classes.heading}>
|
||||
<Paragraph weight="bolder" className={classes.manage} noMargin>
|
||||
Replace owner
|
||||
</Paragraph>
|
||||
<Paragraph className={classes.annotation}>2 of 2</Paragraph>
|
||||
<IconButton onClick={onClose} disableRipple>
|
||||
<Close className={classes.closeIcon} />
|
||||
</IconButton>
|
||||
</Row>
|
||||
<Hairline />
|
||||
<Block className={classes.formContainer}>
|
||||
<Row className={classes.root}>
|
||||
<Col xs={4} layout="column">
|
||||
<Block className={classes.details}>
|
||||
<Block margin="lg">
|
||||
<Paragraph size="lg" color="primary" noMargin>
|
||||
Details
|
||||
</Paragraph>
|
||||
</Block>
|
||||
<Block margin="lg">
|
||||
<Paragraph size="sm" color="disabled" noMargin>
|
||||
Safe name
|
||||
</Paragraph>
|
||||
<Paragraph size="lg" color="primary" noMargin weight="bolder" className={classes.name}>
|
||||
{safeName}
|
||||
</Paragraph>
|
||||
</Block>
|
||||
<Block margin="lg">
|
||||
<Paragraph size="sm" color="disabled" noMargin>
|
||||
Any transaction requires the confirmation of:
|
||||
</Paragraph>
|
||||
<Paragraph size="lg" color="primary" noMargin weight="bolder" className={classes.name}>
|
||||
{`${threshold} out of ${owners.size} owner(s)`}
|
||||
</Paragraph>
|
||||
</Block>
|
||||
</Block>
|
||||
</Col>
|
||||
<Col xs={8} layout="column" className={classes.owners}>
|
||||
<Row className={classes.ownersTitle}>
|
||||
</Paragraph>
|
||||
<Paragraph className={classes.annotation}>2 of 2</Paragraph>
|
||||
<IconButton onClick={onClose} disableRipple>
|
||||
<Close className={classes.closeIcon} />
|
||||
</IconButton>
|
||||
</Row>
|
||||
<Hairline />
|
||||
<Block className={classes.formContainer}>
|
||||
<Row className={classes.root}>
|
||||
<Col xs={4} layout="column">
|
||||
<Block className={classes.details}>
|
||||
<Block margin="lg">
|
||||
<Paragraph size="lg" color="primary" noMargin>
|
||||
{owners.size}
|
||||
{' '}
|
||||
Safe owner(s)
|
||||
Details
|
||||
</Paragraph>
|
||||
</Row>
|
||||
<Hairline />
|
||||
{owners.map(
|
||||
(owner) => owner.address !== ownerAddress && (
|
||||
<React.Fragment key={owner.address}>
|
||||
<Row className={classes.owner}>
|
||||
<Col xs={1} align="center">
|
||||
<Identicon address={owner.address} diameter={32} />
|
||||
</Col>
|
||||
<Col xs={11}>
|
||||
<Block className={classNames(classes.name, classes.userName)}>
|
||||
<Paragraph weight="bolder" size="lg" noMargin>
|
||||
{owner.name}
|
||||
</Block>
|
||||
<Block margin="lg">
|
||||
<Paragraph size="sm" color="disabled" noMargin>
|
||||
Safe name
|
||||
</Paragraph>
|
||||
<Paragraph size="lg" color="primary" noMargin weight="bolder" className={classes.name}>
|
||||
{safeName}
|
||||
</Paragraph>
|
||||
</Block>
|
||||
<Block margin="lg">
|
||||
<Paragraph size="sm" color="disabled" noMargin>
|
||||
Any transaction requires the confirmation of:
|
||||
</Paragraph>
|
||||
<Paragraph size="lg" color="primary" noMargin weight="bolder" className={classes.name}>
|
||||
{`${threshold} out of ${owners.size} owner(s)`}
|
||||
</Paragraph>
|
||||
</Block>
|
||||
</Block>
|
||||
</Col>
|
||||
<Col xs={8} layout="column" className={classes.owners}>
|
||||
<Row className={classes.ownersTitle}>
|
||||
<Paragraph size="lg" color="primary" noMargin>
|
||||
{`${owners.size} Safe owner(s)`}
|
||||
</Paragraph>
|
||||
</Row>
|
||||
<Hairline />
|
||||
{owners.map(
|
||||
(owner) => owner.address !== ownerAddress && (
|
||||
<React.Fragment key={owner.address}>
|
||||
<Row className={classes.owner}>
|
||||
<Col xs={1} align="center">
|
||||
<Identicon address={owner.address} diameter={32} />
|
||||
</Col>
|
||||
<Col xs={11}>
|
||||
<Block className={classNames(classes.name, classes.userName)}>
|
||||
<Paragraph weight="bolder" size="lg" noMargin>
|
||||
{owner.name}
|
||||
</Paragraph>
|
||||
<Block justify="center" className={classes.user}>
|
||||
<Paragraph size="md" color="disabled" className={classes.address} noMargin>
|
||||
{owner.address}
|
||||
</Paragraph>
|
||||
<Block justify="center" className={classes.user}>
|
||||
<Paragraph size="md" color="disabled" noMargin>
|
||||
{owner.address}
|
||||
</Paragraph>
|
||||
<Link
|
||||
className={classes.open}
|
||||
to={getEtherScanLink('address', owner.address)}
|
||||
target="_blank"
|
||||
>
|
||||
<OpenInNew style={openIconStyle} />
|
||||
</Link>
|
||||
</Block>
|
||||
<CopyBtn content={owner.address} />
|
||||
<EtherscanBtn type="address" value={owner.address} />
|
||||
</Block>
|
||||
</Col>
|
||||
</Row>
|
||||
<Hairline />
|
||||
</React.Fragment>
|
||||
),
|
||||
)}
|
||||
<Row className={classes.info} align="center">
|
||||
<Paragraph weight="bolder" noMargin color="primary" size="md">
|
||||
</Block>
|
||||
</Col>
|
||||
</Row>
|
||||
<Hairline />
|
||||
</React.Fragment>
|
||||
),
|
||||
)}
|
||||
<Row className={classes.info} align="center">
|
||||
<Paragraph weight="bolder" noMargin color="primary" size="md">
|
||||
REMOVING OWNER ↓
|
||||
</Paragraph>
|
||||
</Row>
|
||||
<Hairline />
|
||||
<Row className={classes.selectedOwnerRemoved}>
|
||||
<Col xs={1} align="center">
|
||||
<Identicon address={ownerAddress} diameter={32} />
|
||||
</Col>
|
||||
<Col xs={11}>
|
||||
<Block className={classNames(classes.name, classes.userName)}>
|
||||
<Paragraph weight="bolder" size="lg" noMargin>
|
||||
{ownerName}
|
||||
</Paragraph>
|
||||
</Row>
|
||||
<Hairline />
|
||||
<Row className={classes.selectedOwnerRemoved}>
|
||||
<Col xs={1} align="center">
|
||||
<Identicon address={ownerAddress} diameter={32} />
|
||||
</Col>
|
||||
<Col xs={11}>
|
||||
<Block className={classNames(classes.name, classes.userName)}>
|
||||
<Paragraph weight="bolder" size="lg" noMargin>
|
||||
{ownerName}
|
||||
</Paragraph>
|
||||
<Block justify="center" className={classes.user}>
|
||||
<Paragraph size="md" color="disabled" className={classes.address} noMargin>
|
||||
{ownerAddress}
|
||||
</Paragraph>
|
||||
<Block justify="center" className={classes.user}>
|
||||
<Paragraph size="md" color="disabled" noMargin>
|
||||
{ownerAddress}
|
||||
</Paragraph>
|
||||
<Link className={classes.open} to={getEtherScanLink('address', ownerAddress)} target="_blank">
|
||||
<OpenInNew style={openIconStyle} />
|
||||
</Link>
|
||||
</Block>
|
||||
<CopyBtn content={ownerAddress} />
|
||||
<EtherscanBtn type="address" value={ownerAddress} />
|
||||
</Block>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className={classes.info} align="center">
|
||||
<Paragraph weight="bolder" noMargin color="primary" size="md">
|
||||
</Block>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className={classes.info} align="center">
|
||||
<Paragraph weight="bolder" noMargin color="primary" size="md">
|
||||
ADDING NEW OWNER ↓
|
||||
</Paragraph>
|
||||
</Row>
|
||||
<Hairline />
|
||||
<Row className={classes.selectedOwnerAdded}>
|
||||
<Col xs={1} align="center">
|
||||
<Identicon address={values.ownerAddress} diameter={32} />
|
||||
</Col>
|
||||
<Col xs={11}>
|
||||
<Block className={classNames(classes.name, classes.userName)}>
|
||||
<Paragraph weight="bolder" size="lg" noMargin>
|
||||
{values.ownerName}
|
||||
</Paragraph>
|
||||
</Row>
|
||||
<Hairline />
|
||||
<Row className={classes.selectedOwnerAdded}>
|
||||
<Col xs={1} align="center">
|
||||
<Identicon address={values.ownerAddress} diameter={32} />
|
||||
</Col>
|
||||
<Col xs={11}>
|
||||
<Block className={classNames(classes.name, classes.userName)}>
|
||||
<Paragraph weight="bolder" size="lg" noMargin>
|
||||
{values.ownerName}
|
||||
</Paragraph>
|
||||
<Block justify="center" className={classes.user}>
|
||||
<Paragraph size="md" color="disabled" className={classes.address} noMargin>
|
||||
{values.ownerAddress}
|
||||
</Paragraph>
|
||||
<Block justify="center" className={classes.user}>
|
||||
<Paragraph size="md" color="disabled" noMargin>
|
||||
{values.ownerAddress}
|
||||
</Paragraph>
|
||||
<Link className={classes.open} to={getEtherScanLink('address', values.ownerAddress)} target="_blank">
|
||||
<OpenInNew style={openIconStyle} />
|
||||
</Link>
|
||||
</Block>
|
||||
<CopyBtn content={values.ownerAddress} />
|
||||
<EtherscanBtn type="address" value={values.ownerAddress} />
|
||||
</Block>
|
||||
</Col>
|
||||
</Row>
|
||||
<Hairline />
|
||||
</Col>
|
||||
</Row>
|
||||
</Block>
|
||||
<Hairline />
|
||||
<Row align="center" className={classes.buttonRow}>
|
||||
<Button minWidth={140} minHeight={42} onClick={onClickBack}>
|
||||
Back
|
||||
</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
onClick={handleSubmit}
|
||||
variant="contained"
|
||||
minHeight={42}
|
||||
minWidth={140}
|
||||
color="primary"
|
||||
testId={REPLACE_OWNER_SUBMIT_BTN_TEST_ID}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</Block>
|
||||
</Col>
|
||||
</Row>
|
||||
<Hairline />
|
||||
</Col>
|
||||
</Row>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</Block>
|
||||
<Hairline />
|
||||
<Row align="center" className={classes.buttonRow}>
|
||||
<Button minWidth={140} minHeight={42} onClick={onClickBack}>
|
||||
Back
|
||||
</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
onClick={onSubmit}
|
||||
variant="contained"
|
||||
minHeight={42}
|
||||
minWidth={140}
|
||||
color="primary"
|
||||
testId={REPLACE_OWNER_SUBMIT_BTN_TEST_ID}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</Row>
|
||||
</>
|
||||
)
|
||||
|
||||
export default withStyles(styles)(ReviewRemoveOwner)
|
||||
|
|
|
@ -22,6 +22,9 @@ export const styles = () => ({
|
|||
manage: {
|
||||
fontSize: '24px',
|
||||
},
|
||||
address: {
|
||||
marginRight: sm,
|
||||
},
|
||||
closeIcon: {
|
||||
height: '35px',
|
||||
width: '35px',
|
||||
|
|
Loading…
Reference in New Issue