diff --git a/src/components/AccountPage.js b/src/components/AccountPage.js index 549269b0..719a53ab 100644 --- a/src/components/AccountPage.js +++ b/src/components/AccountPage.js @@ -25,7 +25,7 @@ import TransactionsList from 'components/TransactionsList' type Props = { t: T, - account: Account, + account?: Account, openModal: Function, } diff --git a/src/components/SelectAccount/stories.js b/src/components/SelectAccount/stories.js index f7bf5d2f..91da4439 100644 --- a/src/components/SelectAccount/stories.js +++ b/src/components/SelectAccount/stories.js @@ -22,6 +22,9 @@ const accounts = [...Array(20)].map(() => ({ path: '', transactions: [], unit: getDefaultUnitByCoinType(0), + settings: { + minConfirmations: 2, + }, })) type State = { diff --git a/src/components/modals/SettingsAccount.js b/src/components/modals/SettingsAccount.js index 186ebe9f..2823ad28 100644 --- a/src/components/modals/SettingsAccount.js +++ b/src/components/modals/SettingsAccount.js @@ -18,9 +18,11 @@ import Input from 'components/base/Input' import Modal, { ModalBody } from 'components/base/Modal' import Text from 'components/base/Text' import Icon from 'components/base/Icon' +import Label from 'components/base/Label' type State = { accountName: string | null, + minConfirmations: number | null, editName: boolean, nameHovered: boolean, } @@ -44,6 +46,7 @@ const mapDispatchToProps = { const defaultState = { editName: false, accountName: null, + minConfirmations: null, nameHovered: false, } @@ -57,7 +60,7 @@ class SettingsAccount extends PureComponent { } getAccount(data: Object) { - const { accountName } = this.state + const { accountName, minConfirmations } = this.state const account = get(data, 'account', {}) @@ -68,6 +71,10 @@ class SettingsAccount extends PureComponent { name: accountName, } : {}), + settings: { + ...account.settings, + minConfirmations: minConfirmations || account.settings.minConfirmations, + }, } } @@ -76,6 +83,20 @@ class SettingsAccount extends PureComponent { nameHovered: state, }) + handleChangeMinConfirmations = account => minConfirmations => { + const { updateAccount } = this.props + this.setState({ minConfirmations }) + window.requestAnimationFrame(() => { + updateAccount({ + ...account, + settings: { + ...account.settings, + minConfirmations, + }, + }) + }) + } + handleEditName = (state: boolean) => () => this.setState({ nameHovered: false, @@ -179,6 +200,16 @@ class SettingsAccount extends PureComponent { )} + + + +