blowfish/src/renderer/screens/Home/index.jsx

42 lines
1018 B
React
Raw Normal View History

2019-09-08 21:47:57 +02:00
import React, { useContext } from 'react'
import { Link } from '@reach/router'
import { AppContext } from '../../store/createContext'
import Welcome from '../../components/Welcome'
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'
const Home = () => {
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} />
</>
)
}
export default Home