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

4
src/components/TransactionsList/index.js

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

2
src/components/modals/SettingsAccount.js

@ -91,7 +91,7 @@ class SettingsAccount extends PureComponent<Props, State> {
...account, ...account,
settings: { settings: {
...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}`, name: account.name || `${key}`,
path: account.path, path: account.path,
unit: account.unit || getDefaultUnitByCoinType(account.coinType), unit: account.unit || getDefaultUnitByCoinType(account.coinType),
settings: account.settings,
} }
return { return {
@ -144,6 +145,7 @@ export function deserializeAccounts(accounts: Accounts) {
path: account.path, path: account.path,
transactions: account.transactions.map(({ account, ...t }) => t), transactions: account.transactions.map(({ account, ...t }) => t),
unit: account.unit, unit: account.unit,
settings: account.settings,
})) }))
} }

Loading…
Cancel
Save