mirror of
https://github.com/kremalicious/blowfish.git
synced 2025-01-07 20:34:59 +01:00
42 lines
1.2 KiB
React
42 lines
1.2 KiB
React
|
import React, { PureComponent } from 'react'
|
||
|
import { Link } from '@reach/router'
|
||
|
import { Consumer } from '../store/createContext'
|
||
|
import Total from '../components/Total'
|
||
|
import Account from '../components/Account'
|
||
|
import Ticker from '../components/Ticker'
|
||
|
import Spinner from '../components/Spinner'
|
||
|
import './Home.css'
|
||
|
|
||
|
export default class Home extends PureComponent {
|
||
|
render() {
|
||
|
return (
|
||
|
<Consumer>
|
||
|
{({ isLoading, accounts, needsConfig }) => (
|
||
|
<>
|
||
|
<Link to="preferences">Settings</Link>
|
||
|
<main className="main">
|
||
|
{needsConfig ? (
|
||
|
'Needs config'
|
||
|
) : isLoading ? (
|
||
|
<Spinner />
|
||
|
) : (
|
||
|
<>
|
||
|
<Total />
|
||
|
|
||
|
<div className="number-unit-wrap number-unit-wrap--accounts">
|
||
|
{accounts.map((account, i) => (
|
||
|
<Account key={i} account={account} />
|
||
|
))}
|
||
|
</div>
|
||
|
</>
|
||
|
)}
|
||
|
</main>
|
||
|
|
||
|
<Ticker style={isLoading ? { opacity: 0 } : null} />
|
||
|
</>
|
||
|
)}
|
||
|
</Consumer>
|
||
|
)
|
||
|
}
|
||
|
}
|