From 5d413fbbcc2a7f36e6c34bb0c12b8fff0b2d0fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Tue, 28 May 2019 13:16:42 +0200 Subject: [PATCH] Add review screen in remove owner modal --- .../ManageOwners/RemoveOwnerModal/index.jsx | 14 ++ .../RemoveOwnerModal/screens/Review/index.jsx | 181 ++++++++++++++++++ .../RemoveOwnerModal/screens/Review/style.js | 78 ++++++++ .../safe/store/actions/createTransaction.js | 1 + 4 files changed, 274 insertions(+) create mode 100644 src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/index.jsx create mode 100644 src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/style.js diff --git a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.jsx b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.jsx index 92aa347f..ad37e4db 100644 --- a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.jsx @@ -9,6 +9,7 @@ import { setOwners } from '~/logic/safe/utils' import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts' import CheckOwner from './screens/CheckOwner' import ThresholdForm from './screens/ThresholdForm' +import ReviewRemoveOwner from './screens/Review' import { withStyles } from '@material-ui/core/styles' const styles = () => ({ @@ -143,6 +144,19 @@ const RemoveOwner = ({ onSubmit={thresholdSubmitted} /> )} + {activeScreen === 'reviewRemoveOwner' && ( + + )} ) diff --git a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/index.jsx b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/index.jsx new file mode 100644 index 00000000..728b3389 --- /dev/null +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/index.jsx @@ -0,0 +1,181 @@ +// @flow +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 Identicon from '~/components/Identicon' +import Link from '~/components/layout/Link' +import Paragraph from '~/components/layout/Paragraph' +import Row from '~/components/layout/Row' +import GnoForm from '~/components/forms/GnoForm' +import Col from '~/components/layout/Col' +import Button from '~/components/layout/Button' +import Block from '~/components/layout/Block' +import Hairline from '~/components/layout/Hairline' +import Field from '~/components/forms/Field' +import TextField from '~/components/forms/TextField' +import type { Owner } from '~/routes/safe/store/models/owner' +import { getEtherScanLink } from '~/logic/wallets/getWeb3' +import { secondary } from '~/theme/variables' +import { styles } from './style' + +const openIconStyle = { + height: '16px', + color: secondary, +} + +type Props = { + onClose: () => void, + classes: Object, + safeName: string, + owners: List, + network: string, + values: Object, + ownerAddress: string, + ownerName: string, + onClickBack: Function, + onSubmit: Function, +} + +const ReviewRemoveOwner = ({ + classes, + onClose, + safeName, + owners, + network, + values, + ownerAddress, + ownerName, + onClickBack, + onSubmit, +}: Props) => { + const handleSubmit = () => { + onSubmit() + } + + return ( + + + + Remove owner + + 3 of 3 + + + + + + + + + + + + Details + + + + + Safe name + + + {safeName} + + + + + Any transaction requires the confirmation of: + + + {values.threshold} out of {owners.size - 1} owner(s) + + + + + + + + {owners.size - 1} Safe owner(s) + + + + {owners.map(owner => owner.get('address') != ownerAddress && ( + + + + + + + + + {owner.get('name')} + + + + {owner.get('address')} + + + + + + + + + + + ))} + + + REMOVING OWNER ↓ + + + + + + + + + + + {ownerName} + + + + {ownerAddress} + + + + + + + + + + + + + + + + + + + ) +} + +export default withStyles(styles)(ReviewRemoveOwner) diff --git a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/style.js b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/style.js new file mode 100644 index 00000000..94b34c28 --- /dev/null +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/style.js @@ -0,0 +1,78 @@ +// @flow +import { + lg, md, sm, border, background, +} from '~/theme/variables' + +export const styles = () => ({ + root: { + height: '372px', + }, + heading: { + padding: `${sm} ${lg}`, + justifyContent: 'flex-start', + boxSizing: 'border-box', + maxHeight: '75px', + }, + annotation: { + letterSpacing: '-1px', + color: '#a2a8ba', + marginRight: 'auto', + marginLeft: '20px', + }, + manage: { + fontSize: '24px', + }, + closeIcon: { + height: '35px', + width: '35px', + }, + info: { + backgroundColor: background, + padding: sm, + justifyContent: 'center', + textAlign: 'center', + flexDirection: 'column', + }, + buttonRow: { + height: '84px', + justifyContent: 'center', + }, + details: { + padding: lg, + borderRight: `solid 1px ${border}`, + height: '100%', + }, + owners: { + overflow: 'auto', + height: '100%', + }, + ownersTitle: { + padding: lg, + }, + owner: { + padding: sm, + alignItems: 'center', + }, + name: { + textOverflow: 'ellipsis', + overflow: 'hidden', + }, + userName: { + whiteSpace: 'nowrap', + }, + selectedOwner: { + padding: sm, + alignItems: 'center', + backgroundColor: '#ffe6ea', + }, + user: { + justifyContent: 'left', + }, + open: { + paddingLeft: sm, + width: 'auto', + '&:hover': { + cursor: 'pointer', + }, + }, +}) diff --git a/src/routes/safe/store/actions/createTransaction.js b/src/routes/safe/store/actions/createTransaction.js index c4b6ff99..4970332f 100644 --- a/src/routes/safe/store/actions/createTransaction.js +++ b/src/routes/safe/store/actions/createTransaction.js @@ -31,6 +31,7 @@ const createTransaction = ( txHash = await executeTransaction(safeInstance, to, valueInWei, txData, CALL, nonce, from) openSnackbar('Transaction has been confirmed', 'success') } else { + console.log('Temporal error: threshold != 1') // txHash = await approveTransaction(safeAddress, to, valueInWei, txData, CALL, nonce) } // dispatch(addTransactions(txHash))