2019-09-08 21:47:57 +02:00
|
|
|
import React, { useContext } from 'react'
|
|
|
|
import { Link } from '@reach/router'
|
|
|
|
import { AppContext } from '../../store/createContext'
|
2019-09-24 01:13:02 +02:00
|
|
|
import Welcome from './Welcome'
|
2019-09-08 21:47:57 +02:00
|
|
|
import Spinner from '../../components/Spinner'
|
|
|
|
import Divider from '../../components/Divider'
|
|
|
|
import Total from './Total'
|
|
|
|
import Ticker from './Ticker'
|
2019-09-09 01:16:17 +02:00
|
|
|
import Accounts from './Accounts'
|
2019-09-08 21:47:57 +02:00
|
|
|
import IconCog from '../../images/cog.svg'
|
|
|
|
import styles from './index.module.css'
|
|
|
|
|
2019-09-24 01:13:02 +02:00
|
|
|
export default function Home() {
|
2019-09-08 21:47:57 +02:00
|
|
|
const { isLoading, needsConfig } = useContext(AppContext)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2019-09-09 01:16:17 +02:00
|
|
|
<main className={styles.main}>
|
2019-09-08 21:47:57 +02:00
|
|
|
<Link className={styles.preferences} to="/preferences">
|
|
|
|
<IconCog />
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
{needsConfig ? (
|
|
|
|
<Welcome />
|
|
|
|
) : isLoading ? (
|
|
|
|
<Spinner />
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
<Total />
|
|
|
|
<Divider />
|
|
|
|
<Accounts />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</main>
|
|
|
|
|
|
|
|
<Ticker style={isLoading ? { opacity: 0 } : null} />
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|