import React, { useEffect } from 'react';
import { Page } from '../Page';
import { useUserProfile } from '../../gql/queries/user';
import { WelcomeContent } from './WelcomeContent';
import { useHistory } from 'react-router';
import { useLoggedIn } from '../../hooks/useLoggedIn';

export function HomePage() {
  const loggedIn = useLoggedIn();
  const history = useHistory();

  useEffect(() => {
    if (loggedIn) history.push('/dashboard');
  }, [loggedIn]);

  return (
    <Page title="Accueil">
      <section className="mt-5">
        <WelcomeContent />
      </section>
    </Page>
  );
}