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

37 lines
915 B
TypeScript
Raw Normal View History

2020-07-21 22:25:39 +02:00
import React from 'react';
2020-06-15 18:10:06 +02:00
import { Page } from '../Page';
2020-07-16 20:43:41 +02:00
import { Dashboard } from './Dashboard';
2020-07-21 22:25:39 +02:00
import { useUserProfileQuery } from '../../gql/queries/profile';
import { Loader } from '../Loader';
2020-06-15 18:10:06 +02:00
export function HomePage() {
2020-07-21 22:25:39 +02:00
const { data, loading } = useUserProfileQuery();
if (loading) {
return (
<Loader />
);
}
const { userProfile } = (data || {});
2020-06-15 18:10:06 +02:00
return (
2020-07-21 22:25:39 +02:00
<Page title={userProfile ? '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
{
2020-07-21 22:25:39 +02:00
userProfile ?
2020-07-16 20:43:41 +02:00
<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>
);
}