From b0000efe887d963eaf9ccc9dd3fa9eb4289e8fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=ABck=20V=C3=A9zien?= Date: Wed, 7 Feb 2018 18:59:02 +0100 Subject: [PATCH] Fix fonts when you build, hide Chart on Dashboard when you don't have any accounts --- src/components/DashboardPage.js | 110 +++++++++++++++++--------------- src/styles/helpers.js | 2 +- 2 files changed, 58 insertions(+), 54 deletions(-) diff --git a/src/components/DashboardPage.js b/src/components/DashboardPage.js index 1267ea83..d7d96ecf 100644 --- a/src/components/DashboardPage.js +++ b/src/components/DashboardPage.js @@ -1,6 +1,6 @@ // @flow -import React, { PureComponent } from 'react' +import React, { PureComponent, Fragment } from 'react' import { compose } from 'redux' import { translate } from 'react-i18next' import { connect } from 'react-redux' @@ -161,59 +161,63 @@ class DashboardPage extends PureComponent { ]} /> - - { - data.forEach((d, i) => { - res[i] = { - name: d.name, - value: (res[i] ? res[i].value : 0) + d.value, - } - }) - return res - }, []), - 25, - )} - /> - - - {this.getAccountsChunk().map((accountsByLine, i) => ( - - {accountsByLine.map( - (account: any, j) => - account === null ? ( - - ) : ( - push(`/account/${account.id}`)} - > - - {account.name} - - - {account.data && formatBTC(account.data.balance)} - - - - ), - )} + {totalAccounts > 0 && ( + + + { + data.forEach((d, i) => { + res[i] = { + name: d.name, + value: (res[i] ? res[i].value : 0) + d.value, + } + }) + return res + }, []), + 25, + )} + /> + + + {this.getAccountsChunk().map((accountsByLine, i) => ( + + {accountsByLine.map( + (account: any, j) => + account === null ? ( + + ) : ( + push(`/account/${account.id}`)} + > + + {account.name} + + + {account.data && formatBTC(account.data.balance)} + + + + ), + )} + + ))} - ))} - + + )} ) } diff --git a/src/styles/helpers.js b/src/styles/helpers.js index 421d2aab..192b2fd7 100644 --- a/src/styles/helpers.js +++ b/src/styles/helpers.js @@ -21,7 +21,7 @@ export const fontFace = ({ }) => ` @font-face { font-family: "${name}"; - src: url("/fonts/${file}.woff2") format("woff2"); + src: url("${__DEV__ ? '' : __static}/fonts/${file}.woff2") format("woff2"); font-style: ${style}; font-weight: ${weight}; }