From 448b88c88a7f9e20dde9e496a0d9cbbf43dca8d7 Mon Sep 17 00:00:00 2001 From: Luis Felipe Risch <lfr20@inf.ufpr.br> Date: Wed, 30 Sep 2020 12:35:41 -0300 Subject: [PATCH] Add new route, the Admin route --- src/App.js | 129 ++++++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/src/App.js b/src/App.js index fc192578..339aa8eb 100644 --- a/src/App.js +++ b/src/App.js @@ -23,6 +23,7 @@ import Header from './Components/Header' import EcFooter from './Components/EcFooter'; import GNUAGPLfooter from './Components/AGPLFooter'; import UserPage from './Pages/UserPage'; +import Admin from './Admin/Pages/Pages /Admin'; import UserTerms from './Pages/UserTerms'; import Contact from './Pages/Contact'; import Teste from './Pages/Teste'; @@ -35,7 +36,7 @@ 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 { BrowserRouter, Switch, Route } from 'react-router-dom'; import { Store } from './Store' import TermsPage from './Pages/TermsPage.js' import PublicationPermissionsPage from './Pages/PublicationPermissionsPage.js' @@ -43,72 +44,76 @@ 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 UploadPage from './Pages/UploadPage.js' +import EditLearningObjectPage from './Pages/EditLearningObjectPage.js' -export default function App(){ - // eslint-disable-next-line - const { state, dispatch } = useContext(Store) +const App = (props) => { + // eslint-disable-next-line + const { state, dispatch } = useContext(Store) - useEffect(()=>{ - dispatch({ - type: 'WINDOW_SIZE', - innerWindow: { - width: window.innerWidth, - height: window.innerHeight - } - }) - },[]) + useEffect(() => { + dispatch({ + type: 'WINDOW_SIZE', + innerWindow: { + width: window.innerWidth, + height: window.innerHeight + } + }) + }, []) - useEffect(()=>{ - const setWindowSize = () => { - dispatch({ - type: 'WINDOW_SIZE', - innerWindow: { - width: window.innerWidth, - height: window.innerHeight + useEffect(() => { + const setWindowSize = () => { + dispatch({ + type: 'WINDOW_SIZE', + innerWindow: { + width: window.innerWidth, + height: window.innerHeight + } + }) } - }) - } - window.addEventListener('resize',setWindowSize) + window.addEventListener('resize', setWindowSize) - return () => window.removeEventListener('resize',setWindowSize) - },[window.innerWidth,window.innerHeight]) + return () => window.removeEventListener('resize', setWindowSize) + }, [window.innerWidth, window.innerHeight]) - return( - <BrowserRouter> - <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}/> - <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}/> - <Route path="/contato" component={Contact}/> - <Route path="/termos" component={UserTerms}/> - <Route path="/teste" component={Teste}/> - <Route path="/sobre" component={AboutPage}/> - <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} /> - </Switch> - <EcFooter/> - <GNUAGPLfooter/> - </BrowserRouter> - ) + return ( + <BrowserRouter> + <Header /> + <div style={{ backgroundImage: "linear-gradient(to right,#ff7f00,#e81f4f,#673ab7,#00bcd4)", height: "5px" }}/> + <link href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" rel="stylesheet" /> + <Switch> + <Route path="/" exact={true} component={Home} /> + <Route path="/busca" component={Search} /> + <Route path="/perfil" component={UserPage} /> + <Route path="/editarperfil" component={EditProfilePage}/> + <Route path="/admin" component={Admin}/> + <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} /> + <Route path="/contato" component={Contact} /> + <Route path="/termos" component={UserTerms} /> + <Route path="/teste" component={Teste} /> + <Route path="/sobre" component={AboutPage} /> + <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} /> + </Switch> + <EcFooter /> + <GNUAGPLfooter /> + </BrowserRouter> + ) } + + +export default App; \ No newline at end of file -- GitLab