2019-09-08 21:47:57 +02:00
|
|
|
import React, { useContext } from 'react'
|
2020-02-09 03:36:19 +01:00
|
|
|
import Link from 'next/link'
|
|
|
|
import { AppContext } from '../store/createContext'
|
|
|
|
import Welcome from '../components/Home/Welcome'
|
|
|
|
import Spinner from '../components/Spinner'
|
|
|
|
import Divider from '../components/Divider'
|
|
|
|
import Total from '../components/Home/Total'
|
|
|
|
import Ticker from '../components/Home/Ticker'
|
|
|
|
import Accounts from '../components/Home/Accounts'
|
|
|
|
import IconCog from '../images/cog.svg'
|
2019-09-08 21:47:57 +02:00
|
|
|
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}>
|
2020-02-09 03:36:19 +01:00
|
|
|
<Link href="/preferences">
|
|
|
|
<a className={styles.preferences}>
|
|
|
|
<IconCog />
|
|
|
|
</a>
|
2019-09-08 21:47:57 +02:00
|
|
|
</Link>
|
|
|
|
|
|
|
|
{needsConfig ? (
|
|
|
|
<Welcome />
|
|
|
|
) : isLoading ? (
|
|
|
|
<Spinner />
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
<Total />
|
|
|
|
<Divider />
|
|
|
|
<Accounts />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</main>
|
|
|
|
|
|
|
|
<Ticker style={isLoading ? { opacity: 0 } : null} />
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|