diff --git a/src/actions/settings.js b/src/actions/settings.js index ebcf3dbd..537cee84 100644 --- a/src/actions/settings.js +++ b/src/actions/settings.js @@ -10,8 +10,13 @@ export const saveSettings: SaveSettings = payload => ({ payload, }) -type FetchSettings = () => { type: string } -export const fetchSettings: FetchSettings = () => ({ - type: 'FETCH_SETTINGS', - payload: db('settings'), -}) +export const fetchSettings: Function = () => dispatch => { + const settings = db('settings') + if (Object.keys(settings).length === 0) { + return + } + dispatch({ + type: 'FETCH_SETTINGS', + payload: settings, + }) +} diff --git a/src/components/AccountPage.js b/src/components/AccountPage.js index 64368136..9fccecba 100644 --- a/src/components/AccountPage.js +++ b/src/components/AccountPage.js @@ -3,15 +3,15 @@ import React, { PureComponent, Fragment } from 'react' import { connect } from 'react-redux' import styled from 'styled-components' -import moment from 'moment' import type { MapStateToProps } from 'react-redux' import type { Account, AccountData } from 'types/common' -import { format } from 'helpers/btc' +import { formatBTC } from 'helpers/format' import { getAccountById, getAccountData } from 'reducers/accounts' +import TransactionsList from 'components/TransactionsList' import Box, { Card } from 'components/base/Box' import Text from 'components/base/Text' import QRCode from 'components/base/QRCode' @@ -67,7 +67,7 @@ class AccountPage extends PureComponent { - {format(accountData.balance)} + {formatBTC(accountData.balance)} @@ -96,12 +96,7 @@ class AccountPage extends PureComponent { - {accountData.transactions.map(tx => ( - - {moment(tx.time * 1e3).format('LLL')} - {format(tx.balance)} - - ))} + )} diff --git a/src/components/DashboardPage.js b/src/components/DashboardPage.js index f8de952d..cc3be0d4 100644 --- a/src/components/DashboardPage.js +++ b/src/components/DashboardPage.js @@ -10,7 +10,7 @@ import { push } from 'react-router-redux' import type { MapStateToProps } from 'react-redux' import type { Accounts, T } from 'types/common' -import { format } from 'helpers/btc' +import { formatBTC } from 'helpers/format' import { openModal } from 'reducers/modals' import { getTotalBalance, getAccounts } from 'reducers/accounts' @@ -93,7 +93,7 @@ class DashboardPage extends PureComponent { title: 'Total balance', render: () => ( - {format(totalBalance)} + {formatBTC(totalBalance)} ), }, @@ -136,7 +136,7 @@ class DashboardPage extends PureComponent { onClick={() => push(`/account/${key}`)} >
{accounts[key].name}
-
{accounts[key].data && format(accounts[key].data.balance)}
+
{accounts[key].data && formatBTC(accounts[key].data.balance)}
), )} diff --git a/src/components/SettingsPage/Display.js b/src/components/SettingsPage/Display.js index 6176aab0..cd116bca 100644 --- a/src/components/SettingsPage/Display.js +++ b/src/components/SettingsPage/Display.js @@ -81,7 +81,7 @@ class TabProfile extends PureComponent {