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/>.*/
Vinícius de Lima Gonçalves
committed
import { Link } from 'react-router-dom'
import { Container } from 'react-grid-system'
import logo from '../img/logo_small.svg'
Vinícius de Lima Gonçalves
committed
import Dropdown from './Dropdown';
import { Button } from '@material-ui/core';
import IconSearch from '@material-ui/icons/Search'

Lucas Eduardo Schoenfelder
committed
import ExitToAppIcon from '@material-ui/icons/ExitToApp'
Vinícius de Lima Gonçalves
committed
import styled from 'styled-components'

Lucas Eduardo Schoenfelder
committed
import { Store } from '../Store';
import CloudUploadIcon from '@material-ui/icons/CloudUpload';
import Notifications from "./Notifications.js"
Vinícius de Lima Gonçalves
committed
const ContainerStyled = styled(Container)`
*{ text-decoration: none }
display: flex;
align-items: center;
border-top: 1px rgba(0,0,0,.1) solid;
padding: 5px;

Lucas Eduardo Schoenfelder
committed
padding-top : 10px;
Vinícius de Lima Gonçalves
committed
`
Vinícius de Lima Gonçalves
committed
text-transform: capitalize !important;
margin : 0 8px !important;
font-weight : normal !important;
color: ${props => props.contrast === "" ? "black !important" : "yellow !important"};
text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"};
Vinícius de Lima Gonçalves
committed
`

Lucas Eduardo Schoenfelder
committed
const ButtonPublicarRecurso = styled(Button)`
font-family : 'Roboto', sans serif;
box-shadow : none !important;
border: ${props => props.contrast === '' ? "1px transparent solid" : "1px white solid !important"};
background-color: ${(props) => props.contrast === "" ? "#ff7f00 !important" : "black !important"};
color: white !important;

Lucas Eduardo Schoenfelder
committed
align-content : center;

Lucas Eduardo Schoenfelder
committed
font-weight : 500 !important;

Lucas Eduardo Schoenfelder
committed
text-transform: capitalize !important;
font-stretch : expanded;
max-width: 200 !important;
background-color: ${(props) => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"};
.MuiSvgIcon-root {
vertical-align : middle !important;
margin-right : 5px !important;
}

Lucas Eduardo Schoenfelder
committed
`
Vinícius de Lima Gonçalves
committed
const IconSearchStyled = styled(IconSearch)`
color: ${props => props.contrast === "" ? "#16b8dd !important" : "white !important"};
Vinícius de Lima Gonçalves
committed
`
const ImageStyled = styled.img`
height: 50px;
width: auto;
cursor: pointer;
margin: 0 10px;
`

Lucas Eduardo Schoenfelder
committed
const Right = styled.span`
width: 100%;
display: inline-flex;
align-items: center;
justify-content: flex-end;
margin-right : 10px;
`

Lucas Eduardo Schoenfelder
committed
width: 100%;
display: inline-flex;
align-items: center;
`
export const ButtonPubRecursoStyled = styled(Button)`

Lucas Eduardo Schoenfelder
committed
font-weight : 500 !important;

Lucas Eduardo Schoenfelder
committed
box-shadow: none;
margin : 0 8px !important;
font-weight : normal !important;
:hover {
background-color: ${(props) =>
props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"};
}

Lucas Eduardo Schoenfelder
committed
`

Lucas Eduardo Schoenfelder
committed
const { state } = useContext(Store)

Lucas Eduardo Schoenfelder
committed
const buildMyAreaTabs = () => {
const minhaArea = [
{ name: "Perfil e Atividades", href: "/perfil", value: '0' },
{ name: "Recursos Publicados", href: "/perfil", value: '1' },
{ name: "Favoritos", href: "/perfil", value: '2' },
{ name: "Coleções", href: "/perfil", value: '3' },
{ name: "Rede", href: "/perfil", value: '4' },
{ name: "Configurações", href: "/editarperfil", value: '5' },
if (state.currentUser.roles) {
let canUserAdmin = false;
let index = 0;
const userRoles = [...state.currentUser.roles]
while (!canUserAdmin && index < userRoles.length) {
if (userRoles[index].id === 3 || userRoles[index].id === 7)
name: "Administrador",
href: "/admin/home",
const canUserCurator = (elem) => elem.id === 4
if (userRoles.some(canUserCurator))
minhaArea.push({
name: "Curadoria",
href: "/perfil",
value: '5',
})
Vinícius de Lima Gonçalves
committed
const menuSobre = [
{ name: "Sobre a Plataforma", href: "/sobre" },
{ name: "Portais Parceiros", href: "/sobre#portaisparceiros" },
{ name: "Termos de Uso", href: "/termos" },
{ name: "Contato", href: "/contato" }
Vinícius de Lima Gonçalves
committed
]
Vinícius de Lima Gonçalves
committed
const menuAjuda = [
{ name: "Central de Ajuda", href: "/ajuda" },
{ name: "Publicando Recursos", href: "/publicando-recurso" },
{ name: "Encontrando Recursos", href: "/encontrando-recurso" },
{ name: "Participando da Rede", href: "/participando-da-rede" },
{ name: "Gerenciando a Conta", href: "/gerenciando-conta" }
Vinícius de Lima Gonçalves
committed
]

Lucas Eduardo Schoenfelder
committed
<ContainerStyled fluid={true} className={`${state.contrast}BackColor`}>

Lucas Eduardo Schoenfelder
committed
<Left>
<Link to="/"> <ImageStyled src={logo} alt="Plataforma Integrada" /> </Link>
<Dropdown name="Sobre" items={menuSobre} />
<Dropdown name="Ajuda" items={menuAjuda} />

Lucas Eduardo Schoenfelder
committed
<a href="http://educacaoconectada.mec.gov.br/" rel="noopener noreferrer" target="_blank" >
<ButtonStyled contrast={state.contrast} >Educação Conectada</ButtonStyled>
<ButtonStyled contrast={state.contrast} onClick={props.openSearchBar} ><IconSearchStyled contrast={state.contrast}/>Buscar</ButtonStyled>

Lucas Eduardo Schoenfelder
committed
{

Lucas Eduardo Schoenfelder
committed
? (
<>
<div style={{ boxSizing: "border-box" }}>
<Link to="/termos-publicar-recurso">
<ButtonPublicarRecurso contrast={state.contrast} className={`${state.contrast}LinkColor`}>
<CloudUploadIcon className={`${state.contrast}IconColor`} style={{ marginLeft: "0" }} />
<span style={{textAlign: "center", alignSelf: "center", fontWeight: "500" }} >

Lucas Eduardo Schoenfelder
committed

Lucas Eduardo Schoenfelder
committed

Lucas Eduardo Schoenfelder
committed
)
: (
<ButtonPubRecursoStyled contrast={state.contrast} className={`${state.contrast}LinkColor ${state.contrast}Border`} onClick={props.openLogin}>PUBLICAR RECURSO?</ButtonPubRecursoStyled>
<ButtonStyled contrast={state.contrast} className={`${state.contrast}LinkColor`} onClick={props.openLogin}><ExitToAppIcon className={`${state.contrast}IconColor`} style={{ color: "#00bcd4" }} />Entrar</ButtonStyled>
<ButtonStyled contrast={state.contrast} className={`${state.contrast}LinkColor`} onClick={props.openSignUp}>Cadastre-<span style={{ textTransform: 'lowercase' }}>se</span></ButtonStyled>

Lucas Eduardo Schoenfelder
committed
)
}
Vinícius de Lima Gonçalves
committed
</ContainerStyled>
);