Browse Source

Save account settings in local db

master
meriadec 7 years ago
parent
commit
36c021ee9c
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 7
      src/components/AccountPage/index.js
  2. 4
      src/components/TransactionsList/index.js
  3. 2
      src/components/modals/SettingsAccount.js
  4. 2
      src/reducers/accounts.js

7
src/components/AccountPage/index.js

@ -69,7 +69,7 @@ class AccountPage extends PureComponent<Props> {
</Box>
</Button>
<Button
style={{ width: 40, padding: 0 }}
style={{ width: 30, padding: 0 }}
onClick={() => openModal(MODAL_SETTINGS_ACCOUNT, { account })}
>
<Box align="center">
@ -82,7 +82,10 @@ class AccountPage extends PureComponent<Props> {
<Text fontSize={5}>{formatBTC(account.balance)}</Text>
</Card>
<Card p={0} px={4} title={t('account:lastOperations')}>
<TransactionsList transactions={account.transactions} />
<TransactionsList
transactions={account.transactions}
minConfirmations={account.settings.minConfirmations}
/>
</Card>
</Box>
)

4
src/components/TransactionsList/index.js

@ -184,6 +184,10 @@ class TransactionsList extends Component<Props> {
}
shouldComponentUpdate(nextProps: Props) {
if (this.props.minConfirmations !== nextProps.minConfirmations) {
return true
}
if (this._hashCache === null) {
return true
}

2
src/components/modals/SettingsAccount.js

@ -91,7 +91,7 @@ class SettingsAccount extends PureComponent<Props, State> {
...account,
settings: {
...account.settings,
minConfirmations,
minConfirmations: Number(minConfirmations),
},
})
})

2
src/reducers/accounts.js

@ -120,6 +120,7 @@ export function serializeAccounts(accounts: Array<Object>) {
name: account.name || `${key}`,
path: account.path,
unit: account.unit || getDefaultUnitByCoinType(account.coinType),
settings: account.settings,
}
return {
@ -144,6 +145,7 @@ export function deserializeAccounts(accounts: Accounts) {
path: account.path,
transactions: account.transactions.map(({ account, ...t }) => t),
unit: account.unit,
settings: account.settings,
}))
}

Loading…
Cancel
Save