zepio/app/views/dashboard.js

67 lines
1.5 KiB
JavaScript
Raw Normal View History

// @flow
2018-12-11 16:46:26 -08:00
import React, { Fragment } from 'react';
import styled from 'styled-components';
import { WalletSummaryComponent } from '../components/wallet-summary';
2018-12-11 04:13:45 -08:00
import { withDaemonStatusCheck } from '../components/with-daemon-status-check';
2018-12-11 16:46:26 -08:00
import { TextComponent } from '../components/text';
const Title = styled(TextComponent)`
font-size: 1.5em;
margin-top: 10px;
margin-bottom: 10px;
`;
const Divider = styled.div`
width: 100%;
background-color: ${props => props.theme.colors.text};
height: 1px;
opacity: 0.1;
`;
type Props = {
getSummary: () => void,
total: number,
shielded: number,
transparent: number,
error: string | null,
isLoading: boolean,
dollarValue: number,
2018-12-10 16:11:53 -08:00
addresses: string[],
};
2018-12-11 04:13:45 -08:00
export class Dashboard extends React.Component<Props> {
componentDidMount() {
this.props.getSummary();
}
render() {
if (this.props.error) {
return this.props.error;
}
return (
<div className='dashboard'>
{this.props.isLoading ? (
'Loading'
) : (
2018-12-11 16:46:26 -08:00
<Fragment>
<Title value='Dashboard' />
<Divider />
<WalletSummaryComponent
total={this.props.total}
shielded={this.props.shielded}
transparent={this.props.transparent}
dollarValue={this.props.dollarValue}
addresses={this.props.addresses}
/>
</Fragment>
)}
</div>
);
}
}
2018-12-11 04:13:45 -08:00
export const DashboardView = withDaemonStatusCheck(Dashboard);