Skip to content
Snippets Groups Projects
Commit 7444dae1 authored by Raul Almeida's avatar Raul Almeida
Browse files

WIP add iframe page

parent e446ad42
Branches master
No related tags found
4 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!39Update admin system,!32Homologa
......@@ -16,7 +16,7 @@ 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/>.*/
import React, { useContext, useEffect } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import Home from './Pages/Home';
import Search from './Pages/Search'
import Header from './Components/Header'
......@@ -35,7 +35,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, useLocation } from 'react-router-dom';
import { Store } from './Store'
import TermsPage from './Pages/TermsPage.js'
import PublicationPermissionsPage from './Pages/PublicationPermissionsPage.js'
......@@ -44,10 +44,16 @@ import ItemStore from './Pages/ItemStore.js'
import EditProfilePage from './Pages/EditProfilePage.js'
import PublicUserPage from './Pages/PublicUserPage.js'
import FormationMaterialPage from './Pages/FormationMaterialPage.js';
import FormationMaterialIframe from './Pages/FormationMaterialIframe.js';
export default function App(){
// eslint-disable-next-line
const { state, dispatch } = useContext(Store)
const [ hideFooter, setHideFooter ] = useState(false);
useEffect(() => {
setHideFooter(String(window.location.href).includes('iframe-colecao'));
}, [ window.location.href ]);
useEffect(()=>{
dispatch({
......@@ -104,9 +110,14 @@ export default function App(){
<Route path='/loja' component={ItemStore} />
<Route path='/colecao' component={FormationMaterialPage} />
<Route path='/topico' component={FormationMaterialPage} />
<Route path='/iframe-colecao' component={FormationMaterialIframe} />
</Switch>
{ !hideFooter &&
<div>
<EcFooter/>
<GNUAGPLfooter/>
</div>
}
</BrowserRouter>
)
}
/*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/>.*/
import React from 'react';
import styled from 'styled-components';
import colecoes_obj from '../Components/FormationMaterialsResources/formationMaterials.js';
export default function FormationMaterialIframe(props) {
const colecao = props.location.pathname == "/colecao";
const colecoes = colecoes_obj();
const colecao_id = Number(
colecao ?
props.location.search.split('=')[1]
: props.location.search.split('&')[0].split('=')[1]
);
const topico_id = Number(colecao ? 0 : props.location.search.split('&')[1].split('=')[1]);
const colecao_obj = ((id) => {
for (const c in colecoes) {
if (id == colecoes[c].id)
return colecoes[c];
}
})(colecao_id);
const topico_obj = ((id) => {
for (const t in colecao_obj.topics) {
if (id == colecao_obj.topics[t].id)
return colecao_obj.topics[t];
}
})(topico_id);
return (
<StyledIframe src={topico_obj.url}
/>
);
}
const StyledIframe=styled.iframe`
width: 98.vw;
height: 83.5vh;
min-height: 300px;
`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment