diff --git a/src/Components/AreasSubPagesFunction.js b/src/Components/AreasSubPagesFunction.js index c12211ff4450d8c4580842947cb281d784c7262e..dda8cf98d425f8b15121dd020f070b39291edfb3 100644 --- a/src/Components/AreasSubPagesFunction.js +++ b/src/Components/AreasSubPagesFunction.js @@ -188,7 +188,7 @@ function ReqCollections(props) { function TabRecurso() { const text = "Nesta área, você tem acesso a Recursos Educacionais Digitais, isto é, a vídeos, animações e a outros recursos destinados à educação. São Recursos de portais parceiros do MEC e de professores que, como você, atuam na Educação Básica!" const [currOrder, setCurrOrder] = useState("Mais Recentes"); - const [currValue, setCurrValue] = useState("publicationdesc"); + const [currValue, setCurrValue] = useState("score"); const [ordenar] = useState([ { label: "Mais Estrelas", value: "review_average" }, { label: "Mais Relevante", value: "score" }, diff --git a/src/Components/ContactCardOptions.js b/src/Components/ContactCardOptions.js index deb12ba4e7a9c4a68785e59986ed3b85d3a05065..a0230269293e59894ecc101988a8f44b9afd4b8d 100644 --- a/src/Components/ContactCardOptions.js +++ b/src/Components/ContactCardOptions.js @@ -16,7 +16,7 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, {useState} from 'react'; +import React, { useState } from 'react'; import styled from 'styled-components' import Button from '@material-ui/core/Button'; import Menu from '@material-ui/core/Menu'; @@ -26,9 +26,9 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'; import OpenIcon from '@material-ui/icons/OpenInNew'; import ReportIcon from '@material-ui/icons/Error'; import PersonAddIcon from '@material-ui/icons/PersonAdd'; -import {putRequest} from './HelperFunctions/getAxiosConfig' +import { putRequest } from './HelperFunctions/getAxiosConfig' import ReportModal from './ReportModal.js' -import {Link} from 'react-router-dom' +import { Link } from 'react-router-dom' export default function SimpleMenu(props) { // const {state} = useContext(Store) @@ -47,7 +47,7 @@ export default function SimpleMenu(props) { putRequest(`/users/${followerID}/follow`, {}, (data) => { console.log(data); props.toggleFollowed() - }, (error) => {console.log(error)}) + }, (error) => { console.log(error) }) handleClose(); } @@ -57,55 +57,55 @@ export default function SimpleMenu(props) { toggleReportModal(value) } - return ( - <> - { - reportModal && - <ReportModal open={reportModal} handleClose={() => handleModal(false)} - form="user" complainableId={props.followableID} - complainableType={"User"} - {...props}/> - } - <div style={{fontSize: "12px", display : "flex", flexDirection : "column", justifyContent : "center"}}> - <ButtonNoWidth aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick} style={{color : "#666"}}> - <MoreVertIcon style={{color : "#666"}}/> - </ButtonNoWidth> - <Menu - id="simple-menu" - anchorEl={anchorEl} - keepMounted - open={Boolean(anchorEl)} - onClose={handleClose} - > - <StyledMenuItem onClick={handleClose}> - <Link to={"/usuario-publico/" + props.followableID}> - <ListItemIcon><OpenIcon /></ListItemIcon>Abrir - </Link> - </StyledMenuItem> - + return ( + <> { - props.followed ? - ( - <StyledMenuItem onClick={() => {handleFollow(props.followableID)}}> - <ListItemIcon><ReportIcon /></ListItemIcon>Deixar de Seguir - </StyledMenuItem> - ) - : - ( - <StyledMenuItem onClick={() => {handleFollow(props.followableID)}}> - <ListItemIcon><PersonAddIcon /></ListItemIcon>Seguir - </StyledMenuItem> - ) + reportModal && + <ReportModal open={reportModal} handleClose={() => handleModal(false)} + form="user" complainableId={props.followableID} + complainableType={"User"} + {...props} /> } + <div style={{ fontSize: "12px", display: "flex", flexDirection: "column", justifyContent: "center" }}> + <ButtonNoWidth aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick} style={{ color: "#666" }}> + <MoreVertIcon style={{ color: "#666" }} /> + </ButtonNoWidth> + <Menu + id="simple-menu" + anchorEl={anchorEl} + keepMounted + open={Boolean(anchorEl)} + onClose={handleClose} + > + <StyledMenuItem onClick={handleClose}> + <Link to={"/usuario-publico/" + props.followableID}> + <ListItemIcon><OpenIcon /></ListItemIcon>Abrir + </Link> + </StyledMenuItem> - - <StyledMenuItem onClick={() => {handleModal(true); handleClose()}}> - <ListItemIcon><ReportIcon /></ListItemIcon>Reportar + { + props.followed ? + ( + <StyledMenuItem onClick={() => { handleFollow(props.followableID) }}> + <ListItemIcon><ReportIcon /></ListItemIcon>Deixar de Seguir + </StyledMenuItem> + ) + : + ( + <StyledMenuItem onClick={() => { handleFollow(props.followableID) }}> + <ListItemIcon><PersonAddIcon /></ListItemIcon>Seguir + </StyledMenuItem> + ) + } + + + <StyledMenuItem onClick={() => { handleModal(true); handleClose() }}> + <ListItemIcon><ReportIcon /></ListItemIcon>Reportar </StyledMenuItem> - </Menu> - </div> - </> - ); + </Menu> + </div> + </> + ); } const ButtonNoWidth = styled(Button)` diff --git a/src/Components/ResourceCardOptions.js b/src/Components/ResourceCardOptions.js index 44bc52df18fd48f3deeeae344a8457ff06e6a8b6..81d9286c5d0671f8885250daf08f2a4e601b3c87 100644 --- a/src/Components/ResourceCardOptions.js +++ b/src/Components/ResourceCardOptions.js @@ -104,6 +104,16 @@ export default function ResourceCardOptions(props) { setLogin(!loginOpen) } + const handleReport = () => { + if (!state.currentUser.id) { + handleLogin() + } + else { + handleModalReportar(true); + } + handleClose(); + } + function Alert(props) { return <MuiAlert elevation={6} variant="filled" {...props} />; } @@ -187,7 +197,7 @@ export default function ResourceCardOptions(props) { <ListItemIcon><AddIcon /></ListItemIcon>Guardar </StyledMenuItem> - <StyledMenuItem onClick={() => { handleModalReportar(true); handleClose() }}> + <StyledMenuItem onClick={() => { handleReport() }}> <ListItemIcon><ReportIcon /></ListItemIcon>Reportar </StyledMenuItem> diff --git a/src/Components/SnackbarComponent.js b/src/Components/SnackbarComponent.js index 0a359a78ba406c70f94ce37fba45b979f4608f60..b0bd36a67d134d598e603d3d8c749763132579d7 100644 --- a/src/Components/SnackbarComponent.js +++ b/src/Components/SnackbarComponent.js @@ -20,12 +20,12 @@ import React from 'react' import Alert from '../Components/Alert.js'; import Snackbar from '@material-ui/core/Snackbar'; -export default function SnackbarComponent (props) { +export default function SnackbarComponent(props) { return ( <Snackbar open={props.snackbarOpen} autoHideDuration={3000} onClose={props.handleClose} - anchorOrigin = {{ vertical:'top', horizontal:'right' }} + anchorOrigin={{ vertical: 'top', horizontal: 'right' }} > - <Alert severity={props.severity} style={ props.color === null ? {backgroundColor:"#00acc1"} : {backgroundColor: props.color}}> + <Alert severity={props.severity} style={props.color ? { backgroundColor: props.color } : { backgroundColor: "#00acc1" }}> {props.text} </Alert> </Snackbar> diff --git a/src/Components/TabPanels/PublicUserPageTabs/LastLearnObj.js b/src/Components/TabPanels/PublicUserPageTabs/LastLearnObj.js index 705faa8d77e70cdeee8b6bbf4ea9e65ead1313fc..2a489ac6808bad38d577ef87125d56e60bcd4f7e 100644 --- a/src/Components/TabPanels/PublicUserPageTabs/LastLearnObj.js +++ b/src/Components/TabPanels/PublicUserPageTabs/LastLearnObj.js @@ -30,13 +30,6 @@ export default function LastLearnObjs(props) { <Grid item xs={9}> <h3>Últimos Recursos Publicados</h3> </Grid> - <Grid item xs={3} style={{ textAlign: "end" }}> - {props.count > 4 && - <span> - VER MAIS - </span> - } - </Grid> </HeaderGrid> { @@ -57,10 +50,10 @@ export default function LastLearnObjs(props) { : ( [ - <StyledGrid container spacing={1} style={{ paddingLeft: "0.5em" }}> + <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> { props.learningObjs.slice(0, 4).map((card) => - <Grid item md={3} xs={12} key={card.id}> + <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> <ResourceCardFunction avatar={card.publisher.avatar} id={card.id} diff --git a/src/Components/TabPanels/PublicUserPageTabs/TabColecoes.js b/src/Components/TabPanels/PublicUserPageTabs/TabColecoes.js index 2b81757d34ee93379d60a8165bac6f6f31216f2e..22fe8e4da3e4ba7e536b2227ca7319f39f600805 100644 --- a/src/Components/TabPanels/PublicUserPageTabs/TabColecoes.js +++ b/src/Components/TabPanels/PublicUserPageTabs/TabColecoes.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, useEffect} from 'react' -import {HeaderGrid, ContainerStyled, Carregados} from '../StyledComponents.js' +import React, { useState, useEffect } from 'react' +import { HeaderGrid, ContainerStyled, Carregados, StyledGrid } from '../StyledComponents.js' import Grid from '@material-ui/core/Grid'; import CollectionCardFunction from '../../CollectionCardFunction.js' import { ButtonMostrarMaisColecao } from '../PanelComponents/ButtonsArea.js' @@ -46,10 +46,10 @@ export default function TabRecursos(props) { </Grid> </HeaderGrid> - <Grid container spacing={1} style={{ paddingLeft: "0.5em" }}> + <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> { colsSlice.map((card) => - <Grid item md={3} xs={12} key={card.id}> + <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> <CollectionCardFunction name={card.name} tags={card.tags} @@ -68,7 +68,7 @@ export default function TabRecursos(props) { </Grid> ) } - </Grid> + </StyledGrid> <Carregados> <p style={{ margin: "0 0 10px", fontSize: "14px" }}> diff --git a/src/Components/TabPanels/PublicUserPageTabs/TabRecursos.js b/src/Components/TabPanels/PublicUserPageTabs/TabRecursos.js index bf677ebd921dd7f91ffe469a49c4800686843191..bbce193bcde870391dda55ee9a67c79aacb768b4 100644 --- a/src/Components/TabPanels/PublicUserPageTabs/TabRecursos.js +++ b/src/Components/TabPanels/PublicUserPageTabs/TabRecursos.js @@ -16,13 +16,14 @@ 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 {HeaderGrid, ContainerStyled, Carregados} from '../StyledComponents.js' +import React, { useState, useEffect } from 'react' +import { HeaderGrid, ContainerStyled, Carregados } from '../StyledComponents.js' import Grid from '@material-ui/core/Grid'; import ResourceCardFunction from '../../ResourceCardFunction.js' -import {ButtonMostrarMaisRecurso} from '../PanelComponents/ButtonsArea' -import {getRequest} from '../../HelperFunctions/getAxiosConfig' - +import { ButtonMostrarMaisRecurso } from '../PanelComponents/ButtonsArea' +import { getRequest } from '../../HelperFunctions/getAxiosConfig' +import { StyledGrid } from '../StyledComponents' + export default function TabRecursos(props) { const [arr, setArr] = useState([]) const [objsSlice, setSlice] = useState([]) @@ -33,7 +34,7 @@ export default function TabRecursos(props) { setSlice(props.learningObjs.slice(0, 4)) }, []) - function handleSuccess (data) { + function handleSuccess(data) { setArr(data) setSlice(data) } @@ -43,7 +44,7 @@ export default function TabRecursos(props) { if (newLength > 12) { const url = `/users/${props.id}/learning_objects?limit=${newLength}$offset=4` - getRequest(url,handleSuccess,(error) => {console.log(error)}) + getRequest(url, handleSuccess, (error) => { console.log(error) }) } else { handleSlice(arr.slice(0, sliceLength + quantity)) @@ -60,10 +61,10 @@ export default function TabRecursos(props) { </Grid> </HeaderGrid> - <Grid container spacing={1} style={{ paddingLeft: "0.5em" }}> + <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> { objsSlice.map((card) => - <Grid item md={3} xs={12} key={card.id}> + <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> <ResourceCardFunction avatar={card.publisher.avatar} id={card.id} @@ -82,7 +83,7 @@ export default function TabRecursos(props) { </Grid> ) } - </Grid> + </StyledGrid> <Carregados> <p style={{ margin: "0 0 10px", fontSize: "14px" }}> diff --git a/src/Pages/PublicUserPage.js b/src/Pages/PublicUserPage.js index e4fee36a0f3516cb25b938622f26e0e527085f03..f5a7d0410066b97524b6ca65b1968c910c1495db 100644 --- a/src/Pages/PublicUserPage.js +++ b/src/Pages/PublicUserPage.js @@ -38,218 +38,217 @@ import Typography from '@material-ui/core/Typography'; import CircularProgress from '@material-ui/core/CircularProgress'; const RenderFollowContainer = (boolUserFollowed, id, followCount) => { - return ( - <FollowContainer> - <> - { - boolUserFollowed ? - ( - [ - <FollowingButton followedID={id} /> - ] - ) - : - ( - [ - <FollowButton followerID={id} /> - ] - ) - } - <FollowersCountButton followCount={followCount} /> - </> - </FollowContainer> - ) + return ( + <FollowContainer> + <> + { + boolUserFollowed ? + ( + [ + <FollowingButton followedID={id} /> + ] + ) + : + ( + [ + <FollowButton followerID={id} /> + ] + ) + } + <FollowersCountButton followCount={followCount} /> + </> + </FollowContainer> + ) } const RenderProfileAvatar = (userAvatar) => { - return ( - <ProfileAvatarDiv> - <img src={userAvatar ? apiDomain + userAvatar : noAvatar} alt="user avatar" style={{ height: "inherit", width: "inherit", border: "0", verticalAlign: "middle" }} /> - </ProfileAvatarDiv> - ) + return ( + <ProfileAvatarDiv> + <img src={userAvatar ? apiDomain + userAvatar : noAvatar} alt="user avatar" style={{ height: "inherit", width: "inherit", border: "0", verticalAlign: "middle" }} /> + </ProfileAvatarDiv> + ) } const RenderUserProfileInfo = (userName) => { - return ( - <UserProfileInfoDiv> - <p - style={{ fontSize: "28px", color: "#fff", marginBottom: "2px", fontWeight: "500", borderRadius: "5px", textShadow: "0 1px 2px rgba(0,0,0,.45)" }} - > - {userName} - </p> - </UserProfileInfoDiv> - ) + return ( + <UserProfileInfoDiv> + <p + style={{ fontSize: "28px", color: "#fff", marginBottom: "2px", fontWeight: "500", borderRadius: "5px", textShadow: "0 1px 2px rgba(0,0,0,.45)" }} + > + {userName} + </p> + </UserProfileInfoDiv> + ) } const RenderCheckTeacher = (submitter_request) => { - if (submitter_request === "accepted") { - return ( - <CheckTeacherDiv> - <p> - <span> - <img alt="" src={CheckDecagram} /> - </span> + if (submitter_request === "accepted") { + return ( + <CheckTeacherDiv> + <p> + <span> + <img alt="" src={CheckDecagram} /> + </span> Professor(a) </p> - </CheckTeacherDiv> - ) - } + </CheckTeacherDiv> + ) + } } export default function PublicUserPage(props) { - /*user info variables--------------------------------------*/ - const WIDTH = window.innerWidth; - const id = props.match.params.userId + /*user info variables--------------------------------------*/ + const WIDTH = window.innerWidth; + const id = props.match.params.userId - const [loading, setLoading] = useState(false); + const [loading, setLoading] = useState(false); - const [userData, setUserData] = useState({}) - const fillUserInfo = (data) => { - setUserData(data) - } - /*---------------------------------------------------------*/ - const [following, setFollowing] = useState([]); - const fillFollowing = (data) => { - setFollowing(data); - } + const [userData, setUserData] = useState({}) + const fillUserInfo = (data) => { + setUserData(data) + } + /*---------------------------------------------------------*/ + const [following, setFollowing] = useState([]); + const fillFollowing = (data) => { + setFollowing(data); + } - /*content control variables--------------------------------*/ - // eslint-disable-next-line - const [tabs, setTabs] = useState([ - 'Início', 'Recursos', 'Coleções', 'Rede' - ]) - const [tabValue, setTabValue] = useState(0); - const handleChangeTab = (event, newValue) => { - setTabValue(newValue) - } - /*---------------------------------------------------------*/ + /*content control variables--------------------------------*/ + // eslint-disable-next-line + const [tabs, setTabs] = useState([ + 'Início', 'Recursos', 'Coleções', 'Rede' + ]) + const [tabValue, setTabValue] = useState(0); + const handleChangeTab = (event, newValue) => { + setTabValue(newValue) + } + /*---------------------------------------------------------*/ - /*content variables--------------------------------*/ - const [learningObjArr, setLearningObjects] = useState([]) - const handleLearningObjects = (data) => { setLearningObjects(data) } - const [collectionsArr, setCollections] = useState([]) - const handleCollections = (data) => { setCollections(data) } - /*---------------------------------------------------------*/ + /*content variables--------------------------------*/ + const [learningObjArr, setLearningObjects] = useState([]) + const handleLearningObjects = (data) => { setLearningObjects(data) } + const [collectionsArr, setCollections] = useState([]) + const handleCollections = (data) => { setCollections(data) } + /*---------------------------------------------------------*/ - function handleSuccess(responseArr) { - setLoading(false); - fillUserInfo(responseArr[0]) + function handleSuccess(responseArr) { + setLoading(false); + fillUserInfo(responseArr[0]) - handleLearningObjects(responseArr[1]) + handleLearningObjects(responseArr[1]) - handleCollections(responseArr[2]) + handleCollections(responseArr[2]) - fillFollowing(responseArr[3]); - } + fillFollowing(responseArr[3]); + } - /*Component Will Mount*/ - useEffect(() => { - const urls = [`/users/${id}`, `/users/${id}/learning_objects`, `/users/${id}/collections`, `/users/${id}/following/User` ] - setLoading(true); - fetchAllRequest(urls, handleSuccess, (error) => { console.log(error) }) - }, []) - /*---------------------------------------------------------*/ + /*Component Will Mount*/ + useEffect(() => { + const urls = [`/users/${id}`, `/users/${id}/learning_objects`, `/users/${id}/collections`, `/users/${id}/following/User`] + setLoading(true); + fetchAllRequest(urls, handleSuccess, (error) => { console.log(error) }) + }, []) + /*---------------------------------------------------------*/ - return ( - <React.Fragment> - <link href="https://fonts.googleapis.com/css?family=Roboto:100,400,500&display=swap" rel="stylesheet" /> - <BackgroundDiv> - <CustomizedBreadcrumbs - values={["Usuário Público", tabs[tabValue]]} - /> - <Grid container spacing={2}> - <Grid item xs={12}> - <div style={{ padding: "10px 0 8px 0" }}> - <UserProfileContainer> - <HeaderContainer> - <> - {RenderFollowContainer(userData.followed, id, userData.follows_count)} - {RenderProfileAvatar(userData.avatar ? userData.avatar : undefined)} - <CoverContainer> - {userData.cover && <img src={apiDomain + userData.cover} alt='' style={{ width: "100%", height: "100%", objectFit: "cover" }} />} - </CoverContainer> - { - WIDTH <= 501 ? null : RenderUserProfileInfo(userData.name) - } - </> - </HeaderContainer> - { - WIDTH <= 501 ? - <Grid style={{ marginTop: '4em' }} container justify="center" alignItems="center" direction="column"> - <Grid item> - <Typography variant="h4" gutterBottom style={{textAlign : "center"}}> - { - userData.name - } - </Typography> - </Grid> - <Grid style={{marginTop: '0.5em', marginBottom: '0.5em', borderTop : "0.5px solid #DCDCDC", borderBottom : "0.5px solid #DCDCDC" }} container spacing={4} justify="center" alignItems="center" direction="row"> - <Grid item> - <Typography variant="h6" > - { - loading ? - <CircularProgress size={20}/> : - `${userData.follows_count} seguidores` - } - </Typography> - </Grid> - <Grid item> - <Typography variant="h6" > - { - loading ? - <CircularProgress size={20}/> : - following ? - `${following.length} seguindo` : - "0 seguindo" - } - </Typography> - </Grid> - </Grid> - </Grid> - : - RenderCheckTeacher(userData.submitter_request)} - <RodapeDiv> - <NavBarContentContainer> - <StyledTabs - value={tabValue} - onChange={handleChangeTab} - indicatorColor="primary" - textColor="primary" - variant="fullwidth" - scrollButtons="desktop" - TabIndicatorProps={{ style: { background: "#00bcd4" } }} - > - { - tabs.map((tab) => - <Tab label={tab} key={tab} - disabled={(tab === "Recursos" && learningObjArr.length === 0) || (tab === "Coleções" && collectionsArr.length === 0)} - /> - ) - } - </StyledTabs> - </NavBarContentContainer> - <ReportButton className="report-button" complainableId={userData.id} complainableType={"User"} /> - </RodapeDiv> - </UserProfileContainer> - </div> + return ( + <React.Fragment> + <link href="https://fonts.googleapis.com/css?family=Roboto:100,400,500&display=swap" rel="stylesheet" /> + <BackgroundDiv> + <CustomizedBreadcrumbs + values={["Usuário Público", tabs[tabValue]]} + /> + <Grid container spacing={2}> + <Grid item xs={12}> + <div style={{ padding: "10px 0 8px 0" }}> + <UserProfileContainer> + <HeaderContainer> + <> + {RenderFollowContainer(userData.followed, id, userData.follows_count)} + {RenderProfileAvatar(userData.avatar ? userData.avatar : undefined)} + <CoverContainer> + {userData.cover && <img src={apiDomain + userData.cover} alt='' style={{ width: "100%", height: "100%", objectFit: "cover" }} />} + </CoverContainer> + { + WIDTH <= 501 ? null : RenderUserProfileInfo(userData.name) + } + </> + </HeaderContainer> + { + WIDTH <= 501 ? + <Grid style={{ marginTop: '4em' }} container justify="center" alignItems="center" direction="column"> + <Grid item> + <Typography variant="h4" gutterBottom style={{ textAlign: "center" }}> + { + userData.name + } + </Typography> + </Grid> + <Grid style={{ marginTop: '0.5em', marginBottom: '0.5em', borderTop: "0.5px solid #DCDCDC", borderBottom: "0.5px solid #DCDCDC" }} container spacing={4} justify="center" alignItems="center" direction="row"> + <Grid item> + <Typography variant="h6" > + { + loading ? + <CircularProgress size={20} /> : + `${userData.follows_count} seguidores` + } + </Typography> + </Grid> + <Grid item> + <Typography variant="h6" > + { + loading ? + <CircularProgress size={20} /> : + following ? + `${following.length} seguindo` : + "0 seguindo" + } + </Typography> + </Grid> + </Grid> </Grid> + : + RenderCheckTeacher(userData.submitter_request)} + <RodapeDiv> + <NavBarContentContainer> + <StyledTabs + value={tabValue} + onChange={handleChangeTab} + indicatorColor="primary" + textColor="primary" + variant="fullwidth" + scrollButtons="desktop" + TabIndicatorProps={{ style: { background: "#00bcd4" } }} + > + { + tabs.map((tab) => + <Tab label={tab} key={tab} + disabled={(tab === "Recursos" && learningObjArr.length === 0) || (tab === "Coleções" && collectionsArr.length === 0)} + /> + ) + } + </StyledTabs> + </NavBarContentContainer> + <ReportButton className="report-button" complainableId={userData.id} complainableType={"User"} /> + </RodapeDiv> + </UserProfileContainer> + </div> + </Grid> - <Grid item xs={12}> - {tabValue === 0 && - <TabInicio id={id} user={userData} learningObjs={learningObjArr} collections={collectionsArr} />} - {tabValue === 1 && - <TabRecursos count={userData.learning_objects_count} learningObjs={learningObjArr} id={id} />} - {tabValue === 2 && - <TabColecoes count={userData.collections_count} collections={collectionsArr} - />} - {tabValue === 3 && - <TabRede id={id} username={userData.name} />} - - </Grid> - </Grid> - </BackgroundDiv> - </React.Fragment> - ) + <Grid item xs={12}> + {tabValue === 0 && + <TabInicio id={id} user={userData} learningObjs={learningObjArr} collections={collectionsArr} />} + {tabValue === 1 && + <TabRecursos count={userData.learning_objects_count} learningObjs={learningObjArr} id={id} />} + {tabValue === 2 && + <TabColecoes count={userData.collections_count} collections={collectionsArr} + />} + {tabValue === 3 && + <TabRede id={id} username={userData.name} />} + </Grid> + </Grid> + </BackgroundDiv> + </React.Fragment> + ) } diff --git a/src/Pages/Search.js b/src/Pages/Search.js index ef5d280a14a37f3edfcd67b6aa60b08fce0e5b0a..65dc38660dc52882e324ae361c0ec92ff9a4cf39 100644 --- a/src/Pages/Search.js +++ b/src/Pages/Search.js @@ -125,9 +125,9 @@ export default function Search(props) { }, }); } - - setOptionResult(searchClass) currOption = searchClass + setOption(searchClass) + setOptionResult(searchClass) collectStuff(searchClass) return () => diff --git a/src/env.js b/src/env.js index 82bf229b11fe78f3cb5ff8a58d096eec156cedf2..b7359157e1c0e9d260976bbe2b2545a2e0ca51b0 100644 --- a/src/env.js +++ b/src/env.js @@ -17,7 +17,7 @@ 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/>.*/ -var apiDomain = 'https://api.portalmectest.c3sl.ufpr.br', +var apiDomain = 'https://api.portalmec.c3sl.ufpr.br', apiVersion = 'v1', apiUrl = apiDomain + '/' + apiVersion;