Browse Source

Fix fonts when you build, hide Chart on Dashboard when you don't have any accounts

master
Loëck Vézien 7 years ago
parent
commit
b0000efe88
No known key found for this signature in database GPG Key ID: CBCDCE384E853AC4
  1. 110
      src/components/DashboardPage.js
  2. 2
      src/styles/helpers.js

110
src/components/DashboardPage.js

@ -1,6 +1,6 @@
// @flow // @flow
import React, { PureComponent } from 'react' import React, { PureComponent, Fragment } from 'react'
import { compose } from 'redux' import { compose } from 'redux'
import { translate } from 'react-i18next' import { translate } from 'react-i18next'
import { connect } from 'react-redux' import { connect } from 'react-redux'
@ -161,59 +161,63 @@ class DashboardPage extends PureComponent<Props, State> {
]} ]}
/> />
</Card> </Card>
<Card flow={3} p={0}> {totalAccounts > 0 && (
<AreaChart <Fragment>
height={250} <Card flow={3} p={0}>
data={takeRight( <AreaChart
fakeDatas.reduce((res, data) => { height={250}
data.forEach((d, i) => { data={takeRight(
res[i] = { fakeDatas.reduce((res, data) => {
name: d.name, data.forEach((d, i) => {
value: (res[i] ? res[i].value : 0) + d.value, res[i] = {
} name: d.name,
}) value: (res[i] ? res[i].value : 0) + d.value,
return res }
}, []), })
25, return res
)} }, []),
/> 25,
</Card> )}
<Box flow={3}> />
{this.getAccountsChunk().map((accountsByLine, i) => ( </Card>
<Box <Box flow={3}>
key={i} // eslint-disable-line react/no-array-index-key {this.getAccountsChunk().map((accountsByLine, i) => (
horizontal <Box
flow={3} key={i} // eslint-disable-line react/no-array-index-key
> horizontal
{accountsByLine.map( flow={3}
(account: any, j) => >
account === null ? ( {accountsByLine.map(
<Box (account: any, j) =>
key={j} // eslint-disable-line react/no-array-index-key account === null ? (
p={2} <Box
flex={1} key={j} // eslint-disable-line react/no-array-index-key
/> p={2}
) : ( flex={1}
<Card />
key={account.id} ) : (
p={2} <Card
flex={1} key={account.id}
style={{ cursor: 'pointer' }} p={2}
onClick={() => push(`/account/${account.id}`)} flex={1}
> style={{ cursor: 'pointer' }}
<Box> onClick={() => push(`/account/${account.id}`)}
<Text fontWeight="bold">{account.name}</Text> >
</Box> <Box>
<Box grow align="center" justify="center"> <Text fontWeight="bold">{account.name}</Text>
{account.data && formatBTC(account.data.balance)} </Box>
</Box> <Box grow align="center" justify="center">
<BarChart height={100} data={takeRight(fakeDatas[j], 25)} /> {account.data && formatBTC(account.data.balance)}
</Card> </Box>
), <BarChart height={100} data={takeRight(fakeDatas[j], 25)} />
)} </Card>
),
)}
</Box>
))}
</Box> </Box>
))} </Fragment>
</Box> )}
</Box> </Box>
) )
} }

2
src/styles/helpers.js

@ -21,7 +21,7 @@ export const fontFace = ({
}) => ` }) => `
@font-face { @font-face {
font-family: "${name}"; font-family: "${name}";
src: url("/fonts/${file}.woff2") format("woff2"); src: url("${__DEV__ ? '' : __static}/fonts/${file}.woff2") format("woff2");
font-style: ${style}; font-style: ${style};
font-weight: ${weight}; font-weight: ${weight};
} }

Loading…
Cancel
Save