Refactor add owner modal window
This commit is contained in:
parent
f619905b11
commit
fcbb02e56f
|
@ -65,14 +65,14 @@ const AddOwner = ({
|
|||
}
|
||||
}
|
||||
|
||||
const ownerSubmited = (newValues: Object) => {
|
||||
const ownerSubmitted = (newValues: Object) => {
|
||||
values.ownerName = newValues.ownerName
|
||||
values.ownerAddress = newValues.ownerAddress
|
||||
setValues(values)
|
||||
setActiveScreen('selectThreshold')
|
||||
}
|
||||
|
||||
const thresholdSubmited = (newValues: Object) => {
|
||||
const thresholdSubmitted = (newValues: Object) => {
|
||||
values.threshold = newValues.threshold
|
||||
setValues(values)
|
||||
setActiveScreen('reviewAddOwner')
|
||||
|
@ -95,8 +95,8 @@ const AddOwner = ({
|
|||
|
||||
return (
|
||||
<Modal
|
||||
title="Send Tokens"
|
||||
description="Send Tokens Form"
|
||||
title="Add owner to Safe"
|
||||
description="Add owner to Safe"
|
||||
handleClose={onClose}
|
||||
open={isOpen}
|
||||
paperClassName={classes.biggerModalWindow}
|
||||
|
@ -105,22 +105,16 @@ const AddOwner = ({
|
|||
{activeScreen === 'selectOwner' && (
|
||||
<OwnerForm
|
||||
onClose={onClose}
|
||||
setActiveScreen={setActiveScreen}
|
||||
safeAddress={safeAddress}
|
||||
safeName={safeName}
|
||||
onSubmit={ownerSubmited}
|
||||
onSubmit={ownerSubmitted}
|
||||
/>
|
||||
)}
|
||||
{activeScreen === 'selectThreshold' && (
|
||||
<ThresholdForm
|
||||
onClose={onClose}
|
||||
setActiveScreen={setActiveScreen}
|
||||
safeAddress={safeAddress}
|
||||
safeName={safeName}
|
||||
owners={owners}
|
||||
threshold={threshold}
|
||||
onClickBack={onClickBack}
|
||||
onSubmit={thresholdSubmited}
|
||||
onSubmit={thresholdSubmitted}
|
||||
/>
|
||||
)}
|
||||
{activeScreen === 'reviewAddOwner' && (
|
||||
|
|
|
@ -24,16 +24,12 @@ import { styles } from './style'
|
|||
type Props = {
|
||||
onClose: () => void,
|
||||
classes: Object,
|
||||
safeAddress: string,
|
||||
safeName: string,
|
||||
onSubmit: Function,
|
||||
}
|
||||
|
||||
const OwnerForm = ({
|
||||
classes,
|
||||
onClose,
|
||||
safeAddress,
|
||||
safeName,
|
||||
onSubmit,
|
||||
}: Props) => {
|
||||
const handleSubmit = (values) => {
|
||||
|
|
|
@ -93,7 +93,7 @@ const ReviewAddOwner = ({
|
|||
<Col xs={8} layout="column" className={classes.owners}>
|
||||
<Row className={classes.ownersTitle}>
|
||||
<Paragraph size="lg" color="primary" noMargin>
|
||||
{owners.size + 1} Safe owners
|
||||
{owners.size + 1} Safe owner(s)
|
||||
</Paragraph>
|
||||
</Row>
|
||||
<Hairline />
|
||||
|
@ -128,7 +128,7 @@ const ReviewAddOwner = ({
|
|||
</Paragraph>
|
||||
</Row>
|
||||
<Hairline />
|
||||
<Row className={classes.newOwner}>
|
||||
<Row className={classes.selectedOwner}>
|
||||
<Col xs={1} align="center">
|
||||
<Identicon address={values.ownerAddress} diameter={32} />
|
||||
</Col>
|
||||
|
@ -166,7 +166,7 @@ const ReviewAddOwner = ({
|
|||
color="primary"
|
||||
data-testid="review-tx-btn"
|
||||
>
|
||||
Next
|
||||
Submit
|
||||
</Button>
|
||||
</Row>
|
||||
</React.Fragment>
|
||||
|
|
|
@ -60,7 +60,7 @@ export const styles = () => ({
|
|||
userName: {
|
||||
whiteSpace: 'nowrap',
|
||||
},
|
||||
newOwner: {
|
||||
selectedOwner: {
|
||||
padding: sm,
|
||||
alignItems: 'center',
|
||||
backgroundColor: '#fff3e2',
|
||||
|
|
|
@ -28,8 +28,6 @@ import { styles } from './style'
|
|||
type Props = {
|
||||
onClose: () => void,
|
||||
classes: Object,
|
||||
safeAddress: string,
|
||||
safeName: string,
|
||||
owners: List<Owner>,
|
||||
threshold: number,
|
||||
onClickBack: Function,
|
||||
|
@ -39,8 +37,6 @@ type Props = {
|
|||
const ThresholdForm = ({
|
||||
classes,
|
||||
onClose,
|
||||
safeAddress,
|
||||
safeName,
|
||||
owners,
|
||||
threshold,
|
||||
onClickBack,
|
||||
|
@ -127,7 +123,7 @@ const ThresholdForm = ({
|
|||
color="primary"
|
||||
data-testid="review-tx-btn"
|
||||
>
|
||||
Next
|
||||
Review
|
||||
</Button>
|
||||
</Row>
|
||||
</React.Fragment>
|
||||
|
|
Loading…
Reference in New Issue