Skip to content
Snippets Groups Projects
App.js 5.94 KiB
Newer Older
/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana

This file is part of Plataforma Integrada MEC.

Plataforma Integrada MEC is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Plataforma Integrada MEC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/

Raul Almeida's avatar
Raul Almeida committed
import React, { useContext, useEffect, useState } from 'react';
import Home from './Pages/Home';
import Search from './Pages/Search'
import Header from './Components/Header'
import EcFooter from './Components/EcFooter';
import GNUAGPLfooter from './Components/AGPLFooter';
import UserPage from './Pages/UserPage';
lfr20's avatar
lfr20 committed
import Admin from './Admin/Pages/Pages/Admin';
mrp19's avatar
mrp19 committed
import UserTerms from './Pages/UserTerms';
mrp19's avatar
mrp19 committed
import Contact from './Pages/Contact';
import Teste from './Pages/Teste';
import AboutPage from './Pages/AboutPage';
import HelpCenter from './Pages/HelpCenter';
import TabResoursePub from './Pages/TabsHelp/TabResoursePub';
import TabResourseFind from './Pages/TabsHelp/TabResourseFind';
import TabNetPart from './Pages/TabsHelp/TabNetPart';
import TabManageAc from './Pages/TabsHelp/TabManageAc';
import PasswordRecoveryPage from './Pages/PasswordRecoveryPage.js'
import PageProfessor from './Pages/PageProfessor.js'
import ResourcePage from './Pages/ResourcePage';
import {BrowserRouter, Switch, Route } from 'react-router-dom';
import TermsPage from './Pages/TermsPage.js'
import PublicationPermissionsPage from './Pages/PublicationPermissionsPage.js'
import TabPlataformaMEC from './Pages/TabsHelp/TabPlataformaMEC';
import ItemStore from './Pages/ItemStore.js'
import EditProfilePage from './Pages/EditProfilePage.js'
import PublicUserPage from './Pages/PublicUserPage.js'
import UploadPage from './Pages/UploadPage.js'
import EditLearningObjectPage from './Pages/EditLearningObjectPage.js'
import SiteMap from './Pages/SiteMap'
import Accessibility from './Pages/Accessibility'
Raul Almeida's avatar
Raul Almeida committed
import CollectionPage from './Pages/CollectionPage.js'
import FormationMaterialPage from './Pages/FormationMaterialPage.js';
Raul Almeida's avatar
Raul Almeida committed
import FormationMaterialIframe from './Pages/FormationMaterialIframe.js';

export default function App(){
  // eslint-disable-next-line
  const { state, dispatch } = useContext(Store)
Raul Almeida's avatar
Raul Almeida committed
	const [ hideFooter, setHideFooter ] = useState(false);

	useEffect(() => {
		setHideFooter(String(window.location.href).includes('iframe-colecao'));
	}, [ window.location.href ]);
lfr20's avatar
lfr20 committed
    useEffect(() => {
        dispatch({
            type: 'WINDOW_SIZE',
            innerWindow: {
                width: window.innerWidth,
                height: window.innerHeight
            }
        })
    }, [])
lfr20's avatar
lfr20 committed
    useEffect(() => {
        const setWindowSize = () => {
            dispatch({
                type: 'WINDOW_SIZE',
                innerWindow: {
                    width: window.innerWidth,
                    height: window.innerHeight
                }
            })
lfr20's avatar
lfr20 committed
        window.addEventListener('resize', setWindowSize)
lfr20's avatar
lfr20 committed
        return () => window.removeEventListener('resize', setWindowSize)
    }, [window.innerWidth, window.innerHeight])
    <BrowserRouter basename="/react">
      <Header />
      <div style={{backgroundImage: "linear-gradient(to right,#ff7f00,#e81f4f,#673ab7,#00bcd4)", height:"5px"}}></div>
      <link href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" rel="stylesheet"/>
      <Switch>
        <Route path="/" exact={true} component={Home}/>
lfr20's avatar
lfr20 committed
        <Route path="/admin" component={Admin}/>
        <Route path="/busca" component={Search} />
        <Route path="/perfil" component={UserPage} />
        <Route path="/editarperfil" component={EditProfilePage} />
        <Route path="/recurso/:recursoId" component={ResourcePage}/>
        <Route path="/termos-publicar-recurso" component={TermsPage}/>
        <Route path="/permission" component={PublicationPermissionsPage}/>
        {/*<Route path="termos-de-uso#publicacoes-de-usuario" component={}*/}
        <Route path="/ajuda" component={HelpCenter}/>
mrp19's avatar
mrp19 committed
        <Route path="/contato" component={Contact}/>
      	<Route path="/termos" component={UserTerms}/>
        <Route path="/teste" component={Teste}/>
        <Route path="/sobre" component={AboutPage}/>
        <Route path="/mapa-site" component={SiteMap}/>
      	<Route path="/acessibilidade" component={Accessibility}/>
        <Route path="/publicando-recurso" component={TabResoursePub}/>
        <Route path="/encontrando-recurso" component={TabResourseFind}/>
        <Route path="/participando-da-rede" component={TabNetPart}/>
        <Route path="/gerenciando-conta" component={TabManageAc}/>
        <Route path="/plataforma-mec" component={TabPlataformaMEC}/>
        <Route path="/recuperar-senha" component={PasswordRecoveryPage}/>
        <Route path="/usuario-publico/:userId" component={PublicUserPage}/>
        <Route path="/editar-recurso/:recursoId" component={EditLearningObjectPage}/>
        <Route path='/professor' component={PageProfessor}/>
        <Route path="/upload" component={UploadPage}/>
        <Route path='/loja' component={ItemStore} />
Raul Almeida's avatar
Raul Almeida committed
        <Route path='/colecao-do-usuario/:id' component={CollectionPage} />
				<Route path='/colecao' component={FormationMaterialPage}  />
				<Route path='/topico' component={FormationMaterialPage}  />
Raul Almeida's avatar
Raul Almeida committed
				<Route path='/iframe-colecao' component={FormationMaterialIframe} />
Raul Almeida's avatar
Raul Almeida committed
			{ !hideFooter &&
				<div>
					<EcFooter/>
					<GNUAGPLfooter/>
				</div>
			}