Skip to content
Snippets Groups Projects
Commit 1a56b6fa authored by lfr20's avatar lfr20
Browse files

Fixed "Meus recursos" and "Atividades" in the user Page

parent aa82e14b
Branches
Tags
4 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!39Update admin system,!36Fix perfil into develop
......@@ -32,12 +32,11 @@ export function ButtonsAreaRecurso(props) {
props.end ?
null :
<React.Fragment>
<ButtonMostrarMaisRecurso onClick={() => props.showMore()}>
<span style={{ color: "#fff", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS</span>
<ButtonMostrarMaisRecurso onClick={() => props.showMore(4)}>
<span style={{ color: "#fff", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS 4</span>
</ButtonMostrarMaisRecurso>
<ButtonMostrarTodos onClick={() => { props.showAll() }}>
<span style={{ color: "#666", fontSize: "14px", fontWeight: "500" }}>MOSTRAR TODOS</span>
<ButtonMostrarTodos onClick={() => { props.showMore(20) }}>
<span style={{ color: "#666", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS 20</span>
</ButtonMostrarTodos>
</React.Fragment>
}
......
......@@ -75,8 +75,7 @@ export default function Template(props) {
<ButtonsAreaRecurso
sliceLength={props.sliceArr.length}
length={props.length}
showMore={() => props.showMore()}
showAll={() => props.showAll()}
showMore={props.showMore}
end={props.end}
/>
}
......
......@@ -27,8 +27,8 @@ import LoadingSpinner from '../../LoadingSpinner.js'
export default function Template(props) {
function showMore() {
props.showMore()
function showMore(limite) {
props.showMore(limite)
}
return (
......@@ -80,7 +80,6 @@ export default function Template(props) {
sliceLength={props.slice.length}
length={props.length}
showMore={showMore}
showAll={() => props.showAll()}
end={props.end}
/>
}
......
......@@ -27,6 +27,8 @@ import ActivityListItem from '../../ActivityListItem.js'
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';
let limit = 30;
......@@ -108,7 +110,7 @@ export default function TabPanelAtividades(props) {
notifications.map((notification) =>
<ActivityListItem
onMenuBar={false}
avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : null}
avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : DefaultProfile}
activity={notification.activity}
actionType={notification.trackable_type}
objectType={notification.recipient_type}
......
......@@ -37,7 +37,6 @@ export default function TabPanelAtividades(props) {
const [endOfDrafts, setEndofDrafts] = useState(false);
const [endOfCurating, setEndofCurating] = useState(false);
const [learningObjects, setLearningObjects] = useState([]);
const [drafts, setDrafts] = useState([]);
const [curating, setCurating] = useState([]);
......@@ -62,9 +61,9 @@ export default function TabPanelAtividades(props) {
fetchAllRequest(urls, handleSuccess, (error) => { console.log(error) })
}, [])
const showMoreLearnObj = () => {
const showMoreLearnObj = (limite) => {
setLoadingMoreLearnObj(true);
const limit = 4;
const limit = limite;
currLimitLearnObj = currLimitLearnObj + limit;
const url = `/users/${props.id}/learning_objects?offset=${currLimitLearnObj}&limit=${limit}`;
getRequest(url,
......@@ -84,22 +83,10 @@ export default function TabPanelAtividades(props) {
)
}
const showAllLearnObj = () => {
setLoadingMoreLearnObj(true);
const url = `/users/${props.id}/learning_objects`
getRequest(url,
(data) => {
setLearningObjects([...data]);
setLoadingMoreLearnObj(false);
setEndofLearndObj(true)
},
(error) => { console.log(error) }
)
}
const showMoreDrafts = () => {
const showMoreDrafts = (limite) => {
setLoadingMoreDrafts(true);
const limit = 4;
console.log(limite);
const limit = limite;
currLimitDrafts = currLimitDrafts + limit;
const url = `/users/${props.id}/drafts?offset=${currLimitDrafts}&limit=${limit}`;
getRequest(url,
......@@ -120,22 +107,9 @@ export default function TabPanelAtividades(props) {
)
}
const showAllDrafts = () => {
setLoadingMoreDrafts(true);
const url = `/users/${props.id}/drafts`;
getRequest(url,
(data) => {
setDrafts([...data]);
setLoadingMoreDrafts(false);
setEndofDrafts(true);
},
(error) => { console.log(error) }
)
}
const showMoreCurating = () => {
const showMoreCurating = (limite) => {
setLoadingMoreCurating(true);
const limit = 4;
const limit = limite;
currLimitCurating = currLimitCurating + limit;
const url = `/users/${props.id}/submissions?offset=${currLimitCurating}&limit=${limit}&status=submitted`;
getRequest(url,
......@@ -156,19 +130,6 @@ export default function TabPanelAtividades(props) {
)
}
const showAllCurating = () => {
setLoadingMoreCurating(true);
const url = `/users/${props.id}/submissions`;
getRequest(url,
(data) => {
setCurating([...data]);
setLoadingMoreCurating(false);
setEndofCurating(true);
},
(error) => { console.log(error) }
)
}
return (
<>
{
......@@ -186,7 +147,6 @@ export default function TabPanelAtividades(props) {
noContentText={"Você ainda não publicou nenhum Recurso!"}
slice={learningObjects}
showMore={showMoreLearnObj}
showAll={showAllLearnObj}
loadingMore={loadingMoreLearnObj}
end={endOfLearnObj}
/>
......@@ -197,7 +157,6 @@ export default function TabPanelAtividades(props) {
noContentText={"Você não tem nenhum recurso sendo editado."}
slice={drafts}
showMore={showMoreDrafts}
showAll={showAllDrafts}
loadingMore={loadingMoreDrafts}
end={endOfDrafts}
/>
......@@ -208,7 +167,6 @@ export default function TabPanelAtividades(props) {
noContentText={"Você não tem nenhum recurso sendo avaliado pelos curadores."}
sliceArr={curating}
showMore={showMoreCurating}
showAll={showAllCurating}
loadingMore={loadingMoreCurating}
end={endOfCurating}
/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment