From cf8427b89acea8f0c416142ce98df9956235417f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Tue, 11 Jun 2019 10:56:08 +0200 Subject: [PATCH] Create edit owner modal window --- .../ManageOwners/EditOwnerModal/index.jsx | 140 ++++++++++++++++++ .../ManageOwners/EditOwnerModal/style.js | 39 +++++ .../Settings/ManageOwners/index.jsx | 11 ++ 3 files changed, 190 insertions(+) create mode 100644 src/routes/safe/components/Settings/ManageOwners/EditOwnerModal/index.jsx create mode 100644 src/routes/safe/components/Settings/ManageOwners/EditOwnerModal/style.js diff --git a/src/routes/safe/components/Settings/ManageOwners/EditOwnerModal/index.jsx b/src/routes/safe/components/Settings/ManageOwners/EditOwnerModal/index.jsx new file mode 100644 index 00000000..80e1bdbe --- /dev/null +++ b/src/routes/safe/components/Settings/ManageOwners/EditOwnerModal/index.jsx @@ -0,0 +1,140 @@ +// @flow +import React from 'react' +import { connect } from 'react-redux' +import { List } from 'immutable' +import { withStyles } from '@material-ui/core/styles' +import OpenInNew from '@material-ui/icons/OpenInNew' +import Row from '~/components/layout/Row' +import Col from '~/components/layout/Col' +import Link from '~/components/layout/Link' +import Block from '~/components/layout/Block' +import GnoForm from '~/components/forms/GnoForm' +import Button from '~/components/layout/Button' +import Hairline from '~/components/layout/Hairline' +import Field from '~/components/forms/Field' +import TextField from '~/components/forms/TextField' +import Paragraph from '~/components/layout/Paragraph' +import Identicon from '~/components/Identicon' +import IconButton from '@material-ui/core/IconButton' +import Close from '@material-ui/icons/Close' +import { getEtherScanLink } from '~/logic/wallets/getWeb3' +import type { Owner } from '~/routes/safe/store/models/owner' +import { makeOwner } from '~/routes/safe/store/models/owner' +import { + composeValidators, + required, + minMaxLength, +} from '~/components/forms/validator' +import Modal from '~/components/Modal' +import { setOwners } from '~/logic/safe/utils' +import { styles } from './style' +import { secondary } from '~/theme/variables' + +const openIconStyle = { + height: '16px', + color: secondary, +} + +const stylesModal = () => ({ + smallerModalWindow: { + height: 'auto', + position: 'static', + }, +}) + +type Props = { + onClose: () => void, + classes: Object, + isOpen: boolean, + safeAddress: string, + ownerAddress: string, + owners: List, + network: string, +} + +const EditOwnerComponent = ({ + onClose, + isOpen, + classes, + safeAddress, + ownerAddress, + owners, + network, +}: Props) => { + const handleSubmit = (values) => { + const updatedOwners = owners.filter(o => o.address !== ownerAddress).push( + makeOwner({ name: values.ownerName, address: ownerAddress }), + ) + setOwners(safeAddress, updatedOwners) + onClose() + } + + return ( + + + + Edit owner name + + + + + + + + {(...args) => ( + + + + + + + + + + {ownerAddress} + + + + + + + + + + + + + + )} + + + ) +} + +const EditOwnerModal = withStyles(styles)(EditOwnerComponent) + +export default EditOwnerModal diff --git a/src/routes/safe/components/Settings/ManageOwners/EditOwnerModal/style.js b/src/routes/safe/components/Settings/ManageOwners/EditOwnerModal/style.js new file mode 100644 index 00000000..8e6294f9 --- /dev/null +++ b/src/routes/safe/components/Settings/ManageOwners/EditOwnerModal/style.js @@ -0,0 +1,39 @@ +// @flow +import { + lg, md, sm, error, background, +} from '~/theme/variables' + +export const styles = (theme: Object) => ({ + heading: { + padding: `${sm} ${lg}`, + justifyContent: 'space-between', + maxHeight: '75px', + boxSizing: 'border-box', + }, + manage: { + fontSize: '24px', + }, + container: { + padding: `${md} ${lg}`, + paddingBottom: '40px', + }, + close: { + height: '35px', + width: '35px', + }, + buttonRow: { + height: '84px', + justifyContent: 'center', + }, + buttonEdit: { + color: '#fff', + backgroundColor: error, + }, + open: { + paddingLeft: sm, + width: 'auto', + '&:hover': { + cursor: 'pointer', + }, + }, +}) diff --git a/src/routes/safe/components/Settings/ManageOwners/index.jsx b/src/routes/safe/components/Settings/ManageOwners/index.jsx index 5b60cc24..1b9bac83 100644 --- a/src/routes/safe/components/Settings/ManageOwners/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/index.jsx @@ -22,6 +22,7 @@ import Button from '~/components/layout/Button' import AddOwnerModal from './AddOwnerModal' import RemoveOwnerModal from './RemoveOwnerModal' import ReplaceOwnerModal from './ReplaceOwnerModal' +import EditOwnerModal from './EditOwnerModal' import OwnerAddressTableCell from './OwnerAddressTableCell' import type { Owner } from '~/routes/safe/store/models/owner' import { @@ -62,6 +63,7 @@ class ManageOwners extends React.Component { showAddOwner: false, showRemoveOwner: false, showReplaceOwner: false, + showEditOwner: false, } onShow = (action: Action, row?: Object) => () => { @@ -95,6 +97,7 @@ class ManageOwners extends React.Component { showAddOwner, showRemoveOwner, showReplaceOwner, + showEditOwner, selectedOwnerName, selectedOwnerAddress, } = this.state @@ -185,6 +188,14 @@ class ManageOwners extends React.Component { userAddress={userAddress} createTransaction={createTransaction} /> + ) }