From 73eca39a3d79bf5e2f7957ad30f3a0e4808d9439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=ABck=20V=C3=A9zien?= Date: Mon, 12 Feb 2018 17:05:36 +0100 Subject: [PATCH] Update AccountCard, and Dasbhoard Chart --- src/components/DashboardPage/AccountCard.js | 2 +- src/components/DashboardPage/index.js | 68 ++++++++++++--------- src/components/base/Chart/index.js | 49 +++++++++++---- 3 files changed, 78 insertions(+), 41 deletions(-) diff --git a/src/components/DashboardPage/AccountCard.js b/src/components/DashboardPage/AccountCard.js index 1a788663..82601c6c 100644 --- a/src/components/DashboardPage/AccountCard.js +++ b/src/components/DashboardPage/AccountCard.js @@ -45,7 +45,7 @@ const AccountCard = ({ height={52} data={data} strokeWidth={1} - linearGradient={[[5, 0.4], [100, 0]]} + linearGradient={[[5, 0.4], [80, 0]]} /> ) diff --git a/src/components/DashboardPage/index.js b/src/components/DashboardPage/index.js index bdafe16d..bd9dc575 100644 --- a/src/components/DashboardPage/index.js +++ b/src/components/DashboardPage/index.js @@ -14,6 +14,7 @@ import type { MapStateToProps } from 'react-redux' import type { Accounts } from 'types/common' import { formatBTC } from 'helpers/format' +import { space } from 'styles/theme' import { getTotalBalance, getVisibleAccounts } from 'reducers/accounts' @@ -121,7 +122,7 @@ class DashboardPage extends PureComponent { - + {'Good morning, Khalil.'} @@ -140,11 +141,17 @@ class DashboardPage extends PureComponent { {totalAccounts > 0 && ( - + {formatBTC(totalBalance)} { /> - - {this.getAccountsChunk().map((accountsByLine, i) => ( - - {accountsByLine.map( - (account: any, j) => - account === null ? ( - - ) : ( - push(`/account/${account.id}`)} - /> - ), - )} - - ))} + + + {'Accounts'} + + + {this.getAccountsChunk().map((accountsByLine, i) => ( + + {accountsByLine.map( + (account: any, j) => + account === null ? ( + + ) : ( + push(`/account/${account.id}`)} + /> + ), + )} + + ))} + )} diff --git a/src/components/base/Chart/index.js b/src/components/base/Chart/index.js index 9971f14a..e9ebe6b0 100644 --- a/src/components/base/Chart/index.js +++ b/src/components/base/Chart/index.js @@ -1,7 +1,7 @@ // @flow import React, { PureComponent } from 'react' -import { AreaChart as ReactAreaChart, Area, XAxis, CartesianGrid, Tooltip } from 'recharts' +import { AreaChart as ReactAreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip } from 'recharts' import Box from 'components/base/Box' @@ -89,26 +89,32 @@ export const AreaChart = ({ {linearGradient && ( - {linearGradient.map(g => ( - + {linearGradient.map((g, i) => ( + ))} )} {!tiny && ( - { + tick={({ x, y, index, payload }) => { const { value } = payload - if (index !== 0 && index !== visibleTicksCount - 1) { + if (index !== 0) { return ( - - {value} + + {value}k ) @@ -118,8 +124,27 @@ export const AreaChart = ({ }} /> )} + {!tiny && ( + { + const { value } = payload + + return ( + + + {value} + + + ) + }} + /> + )} {!tiny && } - {!tiny && } + {!tiny && }