Select Git revision
TemplateColecao.js
-
added Teacher div to header; added Report Menu to tabs; wip fix to follow/unfollow and followers count buttons
added Teacher div to header; added Report Menu to tabs; wip fix to follow/unfollow and followers count buttons
TemplateColecao.js 3.96 KiB
/*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/>.*/
import React from 'react'
import Grid from '@material-ui/core/Grid';
import NoContent from './NoContent.js'
import CollectionCardFunction from '../../CollectionCardFunction.js'
import Title from './PanelTitle.js'
import {WhiteContainer, StyledGrid} from '../StyledComponents.js'
import {ButtonsAreaColecao} from './ButtonsArea'
export default function PanelTemplateColecao (props) {
const RenderFollowedColCard = (card, followerBoolean) => {
if (followerBoolean) {
return (
<CollectionCardFunction
name={card.followable.name}
rating={card.followable.score}
type={card.followable.object_type}
description={card.followable.description}
author={card.followable.owner.name}
avatar={card.followable.owner.avatar}
thumbnails={card.followable.items_thumbnails}
likeCount={card.followable.likes_count}
liked={card.followable.liked}
followed={card.followable.followed}
/>
)
}
else {
return (
<CollectionCardFunction
name={card.name}
rating={card.score}
type={card.object_type}
description={card.description}
author={card.owner.name}
avatar={card.owner.avatar}
thumbnails={card.items_thumbnails}
likeCount={card.likes_count}
liked={card.liked}
followed={card.followed}
tags={card.tags}
/>
)
}
}
return (
<WhiteContainer>
<Title
title={props.title}
length={props.length}
/>
{
props.length === 0 ?
(
[
<NoContent text={props.noContentText}/>
]
)
:
(
[
<React.Fragment>
<StyledGrid container spacing={1} style={{paddingLeft : "30px", paddingRight : "15px"}}>
{
props.sliceArr.map( (card) =>
<Grid item md={3} xs={12} key={card.id}>
{RenderFollowedColCard(card, props.followed)}
</Grid>
)
}
</StyledGrid>
<ButtonsAreaColecao
sliceLength={props.sliceArr.length}
length={props.length}
showMore={() => props.showMore()}
showAll={() => props.showAll()}
/>
</React.Fragment>
]
)
}
</WhiteContainer>
)
}