2018-11-23 15:23:41 -08:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
2018-12-10 09:09:30 -08:00
|
|
|
import { WalletSummaryComponent } from '../components/wallet-summary';
|
2018-12-11 04:13:45 -08:00
|
|
|
import { withDaemonStatusCheck } from '../components/with-daemon-status-check';
|
2018-12-10 09:09:30 -08:00
|
|
|
|
|
|
|
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-10 09:09:30 -08:00
|
|
|
};
|
|
|
|
|
2018-12-11 04:13:45 -08:00
|
|
|
export class Dashboard extends React.Component<Props> {
|
2018-12-10 09:09:30 -08:00
|
|
|
componentDidMount() {
|
|
|
|
this.props.getSummary();
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
if (this.props.error) {
|
|
|
|
return this.props.error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='dashboard'>
|
|
|
|
{this.props.isLoading ? (
|
|
|
|
'Loading'
|
|
|
|
) : (
|
|
|
|
<WalletSummaryComponent
|
|
|
|
total={this.props.total}
|
|
|
|
shielded={this.props.shielded}
|
|
|
|
transparent={this.props.transparent}
|
|
|
|
dollarValue={this.props.dollarValue}
|
2018-12-10 16:11:53 -08:00
|
|
|
addresses={this.props.addresses}
|
2018-12-10 09:09:30 -08:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-12-11 04:13:45 -08:00
|
|
|
|
|
|
|
export const DashboardView = withDaemonStatusCheck(Dashboard);
|