Refactor add owner modal window

This commit is contained in:
Germán Martínez 2019-05-27 14:46:31 +02:00
parent f619905b11
commit fcbb02e56f
5 changed files with 11 additions and 25 deletions

View File

@ -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' && (

View File

@ -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) => {

View File

@ -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>

View File

@ -60,7 +60,7 @@ export const styles = () => ({
userName: {
whiteSpace: 'nowrap',
},
newOwner: {
selectedOwner: {
padding: sm,
alignItems: 'center',
backgroundColor: '#fff3e2',

View File

@ -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>