Merge pull request #27 from andrerfneves/hotfix/remove-loading-state

Hotfix/remove loading state
This commit is contained in:
George Lima 2019-01-05 17:36:42 -02:00 committed by GitHub
commit 42a6a35b98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 52 deletions

View File

@ -34,6 +34,18 @@ const initialLog = `
In order to ensure you are adequately protecting your privacy when using Zcash, please see <https://z.cash/support/security/>. In order to ensure you are adequately protecting your privacy when using Zcash, please see <https://z.cash/support/security/>.
`; `;
const defaultState = `
\n
Block height | 0
Connections | 0
Network solution rate | 0 Sol/s
You are currently not mining.
To enable mining, add 'gen=1' to your zcash.conf and restart.
Since starting this node 0 minutes, 0 seconds ago:
- You have validated 0 transactions!
`;
const breakpoints = [1, 4, 7, 10, 13]; const breakpoints = [1, 4, 7, 10, 13];
type Props = {}; type Props = {};
@ -44,7 +56,7 @@ type State = {
export class ConsoleView extends Component<Props, State> { export class ConsoleView extends Component<Props, State> {
state = { state = {
log: '', log: initialLog + defaultState,
}; };
componentDidMount() { componentDidMount() {
@ -58,19 +70,15 @@ export class ConsoleView extends Component<Props, State> {
return ( return (
<Wrapper> <Wrapper>
{log ? ( <Fragment>
<Fragment> <ConsoleImg src={ConsoleSymbol} alt='Zcashd' />
<ConsoleImg src={ConsoleSymbol} alt='Zcashd' /> {log.split('\n').map((item, idx) => (
{log.split('\n').map((item, idx) => ( <Fragment key={generateRandomString()}>
<Fragment key={generateRandomString()}> <ConsoleText value={item} />
<ConsoleText value={item} /> {breakpoints.includes(idx) ? <br /> : null}
{breakpoints.includes(idx) ? <br /> : null} </Fragment>
</Fragment> ))}
))} </Fragment>
</Fragment>
) : (
<ConsoleText value='Waiting for daemon logs...' />
)}
</Wrapper> </Wrapper>
); );
} }

View File

@ -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,32 +39,26 @@ 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> <Fragment>
{isLoading ? ( <WalletSummaryComponent
'Loading' total={total}
) : ( shielded={shielded}
<Fragment> transparent={transparent}
<WalletSummaryComponent zecPrice={zecPrice}
total={total} addresses={addresses}
shielded={shielded} />
transparent={transparent} {days.map(day => (
zecPrice={zecPrice} <TransactionDailyComponent
addresses={addresses} transactionsDate={day}
/> transactions={transactions[day]}
{days.map(day => ( zecPrice={zecPrice}
<TransactionDailyComponent key={day}
transactionsDate={day} />
transactions={transactions[day]} ))}
zecPrice={zecPrice}
key={day}
/>
))}
</Fragment>
)}
</Fragment> </Fragment>
); );
} }

View File

@ -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,27 +20,23 @@ 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' <TransactionDailyComponent
: days.map(day => ( transactionsDate={day}
<TransactionDailyComponent transactions={transactions[day]}
transactionsDate={day} zecPrice={zecPrice}
transactions={transactions[day]} />
zecPrice={zecPrice} ))}
/>
))}
</Fragment> </Fragment>
); );
} }