diff --git a/public/index.html b/public/index.html index a990c797fd83682f7876e6c3270c4c4e947ef868..a3e4855ea2b3e65055ba0906ea82a58f7f94a7bd 100755 --- a/public/index.html +++ b/public/index.html @@ -1,3 +1,3 @@ -<!-- 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/>. --> <!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="utf-8" /> <!-- google sign-in --> <meta name="google-signin-client_id" content="288460085642-k4veg4fo8kddvjer8b055n9da5qtgha7.apps.googleusercontent.com"> <script src="https://apis.google.com/js/platform.js" async defer></script> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Portal MEC</title> </head> <body > <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"/> </body> </html> +<!-- 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/. --> <!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="utf-8" /> <meta http-equiv='cache-control' content='no-cache'/> <meta http-equiv='expires' content='0'/> <meta http-equiv='pragma' content='no-cache'/> <!-- google sign-in --> <meta name="google-signin-client_id" content="288460085642-k4veg4fo8kddvjer8b055n9da5qtgha7.apps.googleusercontent.com"> <script src="https://apis.google.com/js/platform.js" async defer></script> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Portal MEC</title> </head> <body > <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"/> </body> </html> \ No newline at end of file diff --git a/src/Components/AreasSubPagesFunction.js b/src/Components/AreasSubPagesFunction.js index 5a2aa3b94c81a92f99c949b5474703a724519d8d..f08832691ff2fc7d21160c18b362a4d7cfd6344d 100644 --- a/src/Components/AreasSubPagesFunction.js +++ b/src/Components/AreasSubPagesFunction.js @@ -86,7 +86,7 @@ function ReqResources(props) { { rows.length >= 1 ? rows.map((row, index) => ( - <Row style={{ paddingBottom: "5px", margin: '0 auto', width: "80%", justifyContent: "center" }} key={(index + 1)}> + <Row style={{ paddingBottom: "5px", margin: '0 auto', width: "80%", justifyContent: "center", minHeight: "50px" }} key={(index + 1)}> {row.map((card) => ( <div style={{ marginLeft: 10, display: 'flex' }} key={card.id * (index + 1)}> <ResourceCardFunction @@ -153,7 +153,7 @@ function ReqCollections(props) { <Carousel showThumbs={false} infiniteLoop={true} showStatus={false}> { rows.map((row, index) => ( - <Row style={{ paddingBottom: "5px", margin: '0 auto', width: "80%", justifyContent: "center" }} key={(index + 1)}> + <Row style={{ paddingBottom: "5px", margin: '0 auto', width: "80%", justifyContent: "center", minHeight: "50px" }} key={(index + 1)}> {row.map((card) => ( <div style={{ marginLeft: 10, display: 'flex' }} key={card.id * (index + 1)}> <CollectionCardFunction @@ -223,7 +223,7 @@ function TabRecurso() { { window.innerWidth <= 501 && <div style={{ display: "flex", justifyContent: "center" }}> - <Link to={`/busca?query=&search_class=LearningObject`} className="button-ver">VER RECURSOS</Link> + <Link to={`/busca?query=*&search_class=LearningObject`} className="button-ver">VER RECURSOS</Link> </div> } </StyledTab> @@ -320,7 +320,7 @@ function TabColecoes() { { window.innerWidth <= 501 && <div style={{ display: "flex", justifyContent: "center" }}> - <Link to={`/busca?query=&search_class=Collection`} className="button-ver">VER COLEÇÕES</Link> + <Link to={`/busca?query=*&search_class=Collection`} className="button-ver">VER COLEÇÕES</Link> </div> } </StyledTab> diff --git a/src/Components/CollectionDowloadButton.js b/src/Components/CollectionDowloadButton.js index f36eed118e3771b92e2117883d5dd8977cefd91f..d7820da26c20262c585c60eff2723a2d5bc78b52 100644 --- a/src/Components/CollectionDowloadButton.js +++ b/src/Components/CollectionDowloadButton.js @@ -4,6 +4,7 @@ import GetAppIcon from '@material-ui/icons/GetApp'; import Button from '@material-ui/core/Button'; import styled from 'styled-components'; import { apiUrl, apiDomain } from '../env'; +import { getRequest } from './HelperFunctions/getAxiosConfig' const DowloadButton = (props) => { @@ -23,6 +24,19 @@ const DowloadButton = (props) => { } }); }, [props.id]); + + const handleDowloadCollection = () => { + // there is no error controller here because the router + ///:type/:id/download is always returning error + getRequest( + `/collections/${props.id}/download`, + (data, header) => { + }, + (error) => { + } + ) + } + return ( <> <DownloadAnchor href={download_url} > @@ -32,9 +46,9 @@ const DowloadButton = (props) => { startIcon={<GetAppIcon fontSize="large" />} size="small" > - <ButtonText>Baixar Coleção</ButtonText> + <ButtonText onClick={handleDowloadCollection}>Baixar Coleção</ButtonText> </DownloadButton> - </DownloadAnchor> + </DownloadAnchor> </> ) } diff --git a/src/Components/CollectionReview.js b/src/Components/CollectionReview.js index 10cc202c3ff6f3908aeb09c7d0d4fb567505fddb..c9dc801016a770dd65acd4378c9db395b6c4d945 100644 --- a/src/Components/CollectionReview.js +++ b/src/Components/CollectionReview.js @@ -27,7 +27,7 @@ import { Store } from '../Store.js' import ReportModal from './ReportModal.js'; import SignUpModal from './SignUpModal.js'; import LoginModal from './LoginModal.js'; -import {putRequest, getRequest} from './HelperFunctions/getAxiosConfig.js' +import { putRequest, getRequest } from './HelperFunctions/getAxiosConfig.js' export default function CollectionReview(props) { const [likes, setLikes] = useState(0); @@ -38,31 +38,31 @@ export default function CollectionReview(props) { const [log_in_open, setLoginOpen] = useState(false); const { state } = useContext(Store); - function handleSuccessfulGet (data) { - setLikes(Number(data.likes_count)); - setLiked(data.liked); - } + function handleSuccessfulGet(data) { + setLikes(Number(data.likes_count)); + setLiked(data.liked); + } useEffect(() => { - const url = `/collections/${props.id}` + const url = `/collections/${props.id}` - getRequest(url, handleSuccessfulGet, (error) => {console.log(error)}) + getRequest(url, handleSuccessfulGet, (error) => { console.log(error) }) - }, [props.id]); + }, [props.id, state.currentUser.id]); const handleClickReport = () => { setReportOpen(true); } - function handleSuccess (data) { - setLiked(!liked) - setLikes(data.count) - } + function handleSuccess(data) { + setLiked(!liked) + setLikes(data.count) + } const handleLikeClick = () => { if (state.currentUser.id) { - const url = `/collections/${props.id}/like` - putRequest(url, {}, handleSuccess, (error) => {console.log(error)}) + const url = `/collections/${props.id}/like` + putRequest(url, {}, handleSuccess, (error) => { console.log(error) }) } else setSignUpOpen(true); } @@ -91,7 +91,7 @@ export default function CollectionReview(props) { </Grid> <Grid item justify="center" alignItems="center"> <IconButton aria-label="like" onClick={handleLikeClick}> - {likes}<FavoriteIcon style={{fill : liked ? "red" : null}} /> + {likes}<FavoriteIcon style={{ fill: liked ? "red" : null }} /> </IconButton> </Grid> </Grid> diff --git a/src/Components/ExpansionPanels.js b/src/Components/ExpansionPanels.js index 9a242d21a3b8616c70c6ed7b419f24e133194aec..017816eb2c4160545b7b9597c206a28eec9b3b1d 100644 --- a/src/Components/ExpansionPanels.js +++ b/src/Components/ExpansionPanels.js @@ -182,7 +182,7 @@ export default function SimpleExpansionPanel() { <h6 style={{fontSize:"18px",marginBlock: "10px"}}>3.2 É vedado ao usuário:</h6> <ul> <li> - <p>Transmitir, exibir, enviar, ou de qualquer outra forma, disponibilizar conteúdo que contenha material pornográfico e/ou atividades ilegais relativas a menores de 18 anos (consoante o <AColorido href="http://www.planalto.gov.br/ccivil_03/leis/L8069.htm" target="_blank">Estatuto da Criança e do Adolescente</AColorido>), que invada a privacidade de terceiros, que tenha cunho comercial, viole os <AColorido href="http://www.onu.org.br/img/2014/09/DUDH.pdf" target="_blank">Direitos Humanos</AColorido> ou seja ilegal, ofensivo, ameaçador, que incite a violência, seja vulgar, preconceituoso ou racista (como descrito nos artigos 138-140 do Código Penal Brasileiro), ou de qualquer forma seja contrário às cláusulas destes Termos de Uso;</p> + <p>Transmitir, exibir, enviar, ou de qualquer outra forma, disponibilizar conteúdo que contenha material pornográfico e/ou atividades ilegais relativas a menores de 18 anos (consoante o <AColorido href="http://www.planalto.gov.br/ccivil_03/leis/L8069.htm" target="_blank">Estatuto da Criança e do Adolescente</AColorido>), que invada a privacidade de terceiros, que tenha cunho comercial, viole os <AColorido href="https://www.ohchr.org/EN/UDHR/Pages/Language.aspx?LangID=por" target="_blank">Direitos Humanos</AColorido> ou seja ilegal, ofensivo, ameaçador, que incite a violência, seja vulgar, preconceituoso ou racista (como descrito nos artigos 138-140 do Código Penal Brasileiro), ou de qualquer forma seja contrário às cláusulas destes Termos de Uso;</p> </li> <li> <p>Assumir a identidade de outra pessoa, física ou jurídica; forjar cabeçalhos, ou de qualquer outra forma manipular identificadores, a fim de disfarçar a origem de qualquer material contido na plataforma, com sentido de desmoralizar, desprestigiar ou se fazer passar pela <strong>Plataforma Integrada de RED do MEC</strong>;</p> diff --git a/src/Components/FollowCollectionButton.js b/src/Components/FollowCollectionButton.js index be01ad44329cfe45b7ca167a4111d721cd8f7e7a..974a56fd3492cf7440b46679794fb061ea237e7a 100644 --- a/src/Components/FollowCollectionButton.js +++ b/src/Components/FollowCollectionButton.js @@ -16,37 +16,77 @@ 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, useEffect } from 'react'; +import React, { useState, useEffect, useContext } from 'react'; import Button from '@material-ui/core/Button'; import CheckIcon from '@material-ui/icons/Check'; import AddIcon from '@material-ui/icons/Add'; import styled from 'styled-components'; import SignUpModal from './SignUpModal.js'; -import {getRequest, putRequest} from './HelperFunctions/getAxiosConfig' +import LoginModal from './LoginModal'; +import SnackBarComponent from './SnackbarComponent'; +import { getRequest, putRequest } from './HelperFunctions/getAxiosConfig' +import { Store } from '../Store' export default function FollowCollectionButton(props) { + const { state } = useContext(Store) const [icon, setIcon] = useState(<AddIcon fontSize="large" />); const [button_text, setButtonText] = useState("Seguir Coleção"); const [variant, setVariant] = useState("outlined"); const [sign_up_open, setSignUpOpen] = useState(false); + const [open_login, setOpenLogin] = useState(false); + const [snackInfo, setSnackInfo] = useState({ + open: false, + text: '', + severity: '', + color: '' + }); const [following, setFollowing] = useState(false); //user following collection - function handleSuccessGet (data) { - if(data) - data.map((e) => { - if (e["followable"]["id"] === Number(props.collection_id)){ - setVariant("contained"); - setButtonText("Seguindo"); - setIcon(<CheckIcon fontSize="large" />) - setFollowing(true); - } - return undefined - }) - } + function handleSuccessGet(data) { + if (!data.errors) + data.map((e) => { + if (e["followable"]["id"] === Number(props.collection_id)) { + setVariant("contained"); + setButtonText("Seguindo"); + setIcon(<CheckIcon fontSize="large" />) + setFollowing(true); + } + return undefined + }) + else { + const info = { + open: true, + text: 'Falha ao verificar se o usuário segue a coleção!', + severity: 'error', + color: 'red' + } + + handleSnackInfo(info) + } + } useEffect(() => { - const url = `/users/${props.user_id}/following/Collection` - getRequest(url, handleSuccessGet, (error) => console.log(error)) - }, []); + if (state.currentUser.id) { + const url = `/users/${props.user_id}/following/Collection` + getRequest( + url, + handleSuccessGet, + (error) => { + const info = { + open: true, + text: 'Falha ao verificar se o usuário segue a coleção!', + severity: 'error', + color: 'red' + } + handleSnackInfo(info) + }) + } + else { + setIcon(<AddIcon fontSize="large" />) + setButtonText("Seguir Coleção") + setVariant("outlined") + setFollowing(false) + } + }, [state.currentUser.id]); //handleMouse{Enter, Leave} only do anything when user follows given collection: const handleMouseEnter = () => { @@ -65,33 +105,120 @@ export default function FollowCollectionButton(props) { } } - function handleSuccessfulFollow (data) { - setVariant("contained"); - setButtonText("Seguindo"); - setIcon(<CheckIcon fontSize="large" />) - setFollowing(true); - } - function handleSuccessfulUnfollow (data) { - setVariant("outlined"); - setButtonText("Seguir Coleção"); - setIcon(<AddIcon fontSize="large" />); - setFollowing(false); - } + function handleOpenSnackSignIn() { + const info = { + open: true, + text: 'Você foi logado com sucesso!', + severity: 'success', + color: '', + } + + handleSnackInfo(info) + } + + function handleCloseSnack() { + setSnackInfo({ + open: false, + text: '', + severity: '', + color: '', + }) + } + + function handleSnackInfo(info) { + setSnackInfo({ + ...info + }) + } + + function handleOpenLogin() { + setOpenLogin(true) + } + + function handleOpenSignUp() { + setSignUpOpen(true) + } + + function handleSuccessfulFollow(data) { + if (data.errors) { + setVariant("contained"); + handleFailFollow() + } + else { + const info = { + open: true, + text: 'Sucesso ao seguir a coleção!', + severity: 'success', + color: 'green' + } + handleSnackInfo(info) + setVariant("contained"); + setButtonText("Seguindo"); + setIcon(<CheckIcon fontSize="large" />) + setFollowing(true); + } + } + + function handleFailFollow(err) { + const info = { + open: true, + text: 'Falha ao seguir coleção', + severity: 'fail', + color: 'red', + } + handleSnackInfo(info) + } + + function handleSuccessfulUnfollow(data) { + if (data.errors) + handleFailUnfollow() + else { + const info = { + open: true, + text: 'Sucesso ao deixar de seguir a coleção!', + severity: 'success', + color: 'green' + } + handleSnackInfo(info) + setVariant("outlined"); + setButtonText("Seguir Coleção"); + setIcon(<AddIcon fontSize="large" />); + setFollowing(false); + } + } + + function handleFailUnfollow(err) { + const info = { + open: true, + text: 'Falha ao deixar de seguir coleção', + severity: 'error', + color: 'red', + } + handleSnackInfo(info) + } + const handleClick = () => { - const url = `/collections/${props.collection_id}/follow` + const url = `/collections/${props.collection_id}/follow` if (!props.user_id) setSignUpOpen(true); else if (!following) { - putRequest(url, {}, handleSuccessfulFollow, (error) => {console.log(error)}) + putRequest(url, {}, handleSuccessfulFollow, handleFailFollow) } else { - putRequest(url, {}, handleSuccessfulUnfollow, (error) => {console.log(error)}) + putRequest(url, {}, handleSuccessfulUnfollow, handleFailUnfollow) } }; if (!props.user_is_owner) return ( <div> + <SnackBarComponent + snackbarOpen={snackInfo.open} + handleClose={handleCloseSnack} + severity={snackInfo.severity} + text={snackInfo.text} + color={snackInfo.color} + /> <FollowButton variant={variant} color="primary" @@ -103,7 +230,17 @@ export default function FollowCollectionButton(props) { > <ButtonText>{button_text}</ButtonText> </FollowButton> - <SignUpModal open={sign_up_open} handleClose={() => setSignUpOpen(false)} /> + <SignUpModal + open={sign_up_open} + handleClose={() => setSignUpOpen(false)} + openLogin={handleOpenLogin} + /> + <LoginModal + openSnackbar={handleOpenSnackSignIn} + open={open_login} + handleClose={() => setOpenLogin(false)} + openSignUp={handleOpenSignUp} + /> </div> ); else return (<div></div>); diff --git a/src/Components/HelperFunctions/getAxiosConfig.js b/src/Components/HelperFunctions/getAxiosConfig.js index 15a461129312976a379c9c5e81a16da611b611b1..aa645cc9c86714f5cbbdf3439cbad7ab6f190db6 100644 --- a/src/Components/HelperFunctions/getAxiosConfig.js +++ b/src/Components/HelperFunctions/getAxiosConfig.js @@ -12,6 +12,15 @@ export function updateHeaders (newHeaders) { sessionStorage.setItem('@portalmec/accessToken', newHeaders['access-token']) let auth_headers = JSON.parse(sessionStorage.getItem('@portalmec/auth_headers')) + /*const auth_headers = { + client: newHeaders.get('client'), + "access-token": newHeaders.get('access-token'), + uid: newHeaders.get('uid'), + expiry: newHeaders.get('expiry'), + "token-type": "Bearer" + } + + sessionStorage.setItem('@portalmec/auth_headers', JSON.stringify(auth_headers))*/ if (auth_headers) { auth_headers['access-token'] = newHeaders['access-token'] } @@ -30,12 +39,20 @@ export function updateHeaders (newHeaders) { function fetchHeaders () { let auth_headers = JSON.parse(sessionStorage.getItem('@portalmec/auth_headers')) + var myHeaders = undefined if (auth_headers) { - const myHeaders = new Headers(auth_headers) + myHeaders = new Headers(auth_headers) + myHeaders.set('Cache-Control', 'no-cache, no-store, must-revalidate'); + myHeaders.set('Pragma', 'no-cache'); + myHeaders.set('Expires', '0'); return myHeaders } else { - return {} + myHeaders = new Headers() + myHeaders.set('Cache-Control', 'no-cache, no-store, must-revalidate'); + myHeaders.set('Pragma', 'no-cache'); + myHeaders.set('Expires', '0'); + return myHeaders } } @@ -83,10 +100,17 @@ export async function getRequest (url, onSuccess, onError) { headers : fetchHeaders() }) if (response.ok) { + /*if (response.headers.has('access-token')) { + updateHeaders(response.headers) + }*/ if (response.headers.has('access-token')) { updateAccessToken(response.headers.get('access-token')) } - + /*if (response.headers.has('client')) { + let auth_headers = JSON.parse(sessionStorage.getItem('@portalmec/auth_headers')) + auth_headers['client'] = response.headers.get('client') + sessionStorage.setItem('@portalmec/auth_headers', JSON.stringify(auth_headers)) + }*/ let json = await response.json() onSuccess(json, response.headers) } @@ -196,14 +220,21 @@ export async function fetchAllRequest (urls, onSuccess, onError) { headers : fetchHeaders() }))) - console.log(responses) var data = [] var headers = [] for (let res of responses) { + /*if (checkPreviousTokens(res.headers.get('access-token'))) { + updateHeaders(res.headers) + }*/ if (res.headers.has('access-token') && res.status !== 304) { updateAccessToken(res.headers.get('access-token')) } + /*if (res.headers.has('client')) { + let auth_headers = JSON.parse(sessionStorage.getItem('@portalmec/auth_headers')) + auth_headers['client'] = res.headers.get('client') + sessionStorage.setItem('@portalmec/auth_headers', JSON.stringify(auth_headers)) + }*/ let json = await res.json().catch(err => { return {}; }) diff --git a/src/Components/HomeScreenSearchBar.js b/src/Components/HomeScreenSearchBar.js index ed3b4cc1fc76e07b23a718476c35fd174ea71aed..4427eb29fc05fdf4405695a860e83c4c3917d092 100644 --- a/src/Components/HomeScreenSearchBar.js +++ b/src/Components/HomeScreenSearchBar.js @@ -25,7 +25,7 @@ import { Store } from '../Store'; import { List, ListItem, ListItemIcon, ListItemText, MenuItem, Button, TextField } from '@material-ui/core' import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown'; import SearchIcon from '@material-ui/icons/Search'; -import {Link} from 'react-router-dom' +/*import {Link} from 'react-router-dom'*/ export default function HomeScreenSearchBar (props) { const [ query, setQuery ] = useState("") @@ -94,8 +94,8 @@ export default function HomeScreenSearchBar (props) { return ( <StyledGrid container> + {goSearch && <Redirect to={`/busca?query=${state.search.query}&search_class=${state.search.class}`} />} <Grid item md={7} xs={12} className="first white"> - {goSearch && <Redirect to={`/busca?query=${state.search.query}&search_class=${state.search.class}`} />} <StyledTextField id="standard-search" placeholder="O que está buscando?" @@ -146,18 +146,16 @@ export default function HomeScreenSearchBar (props) { </Grid> <Grid item md={2} xs={12}> <div style={{height : "100%"}}> - <Link to={`/busca?query=${query}&search_class=${searchClass}`}> - <Button className="custom-button" style={{backgroundColor : options[selectedIndex].color, color : "#fff"}}> - { - WIDTH < 503 && - <span>Buscar</span> - } - <SearchIcon fontSize="large"/> - </Button> - </Link> + <Button onClick={handleKeyDown} className="custom-button" style={{backgroundColor : options[selectedIndex].color, color : "#fff"}}> + { + WIDTH < 503 && + <span>Buscar</span> + } + <SearchIcon fontSize="large"/> + </Button> </div> - </Grid> - </StyledGrid> + </Grid> + </StyledGrid> ) } diff --git a/src/Components/LoginModal.js b/src/Components/LoginModal.js index 3f3ea6976251726eef17ef39fa7ed454d1a58560..9ebce1910883371a5c81adb9f36c7166247adea5 100644 --- a/src/Components/LoginModal.js +++ b/src/Components/LoginModal.js @@ -100,8 +100,8 @@ export default function LoginModal (props){ > <Zoom in={props.open} style={{ transitionDelay :"0.2ms"}}> <LoginContainer handleClose={props.handleClose} - openSignUp={props.openSignUp} - handleLoginInfo={handleLoginInfo} + openSignUp={props.openSignUp} + handleLoginInfo={handleLoginInfo} /> </Zoom> </StyledLogin> diff --git a/src/Components/ModalAvaliarRecurso.js b/src/Components/ModalAvaliarRecurso.js index 71e0a37d95053eb414256d80cf4434448520b0ef..7795876d0203a82bac0c05ddbb531773b505c39e 100644 --- a/src/Components/ModalAvaliarRecurso.js +++ b/src/Components/ModalAvaliarRecurso.js @@ -162,8 +162,8 @@ export default function ModalAvaliarRecurso(props) { </Grid> <Grid item xs={2}> <RadioGroup row onChange={(e) => { handleRadios(e, option.id) }}> - <FormControlLabel value={"Sim"} control={<StyledRadio />} label="Sim" /> - <FormControlLabel value={"Não"} control={<StyledRadio />} label="Não" /> + <FormControlLabel value={"Sim"} control={<StyledRadio />} label="Não" /> + <FormControlLabel value={"Não"} control={<StyledRadio />} label="Sim" /> </RadioGroup> </Grid> </Grid> diff --git a/src/Components/Notifications.js b/src/Components/Notifications.js index b452b2157622560976cd9af179cabb1bd87e9d45..c8fbe2ae21be7c1b7897c603034785e9e345e2b9 100644 --- a/src/Components/Notifications.js +++ b/src/Components/Notifications.js @@ -204,6 +204,7 @@ export default function Notification(props) { </div> { notifications.map((notification) => + (notification.viewed === false) && <ActivityListItem onMenuBar={true} avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : null} @@ -222,7 +223,7 @@ export default function Notification(props) { <Link to="/perfil"> <NoPadButton> MOSTRAR TODAS - </NoPadButton> + </NoPadButton> </Link> </div> </ContainerDiv> diff --git a/src/Components/PageProfessorComponents/PartThree.js b/src/Components/PageProfessorComponents/PartThree.js index d52d17ba19da2ebb4a9105dc028c2d4d249aa940..4dc30604264bb51d3b51704b5be14fcd9c2d25dc 100644 --- a/src/Components/PageProfessorComponents/PartThree.js +++ b/src/Components/PageProfessorComponents/PartThree.js @@ -17,8 +17,8 @@ export default function PartThree (props) { const handleChangePhoneNumber = (event) => { const input = event.target.value.replace(/\D/,'') setPhoneNumber({...phoneNumber, - flagInvalid : (input.length < 9 ? true : false), - number : (input.length > 9 ? phoneNumber.number : input), + flagInvalid : (input.length < 10 ? true : false), + number : (input.length > 10 ? phoneNumber.number : input), }) } @@ -48,14 +48,13 @@ export default function PartThree (props) { <h4>Vamos localizar o seu cadastro:</h4> <Stepper items={props.stepper}/> <form style={{textAlign:"start"}}> - <span>CENTRO EDUC INF MEU PEDACINHO DE CHAO</span> <FormControl required style={{width:"100%"}}> <p>Inserir o telefone da escola:</p> <FormInput inputType={'text'} pattern="[0-9]" name={'DDD e Número'} - placeholder={'DDD e Número'} + placeholder={'Exemplo: 4112345678'} value={phoneNumber.number} handleChange={handleChangePhoneNumber} error={phoneNumber.flagInvalid} diff --git a/src/Components/ResourceCardOptions.js b/src/Components/ResourceCardOptions.js index 81d9286c5d0671f8885250daf08f2a4e601b3c87..5d2821f3d9a39cc92af23d5ff1fa7c71de868777 100644 --- a/src/Components/ResourceCardOptions.js +++ b/src/Components/ResourceCardOptions.js @@ -40,6 +40,7 @@ import SignUpModal from './SignUpModal' import LoginModal from './LoginModal.js' import Snackbar from '@material-ui/core/Snackbar'; import MuiAlert from '@material-ui/lab/Alert'; +import { getRequest } from './HelperFunctions/getAxiosConfig' export default function ResourceCardOptions(props) { const { state } = useContext(Store) @@ -78,6 +79,13 @@ export default function ResourceCardOptions(props) { const enableDownload = () => { const url = props.downloadableLink window.open(url, '_blank'); + getRequest( + `/learning_objects/${props.learningObjectId}/download`, + (data, header) => { + }, + (error) => { + } + ) toggleSnackbar(true) } diff --git a/src/Components/ResourcePageComponents/Footer.js b/src/Components/ResourcePageComponents/Footer.js index b0a5769cb6a0c268ee52b05f8135600a7a8c0474..98e7fcd119baab3a54029a86ada0860dc0526dd8 100644 --- a/src/Components/ResourcePageComponents/Footer.js +++ b/src/Components/ResourcePageComponents/Footer.js @@ -16,8 +16,8 @@ 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 {Store} from '../../Store.js' +import React, { useState, useContext } from 'react' +import { Store } from '../../Store.js' import styled from 'styled-components' import Grid from '@material-ui/core/Grid'; import { Button } from '@material-ui/core'; @@ -37,18 +37,19 @@ import LoginModal from './../LoginModal.js' import Snackbar from '@material-ui/core/Snackbar'; import SignUpModal from './../SignUpModal' import MuiAlert from '@material-ui/lab/Alert'; +import { getRequest } from '../HelperFunctions/getAxiosConfig' function Alert(props) { return <MuiAlert elevation={6} variant="filled" {...props} />; } -function ReportButton (props) { +function ReportButton(props) { return ( - !props.complained ? + !props.complained ? ( <ButtonGrey onClick={props.userLoggedIn ? props.toggleReport : props.openLogin}> <span className="button-text"> - <ErrorIcon className="icon"/> Reportar abuso ou erro + <ErrorIcon className="icon" /> Reportar abuso ou erro </span> </ButtonGrey> ) @@ -56,46 +57,41 @@ function ReportButton (props) { ( <ButtonGrey> <span className="button-text-report"> - <ErrorIcon className="icon"/> Você já reportou este recurso + <ErrorIcon className="icon" /> Você já reportou este recurso </span> </ButtonGrey> ) ) } -function DownloadButton (props) { +function DownloadButton(props) { return ( - props.downloadableLink ? + props.downloadableLink ? ( - <ButtonOrange onClick={props.enableDownload}> - <span className="text"> - <GetAppIcon className="icon"/> Baixar Recurso + <ButtonOrange onClick={props.enableDownload}> + <span className="text"> + <GetAppIcon className="icon" /> Baixar Recurso </span> - </ButtonOrange> + </ButtonOrange> ) : - props.link ? + props.link ? ( - <ButtonOrange onClick={props.toggleRedirect}> - <span className="text"> - <CallMadeIcon className="icon"/> Abrir Recurso + <ButtonOrange onClick={props.toggleRedirect}> + <span className="text"> + <CallMadeIcon className="icon" /> Abrir Recurso </span> - </ButtonOrange> + </ButtonOrange> ) : ( - <React.Fragment/> + <React.Fragment /> ) ) } -export default function Footer (props) { - const {state} = useContext(Store) - const enableDownload = () => { - const url = props.downloadableLink - window.open(url, '_blank'); - props.handleSnackbar(0) - } +export default function Footer(props) { + const { state } = useContext(Store) let windowWidth = window.innerWidth const [reportOpen, toggleReport] = useState(false) const [shareOpen, toggleShare] = useState(false) @@ -104,9 +100,24 @@ export default function Footer (props) { const [loginOpen, setLogin] = useState(false) const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) const [signUpOpen, setSignUp] = useState(false) - const [anchorEl, setAnchorEl] = React.useState(null); + const enableDownload = () => { + props.handleSnackbar(0) + const url = props.downloadableLink + window.open(url, '_blank'); + + // there is no error controller here because the router + ///:type/:id/download is always returning error + getRequest( + `/learning_objects/${props.recursoId}/download`, + (data, header) => { + }, + (error) => { + } + ) + } + const handleSignUp = () => { setSignUp(!signUpOpen) } @@ -119,16 +130,16 @@ export default function Footer (props) { if (reason === 'clickaway') { return; } - - handleSuccessfulLogin(false); + + handleSuccessfulLogin(false); } function handleClick(event) { - setAnchorEl(event.currentTarget); + setAnchorEl(event.currentTarget); } function handleClose() { - setAnchorEl(null); + setAnchorEl(null); } return ( @@ -139,25 +150,25 @@ export default function Footer (props) { <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> {/*-------------------------------MODALS---------------------------------------*/} - <ReportModal open={reportOpen} handleClose={() => {toggleReport(false)}} + <ReportModal open={reportOpen} handleClose={() => { toggleReport(false) }} form="recurso" complainableId={props.recursoId} complainableType={"LearningObject"} - /> - <ShareModal open={shareOpen} handleClose={() => {toggleShare(false)}} + /> + <ShareModal open={shareOpen} handleClose={() => { toggleShare(false) }} thumb={props.thumb} title={props.title} link={props.currPageLink} - /> + /> - <GuardarModal open={saveToCol} handleClose={() => {toggleSave(false)}} + <GuardarModal open={saveToCol} handleClose={() => { toggleSave(false) }} thumb={props.thumb} title={props.title} recursoId={props.recursoId} - /> - <RedirectModal open={redirectOpen} handleClose={() => {toggleRedirect(false)}} + /> + <RedirectModal open={redirectOpen} handleClose={() => { toggleRedirect(false) }} link={props.link} - /> + /> <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> - <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> {/*----------------------------------------------------------------------------*/} {/*-----------------------------BUTTONS----------------------------------------*/} @@ -165,97 +176,97 @@ export default function Footer (props) { <StyledGrid container> { windowWidth > 990 ? - ( - <React.Fragment> - {/*Botao Reportar*/} - <Grid item xs={3}> - <ReportButton - userLoggedIn={state.currentUser.id === '' ? false : true} - toggleReport={() => {toggleReport(true)}} - openLogin={handleLogin} - complained={props.complained} - /> - </Grid> - - {/*Botao Compartilhar*/} - <Grid item xs={3}> - <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleShare(true)}> - <span className="button-text"> - <ShareIcon className="icon"/> Compartilhar - </span> - </ButtonGrey> - </Grid> - - {/*Botao Guardar*/} - <Grid item xs={3}> - <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleSave(true)}> - <span className="button-text"> - <FolderIcon className="icon"/>Guardar - </span> - </ButtonGrey> - </Grid> - - <Grid item xs={3} style={{justifyContent : "right !important"}}> - <DownloadButton - downloadableLink={props.downloadableLink} - link={props.link} - enableDownload={enableDownload} - toggleRedirect={() => {toggleRedirect(true)}} - /> - </Grid> - </React.Fragment> - ) - : - ( - <React.Fragment> - {/*Botao Guardar*/} - <Grid item xs={4}> - <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleSave(true)}> - <span className="button-text"> - <FolderIcon className="icon"/>Guardar - </span> - </ButtonGrey> - </Grid> - - <Grid item xs={7}> - <DownloadButton - downloadableLink={props.downloadableLink} - link={props.link} - enableDownload={enableDownload} - toggleRedirect={() => {toggleRedirect(true)}} - /> - </Grid> - - <Grid item xs={1}> - <Button aria-haspopup="true" onClick={handleClick} style={{color : "#666"}}> - <MoreVertIcon/> - </Button> - <Menu - id="simple-menu" - anchorEl={anchorEl} - keepMounted - open={Boolean(anchorEl)} - onClose={handleClose} - > - <MenuItem> + ( + <React.Fragment> + {/*Botao Reportar*/} + <Grid item xs={3}> <ReportButton userLoggedIn={state.currentUser.id === '' ? false : true} - toggleReport={() => {toggleReport(true)}} + toggleReport={() => { toggleReport(true) }} openLogin={handleLogin} complained={props.complained} - /> - </MenuItem> - <MenuItem> + /> + </Grid> + + {/*Botao Compartilhar*/} + <Grid item xs={3}> <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleShare(true)}> <span className="button-text"> - <ShareIcon className="icon"/> Compartilhar - </span> + <ShareIcon className="icon" /> Compartilhar + </span> </ButtonGrey> - </MenuItem> - </Menu> - </Grid> - </React.Fragment> - ) + </Grid> + + {/*Botao Guardar*/} + <Grid item xs={3}> + <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleSave(true)}> + <span className="button-text"> + <FolderIcon className="icon" />Guardar + </span> + </ButtonGrey> + </Grid> + + <Grid item xs={3} style={{ justifyContent: "right !important" }}> + <DownloadButton + downloadableLink={props.downloadableLink} + link={props.link} + enableDownload={enableDownload} + toggleRedirect={() => { toggleRedirect(true) }} + /> + </Grid> + </React.Fragment> + ) + : + ( + <React.Fragment> + {/*Botao Guardar*/} + <Grid item xs={4}> + <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleSave(true)}> + <span className="button-text"> + <FolderIcon className="icon" />Guardar + </span> + </ButtonGrey> + </Grid> + + <Grid item xs={7}> + <DownloadButton + downloadableLink={props.downloadableLink} + link={props.link} + enableDownload={enableDownload} + toggleRedirect={() => { toggleRedirect(true) }} + /> + </Grid> + + <Grid item xs={1}> + <Button aria-haspopup="true" onClick={handleClick} style={{ color: "#666" }}> + <MoreVertIcon /> + </Button> + <Menu + id="simple-menu" + anchorEl={anchorEl} + keepMounted + open={Boolean(anchorEl)} + onClose={handleClose} + > + <MenuItem> + <ReportButton + userLoggedIn={state.currentUser.id === '' ? false : true} + toggleReport={() => { toggleReport(true) }} + openLogin={handleLogin} + complained={props.complained} + /> + </MenuItem> + <MenuItem> + <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleShare(true)}> + <span className="button-text"> + <ShareIcon className="icon" /> Compartilhar + </span> + </ButtonGrey> + </MenuItem> + </Menu> + </Grid> + </React.Fragment> + ) } diff --git a/src/Components/ResourcePageComponents/Sobre.js b/src/Components/ResourcePageComponents/Sobre.js index 341f8fcd464499b24c2a16cb0c8b716695dd0542..2de37ad9f73eb7abd78231d078a02c91e6ba350d 100644 --- a/src/Components/ResourcePageComponents/Sobre.js +++ b/src/Components/ResourcePageComponents/Sobre.js @@ -244,14 +244,14 @@ export default function Sobre (props) { followed ? ( <> <NoIconFollowing followedID={props.id} toggleFollowed={toggleFollowed}/> - <ContactCardOptions followableID={props.id}/> + <ContactCardOptions followed={followed} followableID={props.id} toggleFollowed={toggleFollowed}/> </> ) : ( <> <NoIcon followableID={props.id} toggleFollowed={toggleFollowed}/> - <ContactCardOptions followableID={props.id}/> + <ContactCardOptions followed={followed} followableID={props.id} toggleFollowed={toggleFollowed}/> </> ) } diff --git a/src/Components/SearchBar.js b/src/Components/SearchBar.js index 8dc8b65cd2463abab60df99007a8b5f17bb387b0..1c36964e90f24460d54fd70e0386839ac9754335 100644 --- a/src/Components/SearchBar.js +++ b/src/Components/SearchBar.js @@ -25,6 +25,7 @@ import { RadioGroup, Radio, FormControl, Select, MenuItem, Button, FormControlLa import styled from 'styled-components' import { Store } from '../Store'; import { v4 as uuidv4 } from 'uuid' +import Grid from "@material-ui/core/Grid" const dividerStyled = { @@ -36,7 +37,7 @@ const dividerStyled = { bottom: '0', right: '0', minHeight: '70px', - margin: '0 30px' + margin: '0 20px' } const DividerVertical = () => <em style={dividerStyled}></em> @@ -53,11 +54,13 @@ const TextFieldStyled = styled(TextField)` margin: 0 2vw !important; ` +/* const RadioGroupStyled = styled(RadioGroup)` display: flex; flex-direction: row; flex-grow: 1; ` +*/ const FormControlLabelStyled = styled(FormControlLabel)` *{ @@ -81,11 +84,10 @@ const SelectStyled = styled(Select)` ` const MenuItemStyled = styled(MenuItem)` text-transform: uppercase; - color: #ff8a17 !important; fontWeight: bolder; ` -const Bar = styled.div` +/*const Bar = styled.div` display: flex; align-items: center; justify-content: space-between; @@ -95,7 +97,7 @@ const Flex = styled.span` display: flex; align-items: center; color: #787380; -` +`*/ export default function SearchBar(props) { const [query, setQuery] = useState('') @@ -145,59 +147,77 @@ export default function SearchBar(props) { }; return ( - <Bar> - {goSearch && <Redirect to={`/busca?query=${state.search.query}&search_class=${state.search.class}`} />} - <TextFieldStyled - id="standard-search" - label="O que você está buscando" - type="search" - margin="normal" - value={query} - onChange={handleChange} - onKeyPress={handleKeyDown} - /> - <Flex> - <Link - to={linkTarget} - > - <ButtonStyled onClick={handleKeyDown} ><IconSearchStyled /></ButtonStyled> - </Link> - - {state.windowSize.width >= 900 ? - <React.Fragment> - <Flex style={{ "justifyContent": 'middle', 'flexDirection': 'column' }}> - <div>Pressione "Enter"</div> - <div>ou click na lupa</div> - </Flex> + <Grid container> + <Grid container item xs={12} sm={6} md={6} lg={6} xl={6}> + {goSearch && <Redirect to={`/busca?query=${state.search.query}&search_class=${state.search.class}`} />} + <TextFieldStyled + id="standard-search" + label="O que você está buscando" + type="search" + margin="normal" + value={query} + onChange={handleChange} + onKeyPress={handleKeyDown} + /> + </Grid> + <Grid container item justify="center" alignItems="center" xs={12} sm={6} md={6} lg={6} xl={6}> + {state.windowSize.width >= 960 ? + <React.Fragment> + <Grid container item justify="center" alignItems="center" xs={12} sm={1} md={1} lg={1} xl={1}> + <Link + to={linkTarget} + > + <ButtonStyled onClick={handleKeyDown} ><IconSearchStyled /></ButtonStyled> + </Link> + </Grid> + <Grid container item justify="center" alignItems="center" xs={12} sm={3} md={3} lg={3} xl={3}> + <span>Pressione "Enter" ou click na lupa</span> + </Grid> + <Grid container item justify="center" alignItems="center" xs={12} sm={1} md={1} lg={1} xl={1}> <DividerVertical /> - <RadioGroupStyled row={true} + </Grid> + <Grid container item justify="center" alignItems="center" xs={12} sm={7} md={7} lg={7} xl={7}> + <RadioGroup row={true} aria-label="Tipo" name="types" value={searchClass} onChange={ (event) => setSearchClass(event.target.value) } + justify="center" alignItems="center" > <FormControlLabelStyled value="LearningObject" control={<RadioStyled />} label="Recursos" /> <FormControlLabelStyled value="Collection" control={<RadioStyled />} label="Coleções" /> <FormControlLabelStyled value="User" control={<RadioStyled />} label="Usuários" /> - </RadioGroupStyled> - </React.Fragment> - : - <React.Fragment> - <DividerVertical /> + </RadioGroup> + </Grid> + </React.Fragment> + : + <React.Fragment> + <Grid container item justify="center" alignItems="center" xs={5} sm={5} md={5} lg={5} xl={5}> <FormControl> <SelectStyled value={searchClass} onChange={(event) => setSearchClass(event.target.value)} > - <MenuItemStyled value="LearningObject" aria-label="Recursos">Recursos</MenuItemStyled> - <MenuItemStyled value="Collection" aria-label="Coleções">Coleções</MenuItemStyled> - <MenuItemStyled value="User" aria-label="Usuários">Usuários</MenuItemStyled> + <MenuItemStyled style={{color : "#ff7f00"}} value="LearningObject" aria-label="Recursos">Recursos</MenuItemStyled> + <MenuItemStyled style={{color : "#673ab7"}} value="Collection" aria-label="Coleções">Coleções</MenuItemStyled> + <MenuItemStyled style={{color : "#00bcd4"}} value="User" aria-label="Usuários">Usuários</MenuItemStyled> </SelectStyled> </FormControl> - </React.Fragment> - } - </Flex> - </Bar> + </Grid> + <Grid container item justify="center" alignItems="center" xs={2} sm={2} md={2} lg={2} xl={2}> + <DividerVertical /> + </Grid> + <Grid container item justify="center" alignItems="center" xs={5} sm={5} md={5} lg={5} xl={5}> + <Link + to={linkTarget} + > + <ButtonStyled onClick={handleKeyDown} ><IconSearchStyled /></ButtonStyled> + </Link> + </Grid> + </React.Fragment> + } + </Grid> + </Grid> ) -} +} \ No newline at end of file diff --git a/src/Components/TabPanels/PanelComponents/ButtonsArea.js b/src/Components/TabPanels/PanelComponents/ButtonsArea.js index 6492f0b45d7f707b699345a3eb28a465a33f3a0a..848001761ebc4f63beb1f5cc1c46a317dc8158ab 100644 --- a/src/Components/TabPanels/PanelComponents/ButtonsArea.js +++ b/src/Components/TabPanels/PanelComponents/ButtonsArea.js @@ -49,7 +49,7 @@ export function ButtonsAreaColecao(props) { return ( <Carregados> <p style={{ margin: "0 0 10px", fontSize: "14px" }}> - {props.sliceLength} coleções carregadas + {props.sliceLength} coleções carregadas de {props.total} </p> { props.end ? @@ -73,7 +73,7 @@ export function ButtonsAreaRede(props) { return ( <Carregados> <p style={{ margin: "0 0 10px", fontSize: "14px" }}> - {props.sliceLength} usuários carregados + {props.sliceLength} usuários carregados {props.total} </p> { diff --git a/src/Components/TabPanels/PanelComponents/TemplateColecao.js b/src/Components/TabPanels/PanelComponents/TemplateColecao.js index 48d287bf23d35c5eddf062c167c940cdbd97afcd..7af99a6cf6e901be5a1c03276475edb85a4dc44e 100644 --- a/src/Components/TabPanels/PanelComponents/TemplateColecao.js +++ b/src/Components/TabPanels/PanelComponents/TemplateColecao.js @@ -73,40 +73,47 @@ export default function PanelTemplateColecao(props) { <WhiteContainer> <Title title={props.title} - length={props.length} + length={props.end} /> { - props.length === 0 ? - ( - <NoContent text={props.noContentText} /> - ) + props.error ? + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + > + Erro ao tentar obter os dados + </p> : - ( - <React.Fragment> - <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> + props.length === 0 ? + ( + <NoContent text={props.noContentText} /> + ) + : + ( + <React.Fragment> + <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> + { + props.sliceArr.map((card) => + <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> + {RenderFollowedColCard(card, props.followed)} + </Grid> + ) + } + </StyledGrid> { - props.sliceArr.map((card) => - <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> - {RenderFollowedColCard(card, props.followed)} - </Grid> - ) + props.loadingMore ? + <LoadingSpinner text={'Carregando Recursos...'} /> + : + <ButtonsAreaColecao + sliceLength={props.sliceArr.length} + length={props.length} + showMore={props.showMore} + total={props.end} + end={String(props.sliceArr.length) === props.end} + /> } - </StyledGrid> - { - props.loadingMore ? - <LoadingSpinner text={'Carregando Recursos...'} /> - : - <ButtonsAreaColecao - sliceLength={props.sliceArr.length} - length={props.length} - showMore={props.showMore} - total={props.end} - end={String(props.sliceArr.length) === props.end} - /> - } - </React.Fragment> - ) + </React.Fragment> + ) } </WhiteContainer> diff --git a/src/Components/TabPanels/PanelComponents/TemplateCuradoria.js b/src/Components/TabPanels/PanelComponents/TemplateCuradoria.js index b91a0174edfc96fc1a52d2f1f3bbc4dc299c0363..4426a239ded8dc1c3d42925e8f83caa7c59598d7 100644 --- a/src/Components/TabPanels/PanelComponents/TemplateCuradoria.js +++ b/src/Components/TabPanels/PanelComponents/TemplateCuradoria.js @@ -31,59 +31,66 @@ export default function Template(props) { <WhiteContainer> <Title title={props.titleText} - length={props.length} + length={props.end} /> { - props.length === 0 ? - ( - [ - <NoContent text={props.noContentText} /> - ] - ) + props.error ? + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + > + Erro ao tentar obter os dados + </p> : - ( - [ - <React.Fragment> - <StyledGrid container spacing={1} justify="center" alignItems="center" style={{ paddingLeft: "30px", paddingRight: "15px" }}> + props.length === 0 ? + ( + [ + <NoContent text={props.noContentText} /> + ] + ) + : + ( + [ + <React.Fragment> + <StyledGrid container spacing={1} justify="center" alignItems="center" style={{ paddingLeft: "30px", paddingRight: "15px" }}> + { + props.sliceArr.map((card) => + <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> + <ResourceCardFunction + avatar={card.submitter.avatar} + id={card.learning_object.id} + thumbnail={card.learning_object.thumbnail} + type={card.learning_object.object_type ? card.learning_object.object_type : "Outros"} + title={card.learning_object.name} + published={false} + likeCount={card.learning_object.likes_count} + liked={card.learning_object.liked} + rating={card.learning_object.review_average} + author={card.submitter.name} + tags={card.learning_object.tags} + href={"/recurso/" + card.learning_object.id} + downloadableLink={card.default_attachment_location} + /> + </Grid> + ) + } + </StyledGrid> { - props.sliceArr.map((card) => - <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> - <ResourceCardFunction - avatar={card.submitter.avatar} - id={card.learning_object.id} - thumbnail={card.learning_object.thumbnail} - type={card.learning_object.object_type ? card.learning_object.object_type : "Outros"} - title={card.learning_object.name} - published={false} - likeCount={card.learning_object.likes_count} - liked={card.learning_object.liked} - rating={card.learning_object.review_average} - author={card.submitter.name} - tags={card.learning_object.tags} - href={"/recurso/" + card.learning_object.id} - downloadableLink={card.default_attachment_location} - /> - </Grid> - ) + props.loadingMore ? + <LoadingSpinner text="Carregando recurso..." /> + : + <ButtonsAreaRecurso + sliceLength={props.sliceArr.length} + length={props.length} + showMore={props.showMore} + end={String(props.sliceArr.length) === props.end} + total={props.end} + /> } - </StyledGrid> - { - props.loadingMore ? - <LoadingSpinner text="Carregando recurso..." /> - : - <ButtonsAreaRecurso - sliceLength={props.sliceArr.length} - length={props.length} - showMore={props.showMore} - end={String(props.sliceArr.length) === props.end} - total={props.end} - /> - } - </React.Fragment> - ] - ) + </React.Fragment> + ] + ) } </WhiteContainer> diff --git a/src/Components/TabPanels/PanelComponents/TemplateRecurso.js b/src/Components/TabPanels/PanelComponents/TemplateRecurso.js index 78b712414ee802df5f450935d1e9658d8ba31d7b..6bf05604c0d56eef5e435c449b2b8cc103517572 100644 --- a/src/Components/TabPanels/PanelComponents/TemplateRecurso.js +++ b/src/Components/TabPanels/PanelComponents/TemplateRecurso.js @@ -31,16 +31,23 @@ export default function Template(props) { <WhiteContainer> <Title title={props.titleText} - length={props.length} + length={props.end} /> { - props.length === 0 ? - ( - <NoContent text={props.noContentText} /> - ) + props.error ? + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + > + Erro ao tentar obter os dados + </p> : - ( + props.length === 0 ? + ( + <NoContent text={props.noContentText} /> + ) + : + ( <React.Fragment> <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> { @@ -80,7 +87,7 @@ export default function Template(props) { } </React.Fragment> - ) + ) } </WhiteContainer> diff --git a/src/Components/TabPanels/PanelComponents/TemplateRede.js b/src/Components/TabPanels/PanelComponents/TemplateRede.js index 0853c14eb8bc573b80906c038d228add9fa2075c..4fd3364085585a62ff575b4833c9aedd7ba97394 100644 --- a/src/Components/TabPanels/PanelComponents/TemplateRede.js +++ b/src/Components/TabPanels/PanelComponents/TemplateRede.js @@ -47,51 +47,59 @@ export default function PanelTemplateRede(props) { <Title title={props.title} - length={props.length} + length={props.end} /> {/*if length is 0, display "No Content" text */} {/*otherwise, display either ContactCard and Buttons */} { - props.length === 0 ? - ( - [ - <NoContent text={props.noContentText} /> - ] - ) + props.error ? + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + > + Erro ao tentar obter os dados + </p> : - ( - [ - <React.Fragment> - <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> + props.length === 0 ? + ( + [ + <NoContent text={props.noContentText} /> + ] + ) + : + ( + [ + <React.Fragment> + <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> + { + props.sliceArr.map((card) => + <> + { + card.follower && + <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> + {RenderContactCard(card, props.follower)} + </Grid> + } + </> + ) + } + </StyledGrid> { - props.sliceArr.map((card) => - <> - { - card.follower && - <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> - {RenderContactCard(card, props.follower)} - </Grid> - } - </> - ) + props.loadingMore ? + <LoadingSpinner text={'Carregando Recursos...'} /> + : + <ButtonsAreaRede + sliceLength={props.sliceArr.length} + length={props.length} + showMore={props.showMore} + total={props.end} + end={String(props.sliceArr.length) === props.end} + /> } - </StyledGrid> - { - props.loadingMore ? - <LoadingSpinner text={'Carregando Recursos...'} /> - : - <ButtonsAreaRede - sliceLength={props.sliceArr.length} - length={props.length} - showMore={props.showMore} - end={props.end} - /> - } - </React.Fragment> - ] - ) + </React.Fragment> + ] + ) } </WhiteContainer> diff --git a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js index 0985db2b681552b0e8a2a726cb959ef72892e7c6..5502843e9a2785185a4b7c6fa9a4a5ce9c7b8161 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js +++ b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js @@ -28,6 +28,7 @@ import List from '@material-ui/core/List'; import { getRequest } from '../../HelperFunctions/getAxiosConfig.js' import Grid from '@material-ui/core/Grid'; import DefaultProfile from '../../../img/default_profile.png'; +import SnackBar from '../../SnackbarComponent' export default function TabPanelAtividades(props) { @@ -37,36 +38,104 @@ export default function TabPanelAtividades(props) { const [notifications, setNotifications] = useState([]); const [notificatonsLength, setLength] = useState(0); const [totalResults, setTotalResults] = useState(0); - const [limit, setLimit] = useState(4); + const [limit, setLimit] = useState(30); + const [error, setError] = useState(false) + const [snackInfo, setSnackInfo] = useState({ + open: false, + text: '', + severity: '', + color: '', + }) + + function handleCloseSnackBar() { + const info = { + open: false, + text: '', + severity: '', + color: '', + } + handleSnackInfo(info) + } + + function handleSnackInfo(info) { + setSnackInfo({ + ...info + }) + } const showMore = (offset) => { handleLoadingMore(true); const url = `/feed?offset=${limit}&limit=${offset}` setLimit(limit + offset) - getRequest(url, handleSuccess, (error) => { console.log(error) }) + getRequest(url, handleSuccess, handleError) + } + + function handleError(error) { + const info = { + open: true, + text: 'Ocorreu um erro ao tentar carregar suas notificações!', + severity: 'error', + color: 'red', + } + handleSnackInfo(info) + handleLoadingMore(false) + handleLoading(false) + setError(true) } function handleSuccess(data, header) { if (header.has('X-Total-Count')) { setTotalResults(header.get('X-Total-Count')); } - handleLoadingMore(false); - let currData = [...notifications]; - currData = currData.concat(data); - setNotifications(currData) - setLength(currData.length) - - handleLoading(false) + if (data.errors) { + const info = { + open: true, + text: 'Ocorreu um erro ao tentar carregar suas notificações!', + severity: 'error', + color: 'red', + } + handleSnackInfo(info) + handleLoadingMore(false) + handleLoading(false) + setError(true) + } + else { + if (data.length >= 1) { + handleLoadingMore(false) + let currData = [...notifications] + currData = currData.concat(data) + setNotifications(currData) + setLength(currData.length) + handleLoading(false) + } + else { + const info = { + open: true, + text: 'Não há mais notificações para serem carregadas...', + severity: 'warning', + color: 'yellow' + } + handleSnackInfo(info) + handleLoadingMore(false) + handleLoading(false) + } + } } useEffect(() => { const url = `/feed?offset=0&limit=30` - getRequest(url, handleSuccess, (error) => { console.log(error) }) + getRequest(url, handleSuccess, handleError) }, []) return ( - <MainContainerDesktop> + <SnackBar + snackbarOpen={snackInfo.open} + handleClose={handleCloseSnackBar} + severity={snackInfo.severity} + color={snackInfo.color} + text={snackInfo.text} + /> <Paper elevation={3}> <div> <DivTitulo> @@ -86,67 +155,74 @@ export default function TabPanelAtividades(props) { [ <div> { - notificatonsLength === 0 ? - ( + error ? + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + > + Erro ao tentar obter as notificações + </p> + : + notificatonsLength === 0 ? + ( - <NoNotificationsDiv> - <div> + <NoNotificationsDiv> <div> - <H3Styled><img src={Bolo} alt='bolo' style={{ width: "23px" }} /> Você se cadastrou na Plataforma</H3Styled> + <div> + <H3Styled><img src={Bolo} alt='bolo' style={{ width: "23px" }} /> Você se cadastrou na Plataforma</H3Styled> + </div> + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + >Construa conosco a plataforma e amplie sua rede de conhecimento interagindo + <br /> + com pessoas envolvidas com experiências que ocorrem em todo o Brasil! + </p> </div> - <p - style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} - >Construa conosco a plataforma e amplie sua rede de conhecimento interagindo - <br /> - com pessoas envolvidas com experiências que ocorrem em todo o Brasil! - </p> - </div> - </NoNotificationsDiv> + </NoNotificationsDiv> - ) - : - ( - <> - <List height={400} width={300}> + ) + : + ( + <> + <List height={400} width={300}> + { + notifications.map((notification, id) => + <ActivityListItem + key={id} + onMenuBar={false} + avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : DefaultProfile} + activity={notification.activity} + actionType={notification.trackable_type} + objectType={notification.recipient_type} + createdAt={notification.created_at} + ownerName={notification.owner.name} + ownerHref={'/usuario-publico/' + notification.owner.id} + recipientName={notification.recipient.name} + recipientHref={"/recurso/" + notification.recipient.id} + /> + ) + } + </List> { - notifications.map((notification, id) => - <ActivityListItem - key={id} - onMenuBar={false} - avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : DefaultProfile} - activity={notification.activity} - actionType={notification.trackable_type} - objectType={notification.recipient_type} - createdAt={notification.created_at} - ownerName={notification.owner.name} - ownerHref={'/usuario-publico/' + notification.owner.id} - recipientName={notification.recipient.name} - recipientHref={"/recurso/" + notification.recipient.id} - /> - ) - } - </List> - { - loadingMore ? - <LoadingSpinner text="Carregando mais atividades..." /> - : - <Grid container direction="row" alignItems="center" justify="flex-start"> - <Grid item xs={12} md={4}> - <LoadMoreButton onClick={() => { showMore(4) }}>CARREGAR MAIS 4</LoadMoreButton> - </Grid> - <Grid item xs={12} md={4}> - <LoadMoreButton onClick={() => { showMore(20) }}>CARREGAR MAIS 20</LoadMoreButton> - </Grid> - <Grid xs={12} md={4} item style={{ fontSize: "14px", color: "#666" }}> - <ShowData disabled={true}> - Mostrando {notificatonsLength} {notificatonsLength === 1 ? "Atividade" : "Atividades"} + loadingMore ? + <LoadingSpinner text="Carregando mais atividades..." /> + : + <Grid container direction="row" alignItems="center" justify="flex-start"> + <Grid item xs={12} md={4}> + <LoadMoreButton onClick={() => { showMore(4) }}>CARREGAR MAIS 4</LoadMoreButton> + </Grid> + <Grid item xs={12} md={4}> + <LoadMoreButton onClick={() => { showMore(20) }}>CARREGAR MAIS 20</LoadMoreButton> + </Grid> + <Grid xs={12} md={4} item style={{ fontSize: "14px", color: "#666" }}> + <ShowData disabled={true}> + Mostrando {notificatonsLength} {notificatonsLength === 1 ? "Atividade " : "Atividades "} de {totalResults} - </ShowData> + </ShowData> + </Grid> </Grid> - </Grid> - } - </> - ) + } + </> + ) } </div> @@ -195,7 +271,7 @@ const NoNotificationsDiv = styled.div` const LoadMoreButton = styled(Button)` outline : none !important; - display : inline-block !important; + display : block !important; cusor : pointer !important; min-height : 36px !important; min-widht : 88px !important; @@ -203,7 +279,7 @@ const LoadMoreButton = styled(Button)` vertical-align: middle !important; border : 0 !important; padding : 0 px !important; - margin : 6px 8px !important; + margin : auto !important; text-decoration : none !important; font-weight : 500 !important; overflow : hidden !important; @@ -218,7 +294,7 @@ const LoadMoreButton = styled(Button)` const ShowData = styled(Button)` outline : none !important; - display : inline-block !important; + display : block !important; cusor : pointer !important; min-height : 36px !important; min-widht : 88px !important; @@ -226,7 +302,7 @@ const ShowData = styled(Button)` vertical-align: middle !important; border : 0 !important; padding : 0 px !important; - margin : 6px 8px !important; + margin : auto !important; text-decoration : none !important; font-weight : 500 !important; overflow : hidden !important; diff --git a/src/Components/TabPanels/UserPageTabs/PanelColecoes.js b/src/Components/TabPanels/UserPageTabs/PanelColecoes.js index acdd2828493659933402c652e989a906de2c54d4..420071c2cf0b7ec4b7a4feb7a12826ad1041b063 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelColecoes.js +++ b/src/Components/TabPanels/UserPageTabs/PanelColecoes.js @@ -30,216 +30,270 @@ import Title from '../PanelComponents/PanelTitle.js' import CollectionCardFunction from '../../CollectionCardFunction.js' import { ButtonsAreaColecao } from '../PanelComponents/ButtonsArea' import CriarColecaoModal from '../../CriarColecaoModal.js' -import {fetchAllRequest, getRequest} from '../../HelperFunctions/getAxiosConfig' +import { fetchAllRequest, getRequest } from '../../HelperFunctions/getAxiosConfig' export default function TabPanelColecoes(props) { - const [loading, handleLoading] = useState(true) + const [loading, handleLoading] = useState(true) - const [userCollections, setUserCollections] = useState([]) - const [followedCollections, setFollowedCollections] = useState([]) + const [errorInUserColl, setErrorInUserColl] = useState(false) + const [errorInFollowedColl, setErrorInFollowedColl] = useState(false) - const [currLimitUserColl, setCurrLimitUserColl] = useState(4) - const [currLimitFollowedColl, setCurrLimitFollowedColl] = useState(4) + const [userCollections, setUserCollections] = useState([]) + const [followedCollections, setFollowedCollections] = useState([]) - const [loadingMoreUserColl, setLoadingMoreUserColl] = useState(false); - const [loadingMoreFollowedColl, setLoadingMoreFollowedColl] = useState(false); + const [currLimitUserColl, setCurrLimitUserColl] = useState(4) + const [currLimitFollowedColl, setCurrLimitFollowedColl] = useState(4) - const [endOfUserColl, setEndOfUserColl] = useState(false); - const [endOfFollowedColl, setEndOfFollowedColl] = useState(false); + const [loadingMoreUserColl, setLoadingMoreUserColl] = useState(false); + const [loadingMoreFollowedColl, setLoadingMoreFollowedColl] = useState(false); - function handleSuccess (responseArr) { - handleLoading(false) - setUserCollections(responseArr[0]) + const [endOfUserColl, setEndOfUserColl] = useState(false); + const [endOfFollowedColl, setEndOfFollowedColl] = useState(false); - setFollowedCollections(responseArr[1]) - } + function handleSuccess(responseArr, headersArr) { + setErrorInUserColl(responseArr[0].errors ? true : false) + setErrorInFollowedColl(responseArr[1].errors ? true : false) - const getInfo = () => { - const urls = [ - `/users/${props.id}/collections?offset=0&limit=4`, - `/users/${props.id}/following/Collection?offset=0&limit=4` - ] - fetchAllRequest(urls, handleSuccess, (error) => {console.log(error)}) - } + handleLoading(false) + setUserCollections(responseArr[0]) + setFollowedCollections(responseArr[1]) - useEffect(() => { - handleLoading(true) - getInfo() - }, []) - - const showMoreUserCollections = (limite) => { - const limit = limite; - setLoadingMoreUserColl(true); - setCurrLimitUserColl(currLimitUserColl + limit) - const url = `/users/${props.id}/collections?offset=${currLimitUserColl}&limit=${limit}`; - getRequest(url, - (data) => { - if (data.length >= 1) { - let currData = [...userCollections]; - currData = [...currData.concat(data)]; - setLoadingMoreUserColl(false); - setUserCollections(currData); - } - else { - setLoadingMoreUserColl(false); - setEndOfUserColl(true) - } - }, - (error) => { console.log(error) } - ) + if (headersArr[0].has('X-Total-Count')) { + setEndOfUserColl(headersArr[0].get('X-Total-Count')); } - - const showMoreFollowedCollections = (limite) => { - const limit = limite; - setLoadingMoreFollowedColl(true); - setCurrLimitFollowedColl(currLimitFollowedColl + limit) - const url = `/users/${props.id}/following/Collection?offset=${currLimitFollowedColl}&limit=${limit}`; - getRequest(url, - (data) => { - if (data.length >= 1) { - let currData = [...followedCollections]; - currData = [...currData.concat(data)]; - setLoadingMoreFollowedColl(false); - setFollowedCollections(currData); - } - else { - setLoadingMoreFollowedColl(false); - setEndOfFollowedColl(true) - } - }, - (error) => { console.log(error) } - ) + if (headersArr[1].has('X-Total-Count')) { + setEndOfFollowedColl(headersArr[1].get('X-Total-Count')); } + } - return ( - <> - { - loading ? - ( - <LoadingSpinner text={'CARREGANDO COLEÇÕES'} /> - ) - : - ( - [ - <React.Fragment> - <Tentativa - title={"Minhas Coleções"} - length={userCollections.length} - noContentText={ - <div> - <img src={PaginaVaziaColecao} alt="PaginaVaziaColecao" style={{ height: "150px", width: "150px", verticalAlign: "middle", border: "0" }} /> - <br /> - <span style={{ fontFamily: "Roboto", fontWeight: "lighter", fontSize: "24px" }}> - Criamos a sua primeira Coleção! + function handleError(error) { + handleLoading(false) + setErrorInFollowedColl(true) + setErrorInUserColl(true) + } + + const getInfo = () => { + const urls = [ + `/users/${props.id}/collections?offset=0&limit=4`, + `/users/${props.id}/following/Collection?offset=0&limit=4` + ] + fetchAllRequest(urls, handleSuccess, handleError) + } + + useEffect(() => { + handleLoading(true) + getInfo() + }, []) + + const showMoreUserCollections = (limite) => { + const limit = limite; + setLoadingMoreUserColl(true); + setCurrLimitUserColl(currLimitUserColl + limit) + const url = `/users/${props.id}/collections?offset=${currLimitUserColl}&limit=${limit}`; + getRequest(url, + (data) => { + if (data.errors) { + setLoadingMoreUserColl(false); + setEndOfUserColl(true) + setErrorInUserColl(true) + } + else if (data.length >= 1) { + let currData = [...userCollections]; + currData = [...currData.concat(data)]; + setLoadingMoreUserColl(false); + setUserCollections(currData); + } + else { + setLoadingMoreUserColl(false); + setEndOfUserColl(true) + } + }, + (error) => { + setLoadingMoreUserColl(false); + setEndOfUserColl(true) + setErrorInUserColl(true) + } + ) + } + + const showMoreFollowedCollections = (limite) => { + const limit = limite; + setLoadingMoreFollowedColl(true); + setCurrLimitFollowedColl(currLimitFollowedColl + limit) + const url = `/users/${props.id}/following/Collection?offset=${currLimitFollowedColl}&limit=${limit}`; + getRequest(url, + (data) => { + if (data.errors) { + setLoadingMoreFollowedColl(false); + setEndOfFollowedColl(true) + setErrorInFollowedColl(true) + } + else if (data.length >= 1) { + let currData = [...followedCollections]; + currData = [...currData.concat(data)]; + setLoadingMoreFollowedColl(false); + setFollowedCollections(currData); + } + else { + setLoadingMoreFollowedColl(false); + setEndOfFollowedColl(true) + } + }, + (error) => { + setLoadingMoreFollowedColl(false); + setEndOfFollowedColl(true) + setErrorInFollowedColl(true) + } + ) + } + + return ( + <> + { + loading ? + ( + <LoadingSpinner text={'CARREGANDO COLEÇÕES'} /> + ) + : + ( + [ + <React.Fragment> + <Tentativa + title={"Minhas Coleções"} + length={userCollections.length} + noContentText={ + <div> + <img src={PaginaVaziaColecao} alt="PaginaVaziaColecao" style={{ height: "150px", width: "150px", verticalAlign: "middle", border: "0" }} /> + <br /> + <span style={{ fontFamily: "Roboto", fontWeight: "lighter", fontSize: "24px" }}> + Criamos a sua primeira Coleção! </span> - <p style={{ fontFamily: "Roboto", fontSize: "16px", margin: "10px 0 0", fontWeight: "normal" }}> - Adicione nela recursos que você queira acessar mais tarde. + <p style={{ fontFamily: "Roboto", fontSize: "16px", margin: "10px 0 0", fontWeight: "normal" }}> + Adicione nela recursos que você queira acessar mais tarde. <br /> Crie novas coleções clicando no cartão roxo "Criar Colecão". </p> - </div> - } - sliceArr={userCollections} - showMore={showMoreUserCollections} - loadingMore={loadingMoreUserColl} - end={endOfUserColl} - callback={getInfo} - /> - - <PanelTemplateColecao - title={"Coleções que eu sigo"} - length={followedCollections.length} - noContentText={"Você ainda não segue nenhuma coleção."} - sliceArr={followedCollections} - showMore={showMoreFollowedCollections} - loadingMore={loadingMoreFollowedColl} - end={endOfFollowedColl} - followed={true} - /> - </React.Fragment> - ] - ) - } - </> - ) + </div> + } + sliceArr={userCollections} + showMore={showMoreUserCollections} + loadingMore={loadingMoreUserColl} + end={endOfUserColl} + callback={getInfo} + error={errorInUserColl} + /> + + <PanelTemplateColecao + title={"Coleções que eu sigo"} + length={followedCollections.length} + noContentText={"Você ainda não segue nenhuma coleção."} + sliceArr={followedCollections} + showMore={showMoreFollowedCollections} + loadingMore={loadingMoreFollowedColl} + end={endOfFollowedColl} + followed={true} + error={errorInFollowedColl} + /> + </React.Fragment> + ] + ) + } + </> + ) } function Tentativa(props) { - const [modalOpen, toggleModal] = useState(false) - const handleModal = () => { toggleModal(!modalOpen) }; + const [modalOpen, toggleModal] = useState(false) + const handleModal = () => { toggleModal(!modalOpen) }; + if (props.error) return ( - <WhiteContainer> - <CriarColecaoModal open={modalOpen} handleClose={() => { handleModal(); props.callback() }} /> + <WhiteContainer> + <Title + title={props.title} + length={props.length} + /> + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + > + Erro ao tentar obter os dados + </p> + </WhiteContainer> + ) + else + return ( + <WhiteContainer> + <CriarColecaoModal open={modalOpen} handleClose={() => { handleModal(); props.callback() }} /> - <Title - title={props.title} - length={props.length} - /> + <Title + title={props.title} + length={props.end} + /> - <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> - <Grid item xs={12} sm={6} md={'auto'} lg={3}> - <CardDiv onClick={() => { handleModal() }}> - <div style={{ backgroundColor: "#673ab7", display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center", cursor : "pointer" }}> - <CreateNewFolderIcon style={{ color: "#fff", fontSize: "70px" }} /> - <p style={{ fontSize: "16px", margin: "0 0 10px", color: "#fff" }}> - CRIAR COLEÇÃO + <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> + <Grid item xs={12} sm={6} md={'auto'} lg={3}> + <CardDiv onClick={() => { handleModal() }}> + <div style={{ backgroundColor: "#673ab7", display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center", cursor: "pointer" }}> + <CreateNewFolderIcon style={{ color: "#fff", fontSize: "70px" }} /> + <p style={{ fontSize: "16px", margin: "0 0 10px", color: "#fff" }}> + CRIAR COLEÇÃO </p> - </div> - </CardDiv> - </Grid> - - { - props.length === 0 ? - ( - [ - <Grid item lg={6} md={4} sm={6} xs={12}> - <NoContent text={props.noContentText} /> - </Grid> - ] - ) - : - ( - [ - <React.Fragment> - { - props.sliceArr.map((card) => - <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> - <CollectionCardFunction - name={card.name} - tags={card.tags} - rating={card.review_average} - id={card.id} - author={card.owner.name} - description={card.description} - thumbnails={card.items_thumbnails} - avatar={card.owner.avatar} - likeCount={card.likes_count} - followed={card.followed} - liked={card.liked} - collections={card.collection_items} - authorID={card.owner.id} - /> - </Grid> - ) - } - </React.Fragment> - ] - ) - } - </StyledGrid> - { - props.loadingMore ? - <LoadingSpinner text={'Carregando Recursos...'} /> - : - <ButtonsAreaColecao - sliceLength={props.sliceArr.length} - length={props.length} - showMore={props.showMore} - end={props.end} - /> - } - </WhiteContainer> + </div> + </CardDiv> + </Grid> + + { + props.length === 0 ? + ( + [ + <Grid item lg={6} md={4} sm={6} xs={12}> + <NoContent text={props.noContentText} /> + </Grid> + ] + ) + : + ( + [ + <React.Fragment> + { + props.sliceArr.map((card) => + <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> + <CollectionCardFunction + name={card.name} + tags={card.tags} + rating={card.review_average} + id={card.id} + author={card.owner.name} + description={card.description} + thumbnails={card.items_thumbnails} + avatar={card.owner.avatar} + likeCount={card.likes_count} + followed={card.followed} + liked={card.liked} + collections={card.collection_items} + authorID={card.owner.id} + /> + </Grid> + ) + } + </React.Fragment> + ] + ) + } + </StyledGrid> + { + props.loadingMore ? + <LoadingSpinner text={'Carregando Recursos...'} /> + : + <ButtonsAreaColecao + sliceLength={props.sliceArr.length} + length={props.length} + showMore={props.showMore} + total={props.end} + end={String(props.sliceArr.length) === props.end} + /> + } + </WhiteContainer> ) } diff --git a/src/Components/TabPanels/UserPageTabs/PanelCuradoria.js b/src/Components/TabPanels/UserPageTabs/PanelCuradoria.js index 91039db942bd3c0c5d8da4d8488a8f55155e05ae..d9a3ac296fd3d2f0b6faa3c765bb701323c1f09c 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelCuradoria.js +++ b/src/Components/TabPanels/UserPageTabs/PanelCuradoria.js @@ -24,11 +24,11 @@ import { getRequest } from '../../HelperFunctions/getAxiosConfig' export default function TabPanelCuradoria(props) { const [loading, handleLoading] = useState(true) + const [errorCurating, setErrorCurating] = useState(false) const [loadingMoreCurating, setLoadingMoreCurating] = useState(false) const [currLimitCurating, setcurrLimitCurating] = useState(4); - const [endOfCurating, setEndofCurating] = useState(false); + const [endOfCurating, setEndofCurating] = useState(); const [curating, setCurating] = useState([]); - const [totalResults, setTotalResults] = useState(0); const showMoreCurating = (limite) => { setLoadingMoreCurating(true); @@ -37,6 +37,10 @@ export default function TabPanelCuradoria(props) { const url = `/users/${props.id}/submissions?offset=${currLimitCurating}&limit=${limit}&status=submitted`; getRequest(url, (data) => { + if (data.errors) { + setLoadingMoreCurating(false); + setErrorCurating(true); + } if (data.length >= 1) { let currData = [...curating]; currData = [...currData.concat(data)]; @@ -45,25 +49,40 @@ export default function TabPanelCuradoria(props) { } else { setLoadingMoreCurating(false); - setEndofCurating(true); + setErrorCurating(true); } }, - (error) => { console.log(error) } + (error) => { + setLoadingMoreCurating(false); + setErrorCurating(true); + } ) } - + function handleSuccess(data, header) { if (header.has('X-Total-Count')) { - setTotalResults(header.get('X-Total-Count')); + setEndofCurating(header.get('X-Total-Count')); + } + + if (data.errors) { + setErrorCurating(true); } + else + setCurating(data) + handleLoading(false) - setCurating(data) } + + function handleError() { + setErrorCurating(true); + handleLoading(false) + } + useEffect(() => { const url = `/users/${props.id}/submissions?offset=0&limit=4&status=submitted` handleLoading(true) - getRequest(url, handleSuccess, (error) => { console.log(error) }) + getRequest(url, handleSuccess, handleError) }, []) return ( @@ -85,7 +104,7 @@ export default function TabPanelCuradoria(props) { showMore={showMoreCurating} loadingMore={loadingMoreCurating} end={endOfCurating} - total={totalResults} + error={errorCurating} /> </React.Fragment> ] diff --git a/src/Components/TabPanels/UserPageTabs/PanelEditarPerfil.js b/src/Components/TabPanels/UserPageTabs/PanelEditarPerfil.js index 0f2d25afb8ec829e53ce5f9b9d861a54166e66ee..e8d253324b68c006cc892d5084ab8d0f15e3f977 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelEditarPerfil.js +++ b/src/Components/TabPanels/UserPageTabs/PanelEditarPerfil.js @@ -150,13 +150,10 @@ export default function TabPanelEditarPerfil(props) { </ProfileAvatarDiv> </HeaderContainer> <br /> - <br /> - <br /> - <br /> </div> <div style={{ paddingTop: "90px" }}> - <div style={{ display: "flex", flexDirection: "row" }}> + <div style={{ display: "flex", flexDirection: "row", justifyContent: "center" }}> <form onSubmit={e => handleSubmit(e)}> <FormInput inputType={"text"} @@ -279,8 +276,11 @@ const ChangeAvatarDiv = styled.div` ` const ProfileAvatarDiv = styled.div` - bottom: -20px; - left : 120px; + top: 70px; + left: 0; + right: 0; + bottom: -40px; + margin: auto; border-radius : 100%; position : absolute; max-width : 100px; diff --git a/src/Components/TabPanels/UserPageTabs/PanelFavoritos.js b/src/Components/TabPanels/UserPageTabs/PanelFavoritos.js index c92288463871a6a8cdf44944c3fd6a338fdc6266..8c9fff1ba0a9dce2b90cdd477ddc0decf8242c32 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelFavoritos.js +++ b/src/Components/TabPanels/UserPageTabs/PanelFavoritos.js @@ -25,12 +25,14 @@ import { fetchAllRequest, getRequest } from '../../HelperFunctions/getAxiosConfi export default function TabPanelFavoritos(props) { const [loading, handleLoading] = useState(true) + const [errorInLikedInLearnObj, setErrorInLikedInLearnObj] = useState(false) + const [errorInLikedInColl, setErrorInLikedInColl] = useState(false) + const [likedLearnObjs, setlikedLearnObjs] = useState([]) const [likedCollections, setlikedCollections] = useState([]) const [currLimitLearnObjLiked, setCurrLimitLearnObjLiked] = useState(4); const [currLimitCollLiked, setcurrLimitCollLiked] = useState(4); - const [loadingMoreLearnObj, setLoadingMoreLearnObj] = useState(false) const [loadingMoreColl, setLoadingMoreColl] = useState(false) @@ -39,6 +41,9 @@ export default function TabPanelFavoritos(props) { function handleSuccess(responseArr, headersArr) { + setErrorInLikedInLearnObj(responseArr[0].errors ? true : false) + setErrorInLikedInColl(responseArr[1].errors ? true : false) + setlikedLearnObjs(responseArr[0]) setlikedCollections(responseArr[1]) @@ -51,6 +56,12 @@ export default function TabPanelFavoritos(props) { handleLoading(false) } + function handleError(error) { + handleLoading(false) + setErrorInLikedInLearnObj(true) + setErrorInLikedInColl(true) + } + useEffect(() => { handleLoading(true); const urls = [ @@ -58,7 +69,7 @@ export default function TabPanelFavoritos(props) { `/users/${props.id}/collections/liked?offset=0&limit=4` ] - fetchAllRequest(urls, handleSuccess, (error) => { console.log(error) }) + fetchAllRequest(urls, handleSuccess, handleError) }, []) @@ -69,7 +80,12 @@ export default function TabPanelFavoritos(props) { const url = `/users/${props.id}/learning_objects/liked?offset=${currLimitLearnObjLiked}&limit=${limit}`; getRequest(url, (data) => { - if (data.length >= 1) { + if (data.errors) { + setLoadingMoreLearnObj(false); + setEndofLearndObj(true); + setErrorInLikedInLearnObj(true); + } + else if (data.length >= 1) { let currData = [...likedLearnObjs]; currData = [...currData.concat(data)]; setLoadingMoreLearnObj(false); @@ -80,7 +96,11 @@ export default function TabPanelFavoritos(props) { setEndofLearndObj(true) } }, - (error) => { console.log(error) } + (error) => { + setLoadingMoreLearnObj(false); + setEndofLearndObj(true); + setErrorInLikedInLearnObj(true); + } ) } @@ -91,6 +111,11 @@ export default function TabPanelFavoritos(props) { const url = `/users/${props.id}/collections/liked?offset=${currLimitCollLiked}&limit=${limit}`; getRequest(url, (data) => { + if (data.errors) { + setLoadingMoreColl(false); + setEndoffColl(true) + setErrorInLikedInColl(true) + } if (data.length >= 1) { let currData = [...likedCollections]; currData = [...currData.concat(data)]; @@ -102,7 +127,11 @@ export default function TabPanelFavoritos(props) { setEndoffColl(true) } }, - (error) => { console.log(error) } + (error) => { + setLoadingMoreColl(false); + setEndoffColl(true) + setErrorInLikedInColl(true) + } ) } @@ -130,6 +159,7 @@ export default function TabPanelFavoritos(props) { showMore={showMoreLikedLearnObj} loadingMore={loadingMoreLearnObj} end={endOfLearnObj} + error={errorInLikedInLearnObj} /> <PanelTemplateColecao @@ -141,6 +171,7 @@ export default function TabPanelFavoritos(props) { loadingMore={loadingMoreColl} end={endOfColl} followed={false} + error={errorInLikedInColl} /> </React.Fragment> ] diff --git a/src/Components/TabPanels/UserPageTabs/PanelMeusRecursos.js b/src/Components/TabPanels/UserPageTabs/PanelMeusRecursos.js index 6a329d67f849851fe3fb24b7db913fc6edbed4ee..c6c3099a11ac3007bb63adc605896512d79caea1 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelMeusRecursos.js +++ b/src/Components/TabPanels/UserPageTabs/PanelMeusRecursos.js @@ -25,6 +25,10 @@ import { fetchAllRequest, getRequest } from '../../HelperFunctions/getAxiosConfi export default function TabPanelAtividades(props) { const [loading, handleLoading] = useState(true) + const [errorInLearnObj, setErrorInLearnObj] = useState(false) + const [errorInDrafts, setErrorInDrafts] = useState(false) + const [errorInCurating, setErrorInCurating] = useState(false) + const [loadingMoreLearnObj, setLoadingMoreLearnObj] = useState(false) const [loadingMoreDrafts, setLoadingMoreDrafts] = useState(false) const [loadingMoreCurating, setLoadingMoreCurating] = useState(false) @@ -41,7 +45,11 @@ export default function TabPanelAtividades(props) { const [drafts, setDrafts] = useState([]); const [curating, setCurating] = useState([]); - function handleSuccess(responseArr, headersArr) { + function handleSuccess(responseArr, headersArr) { + setErrorInLearnObj(responseArr[0].errors ? true : false) + setErrorInDrafts(responseArr[1].errors ? true : false) + setErrorInCurating(responseArr[2].errors ? true : false) + setLearningObjects(responseArr[0]) if (headersArr[0].has('X-Total-Count')) { setEndofLearndObj(headersArr[0].get('X-Total-Count')); @@ -61,6 +69,13 @@ export default function TabPanelAtividades(props) { } + function handleError(error) { + handleLoading(false) + setErrorInCurating(true) + setErrorInDrafts(true) + setErrorInLearnObj(true) + } + useEffect(() => { const urls = [ `/users/${props.id}/learning_objects?offset=0&limit=4`, @@ -68,7 +83,7 @@ export default function TabPanelAtividades(props) { `/users/${props.id}/submissions?offset=0&limit=4&status=submitted` ] handleLoading(true); - fetchAllRequest(urls, handleSuccess, (error) => { console.log(error) }) + fetchAllRequest(urls, handleSuccess, handleError) }, []) const showMoreLearnObj = (limite) => { @@ -78,7 +93,11 @@ export default function TabPanelAtividades(props) { const url = `/users/${props.id}/learning_objects?offset=${currLimitLearnObj}&limit=${limit}`; getRequest(url, (data) => { - if (data.length >= 1) { + if (data.errors) { + setLoadingMoreLearnObj(false); + setErrorInLearnObj(true) + } + else if (data.length >= 1) { let currData = [...learningObjects]; currData = [...currData.concat(data)]; setLoadingMoreLearnObj(false); @@ -89,7 +108,10 @@ export default function TabPanelAtividades(props) { setEndofLearndObj(true) } }, - (error) => { console.log(error) } + (error) => { + setLoadingMoreLearnObj(false); + setErrorInLearnObj(true) + } ) } @@ -101,7 +123,11 @@ export default function TabPanelAtividades(props) { const url = `/users/${props.id}/drafts?offset=${currLimitDrafts}&limit=${limit}`; getRequest(url, (data) => { - if (data.length >= 1) { + if (data.errors) { + setLoadingMoreDrafts(false); + setErrorInDrafts(true) + } + else if (data.length >= 1) { let currData = [...drafts]; currData = [...currData.concat(data)]; console.log('drafs: ', currData); @@ -113,7 +139,10 @@ export default function TabPanelAtividades(props) { setEndofDrafts(true); } }, - (error) => { console.log(error) } + (error) => { + setLoadingMoreDrafts(false); + setErrorInDrafts(true) + } ) } @@ -124,7 +153,11 @@ export default function TabPanelAtividades(props) { const url = `/users/${props.id}/submissions?offset=${currLimitCurating}&limit=${limit}&status=submitted`; getRequest(url, (data) => { - if (data.length >= 1) { + if (data.errors) { + setLoadingMoreCurating(false); + setErrorInCurating(true); + } + else if (data.length >= 1) { let currData = [...curating]; currData = [...currData.concat(data)]; setLoadingMoreCurating(false); @@ -136,7 +169,10 @@ export default function TabPanelAtividades(props) { } }, - (error) => { console.log(error) } + (error) => { + setLoadingMoreCurating(false); + setErrorInCurating(true); + } ) } @@ -159,6 +195,7 @@ export default function TabPanelAtividades(props) { showMore={showMoreLearnObj} loadingMore={loadingMoreLearnObj} end={endOfLearnObj} + error={errorInLearnObj} /> <Template @@ -169,6 +206,7 @@ export default function TabPanelAtividades(props) { showMore={showMoreDrafts} loadingMore={loadingMoreDrafts} end={endOfDrafts} + error={errorInDrafts} /> <TemplateCuradoria @@ -179,6 +217,7 @@ export default function TabPanelAtividades(props) { showMore={showMoreCurating} loadingMore={loadingMoreCurating} end={endOfCurating} + error={errorInCurating} /> </React.Fragment> ] diff --git a/src/Components/TabPanels/UserPageTabs/PanelRede.js b/src/Components/TabPanels/UserPageTabs/PanelRede.js index 9d3d577dae2be3a6dc811a26d9a0e13dd65f2e1e..03f4083bb18f0ad729f2a6234ef16c455666cef8 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelRede.js +++ b/src/Components/TabPanels/UserPageTabs/PanelRede.js @@ -20,135 +20,174 @@ import React, { useState, useEffect } from 'react' import LoadingSpinner from '../../LoadingSpinner.js' import ContainerRedeVazia from './ContainerRedeVazia.js' import PanelTemplateRede from '../PanelComponents/TemplateRede.js' -import { fetchAllRequest,getRequest } from '../../HelperFunctions/getAxiosConfig' +import { fetchAllRequest, getRequest } from '../../HelperFunctions/getAxiosConfig' export default function TabPanelRede(props) { - const [loading, handleLoading] = useState(true) - - const [followingList, setFollowing] = useState([]) - const [currFollowingLimit, setCurrFollowingLimit] = useState(4) - const [loadingMoreFollowing, setLoadingFollowing] = useState(false) - const [endOfFollowing, setEndOfFollowing] = useState(false) - - const [followersList, setFollowers] = useState([]) - const [currFollowerLimit, setFollowersLimit] = useState(4) - const [loadingMoreFollowers, setLoadingMoreFollowers] = useState(false) - const [endOfFollowers, setEndOfFollowers] = useState(false) - - const showMoreFollowing = (limite) => { - setLoadingFollowing(true); - const limit = limite; - setCurrFollowingLimit(currFollowingLimit + limit) - const url = `/users/${props.id}/following/User?offset=${currFollowingLimit}&limit=${limit}`; - getRequest(url, - (data) => { - if (data.length >= 1) { - let currData = [...followingList]; - currData = [...currData.concat(data)]; - setLoadingFollowing(false); - setFollowing(currData); - } - else { - setLoadingFollowing(false); - setEndOfFollowing(true) - } - }, - (error) => { console.log(error) } - ) + const [loading, handleLoading] = useState(true) + + const [errorInFollowing, setErrorInFollowing] = useState(false) + const [errorInFollowers, setErrorInFollowers] = useState(false) + + const [followingList, setFollowing] = useState([]) + const [currFollowingLimit, setCurrFollowingLimit] = useState(12) + const [loadingMoreFollowing, setLoadingFollowing] = useState(false) + const [endOfFollowing, setEndOfFollowing] = useState(false) + + const [followersList, setFollowers] = useState([]) + const [currFollowerLimit, setFollowersLimit] = useState(12) + const [loadingMoreFollowers, setLoadingMoreFollowers] = useState(false) + const [endOfFollowers, setEndOfFollowers] = useState(false) + + const showMoreFollowing = (limite) => { + setLoadingFollowing(true); + const limit = limite; + setCurrFollowingLimit(currFollowingLimit + limit) + const url = `/users/${props.id}/following/User?offset=${currFollowingLimit}&limit=${limit}`; + getRequest(url, + (data) => { + if (data.errors) { + setLoadingFollowing(false); + setEndOfFollowing(true); + setErrorInFollowing(true); + } + else if (data.length >= 1) { + let currData = [...followingList]; + currData = [...currData.concat(data)]; + setLoadingFollowing(false); + setFollowing(currData); + } + else { + setLoadingFollowing(false); + setEndOfFollowing(true); + } + }, + (error) => { + setLoadingFollowing(false); + setEndOfFollowing(true); + setErrorInFollowing(true); + } + ) + } + + const showMoreFollowers = (limite) => { + setLoadingMoreFollowers(true); + const limit = limite; + setFollowersLimit(currFollowerLimit + limit) + const url = `/users/${props.id}/followers?offset=${currFollowerLimit}&limit=${limit}`; + getRequest(url, + (data) => { + if (data.errors) { + setLoadingMoreFollowers(false); + setEndOfFollowers(true); + setErrorInFollowers(true); + } + else { + if (data.length >= 1) { + let currData = [...followersList]; + currData = [...currData.concat(data)]; + setLoadingMoreFollowers(false); + setFollowers(currData); + } + else { + setLoadingMoreFollowers(false); + setEndOfFollowers(true) + } + } + }, + (error) => { + setLoadingMoreFollowers(false); + setEndOfFollowers(true); + setErrorInFollowers(true); + } + ) + } + + async function handleSuccess(responseArr, headersArr) { + setErrorInFollowing(responseArr[0].errors ? true : false) // prevent of crashing the portal, do not remove it + setErrorInFollowers(responseArr[1].errors ? true : false) // prevent of crashing the portal, do not remove it + setFollowing(responseArr[0]) + setFollowers(responseArr[1]) + if (headersArr[0].has('X-Total-Count')) { + setEndOfFollowing(headersArr[0].get('X-Total-Count')); } - - const showMoreFollowers = (limite) => { - setLoadingMoreFollowers(true); - const limit = limite; - setFollowersLimit(currFollowerLimit + limit) - const url = `/users/${props.id}/followers?offset=${currFollowerLimit}&limit=${limit}`; - getRequest(url, - (data) => { - if (data.length >= 1) { - let currData = [...followersList]; - currData = [...currData.concat(data)]; - setLoadingMoreFollowers(false); - setFollowers(currData); - } - else { - setLoadingMoreFollowers(false); - setEndOfFollowers(true) - } - }, - (error) => { console.log(error) } - ) + if (headersArr[1].has('X-Total-Count')) { + setEndOfFollowers(headersArr[1].get('X-Total-Count')); } - - function handleSuccess(responseArr) { - setFollowing(responseArr[0]) - setFollowers(responseArr[1]) - handleLoading(false) - } - - useEffect(() => { - handleLoading(true) - const urls = [ - `/users/${props.id}/following/User`, - `/users/${props.id}/followers` - ] - - fetchAllRequest(urls, handleSuccess, (error) => { console.log(error) }) - }, []) - - return ( - <> - { - loading ? + handleLoading(false) + } + + function handleErrors() { + setLoadingMoreFollowers(false); + setEndOfFollowers(true); + setErrorInFollowers(true); + } + + useEffect(() => { + handleLoading(true) + const urls = [ + `/users/${props.id}/following/User`, + `/users/${props.id}/followers` + ] + + fetchAllRequest(urls, handleSuccess, handleErrors) + }, []) + + return ( + <> + { + loading ? + ( + [ + <LoadingSpinner text={'CARREGANDO...'} /> + ] + ) + : + ( + [ + <> + { + followingList.length === 0 && followersList.length === 0 ? ( - [ - <LoadingSpinner text={'CARREGANDO...'} /> - ] + [ + <> + <ContainerRedeVazia /> + </> + ] ) : ( - [ - <> - { - followingList.length === 0 && followersList.length === 0 ? - ( - [ - <> - <ContainerRedeVazia /> - </> - ] - ) - : - ( - <React.Fragment> - <PanelTemplateRede - title={followersList.length === 1 ? "Seguidor" : "Seguidores"} - length={followersList.length} - sliceArr={followersList} - showMore={showMoreFollowers} - follower={true} - loadingMore={loadingMoreFollowers} - end={endOfFollowers} - noContentText={'Você não possui nenhum seguidor'} - /> - - <PanelTemplateRede - title={"Seguindo"} - length={followingList.length} - sliceArr={followingList} - showMore={showMoreFollowing} - follower={false} - loadingMore={loadingMoreFollowing} - end={endOfFollowing} - noContentText={'Você ainda não segue nenhum usuário'} - /> - </React.Fragment> - - ) - } - </> - ] + <React.Fragment> + <PanelTemplateRede + title={followersList.length === 1 ? "Seguidor" : "Seguidores"} + length={followersList.length} + sliceArr={followersList} + showMore={showMoreFollowers} + follower={true} + loadingMore={loadingMoreFollowers} + end={endOfFollowers} + error={errorInFollowers} + noContentText={'Você não possui nenhum seguidor'} + /> + + <PanelTemplateRede + title={"Seguindo"} + length={followingList.length} + sliceArr={followingList} + showMore={showMoreFollowing} + follower={false} + loadingMore={loadingMoreFollowing} + end={endOfFollowing} + error={errorInFollowing} + noContentText={'Você ainda não segue nenhum usuário'} + /> + </React.Fragment> + ) - } - </> - ) + } + </> + ] + ) + } + </> + ) } diff --git a/src/Components/TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js b/src/Components/TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js index a31c0676151a96e765c4d3da889f4df67e9e413b..6a7aa88863a342036fab9e1474437c857e3e1d37 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js +++ b/src/Components/TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js @@ -20,6 +20,7 @@ import React, {useContext} from 'react' import { Store } from '../../../Store.js'; import styled from 'styled-components' import Button from '@material-ui/core/Button'; +import {Link} from 'react-router-dom'; //3 casos //Professor nao cadastrado (nao pediu OU submitter_request = rejected) @@ -33,7 +34,7 @@ export default function TabPanelSolicitarContaProfessor (props) { <div className='card-config'> <div className='content-div'> { - state.currentUser.submitter_request === 'default' || state.currentUser.submitter_request === 'rejected' ? + !state.currentUser.roles.some(role => role.name === "teacher") && ( state.currentUser.submitter_request === 'default' || state.currentUser.submitter_request === 'rejected' ) ? ( <div> <ImageDiv/> @@ -42,9 +43,14 @@ export default function TabPanelSolicitarContaProfessor (props) { digitais na plataforma com toda a comunidade escolar do país. </StyledP> <div> - <CompletarCadastroButton> - SIM, COMPLETAR CADASTRO - </CompletarCadastroButton> + <Link to={{ + pathname: '/termos-publicar-recurso', + state: true + }}> + <CompletarCadastroButton > + SIM, COMPLETAR CADASTRO + </CompletarCadastroButton> + </Link> </div> </div> ) @@ -54,11 +60,11 @@ export default function TabPanelSolicitarContaProfessor (props) { { state.currentUser.submitter_request === 'requested' ? ( - <span>Requested</span> + <h1>A sua conta de Professor foi solicitada</h1> ) : ( - <span>Professor</span> + <h1>Você já possui uma conta de Professor</h1> ) } </> diff --git a/src/Components/UploadPageComponents/Forms/TipoDeRecurso.js b/src/Components/UploadPageComponents/Forms/TipoDeRecurso.js index 5082742a016e1434fc7b6b1ba13ee25fa5e8e776..4e7a9f29ba8a55c6257cd1f03bb80e3821ab7aab 100644 --- a/src/Components/UploadPageComponents/Forms/TipoDeRecurso.js +++ b/src/Components/UploadPageComponents/Forms/TipoDeRecurso.js @@ -21,7 +21,7 @@ import FormControl from '@material-ui/core/FormControl'; import {StyledRadio, StyledFormLabel} from '../StyledComponents.js' import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; - + function TipoDeRecurso (props) { diff --git a/src/Components/UploadPageComponents/GetIconByName.js b/src/Components/UploadPageComponents/GetIconByName.js index b5f8e8404126abedb86ef16fac02a25b016c0a71..d3c40d376b0032dea30ee2f22e423b4f189c5f38 100644 --- a/src/Components/UploadPageComponents/GetIconByName.js +++ b/src/Components/UploadPageComponents/GetIconByName.js @@ -1,129 +1,132 @@ import React from 'react' -import {ReactComponent as AplicativoMovelIcon} from '../../img/object_type_icons/object-type_aplicativo-movel.svg' -import {ReactComponent as ApresentacaoIcon} from '../../img/object_type_icons/object-type_apresentacao.svg' -import {ReactComponent as AudioIcon} from '../../img/object_type_icons/object-type_audio.svg' -import {ReactComponent as ImagemIcon} from '../../img/object_type_icons/object-type_imagem.svg' -import {ReactComponent as InfograficoIcon} from '../../img/object_type_icons/object-type_infografico.svg' -import {ReactComponent as JogoIcon} from '../../img/object_type_icons/object-type_jogo.svg' -import {ReactComponent as LivroDigitalIcon} from '../../img/object_type_icons/object-type_livro-digital.svg' -import {ReactComponent as MapaIcon} from '../../img/object_type_icons/object-type_mapa.svg' -import {ReactComponent as OutrosIcon} from '../../img/object_type_icons/object-type_outros.svg' -import {ReactComponent as SoftwareEducacionalIcon} from '../../img/object_type_icons/object-type_software-educacional.svg' -import {ReactComponent as TextoIcon} from '../../img/object_type_icons/object-type_texto.svg' -import {ReactComponent as VideoIcon} from '../../img/object_type_icons/object-type_video.svg' -import {ReactComponent as AnimacaoIcon} from '../../img/object_type_icons/object-type_animacao.svg' +import { ReactComponent as AplicativoMovelIcon } from '../../img/object_type_icons/object-type_aplicativo-movel.svg' +import { ReactComponent as ApresentacaoIcon } from '../../img/object_type_icons/object-type_apresentacao.svg' +import { ReactComponent as AudioIcon } from '../../img/object_type_icons/object-type_audio.svg' +import { ReactComponent as ImagemIcon } from '../../img/object_type_icons/object-type_imagem.svg' +import { ReactComponent as InfograficoIcon } from '../../img/object_type_icons/object-type_infografico.svg' +import { ReactComponent as JogoIcon } from '../../img/object_type_icons/object-type_jogo.svg' +import { ReactComponent as LivroDigitalIcon } from '../../img/object_type_icons/object-type_livro-digital.svg' +import { ReactComponent as MapaIcon } from '../../img/object_type_icons/object-type_mapa.svg' +import { ReactComponent as OutrosIcon } from '../../img/object_type_icons/object-type_outros.svg' +import { ReactComponent as SoftwareEducacionalIcon } from '../../img/object_type_icons/object-type_software-educacional.svg' +import { ReactComponent as TextoIcon } from '../../img/object_type_icons/object-type_texto.svg' +import { ReactComponent as VideoIcon } from '../../img/object_type_icons/object-type_video.svg' +import { ReactComponent as AnimacaoIcon } from '../../img/object_type_icons/object-type_animacao.svg' +import { ReactComponent as PlanoAulaIcon } from '../../img/object_type_icons/object-type_plano-de-aula.svg' -import {ReactComponent as Arte} from '../../img/subject_icons/subject_arte.svg' -import {ReactComponent as Biologia} from '../../img/subject_icons/subject_biologia.svg' -import {ReactComponent as CienciasNatureza} from '../../img/subject_icons/subject_ciencias-da-natureza.svg' -import {ReactComponent as DireitosHumanos} from '../../img/subject_icons/subject_direitos-humanos.svg' -import {ReactComponent as EducacaoAmbiental} from '../../img/subject_icons/subject_educacao-ambiental.svg' -import {ReactComponent as EducacaoCampo} from '../../img/subject_icons/subject_educacao-do-campo.svg' -import {ReactComponent as EducacaoEspecial} from '../../img/subject_icons/subject_educacao-especial.svg' -import {ReactComponent as EducacaoFisica} from '../../img/subject_icons/subject_educacao-fisica.svg' -import {ReactComponent as EducacaoIndigena} from '../../img/subject_icons/subject_educacao-indigena.svg' -import {ReactComponent as EducacaoQuilombola} from '../../img/subject_icons/subject_educacao-quilombola.svg' -import {ReactComponent as EducacaoSexual} from '../../img/subject_icons/subject_educacao-sexual.svg' -import {ReactComponent as EnsinoReligioso} from '../../img/subject_icons/subject_ensino-religioso.svg' -import {ReactComponent as Filosofia} from '../../img/subject_icons/subject_filosofia.svg' -import {ReactComponent as Fisica} from '../../img/subject_icons/subject_fisica.svg' -import {ReactComponent as Geografia} from '../../img/subject_icons/subject_geografia.svg' -import {ReactComponent as Historia} from '../../img/subject_icons/subject_historia.svg' -import {ReactComponent as Informatica} from '../../img/subject_icons/subject_informatica.svg' -import {ReactComponent as LinguaEspanhola} from '../../img/subject_icons/subject_lingua-espanhola.svg' -import {ReactComponent as LinguaInglesa} from '../../img/subject_icons/subject_lingua-inglesa.svg' -import {ReactComponent as LinguaPortuguesa} from '../../img/subject_icons/subject_lingua-portuguesa.svg' -import {ReactComponent as Matematica} from '../../img/subject_icons/subject_matematica.svg' -import {ReactComponent as OutrasLinguas} from '../../img/subject_icons/subject_outras-linguas.svg' -import {ReactComponent as Quimica} from '../../img/subject_icons/subject_quimica.svg' -import {ReactComponent as Sociologia} from '../../img/subject_icons/subject_sociologia.svg' -import {ReactComponent as Outros} from '../../img/subject_icons/subject_outros.svg' +import { ReactComponent as Arte } from '../../img/subject_icons/subject_arte.svg' +import { ReactComponent as Biologia } from '../../img/subject_icons/subject_biologia.svg' +import { ReactComponent as CienciasNatureza } from '../../img/subject_icons/subject_ciencias-da-natureza.svg' +import { ReactComponent as DireitosHumanos } from '../../img/subject_icons/subject_direitos-humanos.svg' +import { ReactComponent as EducacaoAmbiental } from '../../img/subject_icons/subject_educacao-ambiental.svg' +import { ReactComponent as EducacaoCampo } from '../../img/subject_icons/subject_educacao-do-campo.svg' +import { ReactComponent as EducacaoEspecial } from '../../img/subject_icons/subject_educacao-especial.svg' +import { ReactComponent as EducacaoFisica } from '../../img/subject_icons/subject_educacao-fisica.svg' +import { ReactComponent as EducacaoIndigena } from '../../img/subject_icons/subject_educacao-indigena.svg' +import { ReactComponent as EducacaoQuilombola } from '../../img/subject_icons/subject_educacao-quilombola.svg' +import { ReactComponent as EducacaoSexual } from '../../img/subject_icons/subject_educacao-sexual.svg' +import { ReactComponent as EnsinoReligioso } from '../../img/subject_icons/subject_ensino-religioso.svg' +import { ReactComponent as Filosofia } from '../../img/subject_icons/subject_filosofia.svg' +import { ReactComponent as Fisica } from '../../img/subject_icons/subject_fisica.svg' +import { ReactComponent as Geografia } from '../../img/subject_icons/subject_geografia.svg' +import { ReactComponent as Historia } from '../../img/subject_icons/subject_historia.svg' +import { ReactComponent as Informatica } from '../../img/subject_icons/subject_informatica.svg' +import { ReactComponent as LinguaEspanhola } from '../../img/subject_icons/subject_lingua-espanhola.svg' +import { ReactComponent as LinguaInglesa } from '../../img/subject_icons/subject_lingua-inglesa.svg' +import { ReactComponent as LinguaPortuguesa } from '../../img/subject_icons/subject_lingua-portuguesa.svg' +import { ReactComponent as Matematica } from '../../img/subject_icons/subject_matematica.svg' +import { ReactComponent as OutrasLinguas } from '../../img/subject_icons/subject_outras-linguas.svg' +import { ReactComponent as Quimica } from '../../img/subject_icons/subject_quimica.svg' +import { ReactComponent as Sociologia } from '../../img/subject_icons/subject_sociologia.svg' +import { ReactComponent as Outros } from '../../img/subject_icons/subject_outros.svg' -export function GetSubjectIconByName (subjName) { + +export function GetSubjectIconByName(subjName) { switch (subjName) { case "Arte": - return <Arte className="icon"/> + return <Arte className="icon" /> case "Biologia": - return <Biologia className="icon"/> + return <Biologia className="icon" /> case "Ciências da Natureza": - return <CienciasNatureza className="icon"/> + return <CienciasNatureza className="icon" /> case "Direitos Humanos": - return <DireitosHumanos className="icon"/> + return <DireitosHumanos className="icon" /> case "Educação Ambiental": - return <EducacaoAmbiental className="icon"/>; + return <EducacaoAmbiental className="icon" />; case "Educação do Campo": - return <EducacaoCampo className="icon"/>; + return <EducacaoCampo className="icon" />; case "Educação Especial": - return <EducacaoEspecial className="icon"/>; + return <EducacaoEspecial className="icon" />; case "Educação Física": - return <EducacaoFisica className="icon"/>; + return <EducacaoFisica className="icon" />; case "Educação Indígena": - return <EducacaoIndigena className="icon"/>; + return <EducacaoIndigena className="icon" />; case "Educação Quilombola": - return <EducacaoQuilombola className="icon"/>; + return <EducacaoQuilombola className="icon" />; case "Educação Sexual": - return <EducacaoSexual className="icon"/>; + return <EducacaoSexual className="icon" />; case "Ensino Religioso": - return <EnsinoReligioso className="icon"/>; + return <EnsinoReligioso className="icon" />; case "Filosofia": - return <Filosofia className="icon"/>;; + return <Filosofia className="icon" />;; case "Física": - return <Fisica className="icon"/>; + return <Fisica className="icon" />; case "Geografia": - return <Geografia className="icon"/>; + return <Geografia className="icon" />; case "História": - return <Historia className="icon"/>; + return <Historia className="icon" />; case "Informática": - return <Informatica className="icon"/>; + return <Informatica className="icon" />; case "Língua Espanhola": - return <LinguaEspanhola className="icon"/>; + return <LinguaEspanhola className="icon" />; case "Língua Inglesa": - return <LinguaInglesa className="icon"/>; + return <LinguaInglesa className="icon" />; case "Língua Portuguesa": - return <LinguaPortuguesa className="icon"/>; + return <LinguaPortuguesa className="icon" />; case "Matemática": - return <Matematica className="icon"/>; + return <Matematica className="icon" />; case "Outras Línguas": - return <OutrasLinguas className="icon"/>; + return <OutrasLinguas className="icon" />; case "Química": - return <Quimica className="icon"/>; + return <Quimica className="icon" />; case "Sociologia": - return <Sociologia className="icon"/>; + return <Sociologia className="icon" />; default: - return <Outros className="icon"/>; + return <Outros className="icon" />; } } -export default function GetIconByName (objName) { +export default function GetIconByName(objName) { switch (objName.toLowerCase()) { case "imagem": return <ImagemIcon className="icon" />; case "mapa": - return <MapaIcon className="icon"/>; - case "software educacional" : - return <SoftwareEducacionalIcon className="icon"/>; + return <MapaIcon className="icon" />; + case "software educacional": + return <SoftwareEducacionalIcon className="icon" />; + case "plano de aula": + return <PlanoAulaIcon className="icon" />; case "aplicativo móvel": - return <AplicativoMovelIcon className="icon"/>; + return <AplicativoMovelIcon className="icon" />; case "apresentação": - return <ApresentacaoIcon className="icon"/>; + return <ApresentacaoIcon className="icon" />; case "áudio": - return <AudioIcon className="icon"/>; + return <AudioIcon className="icon" />; case "infográfico": - return <InfograficoIcon className="icon"/>; + return <InfograficoIcon className="icon" />; case "jogo": - return <JogoIcon className="icon"/>; - case "livro digital" : - return <LivroDigitalIcon className="icon"/>; + return <JogoIcon className="icon" />; + case "livro digital": + return <LivroDigitalIcon className="icon" />; case "texto": - return <TextoIcon className="icon"/>; + return <TextoIcon className="icon" />; case "vídeo": - return <VideoIcon className="icon"/>; + return <VideoIcon className="icon" />; case "animação": - return <AnimacaoIcon className="icon"/>; + return <AnimacaoIcon className="icon" />; default: - return <OutrosIcon className="icon"/>; - - } + return <OutrosIcon className="icon" />; + } } diff --git a/src/Components/UploadPageComponents/ModalCancelar.js b/src/Components/UploadPageComponents/ModalCancelar.js index 9616436b10e683fdb274387b58ff2aed3c8d788b..fcfbc9b273cb75e79e05910aed2946eba4a39eb6 100644 --- a/src/Components/UploadPageComponents/ModalCancelar.js +++ b/src/Components/UploadPageComponents/ModalCancelar.js @@ -126,9 +126,9 @@ const Container = styled.div` border-radius : 4px; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); - @media screen and (max-width : 899px) { + @media screen and (max-width : 599px) { width : 100%; - height : 100%; + height : 40%; } ` const StyledButton = styled(Button)` diff --git a/src/Components/UserPageComponents/SubmitterStatus.js b/src/Components/UserPageComponents/SubmitterStatus.js index 7795a90df8376ca052eb13013c1771b1c522d03a..1cb29365644038f8a8a9a115675ddf8f0af1ccfd 100644 --- a/src/Components/UserPageComponents/SubmitterStatus.js +++ b/src/Components/UserPageComponents/SubmitterStatus.js @@ -18,6 +18,7 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, {useContext} from 'react'; import { Store } from '../../Store.js'; import CheckDecagram from '../../img/check-decagram-gray.svg' +import {Link} from 'react-router-dom'; export default function SubmitterStatus (props) { const {state} = useContext(Store) @@ -42,7 +43,15 @@ export default function SubmitterStatus (props) { <img src={CheckDecagram} alt='check icon'/> </span> {text} - <span style={{color:"#00bcd4"}}> SAIBA MAIS</span> + <Link to={{ + pathname: '/editarperfil', + tabValue: { + value: 1 + } + }}> + <span style={{color:"#00bcd4"}}> SAIBA MAIS</span> + </Link> + </span> </p> </React.Fragment> diff --git a/src/Pages/CollectionPage.js b/src/Pages/CollectionPage.js index b0bfdeb7db587ccfa45f4d11ef030f330978322f..3ccb5ab1929d32cc3be204d59fa939664b85596f 100644 --- a/src/Pages/CollectionPage.js +++ b/src/Pages/CollectionPage.js @@ -29,7 +29,7 @@ import Breadcrumbs from "@material-ui/core/Breadcrumbs"; import { Link } from 'react-router-dom'; import FollowCollectionButton from '../Components/FollowCollectionButton'; import { Store } from '../Store.js' -import {getRequest} from '../Components/HelperFunctions/getAxiosConfig.js' +import { getRequest } from '../Components/HelperFunctions/getAxiosConfig.js' export default function CollectionPage(props) { const { state } = useContext(Store); @@ -42,13 +42,13 @@ export default function CollectionPage(props) { const comment_ref = useRef(null); useEffect(() => { - const url = `/collections/${collection_id}` + const url = `/collections/${collection_id}` - getRequest(url, (data) => {setCollection(Object.assign({}, data))}, (error) => {console.log(error)}) + getRequest(url, (data) => { setCollection(Object.assign({}, data)) }, (error) => { console.log(error) }) }, []); const handleScrollToComments = () => { - window.scrollTo(0, comment_ref.current.offsetTop); + comment_ref.current.scrollIntoView({ behavior: 'smooth' }) } return ( <> @@ -78,7 +78,7 @@ export default function CollectionPage(props) { <DowloadButton id={collection.id ? collection.id : 0} /> - <div style={{height : 12}}></div> + <div style={{ height: 12 }}></div> <FollowCollectionButton user_id={state.currentUser.id} collection_id={collection_id} /> @@ -87,7 +87,7 @@ export default function CollectionPage(props) { <VerticalRuler width={1} height={100} color="rgb(238, 238, 238)" /> - <Grid container justify="center" style={{ backgroundColor: '#f4f4f4'}}> + <Grid container justify="center" style={{ backgroundColor: '#f4f4f4' }}> {/* <Grid item xs={1}/> */} <Grid item xs={10}> <ResourceList resources={ @@ -113,7 +113,7 @@ export default function CollectionPage(props) { } /> </Grid> - <Grid container item xs={12} style={{ marginTop: 40, paddingBottom:40 }} ref={comment_ref}> + <Grid container item xs={12} style={{ marginTop: 40, paddingBottom: 40 }} ref={comment_ref}> <CollectionCommentSection id={collection_id} /> </Grid> </Grid> diff --git a/src/Pages/EditLearningObjectPage.js b/src/Pages/EditLearningObjectPage.js index 1f929c4765c2bd93cd375167b52b8ba09dcec820..5f8e84fd37ca9631c73f1ede50177413be608507 100644 --- a/src/Pages/EditLearningObjectPage.js +++ b/src/Pages/EditLearningObjectPage.js @@ -101,7 +101,14 @@ export default function EditLearningObjectPage (props) { const [updatedInfo, setUpdatedInfo] = useState({}) const onBlurCallback = (fieldName, payload) => { - setUpdatedInfo({...updatedInfo, [fieldName] : payload}) + const key = fieldName + let value = payload + if (key === "tags") { + value = payload.map( (tag, index) => + index = { "name" : tag} + ) + } + setUpdatedInfo({...updatedInfo, [fieldName] : value}) } const [snackbarOpen, toggleSnackbar] = useState(false) @@ -123,7 +130,10 @@ export default function EditLearningObjectPage (props) { "learning_object" : updatedInfo } - putRequest(url, payload, (data) => {props.history.goBack()}, (error) => {console.log(error)}) + putRequest(url, payload, + (data) => {props.history.push( `/recurso/${learningObject.id}`)}, + (error) => {console.log(error)} + ) } const handlePost = () => { @@ -140,6 +150,34 @@ export default function EditLearningObjectPage (props) { } + const handleSubmit = () => { + if (state.currentUser.id !== "") { + const url = `/submissions/` + + let payload = { + "submission" : { + "learning_object_id" : learningObject.id + } + } + + postRequest(url, payload, + (data) => {props.history.push( `/recurso/${learningObject.id}`)}, + (error) => {console.log(error)} + ) + + } + } + + const checkAccessLevel = (levelToCheck) => { + if (state.currentUser.id !== '') { + return (checkUserRole(levelToCheck)) + } + } + + const checkUserRole = (userRole) => { + return (state.currentUser.roles.filter((role) => role.name === userRole).length > 0) + } + const [thumbnailStage, setThumbnailStage] = useState('default') const [thumbnail, setThumbnail] = useState('') @@ -217,7 +255,7 @@ export default function EditLearningObjectPage (props) { </Grid> <Grid item md={8} xs={12}> <InfoBox> - <form onSubmit={handlePost}> + <form> <div className="cabecalho"> <h2>Editar Recurso</h2> </div> @@ -295,11 +333,22 @@ export default function EditLearningObjectPage (props) { SALVAR ALTERAÇÕES </OrangeButton> - { + {/* learningObject.state === "draft" && <OrangeButton type="submit"> PUBLICAR RECURSO </OrangeButton> + */} + { + checkAccessLevel("partner") ? + ( + <OrangeButton onClick={() => {handleUpdateInfo(); handlePost()}}>PUBLICAR RECURSO</OrangeButton> + ) + : + ( + <OrangeButton onClick={() => {handleUpdateInfo(); handleSubmit()}}>SUBMETER RECURSO</OrangeButton> + ) + } </div> </Grid> diff --git a/src/Pages/EditProfilePage.js b/src/Pages/EditProfilePage.js index a7e7755588243eaf22194f14a97f0673f5453563..0cf1e91667ca942dca98460c73cb6223519de77c 100644 --- a/src/Pages/EditProfilePage.js +++ b/src/Pages/EditProfilePage.js @@ -21,7 +21,7 @@ export default function EditProfilePage(props) { const [tabs, setTabs] = useState([ 'Editar Perfil', 'Solicitar conta de Professor', 'Gerenciar Conta' ]) - const [tabValue, setTabValue] = useState(0) + const [tabValue, setTabValue] = useState(props.location.tabValue !== undefined ? props.location.tabValue.value : 0) const handleChangeTab = (e, newValue) => { setTabValue(newValue) } @@ -139,7 +139,7 @@ export default function EditProfilePage(props) { </h4> <StyledTabs orientation="vertical" - variant="scrollable" + variant="fullWidth" value={tabValue} onChange={handleChangeTab} TabIndicatorProps={{ style: { display: "none" } }} diff --git a/src/Pages/PageProfessor.js b/src/Pages/PageProfessor.js index 6ee8588e27a0ba57100336e6da714c2c938f1acd..96cd46bb141e537274c606200855b89428a8e54a 100644 --- a/src/Pages/PageProfessor.js +++ b/src/Pages/PageProfessor.js @@ -78,8 +78,8 @@ export default function PageProfessor (props) { const handleParteTres = (phone, cpf) => { setRegisterInformation({...registerInformation, - teacher_cpf: (phone ? phone : ''), - school_phone: (cpf ? cpf : ''), + teacher_cpf: (cpf ? cpf : ''), + school_phone: (phone ? phone : ''), }) handleModal(); } @@ -141,7 +141,7 @@ export default function PageProfessor (props) { } { stepper[3].selected && - <SuccessfulRequest email={state.currentUser.email}/> + <SuccessfulRequest email={state.currentUser.email} history={props.history}/> } </div> </Paper> diff --git a/src/Pages/ResourcePage.js b/src/Pages/ResourcePage.js index 834a2c13e37779d62476666f5f5f64a8c5138b21..ff63e4f479a36799c3d8240d5a3afa3e5905eb2c 100644 --- a/src/Pages/ResourcePage.js +++ b/src/Pages/ResourcePage.js @@ -79,7 +79,8 @@ export default function LearningObjectPage(props) { "O Recurso foi guardado na coleção!", "O recurso foi aprovado com sucesso!", "Erro ao aprovar o recurso!", - "Erro ao carregar a página" + "Erro ao carregar a página", + "Erro ao fazer o dowload do recurso", ]; const [snackbarIndex, setIndex] = useState(0); const classes = useStyles(); diff --git a/src/Pages/Search.js b/src/Pages/Search.js index b1ba6498171ed7fa92fc4cec260a2af5ece18d74..db1c0201834e8a4b54f7ac4f3313425255cf436e 100644 --- a/src/Pages/Search.js +++ b/src/Pages/Search.js @@ -216,7 +216,7 @@ export default function Search(props) { <Grid item xs> <Grid container justify="center" alignItems="center" spacing={2}> {resultsCollection.map((card) => ( - <Grid item xs key={card.id}> + <Grid container item xs justify="center" alignItems="center" key={card.id}> <CollectionCardFunction name={card.name} tags={card.tags} @@ -277,7 +277,7 @@ export default function Search(props) { <Grid item xs> <Grid container justify="center" spacing={3} alignItems="center" > {resultsResource.map((card) => ( - <Grid item xs={12} sm={6} md={4} lg={3} key={card.id}> + <Grid container justify="center" alignItems="center" item xs={12} sm={6} md={4} lg={3} key={card.id}> <ResourceCardFunction avatar={card.publisher ? card.publisher.avatar : ""} id={card.id} @@ -354,7 +354,7 @@ export default function Search(props) { <Grid item xs > <Grid container spacing={2} justify="center" alignItems="center"> {resultsUser.map((card) => ( - <Grid item xs key={card.id}> + <Grid container justify="center" alignItems="center" item xs key={card.id}> <ContactCard name={card.name} avatar={card.avatar ? apiDomain + card.avatar : null} diff --git a/src/Pages/UserPage.js b/src/Pages/UserPage.js index da97c43e1f7d0a75be524b76168c8e666125a584..259522a052527be06359a1f29e9e98b5faa31b9c 100644 --- a/src/Pages/UserPage.js +++ b/src/Pages/UserPage.js @@ -53,8 +53,7 @@ export default function UserPage(props) { const [follows, setFollows] = useState(0); const [following, setFollowing] = useState(0); - const [loading, setLoading] = useState(false); - + const [loading, setLoading] = useState(false); const [tabValue, setTabValue] = useState(Number(props.location.state) || 0); const [tabs, setTabs] = useState([ "Atividades", @@ -108,7 +107,7 @@ export default function UserPage(props) { }, []); useEffect(() => { - setTabValue(Number(props.location.state)) + setTabValue(Number(props.location.state) || 0) }, [window.history.state.key]) const redirect = () => { diff --git a/src/img/object_type_icons/object-type_plano-de-aula.svg b/src/img/object_type_icons/object-type_plano-de-aula.svg new file mode 100644 index 0000000000000000000000000000000000000000..c015b3d4a95589081c61f9b91bfd89448237fe82 --- /dev/null +++ b/src/img/object_type_icons/object-type_plano-de-aula.svg @@ -0,0 +1,2 @@ + +<svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="52" height="47.7" viewBox="0, 0, 400,645.1612903225806"><g id="svgg"><path id="path0" d="M254.902 4.047 C 254.188 4.253,253.330 4.840,252.995 5.351 C 252.453 6.178,251.976 6.307,248.659 6.525 C 244.626 6.790,243.357 7.139,241.200 8.579 C 240.277 9.195,238.915 9.603,237.200 9.778 C 233.485 10.157,231.875 10.656,230.850 11.747 C 230.173 12.467,229.344 12.769,227.476 12.976 C 223.669 13.398,221.751 13.988,220.763 15.039 C 220.200 15.639,219.410 16.000,218.663 16.000 C 215.632 16.000,212.214 16.915,211.204 17.996 C 210.346 18.915,209.742 19.120,207.197 19.358 C 203.299 19.722,201.811 20.219,201.024 21.420 C 200.506 22.211,200.046 22.400,198.645 22.400 C 195.076 22.400,192.686 23.120,191.320 24.607 C 190.115 25.919,189.892 26.000,187.484 26.000 C 184.513 26.000,181.784 26.730,179.997 28.002 C 179.175 28.587,177.808 29.006,176.068 29.206 C 172.970 29.562,171.349 30.126,170.123 31.275 C 169.480 31.877,168.414 32.181,166.123 32.415 C 162.550 32.780,161.145 33.239,159.587 34.550 C 158.752 35.252,157.800 35.534,155.663 35.713 C 152.720 35.960,151.711 36.328,149.941 37.799 C 149.114 38.486,148.179 38.728,145.691 38.899 C 142.301 39.131,141.132 39.554,139.719 41.061 C 139.010 41.817,138.424 42.000,136.719 42.002 C 133.779 42.005,131.794 42.637,130.379 44.021 C 129.305 45.071,128.900 45.200,126.684 45.200 C 123.380 45.200,121.679 45.735,120.347 47.194 C 119.335 48.302,119.031 48.400,116.610 48.400 C 113.600 48.400,111.792 49.036,110.503 50.548 C 109.709 51.479,109.313 51.600,107.075 51.600 C 104.044 51.600,101.072 52.419,99.266 53.751 C 98.374 54.410,97.136 54.820,95.471 55.008 C 92.737 55.318,90.862 55.978,89.361 57.159 C 88.718 57.665,87.424 58.032,85.684 58.201 C 82.193 58.540,80.432 59.085,79.200 60.208 C 78.473 60.870,77.490 61.192,75.600 61.387 C 72.182 61.739,70.421 62.296,69.200 63.408 C 68.475 64.068,67.485 64.394,65.600 64.591 C 61.669 65.003,60.070 65.521,59.353 66.616 C 58.901 67.306,58.343 67.600,57.487 67.600 C 54.432 67.600,51.017 68.511,50.003 69.597 C 49.117 70.546,48.571 70.717,45.608 70.975 C 41.993 71.290,40.282 71.925,39.598 73.204 C 39.273 73.810,38.759 74.000,37.441 74.000 C 34.061 74.000,31.468 74.714,30.400 75.939 C 29.494 76.978,29.079 77.112,26.000 77.358 C 21.545 77.714,20.023 78.151,18.199 79.601 C 17.065 80.502,16.273 80.800,15.016 80.800 C 10.744 80.800,7.608 83.155,6.790 86.977 C 6.481 88.419,6.392 154.291,6.480 316.200 C 6.612 560.097,6.480 545.647,8.595 547.033 C 9.340 547.522,9.612 548.158,9.831 549.930 C 10.065 551.826,10.346 552.422,11.531 553.544 C 12.312 554.284,13.345 555.724,13.826 556.744 C 15.254 559.773,22.480 566.531,25.000 567.193 C 26.100 567.483,27.360 568.041,27.800 568.435 C 29.514 569.968,32.093 570.782,35.262 570.791 C 38.170 570.800,38.409 570.870,40.000 572.200 C 40.922 572.970,41.704 573.612,41.738 573.626 C 41.772 573.641,44.094 573.801,46.899 573.983 C 51.909 574.307,52.018 574.334,53.159 575.556 C 53.798 576.240,54.384 576.810,54.460 576.822 C 54.537 576.835,56.445 576.983,58.699 577.152 C 62.052 577.403,62.962 577.612,63.699 578.303 C 65.134 579.647,66.714 580.080,71.221 580.366 C 74.735 580.588,75.661 580.789,76.750 581.564 C 78.603 582.884,81.297 583.600,84.409 583.600 C 86.771 583.600,87.265 583.739,88.563 584.771 C 90.339 586.182,92.967 586.800,97.189 586.800 C 99.998 586.800,100.472 586.913,101.576 587.841 C 103.289 589.283,105.971 590.000,109.650 590.000 C 112.561 590.000,112.866 590.083,114.163 591.221 C 115.949 592.790,117.273 593.153,122.343 593.469 C 125.954 593.694,126.595 593.844,127.343 594.641 C 128.616 595.998,129.956 596.359,134.827 596.655 C 138.529 596.880,139.301 597.041,139.631 597.657 C 140.384 599.064,142.212 599.597,147.217 599.866 C 151.666 600.105,152.113 600.201,152.659 601.033 C 153.454 602.248,154.922 602.704,159.100 603.037 C 161.922 603.262,162.816 603.496,163.718 604.247 C 165.174 605.460,166.956 605.908,171.600 606.228 C 174.628 606.436,175.684 606.679,176.800 607.422 C 178.905 608.825,179.918 609.103,184.033 609.411 C 187.132 609.642,187.977 609.852,188.800 610.592 C 190.247 611.894,191.900 612.331,196.509 612.632 C 199.997 612.859,200.747 613.033,201.600 613.815 C 202.901 615.006,204.915 615.511,209.692 615.845 C 213.157 616.087,213.651 616.218,214.189 617.039 C 214.992 618.265,216.925 618.759,222.132 619.069 C 225.994 619.298,226.526 619.421,227.038 620.201 C 227.964 621.615,229.529 622.082,234.234 622.349 C 238.509 622.591,238.721 622.647,240.148 623.900 C 241.921 625.458,240.854 625.191,246.899 625.583 C 251.909 625.907,252.018 625.934,253.159 627.156 C 253.798 627.840,254.384 628.410,254.460 628.422 C 254.537 628.435,256.445 628.583,258.699 628.752 C 262.052 629.003,262.962 629.212,263.699 629.903 C 265.134 631.247,266.714 631.680,271.221 631.966 C 274.735 632.188,275.661 632.389,276.750 633.164 C 278.603 634.484,281.297 635.200,284.409 635.200 C 286.774 635.200,287.264 635.339,288.571 636.377 C 290.376 637.812,292.559 638.263,299.175 638.570 C 303.234 638.759,304.302 638.937,304.975 639.541 C 307.639 641.930,313.532 642.096,315.021 639.824 C 315.558 639.004,316.071 638.845,318.920 638.613 C 325.032 638.116,329.931 634.970,332.048 630.184 C 332.480 629.209,333.201 628.214,333.650 627.973 C 335.612 626.923,335.738 625.809,335.977 607.400 L 336.200 590.200 344.395 590.344 C 352.284 590.483,352.621 590.522,353.423 591.387 C 356.107 594.283,376.637 594.293,379.601 591.399 C 380.606 590.418,381.399 590.000,382.257 590.000 C 384.249 590.000,385.982 589.196,386.611 587.979 C 386.933 587.355,387.691 586.608,388.295 586.319 C 388.899 586.029,389.631 585.296,389.922 584.689 C 390.213 584.082,390.914 583.282,391.480 582.911 C 392.657 582.140,393.600 580.163,393.600 578.468 C 393.600 577.786,394.089 576.695,394.790 575.813 C 395.444 574.989,396.119 573.660,396.290 572.858 C 396.699 570.934,396.693 145.040,396.284 143.112 C 396.110 142.293,395.505 141.073,394.939 140.400 C 394.141 139.452,393.834 138.506,393.575 136.201 C 393.211 132.949,392.858 132.062,391.141 130.086 C 390.514 129.363,390.000 128.583,390.000 128.353 C 390.000 127.761,381.732 119.600,381.132 119.600 C 380.860 119.600,380.060 119.040,379.354 118.356 C 378.037 117.079,374.770 116.019,372.109 116.006 C 371.201 116.002,370.636 115.722,370.204 115.062 C 369.068 113.328,367.871 113.090,359.269 112.888 C 351.405 112.704,351.109 112.668,350.269 111.771 C 349.069 110.492,347.552 110.000,344.809 110.000 L 342.470 110.000 342.307 86.100 C 342.131 60.219,342.120 60.096,339.957 58.978 C 339.280 58.628,338.800 58.055,338.800 57.598 C 338.800 56.083,337.514 53.630,336.192 52.621 C 335.456 52.060,334.739 51.238,334.599 50.796 C 334.297 49.844,332.757 48.978,330.672 48.587 C 329.594 48.385,329.010 47.993,328.598 47.196 C 327.975 45.992,326.228 45.200,324.195 45.200 C 323.370 45.200,322.370 44.771,321.401 44.001 C 319.007 42.098,317.560 41.901,307.406 42.090 C 297.873 42.269,296.641 42.466,294.905 44.091 C 294.076 44.868,293.531 44.932,287.505 44.965 L 281.000 45.000 280.800 32.000 C 280.592 18.457,280.469 17.530,278.823 17.007 C 278.301 16.842,277.833 16.032,277.401 14.544 C 277.037 13.292,276.326 11.952,275.767 11.464 C 275.223 10.989,274.088 9.907,273.244 9.060 C 271.665 7.475,268.671 6.421,265.709 6.406 C 264.789 6.402,264.236 6.122,263.783 5.430 C 262.666 3.725,258.346 3.052,254.902 4.047 M259.863 20.700 C 260.617 21.305,261.992 22.462,262.917 23.271 L 264.600 24.742 264.600 36.471 L 264.600 48.200 258.000 48.432 C 251.296 48.667,249.644 48.994,247.449 50.525 C 246.410 51.249,245.377 51.356,236.849 51.623 C 226.417 51.950,225.926 52.027,224.200 53.603 L 223.000 54.700 213.400 54.946 C 203.361 55.203,201.508 55.469,199.200 56.987 C 197.870 57.863,197.329 57.921,188.326 58.154 C 178.514 58.409,177.186 58.621,175.744 60.158 C 174.912 61.045,174.608 61.078,165.344 61.318 C 155.372 61.575,153.650 61.854,152.658 63.368 C 152.072 64.261,151.896 64.280,141.931 64.521 C 131.254 64.779,129.235 65.077,127.578 66.637 C 126.572 67.586,126.446 67.599,119.178 67.564 C 113.882 67.538,112.166 67.422,113.098 67.153 C 113.812 66.947,114.687 66.333,115.044 65.789 C 115.499 65.094,116.056 64.800,116.913 64.800 C 120.049 64.800,123.381 63.891,124.453 62.743 C 125.319 61.816,125.858 61.600,127.306 61.600 C 130.813 61.600,133.324 60.896,134.429 59.604 C 135.258 58.634,135.772 58.400,137.075 58.400 C 140.499 58.400,142.938 57.680,144.091 56.329 C 145.131 55.112,145.358 55.039,148.891 54.782 C 152.879 54.493,154.498 54.017,155.872 52.730 C 156.472 52.168,157.594 51.816,159.472 51.600 C 162.600 51.241,164.245 50.679,165.437 49.563 C 166.040 48.998,167.238 48.669,169.716 48.387 C 173.693 47.935,174.862 47.556,176.486 46.189 C 177.334 45.475,178.136 45.200,179.367 45.200 C 181.721 45.200,184.548 44.283,186.024 43.041 C 187.007 42.214,187.687 42.000,189.331 41.998 C 192.223 41.995,194.213 41.356,195.621 39.979 C 196.644 38.979,197.145 38.800,198.914 38.798 C 201.744 38.795,203.617 38.217,205.407 36.794 C 206.722 35.750,207.231 35.600,209.468 35.600 C 212.404 35.600,214.216 34.954,215.497 33.452 C 216.297 32.515,216.680 32.400,219.010 32.400 C 221.957 32.400,223.999 31.708,224.916 30.398 C 225.451 29.635,226.055 29.471,229.269 29.217 C 233.133 28.912,235.142 28.284,236.718 26.888 C 237.315 26.359,238.506 25.974,240.118 25.788 C 243.024 25.452,244.096 25.093,246.000 23.818 C 246.969 23.169,248.262 22.797,250.200 22.611 C 253.935 22.253,255.789 21.676,256.855 20.541 C 257.975 19.350,258.192 19.361,259.863 20.700 M317.133 59.594 C 317.618 60.251,318.507 60.908,319.108 61.055 C 319.709 61.201,321.412 62.390,322.894 63.697 C 325.570 66.056,325.716 66.310,326.560 70.069 C 326.692 70.657,327.250 71.673,327.800 72.327 L 328.800 73.515 328.800 91.558 L 328.800 109.600 322.054 109.600 C 315.793 109.600,315.231 109.539,314.233 108.755 C 311.930 106.943,310.314 106.769,293.413 106.514 L 277.426 106.273 276.201 104.974 C 274.601 103.277,274.524 103.270,256.432 103.056 C 242.099 102.887,241.437 102.846,240.832 102.087 C 239.393 100.281,238.979 100.234,222.080 99.962 C 206.539 99.711,205.929 99.673,205.080 98.878 C 203.259 97.172,202.407 97.079,185.869 96.787 C 170.631 96.517,169.890 96.469,168.821 95.679 C 166.409 93.896,164.326 93.678,147.627 93.467 C 132.551 93.276,131.826 93.232,131.227 92.480 C 129.794 90.682,129.369 90.634,112.480 90.362 C 96.939 90.111,96.329 90.073,95.480 89.278 C 94.996 88.824,94.060 88.226,93.400 87.949 C 92.309 87.490,92.635 87.419,97.000 87.164 C 102.043 86.869,103.644 86.467,105.059 85.142 C 105.849 84.402,106.598 84.323,114.459 84.152 C 125.749 83.905,126.291 83.827,127.799 82.229 L 129.021 80.933 139.210 80.666 C 149.940 80.386,151.975 80.095,153.600 78.613 C 154.560 77.737,154.958 77.691,163.600 77.460 C 173.253 77.202,174.998 76.927,176.269 75.465 C 177.069 74.544,177.258 74.523,186.642 74.283 C 196.575 74.030,199.255 73.621,201.562 72.005 C 202.466 71.372,203.791 71.249,211.800 71.050 C 221.633 70.806,223.662 70.488,224.608 69.044 C 225.198 68.143,225.374 68.123,234.904 67.869 C 245.037 67.600,246.889 67.333,249.200 65.813 C 250.530 64.938,251.072 64.879,260.000 64.649 C 270.069 64.389,272.067 64.081,273.008 62.643 C 273.599 61.742,273.771 61.722,283.170 61.483 C 293.296 61.225,295.084 60.911,295.982 59.234 C 296.416 58.423,296.703 58.400,306.339 58.400 L 316.250 58.400 317.133 59.594 M27.167 101.112 C 28.192 102.399,29.387 102.807,33.153 103.154 C 35.848 103.403,37.020 103.703,37.985 104.389 C 39.843 105.713,42.532 106.400,45.850 106.400 C 48.546 106.400,48.866 106.491,49.979 107.579 C 51.485 109.052,53.196 109.545,57.932 109.869 C 61.219 110.094,61.734 110.233,62.258 111.032 C 63.056 112.250,64.528 112.706,68.700 113.029 C 71.132 113.217,72.444 113.509,73.000 113.989 C 74.406 115.200,77.030 115.958,80.806 116.243 C 83.912 116.478,84.613 116.663,85.340 117.438 C 86.616 118.799,87.953 119.159,92.827 119.455 C 96.615 119.685,97.296 119.832,97.651 120.495 C 98.280 121.671,100.278 122.317,104.222 122.622 C 106.844 122.825,108.015 123.095,108.605 123.630 C 110.031 124.925,112.234 125.572,116.154 125.848 C 119.555 126.087,120.052 126.220,120.589 127.039 C 121.378 128.244,123.260 128.729,128.393 129.050 C 132.387 129.300,132.651 129.371,133.600 130.469 C 134.647 131.681,137.390 132.393,141.030 132.398 C 142.223 132.399,142.898 132.653,143.545 133.341 C 144.738 134.611,146.628 135.108,151.517 135.439 C 154.933 135.669,155.702 135.842,156.029 136.454 C 156.780 137.858,158.816 138.502,163.530 138.825 C 167.562 139.102,168.151 139.237,168.693 140.011 C 169.615 141.328,171.664 142.000,174.756 142.000 C 177.132 142.000,177.710 142.144,178.714 142.989 C 180.489 144.482,181.796 144.846,186.546 145.168 C 190.244 145.418,190.990 145.585,191.546 146.284 C 192.613 147.625,193.819 148.025,197.825 148.363 C 200.919 148.624,201.799 148.847,202.564 149.566 C 203.895 150.817,206.848 151.600,210.233 151.600 C 212.740 151.600,213.300 151.736,214.314 152.589 C 216.119 154.108,217.437 154.476,222.141 154.773 C 225.862 155.008,226.575 155.166,227.141 155.877 C 228.193 157.200,229.362 157.604,233.153 157.954 C 235.848 158.203,237.020 158.503,237.985 159.189 C 239.842 160.512,242.531 161.200,245.843 161.200 C 248.530 161.200,248.848 161.291,249.880 162.351 C 251.371 163.884,252.962 164.354,257.698 164.665 C 261.227 164.896,261.728 165.024,262.258 165.832 C 263.056 167.050,264.528 167.506,268.700 167.829 C 271.132 168.017,272.444 168.309,273.000 168.789 C 274.418 170.011,277.159 170.806,280.865 171.069 C 283.926 171.286,284.617 171.467,285.342 172.240 C 286.601 173.583,287.907 173.943,292.622 174.248 C 296.415 174.493,296.923 174.616,297.450 175.420 C 298.128 176.455,299.447 177.036,302.000 177.426 C 303.097 177.593,304.289 178.128,305.053 178.797 C 305.742 179.400,307.002 180.019,307.853 180.172 C 308.738 180.331,309.914 180.949,310.600 181.615 C 311.260 182.256,312.906 183.843,314.258 185.143 C 315.610 186.442,316.832 187.871,316.974 188.317 C 317.115 188.763,317.658 189.408,318.180 189.750 C 318.993 190.283,319.170 190.820,319.414 193.486 C 319.724 196.869,320.364 198.538,321.604 199.202 C 322.397 199.627,322.400 200.396,322.400 406.292 L 322.400 612.956 321.394 614.006 C 320.724 614.706,320.199 615.962,319.819 617.775 C 319.169 620.885,318.261 622.075,316.030 622.744 C 315.182 622.998,314.194 623.654,313.835 624.203 C 312.930 625.583,306.322 625.749,305.605 624.409 C 304.873 623.042,303.545 622.669,298.434 622.393 C 294.244 622.166,293.368 622.005,292.829 621.362 C 291.430 619.695,290.718 619.436,286.861 619.192 C 283.556 618.982,282.776 618.792,281.445 617.874 C 279.462 616.506,277.848 616.082,273.392 615.758 C 270.746 615.565,269.588 615.304,268.995 614.767 C 267.577 613.484,265.412 612.844,261.558 612.569 C 258.425 612.345,257.634 612.148,256.800 611.385 C 255.486 610.182,253.465 609.684,248.600 609.363 C 245.141 609.135,244.461 608.969,243.570 608.142 C 242.184 606.854,240.535 606.422,235.858 606.125 C 232.451 605.908,231.799 605.750,231.058 604.960 C 229.771 603.587,228.399 603.226,223.381 602.940 C 219.203 602.701,218.761 602.600,218.210 601.759 C 217.411 600.540,215.459 600.027,210.469 599.726 C 206.759 599.501,206.276 599.383,205.742 598.568 C 204.882 597.256,203.259 596.829,198.035 596.541 C 193.562 596.294,193.365 596.245,192.400 595.130 C 191.332 593.896,188.600 593.207,184.754 593.202 C 183.508 593.201,182.573 592.936,181.877 592.389 C 180.081 590.976,178.315 590.484,174.000 590.192 C 170.368 589.947,169.664 589.782,168.794 588.970 C 167.264 587.541,164.664 586.800,161.180 586.800 C 158.404 586.800,157.925 586.686,156.824 585.759 C 155.088 584.298,152.419 583.600,148.567 583.600 C 145.635 583.600,145.129 583.488,144.086 582.611 C 142.281 581.092,140.963 580.724,136.259 580.427 C 132.538 580.192,131.825 580.034,131.259 579.323 C 130.115 577.884,128.789 577.504,123.940 577.228 C 119.955 577.001,119.080 576.830,118.311 576.130 C 116.667 574.632,115.500 574.292,110.914 573.978 C 106.543 573.678,106.343 573.623,105.231 572.433 C 104.597 571.755,104.016 571.186,103.940 571.170 C 103.863 571.153,101.492 571.002,98.671 570.834 C 93.784 570.543,93.493 570.477,92.531 569.439 C 91.151 567.951,90.032 567.600,86.668 567.600 C 84.506 567.600,83.440 567.399,82.394 566.793 C 79.378 565.045,78.110 564.682,74.106 564.419 C 70.700 564.196,69.858 564.006,69.100 563.294 C 67.608 561.893,65.534 561.253,61.558 560.969 C 58.425 560.745,57.634 560.548,56.800 559.785 C 55.486 558.582,53.465 558.084,48.600 557.763 C 45.141 557.535,44.461 557.369,43.570 556.542 C 42.373 555.430,41.075 555.003,37.688 554.610 C 35.726 554.382,35.120 554.137,34.614 553.365 C 34.268 552.837,33.313 552.124,32.492 551.781 C 30.799 551.074,28.800 549.311,28.800 548.525 C 28.800 548.236,28.107 547.324,27.261 546.500 C 26.414 545.675,25.499 544.320,25.226 543.490 C 24.954 542.659,24.252 541.410,23.666 540.713 L 22.600 539.447 22.496 320.223 C 22.438 199.651,22.486 100.752,22.603 100.449 C 22.926 99.607,26.366 100.107,27.167 101.112 M133.994 107.933 C 135.615 109.554,135.587 109.551,152.800 109.841 C 168.099 110.099,168.207 110.107,169.200 111.013 C 170.975 112.632,172.707 112.803,190.133 113.072 L 206.867 113.330 207.460 114.235 C 208.542 115.887,209.888 116.031,226.543 116.285 C 242.483 116.528,242.486 116.528,243.343 117.441 C 244.931 119.134,245.940 119.242,262.393 119.476 C 278.144 119.699,278.204 119.703,279.200 120.613 C 280.968 122.227,282.740 122.413,298.600 122.656 C 313.610 122.887,313.818 122.901,315.200 123.812 C 317.691 125.452,319.227 125.605,335.933 125.872 L 352.067 126.130 352.666 127.045 C 353.488 128.299,355.043 128.700,360.320 129.018 C 364.449 129.267,364.893 129.370,365.447 130.215 C 366.087 131.192,367.897 132.000,369.444 132.000 C 370.256 132.000,371.703 133.114,374.284 135.724 C 374.678 136.122,375.585 137.035,376.300 137.752 C 377.015 138.470,377.601 139.224,377.602 139.428 C 377.610 140.704,378.623 143.045,379.532 143.888 L 380.600 144.877 380.695 356.339 C 380.778 541.201,380.717 567.926,380.206 568.800 C 379.884 569.350,379.203 570.629,378.693 571.642 C 378.182 572.655,376.872 574.340,375.782 575.387 L 373.800 577.290 362.400 577.039 C 351.923 576.808,350.951 576.727,350.400 576.041 C 349.179 574.520,347.937 574.232,341.900 574.071 L 336.000 573.913 336.000 391.370 C 336.000 212.615,336.016 208.820,336.758 208.423 C 338.961 207.244,338.989 200.548,336.801 198.200 C 336.192 197.546,336.008 196.487,335.795 192.400 C 335.523 187.201,334.813 184.039,333.713 183.131 C 333.360 182.839,332.670 181.696,332.181 180.592 C 331.692 179.488,330.865 178.356,330.345 178.077 C 329.824 177.799,329.064 176.765,328.657 175.780 C 327.838 173.800,325.656 171.764,323.952 171.389 C 323.270 171.240,322.541 170.627,322.045 169.786 C 321.592 169.018,320.792 168.313,320.207 168.166 C 319.638 168.023,318.911 167.402,318.593 166.786 C 318.009 165.656,316.819 165.105,313.905 164.616 C 312.988 164.463,312.241 164.050,311.973 163.549 C 311.356 162.396,309.462 161.711,305.993 161.386 C 303.612 161.162,302.786 160.905,301.954 160.130 C 300.495 158.769,297.614 158.000,293.974 158.000 C 291.019 158.000,290.798 157.935,289.200 156.600 C 288.278 155.830,287.496 155.191,287.462 155.181 C 287.428 155.170,285.647 155.020,283.505 154.847 C 280.719 154.622,279.393 154.337,278.850 153.845 C 277.404 152.537,274.140 151.600,271.026 151.600 C 268.501 151.600,267.894 151.461,266.931 150.659 C 264.916 148.984,263.890 148.678,259.323 148.395 C 254.953 148.125,254.798 148.082,253.655 146.858 C 253.008 146.166,252.416 145.590,252.340 145.578 C 252.263 145.565,250.360 145.417,248.110 145.249 C 245.114 145.025,243.816 144.757,243.255 144.250 C 241.794 142.928,238.545 142.000,235.377 142.000 C 232.730 142.000,232.254 141.885,231.481 141.061 C 229.990 139.471,228.896 139.144,223.920 138.794 C 219.647 138.495,219.048 138.361,218.505 137.586 C 217.581 136.266,215.531 135.600,212.394 135.600 C 209.864 135.600,209.460 135.490,208.606 134.568 C 207.346 133.210,204.753 132.469,200.111 132.143 C 196.872 131.915,196.192 131.742,195.459 130.961 C 194.193 129.611,192.889 129.256,188.109 128.957 C 184.006 128.700,183.752 128.632,182.800 127.531 C 181.753 126.319,179.010 125.607,175.370 125.602 C 174.168 125.601,173.502 125.348,172.837 124.639 C 171.705 123.435,169.395 122.844,164.580 122.528 C 161.229 122.308,160.747 122.178,160.208 121.356 C 159.490 120.260,157.685 119.717,153.600 119.366 C 151.436 119.180,150.210 118.849,149.200 118.177 C 147.094 116.775,146.081 116.496,141.967 116.189 C 138.868 115.958,138.023 115.748,137.200 115.008 C 135.762 113.715,134.111 113.272,129.562 112.958 C 125.981 112.712,125.476 112.582,124.944 111.771 C 124.146 110.552,122.681 110.096,118.500 109.763 C 115.678 109.538,114.784 109.304,113.882 108.553 C 113.267 108.040,112.097 107.450,111.282 107.241 C 110.467 107.032,109.440 106.763,109.000 106.643 C 108.560 106.524,113.741 106.502,120.514 106.596 L 132.828 106.766 133.994 107.933 M47.728 461.845 C 44.169 463.601,44.144 472.019,47.694 473.695 C 48.504 474.078,49.358 474.749,49.593 475.186 C 50.320 476.546,51.623 476.919,56.693 477.221 C 61.506 477.507,61.619 477.536,62.759 478.756 C 63.398 479.440,63.984 480.008,64.060 480.017 C 64.137 480.027,66.055 480.189,68.323 480.376 C 71.109 480.607,72.671 480.921,73.138 481.344 C 74.534 482.607,77.053 483.315,81.094 483.581 C 84.500 483.804,85.342 483.994,86.100 484.706 C 87.592 486.107,89.666 486.747,93.642 487.031 C 96.775 487.255,97.566 487.452,98.400 488.215 C 99.690 489.396,101.699 489.903,106.400 490.233 C 109.575 490.456,110.365 490.650,111.200 491.413 C 112.517 492.615,114.581 493.140,119.200 493.448 C 122.407 493.662,123.156 493.845,124.000 494.625 C 125.508 496.019,126.800 496.362,131.651 496.656 C 135.560 496.894,136.185 497.033,136.942 497.840 C 138.217 499.199,139.555 499.559,144.440 499.855 C 148.443 500.099,148.919 500.210,149.458 501.032 C 150.320 502.348,152.026 502.803,157.132 503.080 C 161.261 503.304,161.717 503.407,162.258 504.233 C 163.056 505.450,164.529 505.906,168.700 506.229 C 171.132 506.417,172.444 506.709,173.000 507.189 C 174.448 508.436,177.049 509.153,181.159 509.436 C 184.617 509.674,185.370 509.854,186.305 510.666 C 187.806 511.969,190.819 512.800,194.042 512.800 C 196.360 512.800,196.912 512.945,197.970 513.837 C 199.620 515.225,202.702 515.989,206.669 515.995 C 209.559 515.999,210.075 516.115,211.114 516.989 C 212.893 518.486,214.221 518.868,218.694 519.172 C 222.022 519.398,222.958 519.604,223.694 520.275 C 225.350 521.784,226.503 522.101,231.311 522.375 C 235.473 522.612,236.165 522.752,236.740 523.476 C 237.867 524.894,239.116 525.257,244.048 525.603 C 248.676 525.928,248.856 525.976,249.971 527.169 C 250.604 527.846,251.184 528.412,251.260 528.426 C 251.337 528.441,253.694 528.601,256.499 528.783 C 261.509 529.107,261.618 529.134,262.759 530.356 C 263.398 531.040,263.984 531.608,264.060 531.617 C 264.137 531.627,266.004 531.785,268.209 531.967 C 271.495 532.240,272.485 532.482,273.704 533.309 C 275.870 534.779,278.718 535.334,282.952 535.113 C 289.172 534.787,290.203 533.662,290.196 527.200 C 290.190 521.101,289.026 519.851,282.769 519.220 C 280.564 518.998,279.312 518.649,278.409 518.006 C 276.559 516.689,273.866 516.000,270.567 516.000 C 268.021 516.000,267.508 515.871,266.424 514.959 C 264.688 513.498,262.019 512.800,258.167 512.800 C 255.235 512.800,254.729 512.688,253.686 511.811 C 251.912 510.318,250.604 509.954,245.871 509.633 C 241.848 509.361,241.480 509.265,240.671 508.283 C 239.451 506.802,238.220 506.452,233.149 506.144 C 229.240 505.906,228.615 505.767,227.858 504.960 C 226.583 503.601,225.245 503.241,220.360 502.945 C 216.357 502.701,215.881 502.590,215.342 501.768 C 214.486 500.461,212.782 500.002,207.800 499.735 C 203.603 499.510,203.341 499.444,202.124 498.295 C 200.954 497.190,200.483 497.051,196.440 496.621 C 193.428 496.301,191.800 495.943,191.301 495.491 C 189.947 494.266,187.791 493.662,183.786 493.387 C 180.518 493.163,179.541 492.940,178.365 492.148 C 176.474 490.874,175.182 490.535,170.939 490.195 C 168.040 489.964,167.219 489.746,166.400 488.991 C 165.112 487.804,163.109 487.298,158.400 486.967 C 155.220 486.744,154.437 486.551,153.600 485.785 C 152.297 484.592,150.284 484.088,145.469 483.752 C 142.030 483.512,141.466 483.368,140.964 482.600 C 140.029 481.174,138.472 480.724,133.460 480.431 C 129.332 480.189,128.634 480.046,128.060 479.324 C 126.925 477.896,125.640 477.525,120.760 477.213 C 116.133 476.918,115.998 476.882,114.852 475.655 C 114.207 474.965,113.616 474.388,113.540 474.374 C 113.463 474.359,111.098 474.198,108.285 474.016 C 103.542 473.709,103.103 473.612,102.235 472.675 C 101.077 471.427,98.941 470.805,95.794 470.802 C 94.110 470.801,92.969 470.557,91.994 469.993 C 88.988 468.251,87.706 467.882,83.773 467.624 C 80.470 467.407,79.513 467.192,78.444 466.432 C 76.560 465.090,73.885 464.400,70.567 464.400 C 68.021 464.400,67.508 464.271,66.424 463.359 C 63.843 461.187,51.147 460.159,47.728 461.845 M49.600 483.844 C 46.100 484.519,45.197 485.885,45.206 490.487 C 45.213 493.967,45.726 495.135,47.716 496.200 C 48.539 496.640,49.484 497.398,49.818 497.884 C 50.622 499.058,52.546 499.552,57.532 499.866 C 61.235 500.098,61.726 500.220,62.258 501.033 C 63.130 502.364,64.845 502.811,70.119 503.082 C 74.136 503.288,74.897 503.433,75.231 504.058 C 75.898 505.304,77.710 505.936,81.429 506.217 C 84.202 506.427,85.313 506.696,86.400 507.421 C 88.546 508.853,89.615 509.137,94.004 509.439 C 96.329 509.599,98.273 509.930,98.556 510.213 C 100.018 511.675,102.683 512.534,106.468 512.765 C 109.772 512.966,110.480 513.135,111.320 513.925 C 112.738 515.257,115.641 516.000,119.433 516.000 C 122.365 516.000,122.871 516.112,123.914 516.989 C 125.689 518.482,126.996 518.846,131.746 519.168 C 135.444 519.418,136.190 519.585,136.746 520.284 C 137.885 521.716,139.217 522.096,144.060 522.372 C 148.045 522.599,148.920 522.770,149.689 523.470 C 151.333 524.968,152.500 525.308,157.086 525.622 C 161.457 525.922,161.657 525.977,162.769 527.167 C 163.403 527.845,163.984 528.412,164.060 528.426 C 164.137 528.441,166.511 528.602,169.335 528.785 C 174.107 529.093,174.547 529.191,175.565 530.166 C 176.933 531.477,178.711 532.000,181.804 532.000 C 183.493 532.000,184.629 532.241,185.606 532.807 C 188.612 534.549,189.894 534.918,193.827 535.176 C 197.130 535.393,198.087 535.608,199.156 536.368 C 201.044 537.713,203.717 538.400,207.060 538.400 C 209.793 538.400,210.065 538.479,211.028 539.560 C 212.282 540.968,214.156 541.482,219.366 541.849 C 222.394 542.061,223.438 542.289,223.962 542.852 C 225.053 544.023,227.711 544.743,232.037 545.041 C 235.531 545.282,236.195 545.444,236.939 546.237 C 238.230 547.613,239.599 547.974,244.619 548.260 C 248.797 548.499,249.239 548.600,249.790 549.441 C 250.580 550.647,252.500 551.149,257.532 551.466 C 261.235 551.698,261.726 551.820,262.258 552.633 C 263.130 553.964,264.845 554.411,270.119 554.682 C 274.136 554.888,274.897 555.033,275.231 555.658 C 276.009 557.111,277.920 557.690,281.968 557.699 C 288.881 557.713,290.200 556.448,290.200 549.800 C 290.200 543.524,289.171 542.347,283.193 541.786 C 280.883 541.569,279.972 541.296,279.200 540.587 C 277.911 539.404,275.904 538.897,271.200 538.567 C 267.939 538.338,267.252 538.163,266.356 537.329 C 264.990 536.058,261.708 535.211,258.131 535.205 C 255.710 535.201,255.085 535.053,254.131 534.259 C 252.066 532.542,251.079 532.260,246.265 532.012 C 242.104 531.798,241.450 531.667,240.865 530.931 C 239.729 529.501,238.431 529.116,233.781 528.831 C 229.468 528.568,229.224 528.504,227.828 527.278 C 226.083 525.746,227.145 526.008,221.101 525.617 C 216.091 525.293,215.982 525.266,214.841 524.044 C 214.202 523.360,213.616 522.792,213.540 522.783 C 213.463 522.773,211.541 522.611,209.269 522.423 C 205.973 522.150,204.962 521.916,204.269 521.267 C 202.867 519.954,201.260 519.518,196.779 519.234 C 193.265 519.012,192.339 518.811,191.250 518.036 C 189.397 516.716,186.703 516.000,183.591 516.000 C 181.229 516.000,180.735 515.861,179.437 514.829 C 177.661 513.418,175.033 512.800,170.811 512.800 C 168.002 512.800,167.528 512.687,166.424 511.759 C 164.706 510.313,162.027 509.600,158.314 509.600 C 155.311 509.600,155.101 509.541,154.053 508.394 C 152.647 506.855,151.231 506.465,145.866 506.139 C 142.040 505.906,141.413 505.764,140.658 504.960 C 139.384 503.602,138.045 503.241,133.173 502.945 C 129.385 502.715,128.704 502.568,128.349 501.905 C 127.659 500.616,125.388 499.981,120.542 499.721 C 116.337 499.496,115.884 499.395,115.342 498.567 C 114.546 497.352,113.078 496.896,108.900 496.563 C 106.078 496.338,105.184 496.104,104.282 495.353 C 102.826 494.140,101.044 493.692,96.400 493.372 C 93.372 493.164,92.316 492.921,91.200 492.178 C 89.095 490.775,88.082 490.497,83.967 490.189 C 80.829 489.955,80.033 489.754,79.200 488.988 C 77.911 487.804,75.906 487.297,71.200 486.967 C 68.025 486.744,67.235 486.550,66.400 485.787 C 64.692 484.228,54.015 482.993,49.600 483.844 M49.400 506.242 C 46.002 507.104,45.200 508.356,45.200 512.800 C 45.200 516.542,45.898 518.172,47.764 518.788 C 48.557 519.050,49.390 519.608,49.615 520.028 C 50.400 521.495,52.391 522.123,57.086 522.384 C 60.857 522.594,61.717 522.766,62.486 523.467 C 64.134 524.969,65.297 525.307,69.887 525.622 C 74.174 525.917,74.494 526.000,75.823 527.167 C 77.511 528.649,76.498 528.399,82.314 528.767 C 86.888 529.056,87.306 529.152,88.345 530.147 C 89.733 531.477,91.500 532.000,94.604 532.000 C 96.293 532.000,97.429 532.241,98.406 532.807 C 101.431 534.560,102.689 534.914,106.919 535.202 C 110.571 535.451,111.383 535.632,112.171 536.373 C 113.502 537.623,116.458 538.400,119.883 538.400 C 122.520 538.400,122.938 538.507,123.763 539.398 C 125.103 540.843,127.445 541.527,132.098 541.831 C 135.557 542.057,136.357 542.239,137.200 542.995 C 138.658 544.301,140.351 544.746,145.021 545.048 C 148.772 545.290,149.244 545.408,149.788 546.239 C 150.591 547.463,152.524 547.959,157.694 548.266 C 161.587 548.498,162.044 548.607,162.590 549.441 C 163.392 550.665,165.327 551.159,170.519 551.468 C 174.137 551.683,174.902 551.843,175.231 552.458 C 175.983 553.863,177.813 554.397,182.805 554.665 C 186.921 554.886,187.697 555.034,188.031 555.658 C 188.698 556.904,190.510 557.536,194.229 557.817 C 197.048 558.030,198.102 558.290,199.235 559.053 C 201.174 560.358,202.556 560.705,207.118 561.034 C 210.349 561.267,211.188 561.471,212.118 562.247 C 213.529 563.423,215.312 563.899,219.600 564.244 C 222.521 564.479,223.179 564.673,224.268 565.619 C 225.792 566.942,228.557 567.600,232.589 567.600 C 235.143 567.600,235.696 567.733,236.714 568.589 C 238.486 570.080,239.796 570.446,244.498 570.765 C 248.015 571.003,248.959 571.205,249.698 571.878 C 251.359 573.392,252.574 573.738,257.086 573.987 C 260.859 574.194,261.716 574.366,262.486 575.067 C 264.134 576.569,265.297 576.907,269.887 577.222 C 274.149 577.515,274.500 577.605,275.792 578.740 C 277.392 580.144,279.632 580.603,283.408 580.300 C 288.864 579.862,290.543 577.686,290.276 571.400 C 290.048 566.025,288.976 564.922,283.512 564.443 C 280.938 564.218,280.239 563.998,279.312 563.121 C 277.912 561.797,276.022 561.298,271.108 560.955 C 267.643 560.713,267.149 560.582,266.611 559.761 C 265.809 558.537,263.876 558.041,258.706 557.734 C 254.813 557.502,254.356 557.393,253.810 556.559 C 253.015 555.346,251.109 554.861,245.881 554.541 C 242.266 554.320,241.499 554.158,241.169 553.543 C 240.417 552.137,238.588 551.603,233.595 551.335 C 229.385 551.108,228.708 550.976,228.348 550.304 C 227.721 549.132,225.726 548.484,221.778 548.169 C 218.878 547.939,217.988 547.708,217.082 546.953 C 215.632 545.745,213.860 545.296,209.200 544.958 C 206.056 544.730,205.207 544.522,204.282 543.752 C 202.854 542.564,201.083 542.107,196.600 541.772 C 193.670 541.553,192.814 541.336,192.000 540.606 C 190.551 539.306,188.897 538.869,184.291 538.568 C 180.716 538.335,180.068 538.179,179.156 537.329 C 177.791 536.059,174.508 535.211,170.931 535.205 C 168.510 535.201,167.885 535.053,166.931 534.259 C 164.900 532.570,163.861 532.264,159.314 532.013 C 155.541 531.806,154.684 531.634,153.914 530.933 C 152.242 529.409,151.036 529.062,146.550 528.815 C 142.264 528.579,142.046 528.523,140.636 527.285 C 138.879 525.743,139.899 526.001,134.125 525.635 C 129.419 525.337,129.200 525.283,127.811 524.063 C 127.020 523.368,126.333 522.792,126.286 522.783 C 126.239 522.773,124.341 522.611,122.069 522.423 C 118.773 522.150,117.762 521.916,117.069 521.267 C 115.677 519.963,114.080 519.530,109.481 519.207 C 105.837 518.951,105.016 518.766,104.229 518.027 C 102.907 516.786,99.947 516.000,96.591 516.000 C 94.008 516.000,93.558 515.879,92.237 514.829 C 90.489 513.440,87.839 512.800,83.835 512.800 C 81.203 512.800,80.762 512.683,79.437 511.629 C 77.679 510.232,75.037 509.600,70.958 509.600 C 68.128 509.600,67.891 509.530,66.853 508.394 C 66.247 507.730,65.132 506.996,64.376 506.763 C 62.929 506.316,50.774 505.893,49.400 506.242 " stroke="none" fill="currentColor" fill-rule="evenodd"></path></g></svg> \ No newline at end of file diff --git a/src/img/object_type_icons/object-type_software-educacional.svg b/src/img/object_type_icons/object-type_software-educacional.svg index eebeb2a75ea96bfb0979211b84991fe3288e8382..1ad8125b78cc70a19aacbe0a8e32f145b2e1e635 100644 --- a/src/img/object_type_icons/object-type_software-educacional.svg +++ b/src/img/object_type_icons/object-type_software-educacional.svg @@ -6,7 +6,7 @@ .st0{fill:none;} .st1{fill:#00BCD5;} </style> -<path class="st0" d="M0,0h60v60H0V0z"/> +<rect class="st0" d="M0,0h60v60H0V0z"/> <g> <path class="st1" d="M48.7,10.6H11.3c-2.6,0-4.7,2.1-4.7,4.7v24.9c0,2.6,2.1,4.7,4.7,4.7h18.4v2.6h-8c-0.6,0-1,0.4-1,1s0.4,1,1,1 h16.6c0.6,0,1-0.4,1-1s-0.4-1-1-1h-8v-2.6h18.4c2.6,0,4.7-2.1,4.7-4.7V15.3C53.4,12.7,51.3,10.6,48.7,10.6z M52.4,40.2