From 4d0007b13bdf7d4e7e3e9c9a8edbc75572de4b2c Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Tue, 3 Sep 2019 12:31:17 +0400 Subject: [PATCH 01/26] show confirmations(threshold) settings in RO mode --- .../Settings/ManageOwners/index.jsx | 41 ++++++++++------- .../Settings/ThresholdSettings/index.jsx | 11 ++--- src/routes/safe/components/Settings/index.jsx | 44 +++++++++---------- 3 files changed, 53 insertions(+), 43 deletions(-) diff --git a/src/routes/safe/components/Settings/ManageOwners/index.jsx b/src/routes/safe/components/Settings/ManageOwners/index.jsx index bc912b8d..5929be61 100644 --- a/src/routes/safe/components/Settings/ManageOwners/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/index.jsx @@ -20,7 +20,11 @@ import EditOwnerModal from './EditOwnerModal' import OwnerAddressTableCell from './OwnerAddressTableCell' import type { Owner } from '~/routes/safe/store/models/owner' import { - getOwnerData, generateColumns, OWNERS_TABLE_NAME_ID, OWNERS_TABLE_ADDRESS_ID, type OwnerRow, + getOwnerData, + generateColumns, + OWNERS_TABLE_NAME_ID, + OWNERS_TABLE_ADDRESS_ID, + type OwnerRow, } from './dataFetcher' import { lg, sm, boldFont } from '~/theme/variables' import { styles } from './style' @@ -76,13 +80,17 @@ type State = { type Action = 'AddOwner' | 'EditOwner' | 'ReplaceOwner' | 'RemoveOwner' class ManageOwners extends React.Component { - state = { - selectedOwnerAddress: undefined, - selectedOwnerName: undefined, - showAddOwner: false, - showRemoveOwner: false, - showReplaceOwner: false, - showEditOwner: false, + constructor(props) { + super(props) + + this.state = { + selectedOwnerAddress: undefined, + selectedOwnerName: undefined, + showAddOwner: false, + showRemoveOwner: false, + showReplaceOwner: false, + showEditOwner: false, + } } onShow = (action: Action, row?: Object) => () => { @@ -127,13 +135,15 @@ class ManageOwners extends React.Component { } = this.state const columns = generateColumns() - const autoColumns = columns.filter(c => !c.custom) + const autoColumns = columns.filter((c) => !c.custom) const ownerData = getOwnerData(owners) return ( - + <> - Manage Safe Owners + + Manage Safe Owners + { )} - )) - } + ))}
{granted && ( - + <> @@ -205,7 +214,7 @@ class ManageOwners extends React.Component { - + )} { network={network} editSafeOwner={editSafeOwner} /> -
+ ) } } diff --git a/src/routes/safe/components/Settings/ThresholdSettings/index.jsx b/src/routes/safe/components/Settings/ThresholdSettings/index.jsx index 7056b33a..74c98c1d 100644 --- a/src/routes/safe/components/Settings/ThresholdSettings/index.jsx +++ b/src/routes/safe/components/Settings/ThresholdSettings/index.jsx @@ -21,19 +21,20 @@ type Props = { classes: Object, createTransaction: Function, safeAddress: string, + granted: Boolean, } const ThresholdSettings = ({ - owners, threshold, classes, createTransaction, safeAddress, + owners, threshold, classes, createTransaction, safeAddress, granted, }: Props) => { const [isModalOpen, setModalOpen] = useState(false) const toggleModal = () => { - setModalOpen(prevOpen => !prevOpen) + setModalOpen((prevOpen) => !prevOpen) } return ( - + <> {({ openSnackbar }) => { const onChangeThreshold = async (newThreshold) => { @@ -62,7 +63,7 @@ const ThresholdSettings = ({ {' '} owners - {owners.size > 1 && ( + {owners.size > 1 && granted && ( - + ) }} - + ) } diff --git a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/index.jsx b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/index.jsx index 4892a679..35929396 100644 --- a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/index.jsx @@ -21,10 +21,7 @@ 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, + composeValidators, required, minMaxLength, uniqueAddress, } from '~/components/forms/validator' import { styles } from './style' import { secondary } from '~/theme/variables' @@ -60,10 +57,10 @@ const OwnerForm = ({ const handleSubmit = (values) => { onSubmit(values) } - const ownerDoesntExist = uniqueAddress(owners.map(o => o.address)) + const ownerDoesntExist = uniqueAddress(owners.map((o) => o.address)) return ( - + <> Replace owner @@ -79,7 +76,7 @@ const OwnerForm = ({ const mutators = args[3] return ( - + <> @@ -162,11 +159,11 @@ const OwnerForm = ({ Next - + ) }} - + ) } From 19b7777a415ec12738a998839fe530d3174e627f Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Tue, 3 Sep 2019 16:28:21 +0400 Subject: [PATCH 04/26] update threshold text --- src/components/forms/validator.js | 2 +- .../ThresholdSettings/ChangeThreshold/index.jsx | 14 +++++++------- .../Settings/ThresholdSettings/index.jsx | 7 ++----- .../components/Settings/ThresholdSettings/style.js | 1 - 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/components/forms/validator.js b/src/components/forms/validator.js index d688a828..e41ff0ef 100644 --- a/src/components/forms/validator.js +++ b/src/components/forms/validator.js @@ -87,7 +87,7 @@ export const inLimit = (limit: number, base: number, baseText: string, symbol: s return `Should not exceed ${max} ${symbol} (amount to reach ${baseText})` } -export const differentFrom = (diffValue: string) => (value: string) => { +export const differentFrom = (diffValue: string | number) => (value: string) => { if (value === diffValue.toString()) { return `Value should be different than ${value}` } diff --git a/src/routes/safe/components/Settings/ThresholdSettings/ChangeThreshold/index.jsx b/src/routes/safe/components/Settings/ThresholdSettings/ChangeThreshold/index.jsx index 38bf959d..1a0ee366 100644 --- a/src/routes/safe/components/Settings/ThresholdSettings/ChangeThreshold/index.jsx +++ b/src/routes/safe/components/Settings/ThresholdSettings/ChangeThreshold/index.jsx @@ -41,7 +41,7 @@ const ChangeThreshold = ({ } return ( - + <> Change required confirmations @@ -53,7 +53,7 @@ const ChangeThreshold = ({ {() => ( - + <> @@ -63,14 +63,14 @@ const ChangeThreshold = ({ - Any transaction over any daily limit requires the confirmation of: + Any transaction requires the confirmation of: ( + render={(props) => ( <> {[...Array(Number(owners.size))].map((x, index) => ( @@ -96,7 +96,7 @@ const ChangeThreshold = ({ {' '} {owners.size} {' '} - owner(s) +owner(s) @@ -110,10 +110,10 @@ const ChangeThreshold = ({ CHANGE - + )} - + ) } diff --git a/src/routes/safe/components/Settings/ThresholdSettings/index.jsx b/src/routes/safe/components/Settings/ThresholdSettings/index.jsx index 74c98c1d..74a3ce2f 100644 --- a/src/routes/safe/components/Settings/ThresholdSettings/index.jsx +++ b/src/routes/safe/components/Settings/ThresholdSettings/index.jsx @@ -49,12 +49,9 @@ const ThresholdSettings = ({ Required confirmations - Any transaction over any daily limit -
- {' '} - requires the confirmation of: + Any transaction requires the confirmation of:
- + {threshold} {' '} out of diff --git a/src/routes/safe/components/Settings/ThresholdSettings/style.js b/src/routes/safe/components/Settings/ThresholdSettings/style.js index 9f3daf31..b433a281 100644 --- a/src/routes/safe/components/Settings/ThresholdSettings/style.js +++ b/src/routes/safe/components/Settings/ThresholdSettings/style.js @@ -5,7 +5,6 @@ import { export const styles = () => ({ ownersText: { - fontSize: '26px', color: secondaryText, '& b': { color: fontColor, From 5bc5cea43e56a87eacd45e9627678883171f9da1 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Tue, 3 Sep 2019 16:58:06 +0400 Subject: [PATCH 05/26] Safe name change notification, setting style updates --- .../SendModal/screens/ReviewTx/index.jsx | 4 ++-- .../Settings/ChangeSafeName/index.jsx | 21 +++++++++++++------ src/routes/safe/components/Settings/style.js | 3 ++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx index e58b0270..9d233a14 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx @@ -78,7 +78,7 @@ const ReviewTx = ({ } return ( - + <> Send Funds @@ -154,7 +154,7 @@ const ReviewTx = ({ SUBMIT - + ) }} diff --git a/src/routes/safe/components/Settings/ChangeSafeName/index.jsx b/src/routes/safe/components/Settings/ChangeSafeName/index.jsx index 7b2c1da7..4713515c 100644 --- a/src/routes/safe/components/Settings/ChangeSafeName/index.jsx +++ b/src/routes/safe/components/Settings/ChangeSafeName/index.jsx @@ -5,6 +5,7 @@ import Block from '~/components/layout/Block' import Col from '~/components/layout/Col' import Field from '~/components/forms/Field' import Heading from '~/components/layout/Heading' +import { SharedSnackbarConsumer } from '~/components/SharedSnackBar' import { composeValidators, required, minMaxLength } from '~/components/forms/validator' import TextField from '~/components/forms/TextField' import GnoForm from '~/components/forms/GnoForm' @@ -28,22 +29,24 @@ type Props = { safeAddress: string, safeName: string, updateSafe: Function, + openSnackbar: Function, } const ChangeSafeName = (props: Props) => { const { - classes, safeAddress, safeName, updateSafe, + classes, safeAddress, safeName, updateSafe, openSnackbar, } = props const handleSubmit = (values) => { updateSafe({ address: safeAddress, name: values.safeName }) + openSnackbar('Safe name changed', 'success') } return ( - + <> {() => ( - + <> Modify Safe name @@ -78,11 +81,17 @@ const ChangeSafeName = (props: Props) => { - + )} - + ) } -export default withStyles(styles)(ChangeSafeName) +const withSnackbar = (props) => ( + + {({ openSnackbar }) => } + +) + +export default withStyles(styles)(withSnackbar) diff --git a/src/routes/safe/components/Settings/style.js b/src/routes/safe/components/Settings/style.js index 86f50dad..13741457 100644 --- a/src/routes/safe/components/Settings/style.js +++ b/src/routes/safe/components/Settings/style.js @@ -6,9 +6,10 @@ import { export const styles = () => ({ root: { backgroundColor: 'white', - boxShadow: '0 -1px 4px 0 rgba(74, 85, 121, 0.5)', + boxShadow: '1px 2px 10px 0 rgba(212, 212, 211, 0.59)', minHeight: '400px', display: 'flex', + borderRadius: '8px', }, settings: { letterSpacing: '-0.5px', From 4dc756398fbfe8f7f7d6251d0e43b7e89212fd0d Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Wed, 4 Sep 2019 12:42:44 +0400 Subject: [PATCH 06/26] Add an option to disable table pagination WIP --- .eslintrc | 2 ++ package.json | 4 +-- src/components/Table/index.jsx | 33 +++++++++-------- .../Settings/ManageOwners/index.jsx | 1 + .../Settings/ThresholdSettings/index.jsx | 2 +- yarn.lock | 36 +++++++++++-------- 6 files changed, 47 insertions(+), 31 deletions(-) diff --git a/.eslintrc b/.eslintrc index 570d4fa3..392bf94e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,6 +23,8 @@ "import/no-extraneous-dependencies": 0, "import/extensions": 0, "import/prefer-default-export": 0, + "react/default-props-match-prop-types": ["error", { "allowRequiredDefaults": true }], + // https://github.com/yannickcr/eslint-plugin-react/issues/1593 ^ "jsx-a11y/label-has-for": 0, "indent": ["error", 2, { "SwitchCase": 1 }], "no-console": ["error", { "allow": ["warn", "error"] }], diff --git a/package.json b/package.json index a8030ba6..ed64771a 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "@storybook/addon-knobs": "5.1.11", "@storybook/addon-links": "5.1.11", "@storybook/react": "5.1.11", - "@testing-library/react": "9.1.3", + "@testing-library/react": "9.1.4", "autoprefixer": "9.6.1", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "10.0.3", @@ -107,7 +107,7 @@ "detect-port": "^1.2.2", "eslint": "5.16.0", "eslint-config-airbnb": "18.0.1", - "eslint-plugin-flowtype": "4.2.0", + "eslint-plugin-flowtype": "4.3.0", "eslint-plugin-import": "2.18.2", "eslint-plugin-jest": "22.16.0", "eslint-plugin-jsx-a11y": "6.2.3", diff --git a/src/components/Table/index.jsx b/src/components/Table/index.jsx index e3c49fa0..e24639b1 100644 --- a/src/components/Table/index.jsx +++ b/src/components/Table/index.jsx @@ -20,9 +20,10 @@ type Props = { classes: Object, children: Function, size: number, - defaultFixed?: boolean, - defaultOrder?: 'desc' | 'asc', + defaultFixed: boolean, + defaultOrder: 'desc' | 'asc', noBorder: boolean, + disablePagination: boolean, } type State = { @@ -142,6 +143,7 @@ class GnoTable extends React.Component, State> { classes, children, size, + disablePagination, defaultOrderBy, defaultOrder, defaultFixed, @@ -184,18 +186,20 @@ class GnoTable extends React.Component, State> { )} - + {!disablePagination && ( + + )} ) } @@ -203,6 +207,7 @@ class GnoTable extends React.Component, State> { GnoTable.defaultProps = { defaultOrder: 'asc', + disablePagination: false, } export default withStyles(styles)(GnoTable) diff --git a/src/routes/safe/components/Settings/ManageOwners/index.jsx b/src/routes/safe/components/Settings/ManageOwners/index.jsx index d698c72b..11b3f69a 100644 --- a/src/routes/safe/components/Settings/ManageOwners/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/index.jsx @@ -150,6 +150,7 @@ class ManageOwners extends React.Component { columns={columns} data={ownerData} size={ownerData.size} + disablePagination defaultFixed noBorder > diff --git a/src/routes/safe/components/Settings/ThresholdSettings/index.jsx b/src/routes/safe/components/Settings/ThresholdSettings/index.jsx index 74a3ce2f..05b0cea8 100644 --- a/src/routes/safe/components/Settings/ThresholdSettings/index.jsx +++ b/src/routes/safe/components/Settings/ThresholdSettings/index.jsx @@ -21,7 +21,7 @@ type Props = { classes: Object, createTransaction: Function, safeAddress: string, - granted: Boolean, + granted: boolean, } const ThresholdSettings = ({ diff --git a/yarn.lock b/yarn.lock index 44c16583..dfcb05b0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2255,13 +2255,14 @@ dependencies: defer-to-connect "^1.0.1" -"@testing-library/dom@^6.0.0": - version "6.0.0" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-6.0.0.tgz#34e28e69e49bd6347fc64a5dde4c4f9aabbd17d3" - integrity sha512-B5XTz3uMsbqbdR9CZlnwpZjTE3fCWuqRkz/zvDc2Ej/vuHmTM0Ur2v0XPwr7usWfGIBsahEK5HL1E91+4IFiBg== +"@testing-library/dom@^6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-6.1.0.tgz#8d5a954158e81ecd7c994907f4ec240296ed823b" + integrity sha512-qivqFvnbVIH3DyArFofEU/jlOhkGIioIemOy9A9M/NQTpPyDDQmtVkAfoB18RKN581f0s/RJMRBbq9WfMIhFTw== dependencies: "@babel/runtime" "^7.5.5" "@sheerun/mutationobserver-shim" "^0.3.2" + "@types/testing-library__dom" "^6.0.0" aria-query "3.0.0" pretty-format "^24.8.0" wait-for-expect "^1.3.0" @@ -2281,13 +2282,13 @@ pretty-format "^24.0.0" redent "^3.0.0" -"@testing-library/react@9.1.3": - version "9.1.3" - resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-9.1.3.tgz#3fb495227322ea36cd817532441dabb552e0d6ce" - integrity sha512-qFVo6TsEbpEFpOmKjIxMHDujOKVdvVpcYFcUfJeWBqMO8eja5pN9SZnt6W6AzW3a1MRvRfw3X0Fhx3eXnBJxjA== +"@testing-library/react@9.1.4": + version "9.1.4" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-9.1.4.tgz#4cc1a228a944c0f468ee501e7da1651d8bbd9902" + integrity sha512-fQ/PXZoLcmnS1W5ZiM3P7XBy2x6Hm9cJAT/ZDuZKzJ1fS1rN3j31p7ReAqUe3N1kJ46sNot0n1oiGbz7FPU+FA== dependencies: "@babel/runtime" "^7.5.5" - "@testing-library/dom" "^6.0.0" + "@testing-library/dom" "^6.1.0" "@types/testing-library__react" "^9.1.0" "@truffle/blockchain-utils@^0.0.11": @@ -2462,6 +2463,13 @@ dependencies: "@types/pretty-format" "*" +"@types/testing-library__dom@^6.0.0": + version "6.0.2" + resolved "https://registry.yarnpkg.com/@types/testing-library__dom/-/testing-library__dom-6.0.2.tgz#1e40c5f12671b98e86706f6c9ba55eaab3461edc" + integrity sha512-p5Jjm2kaHpee2rMartE3F2vg4rosMoAc1KVr4+WPz1TOc4B8A6EO5oLJUZvuRyiT3pFy/WO77kn40qp51DF3Sg== + dependencies: + pretty-format "^24.3.0" + "@types/testing-library__react@^9.1.0": version "9.1.1" resolved "https://registry.yarnpkg.com/@types/testing-library__react/-/testing-library__react-9.1.1.tgz#4bcb8bba54b07fbb6c084f2f00e7f9410e587c10" @@ -6997,10 +7005,10 @@ eslint-module-utils@^2.4.0: debug "^2.6.8" pkg-dir "^2.0.0" -eslint-plugin-flowtype@4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.2.0.tgz#a89ac991eef6753226eb8871261e266645aca4b9" - integrity sha512-mqf6AbQCP6N8Bk+ryXYwxt6sj3RT7i3kt8JOOx7WOQNlZtsLxqvnkXRRrToFHcN52E5W9c/p3UfNxCMsfENIJA== +eslint-plugin-flowtype@4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.3.0.tgz#06d0837ac341caf369e7e6dbb112dd7fd21acf17" + integrity sha512-elvqoadMHnYqSYN1YXn02DR7SFW8Kc2CLe8na3m2GdQPQhIY+BgCd2quVJ1AbW3aO0zcyE9loVJ7Szy8A/xlMA== dependencies: lodash "^4.17.15" @@ -13860,7 +13868,7 @@ pretty-format@^24.0.0, pretty-format@^24.8.0: ansi-styles "^3.2.0" react-is "^16.8.4" -pretty-format@^24.9.0: +pretty-format@^24.3.0, pretty-format@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== From cd33d04481baca51138e4c5e815bc3a9abdd74c7 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Wed, 4 Sep 2019 14:43:41 +0400 Subject: [PATCH 07/26] add prop to disable pagination in table component --- src/components/Table/index.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/Table/index.jsx b/src/components/Table/index.jsx index e24639b1..577277aa 100644 --- a/src/components/Table/index.jsx +++ b/src/components/Table/index.jsx @@ -162,10 +162,11 @@ class GnoTable extends React.Component, State> { input: classes.white, } - const sortedData = stableSort(data, getSorting(orderParam, orderByParam, orderProp), fixedParam).slice( - page * rowsPerPage, - page * rowsPerPage + rowsPerPage, - ) + let sortedData = stableSort(data, getSorting(orderParam, orderByParam, orderProp), fixedParam) + + if (!disablePagination) { + sortedData = sortedData.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + } const emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage) const isEmpty = size === 0 From 753e46a24382277d6b29905e4c9ebe1e427d2c1b Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Wed, 4 Sep 2019 17:16:18 +0400 Subject: [PATCH 08/26] Add annotation to manage owners --- src/components/layout/Heading/index.jsx | 17 +++++++++-------- .../components/Settings/ManageOwners/index.jsx | 13 +++++++------ .../components/Settings/ManageOwners/style.js | 7 +++++++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/components/layout/Heading/index.jsx b/src/components/layout/Heading/index.jsx index aa24c044..51d8a1da 100644 --- a/src/components/layout/Heading/index.jsx +++ b/src/components/layout/Heading/index.jsx @@ -15,19 +15,20 @@ type Props = { tag: HeadingTag, truncate?: boolean, children: React.Node, + className?: string, testId?: string, } -class Heading extends React.PureComponent { - render() { - const { - align, tag, truncate, margin, color, children, testId, ...props - } = this.props +const Heading = (props: Props) => { + const { + align, tag, truncate, margin, color, children, testId, className = '', ...rest + } = props - const className = cx('heading', align, tag, margin ? capitalize(margin, 'margin') : undefined, color, { truncate }) + const classes = cx(className, 'heading', align, tag, margin ? capitalize(margin, 'margin') : undefined, color, { + truncate, + }) - return React.createElement(tag, { ...props, className, 'data-testid': testId || '' }, children) - } + return React.createElement(tag, { ...rest, className: classes, 'data-testid': testId || '' }, children) } export default Heading diff --git a/src/routes/safe/components/Settings/ManageOwners/index.jsx b/src/routes/safe/components/Settings/ManageOwners/index.jsx index 11b3f69a..f3793f0f 100644 --- a/src/routes/safe/components/Settings/ManageOwners/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/index.jsx @@ -26,11 +26,12 @@ import { OWNERS_TABLE_ADDRESS_ID, type OwnerRow, } from './dataFetcher' -import { lg, sm, boldFont } from '~/theme/variables' +import { sm, boldFont } from '~/theme/variables' import { styles } from './style' import ReplaceOwnerIcon from './assets/icons/replace-owner.svg' import RenameOwnerIcon from './assets/icons/rename-owner.svg' import RemoveOwnerIcon from '../assets/icons/bin.svg' +import Paragraph from '~/components/layout/Paragraph/index' export const RENAME_OWNER_BTN_TEST_ID = 'rename-owner-btn' export const REMOVE_OWNER_BTN_TEST_ID = 'remove-owner-btn' @@ -48,10 +49,6 @@ const addOwnerButtonStyle = { fontWeight: boldFont, } -const title = { - padding: lg, -} - type Props = { classes: Object, safeAddress: string, @@ -141,9 +138,13 @@ class ManageOwners extends React.Component { return ( <> - + Manage Safe Owners + + Add, remove and replace owners or rename existing owners. Owner names are only stored locally and never + shared with Gnosis or any third parties + ({ formContainer: { minHeight: '369px', }, + title: { + padding: lg, + paddingBottom: 0, + }, + annotation: { + padding: lg, + }, hide: { '&:hover': { backgroundColor: '#fff3e2', From 590147682a9011ea76a9678154694ce62bf40566 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Wed, 4 Sep 2019 19:27:19 +0400 Subject: [PATCH 09/26] Pass notifications to createTransaction/executeTransaction to allow custom messages WIP --- src/components/SharedSnackBar/index.jsx | 18 ++++----- src/logic/safe/transactions/send.js | 6 +-- .../ManageOwners/RemoveOwnerModal/index.jsx | 37 +++++++++---------- .../RemoveOwnerModal/screens/Review/index.jsx | 19 ++++++---- .../safe/store/actions/createTransaction.js | 36 ++++++++++++++---- 5 files changed, 67 insertions(+), 49 deletions(-) diff --git a/src/components/SharedSnackBar/index.jsx b/src/components/SharedSnackBar/index.jsx index c208afdb..c22c9213 100644 --- a/src/components/SharedSnackBar/index.jsx +++ b/src/components/SharedSnackBar/index.jsx @@ -20,11 +20,7 @@ export const SharedSnackbar = () => ( autoHideDuration={4000} onClose={closeSnackbar} > - + ) }} @@ -60,10 +56,14 @@ type State = { } export class SharedSnackbarProvider extends React.Component { - state = { - isOpen: false, - message: '', - variant: 'info', + constructor(props: Props) { + super(props) + + this.state = { + isOpen: false, + message: '', + variant: 'info', + } } openSnackbar = (message: string, variant: Variant) => { diff --git a/src/logic/safe/transactions/send.js b/src/logic/safe/transactions/send.js index abe2920d..6bba674d 100644 --- a/src/logic/safe/transactions/send.js +++ b/src/logic/safe/transactions/send.js @@ -108,11 +108,9 @@ export const executeTransaction = async ( .execTransaction(to, valueInWei, data, operation, 0, 0, 0, ZERO_ADDRESS, ZERO_ADDRESS, sigs) .encodeABI() const errMsg = await getErrorMessage(safeInstance.address, 0, executeDataUsedSignatures, sender) - - console.log(`Error executing the TX: ${error}`) console.log(`Error executing the TX: ${errMsg}`) - /* eslint-enable */ - return 0 + + throw error; } } diff --git a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.jsx b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.jsx index 244c6b9d..c245965b 100644 --- a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.jsx @@ -46,7 +46,9 @@ export const sendRemoveOwner = async ( ) => { const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress) const safeOwners = await gnosisSafe.getOwners() - const index = safeOwners.findIndex(ownerAddress => ownerAddress.toLowerCase() === ownerAddressToRemove.toLowerCase()) + const index = safeOwners.findIndex( + (ownerAddress) => ownerAddress.toLowerCase() === ownerAddressToRemove.toLowerCase(), + ) const prevAddress = index === 0 ? SENTINEL_ADDRESS : safeOwners[index - 1] const txData = gnosisSafe.contract.methods .removeOwner(prevAddress, ownerAddressToRemove, values.threshold) @@ -103,26 +105,21 @@ const RemoveOwner = ({ } return ( - + <> {({ openSnackbar }) => { const onRemoveOwner = () => { onClose() - try { - sendRemoveOwner( - values, - safeAddress, - ownerAddress, - ownerName, - owners, - openSnackbar, - createTransaction, - removeSafeOwner, - ) - } catch (error) { - // eslint-disable-next-line - console.log('Error while removing an owner ' + error) - } + sendRemoveOwner( + values, + safeAddress, + ownerAddress, + ownerName, + owners, + openSnackbar, + createTransaction, + removeSafeOwner, + ) } return ( @@ -133,7 +130,7 @@ const RemoveOwner = ({ open={isOpen} paperClassName={classes.biggerModalWindow} > - + <> {activeScreen === 'checkOwner' && ( )} - + ) }} - + ) } 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 index e5e7921e..37ea76fe 100644 --- a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/index.jsx @@ -56,7 +56,7 @@ const ReviewRemoveOwner = ({ } return ( - + <> Remove owner @@ -91,11 +91,10 @@ const ReviewRemoveOwner = ({ {values.threshold} {' '} - out of - {' '} +out of {owners.size - 1} {' '} - owner(s) +owner(s) @@ -105,12 +104,12 @@ const ReviewRemoveOwner = ({ {owners.size - 1} {' '} - Safe owner(s) +Safe owner(s) {owners.map( - owner => owner.address !== ownerAddress && ( + (owner) => owner.address !== ownerAddress && ( @@ -159,7 +158,11 @@ const ReviewRemoveOwner = ({ {ownerAddress} - + @@ -187,7 +190,7 @@ const ReviewRemoveOwner = ({ Submit - + ) } diff --git a/src/routes/safe/store/actions/createTransaction.js b/src/routes/safe/store/actions/createTransaction.js index 164427ee..03982ea7 100644 --- a/src/routes/safe/store/actions/createTransaction.js +++ b/src/routes/safe/store/actions/createTransaction.js @@ -7,6 +7,20 @@ import { type GlobalState } from '~/store' import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts' import { approveTransaction, executeTransaction, CALL } from '~/logic/safe/transactions' +export type Notifications = { + BEFORE_EXECUTION_OR_CREATION: string, + AFTER_EXECUTION: string, + CREATED_MORE_CONFIRMATIONS_NEEDED: string, + ERROR: string, +} + +const DEFAULT_NOTIFICATIONS: Notifications = { + BEFORE_EXECUTION_OR_CREATION: 'Transaction in progress', + AFTER_EXECUTION: 'Transaction successfully executed', + CREATED_MORE_CONFIRMATIONS_NEEDED: 'Transaction in progress: More confirmations required to execute', + ERROR: 'Transaction failed', +} + const createTransaction = ( safeAddress: string, to: string, @@ -14,6 +28,7 @@ const createTransaction = ( txData: string = EMPTY_DATA, openSnackbar: Function, shouldExecute?: boolean, + notifications?: Notifications = DEFAULT_NOTIFICATIONS, ) => async (dispatch: ReduxDispatch, getState: GetState) => { const state: GlobalState = getState() @@ -24,14 +39,19 @@ const createTransaction = ( const isExecution = threshold.toNumber() === 1 || shouldExecute let txHash - if (isExecution) { - openSnackbar('Transaction has been submitted', 'success') - txHash = await executeTransaction(safeInstance, to, valueInWei, txData, CALL, nonce, from) - openSnackbar('Transaction has been confirmed', 'success') - } else { - openSnackbar('Approval transaction has been submitted', 'success') - txHash = await approveTransaction(safeInstance, to, valueInWei, txData, CALL, nonce, from) - openSnackbar('Approval transaction has been confirmed', 'success') + try { + if (isExecution) { + openSnackbar(notifications.BEFORE_EXECUTION_OR_CREATION, 'success') + txHash = await executeTransaction(safeInstance, to, valueInWei, txData, CALL, nonce, from) + openSnackbar(notifications.AFTER_EXECUTION, 'success') + } else { + openSnackbar(notifications.BEFORE_EXECUTION_OR_CREATION, 'success') + txHash = await approveTransaction(safeInstance, to, valueInWei, txData, CALL, nonce, from) + openSnackbar(notifications.CREATED_MORE_CONFIRMATIONS_NEEDED, 'success') + } + } catch (err) { + openSnackbar(notifications.ERROR, '') + console.error(`Error while creating transaction: ${err}`) } dispatch(fetchTransactions(safeAddress)) From 0932f34a6808c349f79e2710986225c2ab03f3c9 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Thu, 5 Sep 2019 14:06:04 +0400 Subject: [PATCH 10/26] increase minHeight for settings to avoid jumping --- package.json | 4 +-- src/routes/safe/components/Settings/style.js | 2 +- yarn.lock | 26 ++++++++------------ 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index ed64771a..d221222a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "bignumber.js": "9.0.0", "connected-react-router": "6.5.2", "date-fns": "2.0.1", - "ethereum-ens": "^0.7.7", + "ethereum-ens": "0.7.8", "final-form": "4.18.5", "history": "^4.7.2", "immortal-db": "^1.0.2", @@ -132,7 +132,7 @@ "storybook-host": "5.1.0", "storybook-router": "^0.3.3", "style-loader": "1.0.0", - "truffle": "5.0.34", + "truffle": "5.0.35", "truffle-contract": "4.0.31", "truffle-solidity-loader": "0.1.32", "uglifyjs-webpack-plugin": "2.2.0", diff --git a/src/routes/safe/components/Settings/style.js b/src/routes/safe/components/Settings/style.js index 13741457..32807bfb 100644 --- a/src/routes/safe/components/Settings/style.js +++ b/src/routes/safe/components/Settings/style.js @@ -7,7 +7,7 @@ export const styles = () => ({ root: { backgroundColor: 'white', boxShadow: '1px 2px 10px 0 rgba(212, 212, 211, 0.59)', - minHeight: '400px', + minHeight: '505px', display: 'flex', borderRadius: '8px', }, diff --git a/yarn.lock b/yarn.lock index dfcb05b0..c7f47c23 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7338,18 +7338,17 @@ ethereum-common@^0.0.18: resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.0.18.tgz#2fdc3576f232903358976eb39da783213ff9523f" integrity sha1-L9w1dvIykDNYl26znaeDIT/5Uj8= -ethereum-ens@^0.7.7: - version "0.7.7" - resolved "https://registry.yarnpkg.com/ethereum-ens/-/ethereum-ens-0.7.7.tgz#43e104552b9ad70b232a5d98b26367604b4e055c" - integrity sha512-KawlKV0CD8cj3KHIij9xuTpqCMjBjbjBrqJ0xcKNCuaWNN6CtqHoHqgPcVoiad0TuomqzXjzujBOvuacm2Bq4w== +ethereum-ens@0.7.8: + version "0.7.8" + resolved "https://registry.yarnpkg.com/ethereum-ens/-/ethereum-ens-0.7.8.tgz#102874541801507774fef21c9a626fabb1ed0630" + integrity sha512-HJBDmF5/abP/IIM6N7rGHmmlQ4yCKIVK4kzT/Mu05+eZn0i5ZlR25LTAE47SVZ7oyTBvOkNJhxhSkWRvjh7srg== dependencies: bluebird "^3.4.7" eth-ens-namehash "^2.0.0" js-sha3 "^0.5.7" pako "^1.0.4" - text-encoding "^0.6.4" underscore "^1.8.3" - web3 "1.0.0-beta.37" + web3 "^1.0.0-beta.34" ethereumjs-abi@0.6.5: version "0.6.5" @@ -16791,11 +16790,6 @@ test-exclude@^5.2.3: read-pkg-up "^4.0.0" require-main-filename "^2.0.0" -text-encoding@^0.6.4: - version "0.6.4" - resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19" - integrity sha1-45mpgiV6J22uQou5KEXLcb3CbRk= - text-table@0.2.0, text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -17545,10 +17539,10 @@ truffle-workflow-compile@^2.1.3: truffle-external-compile "^1.0.15" truffle-resolver "^5.0.15" -truffle@5.0.34: - version "5.0.34" - resolved "https://registry.yarnpkg.com/truffle/-/truffle-5.0.34.tgz#f2b667843418002511f5604254ed365ebdfa9534" - integrity sha512-fSA3JjaIjFrgn4BGfoATg2ATVWS51240L8mEQdtqLUncOcFnMLTBEaVRujO/f97XW+ew0hUg13oS4H/2Z4dwtg== +truffle@5.0.35: + version "5.0.35" + resolved "https://registry.yarnpkg.com/truffle/-/truffle-5.0.35.tgz#5c93522c3a0915567b2e5c7811934e0ee6e8a2bd" + integrity sha512-ewJPaeHyYgRpuVSvlzhlnalJkeLN0sz7c/P/8WLWpXC966M2o4vL5ov6MNdSHQFYiYQsDrCetrothzsYsg4HWQ== dependencies: app-module-path "^2.2.0" mocha "5.2.0" @@ -19191,7 +19185,7 @@ web3@1.0.0-beta.37: web3-shh "1.0.0-beta.37" web3-utils "1.0.0-beta.37" -web3@1.2.1: +web3@1.2.1, web3@^1.0.0-beta.34: version "1.2.1" resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.1.tgz#5d8158bcca47838ab8c2b784a2dee4c3ceb4179b" integrity sha512-nNMzeCK0agb5i/oTWNdQ1aGtwYfXzHottFP2Dz0oGIzavPMGSKyVlr8ibVb1yK5sJBjrWVnTdGaOC2zKDFuFRw== From 816b3c5ab5c4614d0af7a5aecb56f81a5c4b6f73 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Thu, 5 Sep 2019 14:29:42 +0400 Subject: [PATCH 11/26] remove old/unused transactions route code --- src/routes/safe/components/Layout.jsx | 9 +- .../Transactions/Collapsed/Confirmations.jsx | 83 ----------- .../Transactions/Collapsed/index.jsx | 52 ------- .../Transactions/NoTransactions/index.jsx | 8 +- .../Transactions/Transaction/index.jsx | 131 ------------------ .../Transactions/Transaction/selector.js | 34 ----- .../ExpandedTx/ApproveTxModal/index.jsx | 0 .../ExpandedTx/ApproveTxModal/style.js | 0 .../ExpandedTx/CancelTxModal/index.jsx | 0 .../ExpandedTx/CancelTxModal/style.js | 0 .../ExpandedTx/OwnersColumn/ButtonRow.jsx | 0 .../TxsTable/ExpandedTx/OwnersColumn/List.jsx | 0 .../ExpandedTx/OwnersColumn/index.jsx | 0 .../TxsTable/ExpandedTx/OwnersColumn/style.js | 0 .../ExpandedTx/TxDescription/index.jsx | 0 .../ExpandedTx/TxDescription/utils.js | 0 .../TxsTable/ExpandedTx/index.jsx | 0 .../TxsTable/ExpandedTx/style.js | 0 .../TxsTable/Status/assets/awaiting.svg | 0 .../TxsTable/Status/assets/error.svg | 0 .../TxsTable/Status/assets/ok.svg | 0 .../TxsTable/Status/index.jsx | 0 .../TxsTable/Status/style.js | 0 .../TxsTable/columns.js | 0 .../TxsTable/index.jsx | 0 .../TxsTable/style.js | 0 .../safe/components/Transactions/actions.js | 12 -- .../safe/components/Transactions/index.jsx | 107 +++++++------- .../safe/components/Transactions/selector.js | 16 --- .../TransactionsNew/NoTransactions/index.jsx | 20 --- .../safe/components/TransactionsNew/index.jsx | 58 -------- src/test/safe.dom.funds.threshold>1.test.js | 6 +- .../transactions/transactionList.helper.js | 4 +- 33 files changed, 63 insertions(+), 477 deletions(-) delete mode 100644 src/routes/safe/components/Transactions/Collapsed/Confirmations.jsx delete mode 100644 src/routes/safe/components/Transactions/Collapsed/index.jsx delete mode 100644 src/routes/safe/components/Transactions/Transaction/index.jsx delete mode 100644 src/routes/safe/components/Transactions/Transaction/selector.js rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/ApproveTxModal/index.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/ApproveTxModal/style.js (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/CancelTxModal/index.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/CancelTxModal/style.js (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/OwnersColumn/List.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/OwnersColumn/index.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/OwnersColumn/style.js (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/TxDescription/index.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/TxDescription/utils.js (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/index.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/ExpandedTx/style.js (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/Status/assets/awaiting.svg (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/Status/assets/error.svg (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/Status/assets/ok.svg (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/Status/index.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/Status/style.js (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/columns.js (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/index.jsx (100%) rename src/routes/safe/components/{TransactionsNew => Transactions}/TxsTable/style.js (100%) delete mode 100644 src/routes/safe/components/Transactions/actions.js delete mode 100644 src/routes/safe/components/Transactions/selector.js delete mode 100644 src/routes/safe/components/TransactionsNew/NoTransactions/index.jsx delete mode 100644 src/routes/safe/components/TransactionsNew/index.jsx diff --git a/src/routes/safe/components/Layout.jsx b/src/routes/safe/components/Layout.jsx index 52be6e15..5e4ada9f 100644 --- a/src/routes/safe/components/Layout.jsx +++ b/src/routes/safe/components/Layout.jsx @@ -18,8 +18,9 @@ import { sm, xs, secondary, smallFontSize, border, secondaryText, } from '~/theme/variables' import { copyToClipboard } from '~/utils/clipboard' +import { type Actions } from '../container/actions' import Balances from './Balances' -import Transactions from './TransactionsNew' +import Transactions from './Transactions' import Settings from './Settings' export const BALANCES_TAB_BTN_TEST_ID = 'balances-tab-btn' @@ -31,13 +32,9 @@ type State = { tabIndex: number, } -type Props = SelectorProps & { +type Props = SelectorProps & Actions & { classes: Object, granted: boolean, - updateSafe: Function, - createTransaction: Function, - processTransaction: Function, - fetchTransactions: Function, } const openIconStyle = { diff --git a/src/routes/safe/components/Transactions/Collapsed/Confirmations.jsx b/src/routes/safe/components/Transactions/Collapsed/Confirmations.jsx deleted file mode 100644 index 04a02ab1..00000000 --- a/src/routes/safe/components/Transactions/Collapsed/Confirmations.jsx +++ /dev/null @@ -1,83 +0,0 @@ -// @flow -import * as React from 'react' -import openHoc, { type Open } from '~/components/hoc/OpenHoc' -import { withStyles } from '@material-ui/core/styles' -import Collapse from '@material-ui/core/Collapse' -import IconButton from '@material-ui/core/IconButton' -import ListItemText from '~/components/List/ListItemText' -import List from '@material-ui/core/List' -import ListItem from '@material-ui/core/ListItem' -import ListItemIcon from '@material-ui/core/ListItemIcon' -import Avatar from '@material-ui/core/Avatar' -import Group from '@material-ui/icons/Group' -import Person from '@material-ui/icons/Person' -import ExpandLess from '@material-ui/icons/ExpandLess' -import ExpandMore from '@material-ui/icons/ExpandMore' -import { type WithStyles } from '~/theme/mui' -import { type Confirmation, type ConfirmationProps } from '~/routes/safe/store/models/confirmation' - -const styles = { - nested: { - paddingLeft: '40px', - }, -} - -type Props = Open & WithStyles & { - confirmations: List, - threshold: number, -} - -const GnoConfirmation = ({ owner, type, hash }: ConfirmationProps) => { - const address = owner.get('address') - const confirmed = type === 'confirmation' - const text = confirmed ? 'Confirmed' : 'Not confirmed' - const hashText = confirmed ? `Confirmation hash: ${hash}` : undefined - - return ( - - - - - - - - - ) -} - -const Confirmaitons = openHoc(({ - open, toggle, confirmations, threshold, -}: Props) => ( - - - - - - - - {open - ? - : - } - - - - - {confirmations.map(confirmation => ( - - ))} - - - -)) - -export default withStyles(styles)(Confirmaitons) diff --git a/src/routes/safe/components/Transactions/Collapsed/index.jsx b/src/routes/safe/components/Transactions/Collapsed/index.jsx deleted file mode 100644 index 1a94be9c..00000000 --- a/src/routes/safe/components/Transactions/Collapsed/index.jsx +++ /dev/null @@ -1,52 +0,0 @@ -// @flow -import * as React from 'react' -import { List as ImmutableList } from 'immutable' -import Row from '~/components/layout/Row' -import Col from '~/components/layout/Col' -import List from '@material-ui/core/List' -import ListItem from '@material-ui/core/ListItem' -import ListItemText from '~/components/List/ListItemText' -import Avatar from '@material-ui/core/Avatar' -import Group from '@material-ui/icons/Group' -import MailOutline from '@material-ui/icons/MailOutline' -import { type Confirmation } from '~/routes/safe/store/models/confirmation' -import Confirmations from './Confirmations' - -type Props = { - safeName: string, - confirmations: ImmutableList, - destination: string, - threshold: number, -} - -const listStyle = { - width: '100%', -} - -class Collapsed extends React.PureComponent { - render() { - const { - confirmations, destination, safeName, threshold, - } = this.props - - return ( - - - - - - - - - - - - - - - - ) - } -} - -export default Collapsed diff --git a/src/routes/safe/components/Transactions/NoTransactions/index.jsx b/src/routes/safe/components/Transactions/NoTransactions/index.jsx index f6e99d08..a2ed8291 100644 --- a/src/routes/safe/components/Transactions/NoTransactions/index.jsx +++ b/src/routes/safe/components/Transactions/NoTransactions/index.jsx @@ -5,8 +5,10 @@ import Col from '~/components/layout/Col' import Row from '~/components/layout/Row' import Paragraph from '~/components/layout/Paragraph/index' -const NoRights = () => ( - +export const NO_TRANSACTION_ROW_TEST_ID = 'no-transaction-row' + +const NoTransactions = () => ( + No transactions found for this safe @@ -15,4 +17,4 @@ const NoRights = () => ( ) -export default NoRights +export default NoTransactions diff --git a/src/routes/safe/components/Transactions/Transaction/index.jsx b/src/routes/safe/components/Transactions/Transaction/index.jsx deleted file mode 100644 index b455e43f..00000000 --- a/src/routes/safe/components/Transactions/Transaction/index.jsx +++ /dev/null @@ -1,131 +0,0 @@ -// @flow -import * as React from 'react' -import { List } from 'immutable' -import { connect } from 'react-redux' -import openHoc, { type Open } from '~/components/hoc/OpenHoc' -import ExpandLess from '@material-ui/icons/ExpandLess' -import ExpandMore from '@material-ui/icons/ExpandMore' -import IconButton from '@material-ui/core/IconButton' -import ListItemText from '~/components/List/ListItemText' -import Row from '~/components/layout/Row' -import ListItem from '@material-ui/core/ListItem' -import ListItemIcon from '@material-ui/core/ListItemIcon' -import Avatar from '@material-ui/core/Avatar' -import AttachMoney from '@material-ui/icons/AttachMoney' -import Atm from '@material-ui/icons/LocalAtm' -import DoneAll from '@material-ui/icons/DoneAll' -import CompareArrows from '@material-ui/icons/CompareArrows' -import Collapsed from '~/routes/safe/components/Transactions/Collapsed' -import { type Transaction } from '~/routes/safe/store/models/transaction' -import Hairline from '~/components/layout/Hairline/index' -import Button from '~/components/layout/Button' -import { sameAddress } from '~/logic/wallets/ethAddresses' -import { type Confirmation } from '~/routes/safe/store/models/confirmation' -import selector, { type SelectorProps } from './selector' - -type Props = Open & - SelectorProps & { - transaction: Transaction, - safeName: string, - threshold: number, - onProcessTx: (tx: Transaction, alreadyConfirmed: number) => void, - } - -export const PROCESS_TXS = 'PROCESS TRANSACTION' - -class GnoTransaction extends React.PureComponent { - onProccesClick = () => { - const { onProcessTx, transaction, confirmed } = this.props - - onProcessTx(transaction, confirmed) - } - - hasConfirmed = (userAddress: string, confirmations: List): boolean => ( - confirmations - .filter( - (conf: Confirmation) => ( - sameAddress(userAddress, conf.get('owner').get('address')) && conf.get('type') === 'confirmation' - ), - ) - .count() > 0 - ) - - render() { - const { - open, toggle, transaction, confirmed, safeName, userAddress, executionHash, threshold, - } = this.props - - const confirmationText = executionHash - ? 'Already executed' - : `${confirmed} of the ${threshold} confirmations needed` - const userConfirmed = this.hasConfirmed(userAddress, transaction.get('confirmations')) - - return ( - - - - - - - - - - - - - - - - - {open ? ( - - - - ) : ( - - - - )} - - - - - - {executionHash && ( - - - - - - - )} - {!executionHash && userConfirmed && ( - - - - - - - )} - {!executionHash && !userConfirmed && ( - - )} - - - {open && ( - - )} - - - ) - } -} - -export default openHoc(connect(selector)(GnoTransaction)) diff --git a/src/routes/safe/components/Transactions/Transaction/selector.js b/src/routes/safe/components/Transactions/Transaction/selector.js deleted file mode 100644 index d2bcab74..00000000 --- a/src/routes/safe/components/Transactions/Transaction/selector.js +++ /dev/null @@ -1,34 +0,0 @@ -// @flow -import { createStructuredSelector } from 'reselect' -import { confirmationsTransactionSelector } from '~/routes/safe/store/selectors/index' -import { userAccountSelector } from '~/logic/wallets/store/selectors' -import { type Transaction } from '~/routes/safe/store/models/transaction' -import { type GlobalState } from '~/store' -import { type Confirmation } from '~/routes/safe/store/models/confirmation' - -export type SelectorProps = { - confirmed: typeof confirmationsTransactionSelector, - userAddress: typeof userAccountSelector, - executionHash: string, -} - -type TxProps = { - transaction: Transaction, -} - -const transactionHashSector = (state: GlobalState, props: TxProps) => { - if (!props.transaction) { - return undefined - } - - const confirmations = props.transaction.get('confirmations') - const executedConf = confirmations.find((conf: Confirmation) => conf.get('type') === 'execution') - - return executedConf ? executedConf.get('hash') : undefined -} - -export default createStructuredSelector({ - executionHash: transactionHashSector, - confirmed: confirmationsTransactionSelector, - userAddress: userAccountSelector, -}) diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal/index.jsx b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/ApproveTxModal/index.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal/index.jsx rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/ApproveTxModal/index.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal/style.js b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/ApproveTxModal/style.js similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal/style.js rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/ApproveTxModal/style.js diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/CancelTxModal/index.jsx b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/CancelTxModal/index.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/CancelTxModal/index.jsx rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/CancelTxModal/index.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/CancelTxModal/style.js b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/CancelTxModal/style.js similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/CancelTxModal/style.js rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/CancelTxModal/style.js diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/List.jsx b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/List.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/List.jsx rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/List.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/index.jsx b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/index.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/index.jsx rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/index.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/style.js b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/style.js similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/style.js rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/style.js diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/TxDescription/index.jsx b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/TxDescription/index.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/TxDescription/index.jsx rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/TxDescription/index.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/TxDescription/utils.js b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/TxDescription/utils.js similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/TxDescription/utils.js rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/TxDescription/utils.js diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/index.jsx b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/index.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/index.jsx rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/index.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/style.js b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/style.js similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/style.js rename to src/routes/safe/components/Transactions/TxsTable/ExpandedTx/style.js diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/Status/assets/awaiting.svg b/src/routes/safe/components/Transactions/TxsTable/Status/assets/awaiting.svg similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/Status/assets/awaiting.svg rename to src/routes/safe/components/Transactions/TxsTable/Status/assets/awaiting.svg diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/Status/assets/error.svg b/src/routes/safe/components/Transactions/TxsTable/Status/assets/error.svg similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/Status/assets/error.svg rename to src/routes/safe/components/Transactions/TxsTable/Status/assets/error.svg diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/Status/assets/ok.svg b/src/routes/safe/components/Transactions/TxsTable/Status/assets/ok.svg similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/Status/assets/ok.svg rename to src/routes/safe/components/Transactions/TxsTable/Status/assets/ok.svg diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/Status/index.jsx b/src/routes/safe/components/Transactions/TxsTable/Status/index.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/Status/index.jsx rename to src/routes/safe/components/Transactions/TxsTable/Status/index.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/Status/style.js b/src/routes/safe/components/Transactions/TxsTable/Status/style.js similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/Status/style.js rename to src/routes/safe/components/Transactions/TxsTable/Status/style.js diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/columns.js b/src/routes/safe/components/Transactions/TxsTable/columns.js similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/columns.js rename to src/routes/safe/components/Transactions/TxsTable/columns.js diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/index.jsx b/src/routes/safe/components/Transactions/TxsTable/index.jsx similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/index.jsx rename to src/routes/safe/components/Transactions/TxsTable/index.jsx diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/style.js b/src/routes/safe/components/Transactions/TxsTable/style.js similarity index 100% rename from src/routes/safe/components/TransactionsNew/TxsTable/style.js rename to src/routes/safe/components/Transactions/TxsTable/style.js diff --git a/src/routes/safe/components/Transactions/actions.js b/src/routes/safe/components/Transactions/actions.js deleted file mode 100644 index 32f51f38..00000000 --- a/src/routes/safe/components/Transactions/actions.js +++ /dev/null @@ -1,12 +0,0 @@ -// @flow -import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions' - -type FetchTransactions = typeof fetchTransactions - -export type Actions = { - fetchTransactions: FetchTransactions, -} - -export default { - fetchTransactions, -} diff --git a/src/routes/safe/components/Transactions/index.jsx b/src/routes/safe/components/Transactions/index.jsx index cdf30d0d..c8677ccd 100644 --- a/src/routes/safe/components/Transactions/index.jsx +++ b/src/routes/safe/components/Transactions/index.jsx @@ -1,65 +1,58 @@ // @flow -import * as React from 'react' +import React, { useEffect } from 'react' import { List } from 'immutable' -import { connect } from 'react-redux' -import { type Transaction } from '~/routes/safe/store/models/transaction' import NoTransactions from '~/routes/safe/components/Transactions/NoTransactions' -import GnoTransaction from '~/routes/safe/components/Transactions/Transaction' -import { sameAddress } from '~/logic/wallets/ethAddresses' -import { type Confirmation } from '~/routes/safe/store/models/confirmation' -import { processTransaction } from '~/logic/safe/safeFrontendOperations' -import selector, { type SelectorProps } from './selector' -import actions, { type Actions } from './actions' +import TxsTable from '~/routes/safe/components/Transactions/TxsTable' +import { type Transaction } from '~/routes/safe/store/models/transaction' +import { type Owner } from '~/routes/safe/store/models/owner' -type Props = SelectorProps & Actions & { - safeName: string, +type Props = { safeAddress: string, threshold: number, - -} -class Transactions extends React.Component { - componentDidMount() { - const { fetchTransactions, safeAddress } = this.props - - fetchTransactions(safeAddress) - } - - onProcessTx = async (tx: Transaction, alreadyConfirmed: number) => { - const { - fetchTransactions, safeAddress, userAddress, threshold, - } = this.props - - const confirmations = tx.get('confirmations') - const usersConfirmed = List(confirmations.map((confirmation: Confirmation) => - confirmation.get('owner').get('address'))) - const userHasAlreadyConfirmed = confirmations.filter((confirmation: Confirmation) => { - const ownerAddress = confirmation.get('owner').get('address') - const samePerson = sameAddress(ownerAddress, userAddress) - - return samePerson && confirmation.get('type') === 'confirmation' - }).count() > 0 - - if (userHasAlreadyConfirmed) { - throw new Error('Owner has already confirmed this transaction') - } - - await processTransaction(safeAddress, tx, alreadyConfirmed, userAddress, threshold, usersConfirmed) - fetchTransactions(safeAddress) - } - - render() { - const { transactions, safeName, threshold } = this.props - const hasTransactions = transactions.count() > 0 - - return ( - - { hasTransactions - ? transactions.map((tx: Transaction) => ) - : - } - - ) - } + fetchTransactions: Function, + transactions: List, + owners: List, + userAddress: string, + granted: boolean, + createTransaction: Function, + processTransaction: Function, } -export default connect(selector, actions)(Transactions) +const Transactions = ({ + transactions = List(), + owners, + threshold, + userAddress, + granted, + safeAddress, + createTransaction, + processTransaction, + fetchTransactions, +}: Props) => { + useEffect(() => { + fetchTransactions(safeAddress) + }, [safeAddress]) + + const hasTransactions = transactions.size > 0 + + return ( + + {hasTransactions ? ( + + ) : ( + + )} + + ) +} + +export default Transactions diff --git a/src/routes/safe/components/Transactions/selector.js b/src/routes/safe/components/Transactions/selector.js deleted file mode 100644 index 3722c407..00000000 --- a/src/routes/safe/components/Transactions/selector.js +++ /dev/null @@ -1,16 +0,0 @@ -// @flow -import { List } from 'immutable' -import { createStructuredSelector } from 'reselect' -import { type Transaction } from '~/routes/safe/store/models/transaction' -import { safeTransactionsSelector } from '~/routes/safe/store/selectors/index' -import { userAccountSelector } from '~/logic/wallets/store/selectors' - -export type SelectorProps = { - transactions: List, - userAddress: typeof userAccountSelector, -} - -export default createStructuredSelector({ - transactions: safeTransactionsSelector, - userAddress: userAccountSelector, -}) diff --git a/src/routes/safe/components/TransactionsNew/NoTransactions/index.jsx b/src/routes/safe/components/TransactionsNew/NoTransactions/index.jsx deleted file mode 100644 index a2ed8291..00000000 --- a/src/routes/safe/components/TransactionsNew/NoTransactions/index.jsx +++ /dev/null @@ -1,20 +0,0 @@ -// @flow -import * as React from 'react' -import Bold from '~/components/layout/Bold' -import Col from '~/components/layout/Col' -import Row from '~/components/layout/Row' -import Paragraph from '~/components/layout/Paragraph/index' - -export const NO_TRANSACTION_ROW_TEST_ID = 'no-transaction-row' - -const NoTransactions = () => ( - - - - No transactions found for this safe - - - -) - -export default NoTransactions diff --git a/src/routes/safe/components/TransactionsNew/index.jsx b/src/routes/safe/components/TransactionsNew/index.jsx deleted file mode 100644 index 317e967c..00000000 --- a/src/routes/safe/components/TransactionsNew/index.jsx +++ /dev/null @@ -1,58 +0,0 @@ -// @flow -import React, { useEffect } from 'react' -import { List } from 'immutable' -import NoTransactions from '~/routes/safe/components/TransactionsNew/NoTransactions' -import TxsTable from '~/routes/safe/components/TransactionsNew/TxsTable' -import { type Transaction } from '~/routes/safe/store/models/transaction' -import { type Owner } from '~/routes/safe/store/models/owner' - -type Props = { - safeAddress: string, - threshold: number, - fetchTransactions: Function, - transactions: List, - owners: List, - userAddress: string, - granted: boolean, - createTransaction: Function, - processTransaction: Function, -} - -const Transactions = ({ - transactions = List(), - owners, - threshold, - userAddress, - granted, - safeAddress, - createTransaction, - processTransaction, - fetchTransactions, -}: Props) => { - useEffect(() => { - fetchTransactions(safeAddress) - }, [safeAddress]) - - const hasTransactions = transactions.size > 0 - - return ( - - {hasTransactions ? ( - - ) : ( - - )} - - ) -} - -export default Transactions diff --git a/src/test/safe.dom.funds.threshold>1.test.js b/src/test/safe.dom.funds.threshold>1.test.js index 41716037..8b355f85 100644 --- a/src/test/safe.dom.funds.threshold>1.test.js +++ b/src/test/safe.dom.funds.threshold>1.test.js @@ -10,10 +10,10 @@ import '@testing-library/jest-dom/extend-expect' import { BALANCE_ROW_TEST_ID } from '~/routes/safe/components/Balances' import { fillAndSubmitSendFundsForm } from './utils/transactions' import { TRANSACTIONS_TAB_BTN_TEST_ID } from '~/routes/safe/components/Layout' -import { TRANSACTION_ROW_TEST_ID } from '~/routes/safe/components/TransactionsNew/TxsTable' +import { TRANSACTION_ROW_TEST_ID } from '~/routes/safe/components/Transactions/TxsTable' import { useTestAccountAt, resetTestAccount } from './utils/accounts' -import { CONFIRM_TX_BTN_TEST_ID, EXECUTE_TX_BTN_TEST_ID } from '~/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow' -import { APPROVE_TX_MODAL_SUBMIT_BTN_TEST_ID } from '~/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal' +import { CONFIRM_TX_BTN_TEST_ID, EXECUTE_TX_BTN_TEST_ID } from '~/routes/safe/components/Transactions/TxsTable/ExpandedTx/OwnersColumn/ButtonRow' +import { APPROVE_TX_MODAL_SUBMIT_BTN_TEST_ID } from '~/routes/safe/components/Transactions/TxsTable/ExpandedTx/ApproveTxModal' afterEach(resetTestAccount) diff --git a/src/test/utils/transactions/transactionList.helper.js b/src/test/utils/transactions/transactionList.helper.js index fe5946ee..2238dce7 100644 --- a/src/test/utils/transactions/transactionList.helper.js +++ b/src/test/utils/transactions/transactionList.helper.js @@ -3,12 +3,12 @@ import { fireEvent } from '@testing-library/react' import { sleep } from '~/utils/timer' import { shortVersionOf } from '~/logic/wallets/ethAddresses' import { TRANSACTIONS_TAB_BTN_TEST_ID } from '~/routes/safe/components/Layout' -import { TRANSACTION_ROW_TEST_ID } from '~/routes/safe/components/TransactionsNew/TxsTable' +import { TRANSACTION_ROW_TEST_ID } from '~/routes/safe/components/Transactions/TxsTable' import { TRANSACTIONS_DESC_ADD_OWNER_TEST_ID, TRANSACTIONS_DESC_REMOVE_OWNER_TEST_ID, TRANSACTIONS_DESC_SEND_TEST_ID, -} from '~/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/TxDescription' +} from '~/routes/safe/components/Transactions/TxsTable/ExpandedTx/TxDescription' export const getLastTransaction = async (SafeDom: React.Component) => { // Travel to transactions From 3660174530d6497e6ccb85939c663c861d39c4dc Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Thu, 5 Sep 2019 15:22:32 +0400 Subject: [PATCH 12/26] move notifications to separate file so processTransaction and createTransaction actions able to use it --- src/logic/safe/transactions/index.js | 1 + src/logic/safe/transactions/notifications.js | 14 ++++++++++++ .../safe/components/Transactions/index.jsx | 4 ++-- .../safe/store/actions/createTransaction.js | 22 ++++++------------- 4 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 src/logic/safe/transactions/notifications.js diff --git a/src/logic/safe/transactions/index.js b/src/logic/safe/transactions/index.js index a085a125..056e5633 100644 --- a/src/logic/safe/transactions/index.js +++ b/src/logic/safe/transactions/index.js @@ -4,3 +4,4 @@ export * from './send' export * from './safeBlockchainOperations' export * from './safeTxSignerEIP712' export * from './txHistory' +export * from './notifications' diff --git a/src/logic/safe/transactions/notifications.js b/src/logic/safe/transactions/notifications.js new file mode 100644 index 00000000..65bdf16e --- /dev/null +++ b/src/logic/safe/transactions/notifications.js @@ -0,0 +1,14 @@ +// @flow +export type Notifications = { + BEFORE_EXECUTION_OR_CREATION: string, + AFTER_EXECUTION: string, + CREATED_MORE_CONFIRMATIONS_NEEDED: string, + ERROR: string, +} + +export const DEFAULT_NOTIFICATIONS: Notifications = { + BEFORE_EXECUTION_OR_CREATION: 'Transaction in progress', + AFTER_EXECUTION: 'Transaction successfully executed', + CREATED_MORE_CONFIRMATIONS_NEEDED: 'Transaction in progress: More confirmations required to execute', + ERROR: 'Transaction failed', +} diff --git a/src/routes/safe/components/Transactions/index.jsx b/src/routes/safe/components/Transactions/index.jsx index c8677ccd..7a32b5b5 100644 --- a/src/routes/safe/components/Transactions/index.jsx +++ b/src/routes/safe/components/Transactions/index.jsx @@ -36,7 +36,7 @@ const Transactions = ({ const hasTransactions = transactions.size > 0 return ( - + <> {hasTransactions ? ( )} - + ) } diff --git a/src/routes/safe/store/actions/createTransaction.js b/src/routes/safe/store/actions/createTransaction.js index 03982ea7..4d9359c5 100644 --- a/src/routes/safe/store/actions/createTransaction.js +++ b/src/routes/safe/store/actions/createTransaction.js @@ -5,21 +5,13 @@ import { userAccountSelector } from '~/logic/wallets/store/selectors' import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions' import { type GlobalState } from '~/store' import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts' -import { approveTransaction, executeTransaction, CALL } from '~/logic/safe/transactions' - -export type Notifications = { - BEFORE_EXECUTION_OR_CREATION: string, - AFTER_EXECUTION: string, - CREATED_MORE_CONFIRMATIONS_NEEDED: string, - ERROR: string, -} - -const DEFAULT_NOTIFICATIONS: Notifications = { - BEFORE_EXECUTION_OR_CREATION: 'Transaction in progress', - AFTER_EXECUTION: 'Transaction successfully executed', - CREATED_MORE_CONFIRMATIONS_NEEDED: 'Transaction in progress: More confirmations required to execute', - ERROR: 'Transaction failed', -} +import { + approveTransaction, + executeTransaction, + CALL, + type Notifications, + DEFAULT_NOTIFICATIONS, +} from '~/logic/safe/transactions' const createTransaction = ( safeAddress: string, From d7c056eadeac683e189b25195b1e6a95616f3fa3 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Thu, 5 Sep 2019 17:10:45 +0400 Subject: [PATCH 13/26] Update font sizes, make control row in settings absolutely positioned --- .../components/Settings/ChangeSafeName/index.jsx | 13 +++---------- .../components/Settings/ChangeSafeName/style.js | 12 ++++++++++-- src/routes/safe/components/Settings/index.jsx | 2 +- src/routes/safe/components/Settings/style.js | 8 +++++--- src/theme/mui.js | 2 ++ 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/routes/safe/components/Settings/ChangeSafeName/index.jsx b/src/routes/safe/components/Settings/ChangeSafeName/index.jsx index 4713515c..30eaea1c 100644 --- a/src/routes/safe/components/Settings/ChangeSafeName/index.jsx +++ b/src/routes/safe/components/Settings/ChangeSafeName/index.jsx @@ -11,16 +11,10 @@ import TextField from '~/components/forms/TextField' import GnoForm from '~/components/forms/GnoForm' import Row from '~/components/layout/Row' import Paragraph from '~/components/layout/Paragraph' -import Hairline from '~/components/layout/Hairline' import Button from '~/components/layout/Button' -import { sm } from '~/theme/variables' +import { lg } from '~/theme/variables' import { styles } from './style' -const controlsStyle = { - backgroundColor: 'white', - padding: sm, -} - export const SAFE_NAME_INPUT_TEST_ID = 'safe-name-input' export const SAFE_NAME_SUBMIT_BTN_TEST_ID = 'change-safe-name-btn' @@ -48,7 +42,7 @@ const ChangeSafeName = (props: Props) => { {() => ( <> - Modify Safe name + Modify Safe name You can change the name of this Safe. This name is only stored locally and never shared with Gnosis or any third parties. @@ -66,8 +60,7 @@ const ChangeSafeName = (props: Props) => { /> - - + - + Remove Safe Trash Icon diff --git a/src/routes/safe/components/Settings/style.js b/src/routes/safe/components/Settings/style.js index 32807bfb..fde905d3 100644 --- a/src/routes/safe/components/Settings/style.js +++ b/src/routes/safe/components/Settings/style.js @@ -1,6 +1,6 @@ // @flow import { - sm, lg, border, secondary, bolderFont, background, + sm, md, lg, border, secondary, bolderFont, background, largeFontSize, } from '~/theme/variables' export const styles = () => ({ @@ -15,11 +15,12 @@ export const styles = () => ({ letterSpacing: '-0.5px', }, menu: { - borderRight: `solid 1px ${border}`, + borderRight: `solid 2px ${border}`, height: '100%', }, menuOption: { - padding: lg, + fontSize: largeFontSize, + padding: `${md} 0 ${md} ${lg}`, alignItems: 'center', cursor: 'pointer', }, @@ -30,6 +31,7 @@ export const styles = () => ({ }, container: { height: '100%', + position: 'relative', }, message: { margin: `${sm} 0`, diff --git a/src/theme/mui.js b/src/theme/mui.js index c78b3012..9daa73df 100644 --- a/src/theme/mui.js +++ b/src/theme/mui.js @@ -15,6 +15,7 @@ import { regularFont, boldFont, buttonLargeFontSize, + largeFontSize, border, xs, secondaryText, @@ -49,6 +50,7 @@ export default createMuiTheme({ MuiButton: { label: { lineHeight: 1, + fontSize: largeFontSize, fontWeight: regularFont, }, root: { From 03ede6919f527635575bf5b394e23190c3d6ada1 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Thu, 5 Sep 2019 18:30:12 +0400 Subject: [PATCH 14/26] Threshold Settings controls rebranding fixes --- .../components/Settings/ChangeSafeName/style.js | 5 +++-- .../Settings/ThresholdSettings/index.jsx | 2 +- .../Settings/ThresholdSettings/style.js | 16 ++++++---------- src/theme/mui.js | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/routes/safe/components/Settings/ChangeSafeName/style.js b/src/routes/safe/components/Settings/ChangeSafeName/style.js index 38b64874..e0fbf54c 100644 --- a/src/routes/safe/components/Settings/ChangeSafeName/style.js +++ b/src/routes/safe/components/Settings/ChangeSafeName/style.js @@ -1,5 +1,7 @@ // @flow -import { lg, sm, boldFont, border } from '~/theme/variables' +import { + lg, sm, boldFont, border, +} from '~/theme/variables' export const styles = () => ({ formContainer: { @@ -12,7 +14,6 @@ export const styles = () => ({ saveBtn: { marginRight: sm, fontWeight: boldFont, - boxShadow: '1px 2px 10px 0 rgba(212, 212, 211, 0.59)', }, controlsRow: { padding: lg, diff --git a/src/routes/safe/components/Settings/ThresholdSettings/index.jsx b/src/routes/safe/components/Settings/ThresholdSettings/index.jsx index 05b0cea8..c6775c7b 100644 --- a/src/routes/safe/components/Settings/ThresholdSettings/index.jsx +++ b/src/routes/safe/components/Settings/ThresholdSettings/index.jsx @@ -61,7 +61,7 @@ const ThresholdSettings = ({ owners {owners.size > 1 && granted && ( - + diff --git a/src/routes/safe/components/Settings/ManageOwners/index.jsx b/src/routes/safe/components/Settings/ManageOwners/index.jsx index f3793f0f..8d9ad05c 100644 --- a/src/routes/safe/components/Settings/ManageOwners/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/index.jsx @@ -26,7 +26,6 @@ import { OWNERS_TABLE_ADDRESS_ID, type OwnerRow, } from './dataFetcher' -import { sm, boldFont } from '~/theme/variables' import { styles } from './style' import ReplaceOwnerIcon from './assets/icons/replace-owner.svg' import RenameOwnerIcon from './assets/icons/rename-owner.svg' @@ -39,16 +38,6 @@ export const ADD_OWNER_BTN_TEST_ID = 'add-owner-btn' export const REPLACE_OWNER_BTN_TEST_ID = 'replace-owner-btn' export const OWNERS_ROW_TEST_ID = 'owners-row' -const controlsStyle = { - backgroundColor: 'white', - padding: sm, -} - -const addOwnerButtonStyle = { - marginRight: sm, - fontWeight: boldFont, -} - type Props = { classes: Object, safeAddress: string, @@ -202,10 +191,9 @@ class ManageOwners extends React.Component { {granted && ( <> - + @@ -100,7 +93,7 @@ const CheckOwner = ({ Next - + ) } diff --git a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/CheckOwner/style.js b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/CheckOwner/style.js index f142aecb..2086f27f 100644 --- a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/CheckOwner/style.js +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/CheckOwner/style.js @@ -11,7 +11,7 @@ export const styles = () => ({ maxHeight: '75px', }, annotation: { - letterSpacing: '-1px', + lineHeight: 'normal', color: secondaryText, marginRight: 'auto', marginLeft: '20px', 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 index 01518ffd..f2ab9539 100644 --- a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/style.js +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/Review/style.js @@ -14,7 +14,7 @@ export const styles = () => ({ maxHeight: '75px', }, annotation: { - letterSpacing: '-1px', + lineHeight: 'normal', color: secondaryText, marginRight: 'auto', marginLeft: '20px', diff --git a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/ThresholdForm/index.jsx b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/ThresholdForm/index.jsx index 73667ea8..ca129362 100644 --- a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/ThresholdForm/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/ThresholdForm/index.jsx @@ -40,7 +40,7 @@ const ThresholdForm = ({ const defaultThreshold = threshold > 1 ? threshold - 1 : threshold return ( - + <> Remove owner @@ -56,7 +56,7 @@ const ThresholdForm = ({ const numOptions = owners.size > 1 ? owners.size - 1 : 1 return ( - + <> @@ -72,8 +72,8 @@ const ThresholdForm = ({ ( - + render={(props) => ( + <> {[...Array(Number(numOptions))].map((x, index) => ( @@ -86,7 +86,7 @@ const ThresholdForm = ({ {props.meta.error} )} - + )} validate={composeValidators(required, mustBeInteger, minValue(1), maxValue(numOptions))} data-testid="threshold-select-input" @@ -119,11 +119,11 @@ owner(s) Review - + ) }} - + ) } diff --git a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/ThresholdForm/style.js b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/ThresholdForm/style.js index 68cbadd6..da414b18 100644 --- a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/ThresholdForm/style.js +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/screens/ThresholdForm/style.js @@ -11,7 +11,7 @@ export const styles = () => ({ maxHeight: '75px', }, annotation: { - letterSpacing: '-1px', + lineHeight: 'normal', color: secondaryText, marginRight: 'auto', marginLeft: '20px', diff --git a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/style.js b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/style.js index 9cd32317..9a0e2ce3 100644 --- a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/style.js +++ b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/OwnerForm/style.js @@ -11,10 +11,10 @@ export const styles = () => ({ maxHeight: '75px', }, annotation: { - letterSpacing: '-1px', color: secondaryText, marginRight: 'auto', marginLeft: '20px', + lineHeight: 'normal', }, manage: { fontSize: '24px', diff --git a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/style.js b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/style.js index 043d7727..6c3ccc01 100644 --- a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/style.js +++ b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/style.js @@ -14,10 +14,10 @@ export const styles = () => ({ maxHeight: '75px', }, annotation: { - letterSpacing: '-1px', color: secondaryText, marginRight: 'auto', marginLeft: '20px', + lineHeight: 'normal', }, manage: { fontSize: '24px', From 0337d61ab852d96a3da85e969d0cb2e23d252607 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Fri, 6 Sep 2019 17:25:53 +0400 Subject: [PATCH 19/26] Fix non-rounded corner when choosing 'Safe name' in safe settings --- src/routes/safe/components/Settings/style.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/routes/safe/components/Settings/style.js b/src/routes/safe/components/Settings/style.js index fde905d3..e33e491f 100644 --- a/src/routes/safe/components/Settings/style.js +++ b/src/routes/safe/components/Settings/style.js @@ -23,6 +23,9 @@ export const styles = () => ({ padding: `${md} 0 ${md} ${lg}`, alignItems: 'center', cursor: 'pointer', + '&:first-child': { + borderRadius: '8px', + }, }, active: { backgroundColor: background, From 574b207ebd3100d335a497b58def2c66b98e43de Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Fri, 6 Sep 2019 17:46:06 +0400 Subject: [PATCH 20/26] Make sure that token list/settings tabs don't jump when switching --- src/routes/safe/components/Balances/index.jsx | 6 ++-- src/routes/safe/components/Balances/style.js | 3 -- .../ManageOwners/ReplaceOwnerModal/index.jsx | 12 ++++--- src/routes/safe/components/Settings/index.jsx | 33 ++++++++----------- src/routes/safe/components/Settings/style.js | 1 + 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/routes/safe/components/Balances/index.jsx b/src/routes/safe/components/Balances/index.jsx index e08b5493..7edf6190 100644 --- a/src/routes/safe/components/Balances/index.jsx +++ b/src/routes/safe/components/Balances/index.jsx @@ -131,10 +131,12 @@ class Balances extends React.Component { color="secondary" disableRipple /> - Hide zero balances + Hide zero balances - Manage Tokens + + Manage Tokens + ({ width: '20px', marginRight: sm, }, - zero: { - letterSpacing: '-0.5px', - }, message: { margin: `${sm} 0`, }, diff --git a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.jsx b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.jsx index 74089e60..27705bf2 100644 --- a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.jsx @@ -44,7 +44,9 @@ export const sendReplaceOwner = async ( ) => { const gnosisSafe = await getGnosisSafeInstanceAt(safeAddress) const safeOwners = await gnosisSafe.getOwners() - const index = safeOwners.findIndex(ownerAddress => ownerAddress.toLowerCase() === ownerAddressToRemove.toLowerCase()) + const index = safeOwners.findIndex( + (ownerAddress) => ownerAddress.toLowerCase() === ownerAddressToRemove.toLowerCase(), + ) const prevAddress = index === 0 ? SENTINEL_ADDRESS : safeOwners[index - 1] const txData = gnosisSafe.contract.methods .swapOwner(prevAddress, ownerAddressToRemove, values.ownerAddress) @@ -97,7 +99,7 @@ const ReplaceOwner = ({ } return ( - + <> {({ openSnackbar }) => { const onReplaceOwner = () => { @@ -127,7 +129,7 @@ const ReplaceOwner = ({ open={isOpen} paperClassName={classes.biggerModalWindow} > - + <> {activeScreen === 'checkOwner' && ( )} - + ) }} - + ) } diff --git a/src/routes/safe/components/Settings/index.jsx b/src/routes/safe/components/Settings/index.jsx index 559ea5fa..51464b11 100644 --- a/src/routes/safe/components/Settings/index.jsx +++ b/src/routes/safe/components/Settings/index.jsx @@ -91,25 +91,18 @@ class Settings extends React.Component { return ( <> - - - - Settings - - - - - Remove Safe - Trash Icon - - - + + + Remove Safe + Trash Icon + + @@ -128,7 +121,7 @@ class Settings extends React.Component { > Owners ( {owners.size} - ) +) ({ }, message: { margin: `${sm} 0`, + justifyContent: 'flex-end', }, links: { textDecoration: 'underline', From 91992ccaaf6d6875688a8424edb69f541824c04a Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Fri, 6 Sep 2019 17:49:35 +0400 Subject: [PATCH 21/26] Fix hairline and tab bottom border for tabs on safe view page --- src/routes/safe/components/Layout.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/routes/safe/components/Layout.jsx b/src/routes/safe/components/Layout.jsx index 5e4ada9f..d7716453 100644 --- a/src/routes/safe/components/Layout.jsx +++ b/src/routes/safe/components/Layout.jsx @@ -32,10 +32,11 @@ type State = { tabIndex: number, } -type Props = SelectorProps & Actions & { - classes: Object, - granted: boolean, -} +type Props = SelectorProps & + Actions & { + classes: Object, + granted: boolean, + } const openIconStyle = { height: '16px', @@ -149,7 +150,7 @@ class Layout extends React.Component { - + {tabIndex === 0 && ( Date: Fri, 6 Sep 2019 18:06:06 +0400 Subject: [PATCH 22/26] Remove border bottom in manage owners settings for last owner if there are 4 or more owners --- .../safe/components/Settings/ManageOwners/index.jsx | 8 +++++++- src/routes/safe/components/Settings/ManageOwners/style.js | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/routes/safe/components/Settings/ManageOwners/index.jsx b/src/routes/safe/components/Settings/ManageOwners/index.jsx index b542ebd8..6630ce43 100644 --- a/src/routes/safe/components/Settings/ManageOwners/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/index.jsx @@ -1,5 +1,6 @@ // @flow import React from 'react' +import cn from 'classnames' import { List } from 'immutable' import { withStyles } from '@material-ui/core/styles' import TableRow from '@material-ui/core/TableRow' @@ -145,7 +146,12 @@ class ManageOwners extends React.Component { noBorder > {(sortedData: Array) => sortedData.map((row: any, index: number) => ( - + = 3 && index === sortedData.size - 1 && classes.noBorderBottom)} + data-testid={OWNERS_ROW_TEST_ID} + > {autoColumns.map((column: Column) => ( {column.id === OWNERS_TABLE_ADDRESS_ID ? ( diff --git a/src/routes/safe/components/Settings/ManageOwners/style.js b/src/routes/safe/components/Settings/ManageOwners/style.js index 957f167e..a72dbc99 100644 --- a/src/routes/safe/components/Settings/ManageOwners/style.js +++ b/src/routes/safe/components/Settings/ManageOwners/style.js @@ -24,6 +24,11 @@ export const styles = () => ({ justifyContent: 'flex-end', visibility: 'hidden', }, + noBorderBottom: { + '& > td': { + borderBottom: 'none', + }, + }, editOwnerIcon: { cursor: 'pointer', }, From 128830e965da6e2839c24101b3fd1a13338cebf2 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Mon, 9 Sep 2019 12:48:10 +0400 Subject: [PATCH 23/26] Add space in remove safe modal annotation --- src/routes/safe/components/Settings/RemoveSafeModal/index.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/safe/components/Settings/RemoveSafeModal/index.jsx b/src/routes/safe/components/Settings/RemoveSafeModal/index.jsx index e4894e06..8fbde0a6 100644 --- a/src/routes/safe/components/Settings/RemoveSafeModal/index.jsx +++ b/src/routes/safe/components/Settings/RemoveSafeModal/index.jsx @@ -73,8 +73,10 @@ const RemoveSafeComponent = ({ Removing a Safe only removes it from your interface. + {' '} It does not delete the Safe -. You can always add it back using the Safe's address. + . You can always add it + back using the Safe's address. From 89dd6f2bdb4f40e077f40ea1c6de478784ffd269 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Mon, 9 Sep 2019 14:21:57 +0400 Subject: [PATCH 24/26] Make 'Remove Safe' and 'Manage tokens' positioning the same so they dont jump --- package.json | 26 +- src/components/layout/ButtonLink/index.jsx | 4 +- src/routes/safe/components/Settings/index.jsx | 8 +- src/routes/safe/components/Settings/style.js | 13 +- yarn.lock | 312 +++++++++++++++--- 5 files changed, 285 insertions(+), 78 deletions(-) diff --git a/package.json b/package.json index d221222a..4708563d 100644 --- a/package.json +++ b/package.json @@ -31,14 +31,14 @@ "dependencies": { "@gnosis.pm/safe-contracts": "^1.0.0", "@gnosis.pm/util-contracts": "2.0.1", - "@material-ui/core": "4.4.0", - "@material-ui/icons": "4.2.1", + "@material-ui/core": "4.4.1", + "@material-ui/icons": "4.4.1", "@testing-library/jest-dom": "4.1.0", "@welldone-software/why-did-you-render": "3.3.3", "axios": "0.19.0", "bignumber.js": "9.0.0", "connected-react-router": "6.5.2", - "date-fns": "2.0.1", + "date-fns": "2.1.0", "ethereum-ens": "0.7.8", "final-form": "4.18.5", "history": "^4.7.2", @@ -64,11 +64,11 @@ "web3": "1.2.1" }, "devDependencies": { - "@babel/cli": "7.5.5", - "@babel/core": "7.5.5", + "@babel/cli": "7.6.0", + "@babel/core": "7.6.0", "@babel/plugin-proposal-class-properties": "7.5.5", - "@babel/plugin-proposal-decorators": "7.4.4", - "@babel/plugin-proposal-do-expressions": "7.5.0", + "@babel/plugin-proposal-decorators": "7.6.0", + "@babel/plugin-proposal-do-expressions": "7.6.0", "@babel/plugin-proposal-export-default-from": "7.5.2", "@babel/plugin-proposal-export-namespace-from": "7.5.2", "@babel/plugin-proposal-function-bind": "^7.0.0", @@ -77,15 +77,15 @@ "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0", "@babel/plugin-proposal-nullish-coalescing-operator": "7.4.4", "@babel/plugin-proposal-numeric-separator": "^7.0.0", - "@babel/plugin-proposal-optional-chaining": "^7.0.0", + "@babel/plugin-proposal-optional-chaining": "7.6.0", "@babel/plugin-proposal-pipeline-operator": "7.5.0", "@babel/plugin-proposal-throw-expressions": "^7.0.0", "@babel/plugin-syntax-dynamic-import": "^7.0.0", "@babel/plugin-syntax-import-meta": "^7.0.0", "@babel/plugin-transform-member-expression-literals": "^7.2.0", "@babel/plugin-transform-property-literals": "^7.2.0", - "@babel/polyfill": "7.4.4", - "@babel/preset-env": "7.5.5", + "@babel/polyfill": "7.6.0", + "@babel/preset-env": "7.6.0", "@babel/preset-flow": "^7.0.0-beta.40", "@babel/preset-react": "^7.0.0-beta.40", "@sambego/storybook-state": "^1.0.7", @@ -109,13 +109,13 @@ "eslint-config-airbnb": "18.0.1", "eslint-plugin-flowtype": "4.3.0", "eslint-plugin-import": "2.18.2", - "eslint-plugin-jest": "22.16.0", + "eslint-plugin-jest": "22.17.0", "eslint-plugin-jsx-a11y": "6.2.3", "eslint-plugin-react": "7.14.3", "ethereumjs-abi": "0.6.8", "extract-text-webpack-plugin": "^4.0.0-beta.0", "file-loader": "4.2.0", - "flow-bin": "0.106.3", + "flow-bin": "0.107.0", "fs-extra": "8.1.0", "html-loader": "^0.5.5", "html-webpack-plugin": "^3.0.4", @@ -139,7 +139,7 @@ "url-loader": "^2.1.0", "webpack": "4.39.3", "webpack-bundle-analyzer": "3.4.1", - "webpack-cli": "3.3.7", + "webpack-cli": "3.3.8", "webpack-dev-server": "3.8.0", "webpack-manifest-plugin": "^2.0.0-rc.2" } diff --git a/src/components/layout/ButtonLink/index.jsx b/src/components/layout/ButtonLink/index.jsx index 1f7d9593..05290dd5 100644 --- a/src/components/layout/ButtonLink/index.jsx +++ b/src/components/layout/ButtonLink/index.jsx @@ -12,6 +12,7 @@ type Props = { weight?: 'light' | 'regular' | 'bolder' | 'bold', color?: 'soft' | 'medium' | 'dark' | 'white' | 'fancy' | 'primary' | 'secondary' | 'warning' | 'disabled' | 'error', testId?: string, + className?: string, } const GnoButtonLink = ({ @@ -20,7 +21,8 @@ const GnoButtonLink = ({ weight = 'regular', color = 'secondary', testId = '', + className = '', ...props -}: Props) =>