Skip to content
Snippets Groups Projects
Commit 0ff15727 authored by Lucas Eduardo Schoenfelder's avatar Lucas Eduardo Schoenfelder
Browse files

missing share button and save to collection button functionalities

parent e54e1881
No related branches found
No related tags found
3 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!24Tela recurso
......@@ -24,7 +24,14 @@ import Grid from '@material-ui/core/Grid';
import TextoObjeto from '../Components/ResourcePageComponents/TextoObjeto.js'
import Footer from '../Components/ResourcePageComponents/Footer.js'
import Sobre from '../Components/ResourcePageComponents/Sobre.js'
import CommentsArea from '../Components/ResourcePageComponents/CommentsArea.js'
import noAvatar from "../img/default_profile.png";
import Snackbar from '@material-ui/core/Snackbar';
import MuiAlert from '@material-ui/lab/Alert';
export function Alert(props) {
return <MuiAlert elevation={6} variant="filled" {...props} />;
}
export default function LearningObjectPage (props){
const id = props.match.params.recursoId
......@@ -34,13 +41,35 @@ export default function LearningObjectPage (props){
useEffect( () => {
axios.get( (`${apiUrl}/learning_objects/` + id )
).then( (response) => {
if ( response.headers['access-token'] ) {
sessionStorage.setItem('@portalmec/accessToken', response.headers['access-token'])
}
console.log(response)
setRecurso(response.data)
toggle(false)
}, (error) => {console.log(error)})
}, [])
const [snackbarOpen, toggleSnackbar] = useState(false)
const handleSnackbar = (index) => {setIndex(index); toggleSnackbar(true)}
const snackbarText = [
"Baixando o Recurso... Lembre-se de relatar sua experiência após o uso do Recurso!",
"Seu comentário foi publicado com sucesso!",
"Comentário editado com sucesso.",
"Comentário deletado com sucesso. "
]
const [snackbarIndex, setIndex] = useState(0)
return (
<React.Fragment>
<Snackbar open={snackbarOpen} autoHideDuration={1000} onClose={toggleSnackbar}
anchorOrigin = {{ vertical:'top', horizontal:'right' }}
>
<Alert severity="info" style={{backgroundColor:"#00acc1"}}>
{snackbarText[snackbarIndex]}
</Alert>
</Snackbar>
<Background>
{
carregando ?
......@@ -59,6 +88,8 @@ export default function LearningObjectPage (props){
}
{/*adicionar opcoes caso o usuario seja o publisher*/}
{/*adicionar links para os botoes de editar/deletar*/}
{/*implementar checkUserRole('publisher')*/}
<TextoObjeto
name={recurso.name}
rating={recurso.rating}
......@@ -69,16 +100,28 @@ export default function LearningObjectPage (props){
educationalStages={recurso.educational_stages}
viewCount={recurso.views_count}
downloadCount={recurso.downloads_count}
id={recurso.publisher.id}
stateRecurso={recurso.state}
/>
</div>
{/*adicionar funcionalidade nos botoes do footer*/}
<Footer/>
{/*"Você já reportou esse recurso"*/}
<Footer
recursoId={id}
downloadableLink = {recurso.default_attachment_location}
handleSnackbar={handleSnackbar}
title={recurso.name}
thumb={recurso.thumbnail}
link={window.location.href}
/>
</Card>
</Grid>
<Grid item xs={12}>
<Card>
{/*add option to MoreVertIcon*/}
{/*change file size display*/}
{/*change render method on additional item info*/}
<Sobre
avatar={recurso.publisher.avatar ? (apiDomain + recurso.publisher.avatar) : noAvatar}
publisher={recurso.publisher.name}
......@@ -95,12 +138,24 @@ export default function LearningObjectPage (props){
/>
</Card>
</Grid>
<Grid item xs={12}>
<Card>
{/*adicionar funcionalidade ao botao de entrar*/}
<CommentsArea
recursoId = {id}
handleSnackbar={handleSnackbar}
/>
</Card>
</Grid>
</Grid>
]
)
}
</Background>
</React.Fragment>
)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment