fix: remove loading states from dashboard and transactions
This commit is contained in:
parent
1891e21b5a
commit
2130e6e810
|
@ -4,6 +4,7 @@ import React, { PureComponent, Fragment } from 'react';
|
||||||
|
|
||||||
import { WalletSummaryComponent } from '../components/wallet-summary';
|
import { WalletSummaryComponent } from '../components/wallet-summary';
|
||||||
import { TransactionDailyComponent } from '../components/transaction-daily';
|
import { TransactionDailyComponent } from '../components/transaction-daily';
|
||||||
|
import { TextComponent } from '../components/text';
|
||||||
|
|
||||||
import type { Transaction } from '../components/transaction-item';
|
import type { Transaction } from '../components/transaction-item';
|
||||||
|
|
||||||
|
@ -13,7 +14,6 @@ type Props = {
|
||||||
shielded: number,
|
shielded: number,
|
||||||
transparent: number,
|
transparent: number,
|
||||||
error: string | null,
|
error: string | null,
|
||||||
isLoading: boolean,
|
|
||||||
zecPrice: number,
|
zecPrice: number,
|
||||||
addresses: string[],
|
addresses: string[],
|
||||||
transactions: { [day: string]: Transaction[] },
|
transactions: { [day: string]: Transaction[] },
|
||||||
|
@ -28,7 +28,6 @@ export class DashboardView extends PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
error,
|
error,
|
||||||
isLoading,
|
|
||||||
total,
|
total,
|
||||||
shielded,
|
shielded,
|
||||||
transparent,
|
transparent,
|
||||||
|
@ -40,14 +39,10 @@ export class DashboardView extends PureComponent<Props> {
|
||||||
const days = Object.keys(transactions);
|
const days = Object.keys(transactions);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return error;
|
return <TextComponent value={error} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
|
||||||
{isLoading ? (
|
|
||||||
'Loading'
|
|
||||||
) : (
|
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<WalletSummaryComponent
|
<WalletSummaryComponent
|
||||||
total={total}
|
total={total}
|
||||||
|
@ -65,8 +60,6 @@ export class DashboardView extends PureComponent<Props> {
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)}
|
|
||||||
</Fragment>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
import React, { PureComponent, Fragment } from 'react';
|
import React, { PureComponent, Fragment } from 'react';
|
||||||
|
|
||||||
import { TransactionDailyComponent } from '../components/transaction-daily';
|
import { TransactionDailyComponent } from '../components/transaction-daily';
|
||||||
|
import { TextComponent } from '../components/text';
|
||||||
|
|
||||||
import type { Transaction } from '../components/transaction-item';
|
import type { Transaction } from '../components/transaction-item';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isLoading: boolean,
|
|
||||||
error: string | null,
|
error: string | null,
|
||||||
transactions: { [day: string]: Transaction[] },
|
transactions: { [day: string]: Transaction[] },
|
||||||
zecPrice: number,
|
zecPrice: number,
|
||||||
|
@ -20,21 +20,17 @@ export class TransactionsView extends PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { error, transactions, zecPrice } = this.props;
|
||||||
error, isLoading, transactions, zecPrice,
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return error;
|
return <TextComponent value={error} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const days = Object.keys(transactions);
|
const days = Object.keys(transactions);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{isLoading
|
{days.map(day => (
|
||||||
? 'Loading'
|
|
||||||
: days.map(day => (
|
|
||||||
<TransactionDailyComponent
|
<TransactionDailyComponent
|
||||||
transactionsDate={day}
|
transactionsDate={day}
|
||||||
transactions={transactions[day]}
|
transactions={transactions[day]}
|
||||||
|
|
Loading…
Reference in New Issue