import React from 'react';
import { Page } from '../Page';
import { useSelector } from 'react-redux';
import { RootState } from '../../store/reducers/root';

export function HomePage() {
  const currentUser = useSelector((state: RootState) => state.auth.currentUser);

  return (
    <Page title="Daddy - Accueil">
      <div className="container is-fluid">
        <section className="section">
          <div className="columns">
            <div className="column is-4 is-offset-4">
              <div className="box">
              { 
                currentUser ?
                <p>Bonjour <span className="has-text-weight-bold">{currentUser.email}</span> !</p> :
                <p>Veuillez vous authentifier.</p>
              }
              </div>
            </div>
          </div>
        </section>
      </div>
    </Page>
  );
}