From 951309eee542b43e6ad77a66134a058bca335f4d Mon Sep 17 00:00:00 2001 From: mmv Date: Tue, 25 Jun 2019 18:09:00 +0400 Subject: [PATCH] remove updateSafeName action --- src/routes/safe/components/Layout.jsx | 5 ++-- .../index.jsx | 29 ++++++------------- .../style.js | 0 .../safe/components/Settings/actions.js | 10 ------- src/routes/safe/components/Settings/index.jsx | 20 +++++-------- src/routes/safe/container/actions.js | 3 ++ src/routes/safe/container/index.jsx | 11 ++++++- .../safe/store/actions/updateSafeName.js | 10 ------- 8 files changed, 32 insertions(+), 56 deletions(-) rename src/routes/safe/components/Settings/{UpdateSafeName => ChangeSafeName}/index.jsx (75%) rename src/routes/safe/components/Settings/{UpdateSafeName => ChangeSafeName}/style.js (100%) delete mode 100644 src/routes/safe/components/Settings/actions.js delete mode 100644 src/routes/safe/store/actions/updateSafeName.js diff --git a/src/routes/safe/components/Layout.jsx b/src/routes/safe/components/Layout.jsx index 05cfbf24..864ee30a 100644 --- a/src/routes/safe/components/Layout.jsx +++ b/src/routes/safe/components/Layout.jsx @@ -25,6 +25,7 @@ type Props = SelectorProps & { classes: Object, granted: boolean, createTransaction: Function, + updateSafe: Function, } type State = { @@ -90,7 +91,7 @@ class Layout extends React.Component { render() { const { - safe, provider, network, classes, granted, tokens, activeTokens, createTransaction, updateSafeName, + safe, provider, network, classes, granted, tokens, activeTokens, createTransaction, updateSafe, } = this.props const { tabIndex } = this.state @@ -148,7 +149,7 @@ class Layout extends React.Component { safeAddress={address} safeName={name} etherScanLink={etherScanLink} - updateSafeName={updateSafeName} + updateSafe={updateSafe} threshold={safe.threshold} owners={safe.owners} createTransaction={createTransaction} diff --git a/src/routes/safe/components/Settings/UpdateSafeName/index.jsx b/src/routes/safe/components/Settings/ChangeSafeName/index.jsx similarity index 75% rename from src/routes/safe/components/Settings/UpdateSafeName/index.jsx rename to src/routes/safe/components/Settings/ChangeSafeName/index.jsx index 8205a27c..7d307d8c 100644 --- a/src/routes/safe/components/Settings/UpdateSafeName/index.jsx +++ b/src/routes/safe/components/Settings/ChangeSafeName/index.jsx @@ -4,9 +4,7 @@ import { withStyles } from '@material-ui/core/styles' import Block from '~/components/layout/Block' import Col from '~/components/layout/Col' import Field from '~/components/forms/Field' -import { - composeValidators, required, minMaxLength, -} from '~/components/forms/validator' +import { composeValidators, required, minMaxLength } from '~/components/forms/validator' import TextField from '~/components/forms/TextField' import GnoForm from '~/components/forms/GnoForm' import Row from '~/components/layout/Row' @@ -30,19 +28,16 @@ type Props = { classes: Object, safeAddress: string, safeName: string, - updateSafeName: Function + updateSafe: Function, } -const UpdateSafeName = (props: Props) => { +const ChangeSafeName = (props: Props) => { const { - classes, - safeAddress, - safeName, - updateSafeName, + classes, safeAddress, safeName, updateSafe, } = props const handleSubmit = (values) => { - updateSafeName(safeAddress, values.safeName) + updateSafe({ address: safeAddress, name: values.safeName }) } return ( @@ -52,7 +47,7 @@ const UpdateSafeName = (props: Props) => { - Modify Safe name + Modify Safe name { - @@ -87,4 +76,4 @@ const UpdateSafeName = (props: Props) => { ) } -export default withStyles(styles)(UpdateSafeName) +export default withStyles(styles)(ChangeSafeName) diff --git a/src/routes/safe/components/Settings/UpdateSafeName/style.js b/src/routes/safe/components/Settings/ChangeSafeName/style.js similarity index 100% rename from src/routes/safe/components/Settings/UpdateSafeName/style.js rename to src/routes/safe/components/Settings/ChangeSafeName/style.js diff --git a/src/routes/safe/components/Settings/actions.js b/src/routes/safe/components/Settings/actions.js deleted file mode 100644 index 0f1aae07..00000000 --- a/src/routes/safe/components/Settings/actions.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow -import updateSafeName from '~/routes/safe/store/actions/updateSafeName' - -export type Actions = { - updateSafeName: Function, -} - -export default { - updateSafeName, -} diff --git a/src/routes/safe/components/Settings/index.jsx b/src/routes/safe/components/Settings/index.jsx index b9f86d3a..ab8d38d9 100644 --- a/src/routes/safe/components/Settings/index.jsx +++ b/src/routes/safe/components/Settings/index.jsx @@ -2,7 +2,6 @@ import * as React from 'react' import cn from 'classnames' import { List } from 'immutable' -import { connect } from 'react-redux' import { withStyles } from '@material-ui/core/styles' import Block from '~/components/layout/Block' import Col from '~/components/layout/Col' @@ -11,17 +10,16 @@ import RemoveSafeModal from './RemoveSafeModal' import Paragraph from '~/components/layout/Paragraph' import Hairline from '~/components/layout/Hairline' import { type Owner } from '~/routes/safe/store/models/owner' -import UpdateSafeName from './UpdateSafeName' +import ChangeSafeName from './ChangeSafeName' import ThresholdSettings from './ThresholdSettings' -import actions, { type Actions } from './actions' import { styles } from './style' type State = { showRemoveSafe: boolean, - menuOptionIndex: number + menuOptionIndex: number, } -type Props = Actions & { +type Props = { classes: Object, granted: boolean, etherScanLink: string, @@ -30,6 +28,7 @@ type Props = Actions & { owners: List, threshold: number, createTransaction: Function, + updateSafe: Function, } type Action = 'RemoveSafe' @@ -60,7 +59,7 @@ class Settings extends React.Component { etherScanLink, safeAddress, safeName, - updateSafeName, + updateSafe, owners, threshold, createTransaction, @@ -127,7 +126,7 @@ class Settings extends React.Component { {menuOptionIndex === 1 && ( - + )} {granted && menuOptionIndex === 2 &&

To be done

} {granted && menuOptionIndex === 3 && ( @@ -147,9 +146,4 @@ class Settings extends React.Component { } } -const settingsComponent = withStyles(styles)(Settings) - -export default connect( - undefined, - actions, -)(settingsComponent) +export default withStyles(styles)(Settings) diff --git a/src/routes/safe/container/actions.js b/src/routes/safe/container/actions.js index 41636c2a..c7dcf1e6 100644 --- a/src/routes/safe/container/actions.js +++ b/src/routes/safe/container/actions.js @@ -2,15 +2,18 @@ import fetchSafe from '~/routes/safe/store/actions/fetchSafe' import fetchTokenBalances from '~/routes/safe/store/actions/fetchTokenBalances' import createTransaction from '~/routes/safe/store/actions/createTransaction' +import updateSafe from '~/routes/safe/store/actions/updateSafe' export type Actions = { fetchSafe: typeof fetchSafe, fetchTokenBalances: typeof fetchTokenBalances, createTransaction: typeof createTransaction, + updateSafe: typeof updateSafe, } export default { fetchSafe, fetchTokenBalances, createTransaction, + updateSafe, } diff --git a/src/routes/safe/container/index.jsx b/src/routes/safe/container/index.jsx index af7d0a4e..03ed5472 100644 --- a/src/routes/safe/container/index.jsx +++ b/src/routes/safe/container/index.jsx @@ -53,7 +53,15 @@ class SafeView extends React.Component { render() { const { - safe, provider, activeTokens, granted, userAddress, network, tokens, createTransaction, + safe, + provider, + activeTokens, + granted, + userAddress, + network, + tokens, + createTransaction, + updateSafe, } = this.props return ( @@ -67,6 +75,7 @@ class SafeView extends React.Component { network={network} granted={granted} createTransaction={createTransaction} + updateSafe={updateSafe} /> ) diff --git a/src/routes/safe/store/actions/updateSafeName.js b/src/routes/safe/store/actions/updateSafeName.js deleted file mode 100644 index 131201f3..00000000 --- a/src/routes/safe/store/actions/updateSafeName.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow -import type { Dispatch as ReduxDispatch } from 'redux' -import { type GlobalState } from '~/store' -import updateSafe from './updateSafe' - -const updateSafeName = (safeAddress: string, safeName: string) => async (dispatch: ReduxDispatch) => { - dispatch(updateSafe({ address: safeAddress, name: safeName })) -} - -export default updateSafeName