diff --git a/client/src/components/App.tsx b/client/src/components/App.tsx index 9324cf2..f22bc35 100644 --- a/client/src/components/App.tsx +++ b/client/src/components/App.tsx @@ -1,22 +1,33 @@ -import React from 'react'; +import React, { FunctionComponent } from 'react'; import { BrowserRouter, Route, Redirect, Switch } from "react-router-dom"; import { HomePage } from './HomePage/HomePage'; import { ProfilePage } from './ProfilePage/ProfilePage'; import { WorkgroupPage } from './WorkgroupPage/WorkgroupPage'; import { DecisionSupportFilePage } from './DecisionSupportFilePage/DecisionSupportFilePage'; +import { DashboardPage } from './DashboardPage/DashboardPage'; +import { useUserProfile } from '../gql/queries/profile'; +import { LoggedInContext } from '../hooks/useLoggedIn'; +import { PrivateRoute } from './PrivateRoute'; -export class App extends React.Component { - render() { - return ( +export interface AppProps { + +} + +export const App: FunctionComponent = () => { + const { user } = useUserProfile(); + + return ( + - - - + + + + } /> - ); - } + + ); } \ No newline at end of file diff --git a/client/src/components/HomePage/Dashboard.tsx b/client/src/components/DashboardPage/Dashboard.tsx similarity index 100% rename from client/src/components/HomePage/Dashboard.tsx rename to client/src/components/DashboardPage/Dashboard.tsx diff --git a/client/src/components/DashboardPage/DashboardPage.tsx b/client/src/components/DashboardPage/DashboardPage.tsx new file mode 100644 index 0000000..55726c6 --- /dev/null +++ b/client/src/components/DashboardPage/DashboardPage.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import { Page } from '../Page'; +import { Dashboard } from './Dashboard'; + +export function DashboardPage() { + return ( + +
+
+ +
+
+
+ ); +} \ No newline at end of file diff --git a/client/src/components/HomePage/DecisionSupportFilePanel.tsx b/client/src/components/DashboardPage/DecisionSupportFilePanel.tsx similarity index 100% rename from client/src/components/HomePage/DecisionSupportFilePanel.tsx rename to client/src/components/DashboardPage/DecisionSupportFilePanel.tsx diff --git a/client/src/components/HomePage/ItemPanel.tsx b/client/src/components/DashboardPage/ItemPanel.tsx similarity index 100% rename from client/src/components/HomePage/ItemPanel.tsx rename to client/src/components/DashboardPage/ItemPanel.tsx diff --git a/client/src/components/HomePage/WorkgroupsPanel.tsx b/client/src/components/DashboardPage/WorkgroupsPanel.tsx similarity index 100% rename from client/src/components/HomePage/WorkgroupsPanel.tsx rename to client/src/components/DashboardPage/WorkgroupsPanel.tsx diff --git a/client/src/components/DecisionSupportFilePage/DecisionSupportFilePage.tsx b/client/src/components/DecisionSupportFilePage/DecisionSupportFilePage.tsx index 7aea3e9..50b0d83 100644 --- a/client/src/components/DecisionSupportFilePage/DecisionSupportFilePage.tsx +++ b/client/src/components/DecisionSupportFilePage/DecisionSupportFilePage.tsx @@ -72,7 +72,7 @@ export const DecisionSupportFilePage: FunctionComponent - Clarifier la décision + Clarifier la proposition
  • { + if (user.id !== '') history.push('/dashboard'); + }, [user.id]) return ( - -
    -
    - - { - userProfile ? - : -
    -
    -
    -

    Veuillez vous authentifier.

    -
    -
    -
    - } -
    -
    -
    + + ); } \ No newline at end of file diff --git a/client/src/components/HomePage/WelcomeContent.tsx b/client/src/components/HomePage/WelcomeContent.tsx new file mode 100644 index 0000000..03bd603 --- /dev/null +++ b/client/src/components/HomePage/WelcomeContent.tsx @@ -0,0 +1,75 @@ +import React, { FunctionComponent, Fragment } from "react"; + +export interface WelcomeContentProps { + +} + +export const WelcomeContent: FunctionComponent = () => { + return ( + +
    +
    +
    +

    + Bienvenue sur Daddy ! +

    +

    + L'outil de suivi de la vie d'entreprise démocratique. +

    +
    +
    +
    +
    +

    + Attention Le service est actuellement en alpha. L'accès est restreint aux adresses autorisées. +

    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +

    Une adresse courriel et c'est parti !

    +

    Pas de création de compte, pas de mot de passe à retenir. Entrez votre adresse courriel et commencez directement à travailler !

    + {/*

    En savoir plus

    */} +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +

    Préparer vos dossiers d'aide à la décision

    +

    Une décision à prendre ? Un nouveau projet à lancer ? Crééz votre groupe de travail et rédigez un dossier pour faciliter la prise de décision collective !

    + {/*

    En savoir plus

    */} +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +

    Travaillez collaborativement

    +

    Éditez à plusieurs vos dossiers d'aide à la décision, suivi l'avancée des débats et retrouvez simplement les décisions prises dans l'entreprise.

    + {/*

    En savoir plus

    */} +
    +
    +
    +
    +
    +
    +
    + ); +}; \ No newline at end of file diff --git a/client/src/components/PrivateRoute.tsx b/client/src/components/PrivateRoute.tsx new file mode 100644 index 0000000..fa14f28 --- /dev/null +++ b/client/src/components/PrivateRoute.tsx @@ -0,0 +1,18 @@ +import React, { FunctionComponent, Component, ReactType } from "react" +import { Route, Redirect, RouteProps } from "react-router" +import { useLoggedIn } from "../hooks/useLoggedIn"; + +export interface PrivateRouteProps extends RouteProps { +} + +export const PrivateRoute: FunctionComponent = ({component: Component, ...rest}) => { + const loggedIn = useLoggedIn(); + return ( + loggedIn === true + ? + : } + /> + ) +} \ No newline at end of file diff --git a/client/src/hooks/useLoggedIn.tsx b/client/src/hooks/useLoggedIn.tsx new file mode 100644 index 0000000..8c92e4d --- /dev/null +++ b/client/src/hooks/useLoggedIn.tsx @@ -0,0 +1,7 @@ +import React, { useState, useContext } from "react"; + +export const LoggedInContext = React.createContext(false); + +export const useLoggedIn = () => { + return useContext(LoggedInContext); +}; \ No newline at end of file