daddy/client/src/components/HomePage/HomePage.tsx

29 lines
857 B
TypeScript
Raw Normal View History

import React, { useEffect } from 'react';
2020-06-15 18:10:06 +02:00
import { Page } from '../Page';
2020-07-16 20:43:41 +02:00
import { useSelector } from 'react-redux';
import { RootState } from '../../store/reducers/root';
2020-07-16 20:43:41 +02:00
import { Dashboard } from './Dashboard';
2020-06-15 18:10:06 +02:00
export function HomePage() {
const currentUser = useSelector((state: RootState) => state.auth.currentUser);
2020-06-15 18:10:06 +02:00
return (
2020-07-16 20:43:41 +02:00
<Page title={currentUser ? 'Tableau de bord' : 'Accueil'}>
2020-06-15 18:10:06 +02:00
<div className="container is-fluid">
<section className="section">
2020-07-16 20:43:41 +02:00
{
currentUser ?
<Dashboard /> :
<div className="columns">
<div className="column is-4 is-offset-4">
<div className="box">
<p>Veuillez vous authentifier.</p>
</div>
</div>
2020-07-16 20:43:41 +02:00
</div>
}
</section>
2020-06-15 18:10:06 +02:00
</div>
</Page>
);
}