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';
|
2020-07-22 09:18:50 +02:00
|
|
|
import { WithLoader } from '../WithLoader';
|
2020-06-15 18:10:06 +02:00
|
|
|
|
|
|
|
export function HomePage() {
|
2020-07-21 22:25:39 +02:00
|
|
|
const { data, loading } = useUserProfileQuery();
|
|
|
|
|
|
|
|
const { userProfile } = (data || {});
|
2020-06-18 09:48:45 +02:00
|
|
|
|
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">
|
2020-06-18 09:48:45 +02:00
|
|
|
<section className="section">
|
2020-07-22 09:18:50 +02:00
|
|
|
<WithLoader loading={loading}>
|
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>
|
2020-06-18 09:48:45 +02:00
|
|
|
</div>
|
2020-07-16 20:43:41 +02:00
|
|
|
</div>
|
|
|
|
}
|
2020-07-22 09:18:50 +02:00
|
|
|
</WithLoader>
|
2020-06-18 09:48:45 +02:00
|
|
|
</section>
|
2020-06-15 18:10:06 +02:00
|
|
|
</div>
|
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
}
|