remove updateSafeName action
This commit is contained in:
parent
3f98ac903b
commit
951309eee5
|
@ -25,6 +25,7 @@ type Props = SelectorProps & {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
granted: boolean,
|
granted: boolean,
|
||||||
createTransaction: Function,
|
createTransaction: Function,
|
||||||
|
updateSafe: Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -90,7 +91,7 @@ class Layout extends React.Component<Props, State> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
safe, provider, network, classes, granted, tokens, activeTokens, createTransaction, updateSafeName,
|
safe, provider, network, classes, granted, tokens, activeTokens, createTransaction, updateSafe,
|
||||||
} = this.props
|
} = this.props
|
||||||
const { tabIndex } = this.state
|
const { tabIndex } = this.state
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ class Layout extends React.Component<Props, State> {
|
||||||
safeAddress={address}
|
safeAddress={address}
|
||||||
safeName={name}
|
safeName={name}
|
||||||
etherScanLink={etherScanLink}
|
etherScanLink={etherScanLink}
|
||||||
updateSafeName={updateSafeName}
|
updateSafe={updateSafe}
|
||||||
threshold={safe.threshold}
|
threshold={safe.threshold}
|
||||||
owners={safe.owners}
|
owners={safe.owners}
|
||||||
createTransaction={createTransaction}
|
createTransaction={createTransaction}
|
||||||
|
|
|
@ -4,9 +4,7 @@ import { withStyles } from '@material-ui/core/styles'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
import Col from '~/components/layout/Col'
|
import Col from '~/components/layout/Col'
|
||||||
import Field from '~/components/forms/Field'
|
import Field from '~/components/forms/Field'
|
||||||
import {
|
import { composeValidators, required, minMaxLength } from '~/components/forms/validator'
|
||||||
composeValidators, required, minMaxLength,
|
|
||||||
} from '~/components/forms/validator'
|
|
||||||
import TextField from '~/components/forms/TextField'
|
import TextField from '~/components/forms/TextField'
|
||||||
import GnoForm from '~/components/forms/GnoForm'
|
import GnoForm from '~/components/forms/GnoForm'
|
||||||
import Row from '~/components/layout/Row'
|
import Row from '~/components/layout/Row'
|
||||||
|
@ -30,19 +28,16 @@ type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
safeAddress: string,
|
safeAddress: string,
|
||||||
safeName: string,
|
safeName: string,
|
||||||
updateSafeName: Function
|
updateSafe: Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
const UpdateSafeName = (props: Props) => {
|
const ChangeSafeName = (props: Props) => {
|
||||||
const {
|
const {
|
||||||
classes,
|
classes, safeAddress, safeName, updateSafe,
|
||||||
safeAddress,
|
|
||||||
safeName,
|
|
||||||
updateSafeName,
|
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const handleSubmit = (values) => {
|
const handleSubmit = (values) => {
|
||||||
updateSafeName(safeAddress, values.safeName)
|
updateSafe({ address: safeAddress, name: values.safeName })
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -52,7 +47,7 @@ const UpdateSafeName = (props: Props) => {
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Block className={classes.formContainer}>
|
<Block className={classes.formContainer}>
|
||||||
<Paragraph noMargin className={classes.title} size="lg" weight="bolder">
|
<Paragraph noMargin className={classes.title} size="lg" weight="bolder">
|
||||||
Modify Safe name
|
Modify Safe name
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Block className={classes.root}>
|
<Block className={classes.root}>
|
||||||
<Field
|
<Field
|
||||||
|
@ -69,14 +64,8 @@ const UpdateSafeName = (props: Props) => {
|
||||||
<Hairline />
|
<Hairline />
|
||||||
<Row style={controlsStyle} align="end" grow>
|
<Row style={controlsStyle} align="end" grow>
|
||||||
<Col end="xs">
|
<Col end="xs">
|
||||||
<Button
|
<Button type="submit" style={saveButtonStyle} size="small" variant="contained" color="primary">
|
||||||
type="submit"
|
SAVE
|
||||||
style={saveButtonStyle}
|
|
||||||
size="small"
|
|
||||||
variant="contained"
|
|
||||||
color="primary"
|
|
||||||
>
|
|
||||||
SAVE
|
|
||||||
</Button>
|
</Button>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -87,4 +76,4 @@ const UpdateSafeName = (props: Props) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withStyles(styles)(UpdateSafeName)
|
export default withStyles(styles)(ChangeSafeName)
|
|
@ -1,10 +0,0 @@
|
||||||
// @flow
|
|
||||||
import updateSafeName from '~/routes/safe/store/actions/updateSafeName'
|
|
||||||
|
|
||||||
export type Actions = {
|
|
||||||
updateSafeName: Function,
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
updateSafeName,
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import cn from 'classnames'
|
import cn from 'classnames'
|
||||||
import { List } from 'immutable'
|
import { List } from 'immutable'
|
||||||
import { connect } from 'react-redux'
|
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
import Col from '~/components/layout/Col'
|
import Col from '~/components/layout/Col'
|
||||||
|
@ -11,17 +10,16 @@ import RemoveSafeModal from './RemoveSafeModal'
|
||||||
import Paragraph from '~/components/layout/Paragraph'
|
import Paragraph from '~/components/layout/Paragraph'
|
||||||
import Hairline from '~/components/layout/Hairline'
|
import Hairline from '~/components/layout/Hairline'
|
||||||
import { type Owner } from '~/routes/safe/store/models/owner'
|
import { type Owner } from '~/routes/safe/store/models/owner'
|
||||||
import UpdateSafeName from './UpdateSafeName'
|
import ChangeSafeName from './ChangeSafeName'
|
||||||
import ThresholdSettings from './ThresholdSettings'
|
import ThresholdSettings from './ThresholdSettings'
|
||||||
import actions, { type Actions } from './actions'
|
|
||||||
import { styles } from './style'
|
import { styles } from './style'
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
showRemoveSafe: boolean,
|
showRemoveSafe: boolean,
|
||||||
menuOptionIndex: number
|
menuOptionIndex: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
type Props = Actions & {
|
type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
granted: boolean,
|
granted: boolean,
|
||||||
etherScanLink: string,
|
etherScanLink: string,
|
||||||
|
@ -30,6 +28,7 @@ type Props = Actions & {
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
threshold: number,
|
threshold: number,
|
||||||
createTransaction: Function,
|
createTransaction: Function,
|
||||||
|
updateSafe: Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
type Action = 'RemoveSafe'
|
type Action = 'RemoveSafe'
|
||||||
|
@ -60,7 +59,7 @@ class Settings extends React.Component<Props, State> {
|
||||||
etherScanLink,
|
etherScanLink,
|
||||||
safeAddress,
|
safeAddress,
|
||||||
safeName,
|
safeName,
|
||||||
updateSafeName,
|
updateSafe,
|
||||||
owners,
|
owners,
|
||||||
threshold,
|
threshold,
|
||||||
createTransaction,
|
createTransaction,
|
||||||
|
@ -127,7 +126,7 @@ class Settings extends React.Component<Props, State> {
|
||||||
<Col xs={9} layout="column">
|
<Col xs={9} layout="column">
|
||||||
<Block className={classes.container}>
|
<Block className={classes.container}>
|
||||||
{menuOptionIndex === 1 && (
|
{menuOptionIndex === 1 && (
|
||||||
<UpdateSafeName safeAddress={safeAddress} safeName={safeName} updateSafeName={updateSafeName} />
|
<ChangeSafeName safeAddress={safeAddress} safeName={safeName} updateSafe={updateSafe} />
|
||||||
)}
|
)}
|
||||||
{granted && menuOptionIndex === 2 && <p>To be done</p>}
|
{granted && menuOptionIndex === 2 && <p>To be done</p>}
|
||||||
{granted && menuOptionIndex === 3 && (
|
{granted && menuOptionIndex === 3 && (
|
||||||
|
@ -147,9 +146,4 @@ class Settings extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const settingsComponent = withStyles(styles)(Settings)
|
export default withStyles(styles)(Settings)
|
||||||
|
|
||||||
export default connect(
|
|
||||||
undefined,
|
|
||||||
actions,
|
|
||||||
)(settingsComponent)
|
|
||||||
|
|
|
@ -2,15 +2,18 @@
|
||||||
import fetchSafe from '~/routes/safe/store/actions/fetchSafe'
|
import fetchSafe from '~/routes/safe/store/actions/fetchSafe'
|
||||||
import fetchTokenBalances from '~/routes/safe/store/actions/fetchTokenBalances'
|
import fetchTokenBalances from '~/routes/safe/store/actions/fetchTokenBalances'
|
||||||
import createTransaction from '~/routes/safe/store/actions/createTransaction'
|
import createTransaction from '~/routes/safe/store/actions/createTransaction'
|
||||||
|
import updateSafe from '~/routes/safe/store/actions/updateSafe'
|
||||||
|
|
||||||
export type Actions = {
|
export type Actions = {
|
||||||
fetchSafe: typeof fetchSafe,
|
fetchSafe: typeof fetchSafe,
|
||||||
fetchTokenBalances: typeof fetchTokenBalances,
|
fetchTokenBalances: typeof fetchTokenBalances,
|
||||||
createTransaction: typeof createTransaction,
|
createTransaction: typeof createTransaction,
|
||||||
|
updateSafe: typeof updateSafe,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
fetchSafe,
|
fetchSafe,
|
||||||
fetchTokenBalances,
|
fetchTokenBalances,
|
||||||
createTransaction,
|
createTransaction,
|
||||||
|
updateSafe,
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,15 @@ class SafeView extends React.Component<Props> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
safe, provider, activeTokens, granted, userAddress, network, tokens, createTransaction,
|
safe,
|
||||||
|
provider,
|
||||||
|
activeTokens,
|
||||||
|
granted,
|
||||||
|
userAddress,
|
||||||
|
network,
|
||||||
|
tokens,
|
||||||
|
createTransaction,
|
||||||
|
updateSafe,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -67,6 +75,7 @@ class SafeView extends React.Component<Props> {
|
||||||
network={network}
|
network={network}
|
||||||
granted={granted}
|
granted={granted}
|
||||||
createTransaction={createTransaction}
|
createTransaction={createTransaction}
|
||||||
|
updateSafe={updateSafe}
|
||||||
/>
|
/>
|
||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
|
|
|
@ -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<GlobalState>) => {
|
|
||||||
dispatch(updateSafe({ address: safeAddress, name: safeName }))
|
|
||||||
}
|
|
||||||
|
|
||||||
export default updateSafeName
|
|
Loading…
Reference in New Issue