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

changed logic so it loads forbidden/unexistent learning objects with empty info

parent 683b278d
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
......@@ -56,7 +56,8 @@ export default function Sobre (props) {
useEffect(() => {
let aux = []
if (props.attachments[0]){
if (props.attachments && props.attachments[0]){
aux.push(<AdditionalInfoItem
icon={<SdCardIcon/>}
label={'Tamanho: '}
......@@ -64,14 +65,18 @@ export default function Sobre (props) {
key={props.attachments[0].id}
/>)
}
props.language.map( (lang) =>
aux.push(<AdditionalInfoItem
icon={<TranslateIcon/>}
label={'Idioma: '}
value={lang.name}
key={lang.id}
/>
))
if(props.language){
props.language.map( (lang) =>
aux.push(<AdditionalInfoItem
icon={<TranslateIcon/>}
label={'Idioma: '}
value={lang.name}
key={lang.id}
/>
))
}
if (props.mimeType){
aux.push(<AdditionalInfoItem
icon={<InsertDriveFileIcon/>}
......@@ -141,6 +146,7 @@ export default function Sobre (props) {
<div className="sobre-conteudo">
<div className="tags-container">
{
props.tags &&
props.tags.map( (tag) =>
<span key={tag.name}>{tag.name}</span>
)
......
......@@ -35,34 +35,38 @@ export default function TextoObjeto (props) {
const [eduStages, setEduStages] = useState('')
const extractComponentesCurriculares = (subjects) => {
let outrasTem = []
let compCurr = []
subjects.map((subject) => {
if (!subject.theme) {
compCurr.push(subject.name)
}
else {
outrasTem.push(subject.name)
}
})
return [outrasTem.join(' - '), compCurr.join(' - ')]
if (subjects) {
let outrasTem = []
let compCurr = []
subjects.map((subject) => {
if (!subject.theme) {
compCurr.push(subject.name)
}
else {
outrasTem.push(subject.name)
}
})
setOutrasTem(outrasTem.join(' - '))
setCompCurr(compCurr.join(' - '))
}
else {
setOutrasTem("Dado não identificado")
setCompCurr("Dado não identificado")
}
}
const extractEduStages = (stages) => {
return(stages.map((stage) => {return (stage.name)}).join(' - '))
return(stages ? stages.map((stage) => {return (stage.name)}).join(' - ') : undefined)
}
useEffect(() => {
let evaluate = extractComponentesCurriculares(props.subjects)
setOutrasTem(evaluate[0])
setCompCurr(evaluate[1])
extractComponentesCurriculares(props.subjects)
setEduStages(extractEduStages(props.educationalStages))
}, [])
const infos = [
{label : 'Tipo de Recurso: ', text : props.objType},
{label : 'Tipo de Recurso: ', text : (props.objType ? props.objType : "Dado não identificado")},
{label : 'Componentes Curriculares: ', text : componentesCurriculares},
{label : 'Outras Temáticas: ', text : outrasTematicas},
{label : 'Etapas de Ensino: ', text : eduStages}
......@@ -100,6 +104,21 @@ export default function TextoObjeto (props) {
<span className={"dado-recurso"}>{props.downloadCount}</span>
</span>
{/*|| checkUserRole('publisher')*/}
{
props.stateRecurso === "submitted" &&
<div className="alert-warning">
Esse recurso ainda não foi publicado por estar esperando análise da curadoria
</div>
}
{/*|| checkUserRole('publisher')*/}
{
props.stateRecurso === "draft" &&
<div className="alert-warning">
Esse recurso ainda é um rascunho, termine de editar para publicá-lo
</div>
}
</Grid>
<Grid item xs={1}>
{/*|| checkUserRole('publisher')*/}
......@@ -160,4 +179,15 @@ const TextoObjetoDiv = styled.div`
vertical-align : middle;
margin-right : 2px;
}
.alert-warning {
color : #8a6d3b;
background-color : #fcf8e3;
border-color : #faebcc;
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
font-size : 14px;
}
`
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