diff --git a/src/Components/Header.js b/src/Components/Header.js index fb6694789b140062df071775400608b9f8fbf4a3..329e455e9692552e6e6f93d27e34cc93ccadbc1e 100644 --- a/src/Components/Header.js +++ b/src/Components/Header.js @@ -60,7 +60,7 @@ export default function Header(props){ login: response.data.data } ) - + sessionStorage.setItem('@portalmec/id', response.data.data.id) sessionStorage.setItem('@portalmec/username', response.data.data.name) sessionStorage.setItem('@portalmec/uid', response.data.data.uid) @@ -147,7 +147,7 @@ export default function Header(props){ let windowWidth = window.innerWidth return ( - <React.Fragment style={{paddingTop : "10px"}}> + <React.Fragment> {/* windowWidth > 990 && <AcessibilityBar/> diff --git a/src/Components/MenuBar.js b/src/Components/MenuBar.js index 35b3fecf5f4dc01dc16710e040a015f7be07dc1d..c86d680dee985506328109d6e6ae94292e029c2e 100644 --- a/src/Components/MenuBar.js +++ b/src/Components/MenuBar.js @@ -98,7 +98,7 @@ export const ButtonPubRecursoStyled = styled(Button)` export default function MenuBar(props){ - const { state, dispatch } = useContext(Store) + const { state } = useContext(Store) const menuSobre = [ { name: "Sobre a Plataforma", href: "sobre" }, @@ -144,7 +144,7 @@ export default function MenuBar(props){ ? ( <> <div style={{boxSizing:"border-box"}}> - <Link to="/termos-publicar-recurso" cameFromPublishButton={true}> + <Link to="/termos-publicar-recurso"> <ButtonPublicarRecurso> <CloudUploadIcon style={{color:"white", marginLeft : "0"}}/> <span style={{color : "#fff", textAlign: "center", alignSelf : "center", fontWeight:"500"}} > diff --git a/src/Components/MenuList.js b/src/Components/MenuList.js index 6236239d8809005fd81d79cc0593fc8a3d9a8a64..08b98c5a770610790ace06b2309a49183186d0dd 100644 --- a/src/Components/MenuList.js +++ b/src/Components/MenuList.js @@ -127,7 +127,7 @@ export default function MenuList(props) { <Link to={{ pathname : item.href, state : item.value - }} style={{textDecoration:"none"}} key={item.value}><MenuItem style= {{fontSize:"14px", padding:"5px 20px", color:"#666"}}>{item.name}</MenuItem></Link> + }} style={{textDecoration:"none"}} key={item.value}><MenuItem style= {{fontSize:"14px", padding:"5px 20px", color:"#666"}} key={item.value}>{item.name}</MenuItem></Link> ) } <StyledButtonSair onClick={handleLogout}> <StyledMenuItem disableGutters={true}>Sair<StyledExitToAppIcon/></StyledMenuItem></StyledButtonSair> diff --git a/src/Components/ReportColecaoForm.js b/src/Components/ReportColecaoForm.js index fcea00e793912b73c072b2b146a33d809be9402c..a64164eb04fbc3e8aa7bdff9f9ce4e19dc0439aa 100644 --- a/src/Components/ReportColecaoForm.js +++ b/src/Components/ReportColecaoForm.js @@ -15,7 +15,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} from 'react'; +import React from 'react'; import { Button } from '@material-ui/core'; import styled from 'styled-components' import Radio from '@material-ui/core/Radio'; diff --git a/src/Components/ReportCollectionForm.js b/src/Components/ReportCollectionForm.js index 0832b014c1a6bd9314eccbce7fd712918f33ed26..34fd87b2417016fa80fc43bce90300242a764901 100644 --- a/src/Components/ReportCollectionForm.js +++ b/src/Components/ReportCollectionForm.js @@ -15,7 +15,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} from 'react'; +import React from 'react'; import { Button } from '@material-ui/core'; import styled from 'styled-components' import Radio from '@material-ui/core/Radio'; @@ -101,4 +101,3 @@ export default function ReportRecursoForm (props) { </form> ) } - diff --git a/src/Components/ReportRecursoForm.js b/src/Components/ReportRecursoForm.js index 66704bde8cda4ddad3c60c4aaf3ecd22e74760f8..d6c2a70b9429ab08ecefb8257dade87bdf152264 100644 --- a/src/Components/ReportRecursoForm.js +++ b/src/Components/ReportRecursoForm.js @@ -15,7 +15,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} from 'react'; +import React from 'react'; import { Button } from '@material-ui/core'; import styled from 'styled-components' import Radio from '@material-ui/core/Radio'; diff --git a/src/Components/StoreGuide.js b/src/Components/StoreGuide.js index a4b0f509b11a3c8ab590e397c1fe07e9ba616c5c..3d9ca95a54437548d1d18f01dfabe7a0a12c738e 100644 --- a/src/Components/StoreGuide.js +++ b/src/Components/StoreGuide.js @@ -15,7 +15,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, {useState, useContext} from 'react'; +import React from 'react'; import styled from 'styled-components'; import Grid from '@material-ui/core/Grid'; import Card from '@material-ui/core/Card'; @@ -68,7 +68,7 @@ export default function ItemStoreContainer (props) { As seções da loja dividem os itens por <strong>categoria</strong>. <ul> <li> - Itens adquiridos <strong>somente por conquistas</strong> não aparecem + Itens adquiridos <strong>somente por conquistas</strong> não aparecem na loja (exceto pelos que você já tem); </li> <li> diff --git a/src/Components/TabPanels/UserPageTabs/ModalExcluirConta.js b/src/Components/TabPanels/UserPageTabs/ModalExcluirConta.js index 43ff66284eca688e2582703fa8c988bcb6798027..05c08553ec5aa93fbc965266cf89dacf0f59bbd0 100644 --- a/src/Components/TabPanels/UserPageTabs/ModalExcluirConta.js +++ b/src/Components/TabPanels/UserPageTabs/ModalExcluirConta.js @@ -124,7 +124,7 @@ export default function ModalExcluirConta (props) { handleChange={e => handleChange(e)} required={true} error = {formEmail.key} - help = {formEmail.key ? ( formEmail.value.length == 0 ? "Faltou preencher seu e-mail." : "O e-mail deve ser o mesmo no qual você cadastrou esta conta") : ""} + help = {formEmail.key ? ( formEmail.value.length === 0 ? "Faltou preencher seu e-mail." : "O e-mail deve ser o mesmo no qual você cadastrou esta conta") : ""} /> <div style={{display : "flex", flexDirection : "row", justifyContent : "space-evenly", paddingTop : "15px"}}> <GreyButton callback={props.handleClose} text={"Cancelar"}/> diff --git a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js index 7e7b7b00cbebbe058420cdbb184d808920c2c7cf..3f3632dd609ec9598fc0ab201a81f872ca060d85 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js +++ b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js @@ -27,6 +27,7 @@ import Bolo from '../../../img/Bolo.png' import LoadingSpinner from '../../LoadingSpinner.js' import ActivityListItem from '../../ActivityListItem.js' import List from '@material-ui/core/List'; +import {getAxiosConfig} from '../../HelperFunctions/getAxiosConfig.js' export default function TabPanelAtividades (props) { const [loading, handleLoading] = useState(true) @@ -41,22 +42,22 @@ export default function TabPanelAtividades (props) { } useEffect( () => { - axios.get(`${apiUrl}/feed?offset=0&limit=30`, props.config) + let config = getAxiosConfig() + + axios.get(`${apiUrl}/feed?offset=0&limit=30`, config) .then( (response) => { if ( response.headers['access-token'] ) { sessionStorage.setItem('@portalmec/accessToken', response.headers['access-token']) } - console.log('atividades response: ', response) setNotifications(response.data) setNotificationsSlice(response.data.slice(0,30)) setLength(response.data.length) - handleLoading(false) }, (error) => { - console.log('error while running getNotifications') + console.log(error) } ) }, []) @@ -85,7 +86,7 @@ export default function TabPanelAtividades (props) { { notificatonsLength == 0 ? ( - [ + <NoNotificationsDiv> <div> <div> @@ -99,11 +100,11 @@ export default function TabPanelAtividades (props) { </p> </div> </NoNotificationsDiv> - ] + ) : ( - [ <> + <> <List height={400} width={300}> { notificationsSlice.map( (notification) => @@ -125,7 +126,6 @@ export default function TabPanelAtividades (props) { <LoadMoreButton onClick={() => {showMore(20)}}><span>CARREGAR MAIS 20</span></LoadMoreButton> <span style={{fontSize:"14px", color : "#666"}}>Mostrando {notificationsSlice.length} de {notificatonsLength}</span> </> - ] ) } </div> diff --git a/src/Components/UserCardGamified.js b/src/Components/UserCardGamified.js index 711b9ee433f6a13fcb6f6cbea4c120d8c5793233..701092103949ec94cd529977d44b2396205e7fae 100644 --- a/src/Components/UserCardGamified.js +++ b/src/Components/UserCardGamified.js @@ -15,7 +15,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, {useState, useContext} from 'react'; +import React from 'react'; import styled from 'styled-components'; import Grid from '@material-ui/core/Grid'; import Card from '@material-ui/core/Card'; diff --git a/src/Components/UserPageComponents/SubmitterStatus.js b/src/Components/UserPageComponents/SubmitterStatus.js index 47924373223205e9a81575cc957fbb4f371bce34..435b369560774f2342c7a8ec1676564d2ae3f1db 100644 --- a/src/Components/UserPageComponents/SubmitterStatus.js +++ b/src/Components/UserPageComponents/SubmitterStatus.js @@ -39,7 +39,7 @@ export default function SubmitterStatus (props) { <p style={{fontSize:"15px", lineHeight:"22px", textAlign:"left", margin:"0 0 10px"}}> <span style={{cursor:"pointer"}}> <span style={{paddingRight:"5px"}}> - <img src={CheckDecagram}/> + <img src={CheckDecagram} alt='check icon'/> </span> {text} <span style={{color:"#00bcd4"}}> SAIBA MAIS</span> diff --git a/src/Pages/Accessibility.js b/src/Pages/Accessibility.js index ff57fd98b3f5d3f546dfa3018f28b6f0478b32d2..4f10f78403c02603b95d1d6355fd9c25a3333df8 100644 --- a/src/Pages/Accessibility.js +++ b/src/Pages/Accessibility.js @@ -15,7 +15,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, {useState, useContext} from 'react'; +import React from 'react'; import styled from 'styled-components' import { Link } from "react-router-dom"; import Breadcrumbs from "@material-ui/core/Breadcrumbs"; diff --git a/src/Pages/SiteMap.js b/src/Pages/SiteMap.js index 13d6eb97e97a57234e4a7f452c264ba5995b3392..492d885c0013422940f28347fed261584f82977d 100644 --- a/src/Pages/SiteMap.js +++ b/src/Pages/SiteMap.js @@ -15,7 +15,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, {useState, useContext} from 'react'; +import React from 'react'; import styled from 'styled-components' import { Link } from "react-router-dom"; import Breadcrumbs from "@material-ui/core/Breadcrumbs"; @@ -98,7 +98,7 @@ const StyledBreadCrumbs = styled(Breadcrumbs)` export default function SiteMap (props) { return ( <div style={{ padding:"0 0 30px 0",backgroundColor :"#f4f4f4"}}> - + <div style={breadCrumbs}> <StyledBreadCrumbs> <Link to="/">Página Inicial</Link> @@ -126,7 +126,7 @@ export default function SiteMap (props) { style={item} to={{ pathname: "plataforma-mec", - + state: { value: "0" } }} > O que é a Plataforma MEC</Link> @@ -138,7 +138,7 @@ export default function SiteMap (props) { }} > Publicando Recurso </Link> - + <Link style={item} to={{ @@ -151,7 +151,7 @@ export default function SiteMap (props) { style={item} to={{ pathname: "/participando-da-rede", - + state: { value: "0" } }} > Participando da Rede @@ -160,7 +160,7 @@ export default function SiteMap (props) { style={item} to={{ pathname: "gerenciando-conta", - + state: { value: "0" } }} > Gerenciando a conta @@ -183,6 +183,6 @@ export default function SiteMap (props) { </div> </div> </div> - </div> + </div> ); } diff --git a/src/Pages/UserPage.js b/src/Pages/UserPage.js index d8eecc53d6352a4761d5d3d6ef01f628508fafbe..3e50ca2a57390a80cb912233f05dbd0072e5bfd9 100644 --- a/src/Pages/UserPage.js +++ b/src/Pages/UserPage.js @@ -40,6 +40,7 @@ import ProfileAvatar from '../Components/UserPageComponents/Avatar.js' import UserInfo from '../Components/UserPageComponents/UserInfo.js' import EditProfileButton from '../Components/UserPageComponents/EditProfileButton.js' import SubmitterStatus from '../Components/UserPageComponents/SubmitterStatus.js' +import {getAxiosConfig} from '../Components/HelperFunctions/getAxiosConfig.js' const GetHeaderConfig = () => { @@ -72,31 +73,31 @@ export default function UserPage (props){ } useEffect( () => { + let config = getAxiosConfig() if (id != '') { - axios.get( (`${apiUrl}/users/` + id), { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Host': 'api.portalmec.c3sl.ufpr.br', - 'Cookie': '' - }) - .then( (response) => { - console.log(response) - dispatch ( { - type: 'GET_USER', - user: response.data + axios.get( (`${apiUrl}/users/` + id), config) + .then( (response) => { + console.log(response) + dispatch ( { + type: 'GET_USER', + user: response.data + } + ) + + if((response.data.role_ids.includes(4))) { + setTabs([ + 'Atividades', 'Meus Recursos', 'Favoritos', 'Coleções', 'Rede', 'Curadoria' + ]) } - ) + }).catch( (error) => { + if (error.statusText === 401) { + console.log('erro 401') + //validate Token - if((response.data.role_ids.includes(4))) { - setTabs([ - 'Atividades', 'Meus Recursos', 'Favoritos', 'Coleções', 'Rede', 'Curadoria' - ]) - } - }, - (error) => { - console.log('error while running ComponentDidMout') - } - )} + //retry request + } + }) + } }, []) const redirect = () => {