2020-03-16 14:09:46 +01:00
import { Component , Input } from "@angular/core" ;
import { EnvProperties } from "../../../utils/properties/env-properties" ;
import { Author } from "../../../utils/result-preview/result-preview" ;
import { AlertModal } from "../../../utils/modal/alert" ;
@Component ( {
selector : 'landing-header' ,
template : `
2020-05-20 22:34:29 +02:00
< div class = "title-section uk-margin-bottom" [ ngClass ] = " titleClass " >
2022-04-12 13:51:54 +02:00
< div class = "uk-text-small" >
< span * ngIf = "entityType" class = "uk-text-capitalize uk-text-small" >
2020-03-16 14:09:46 +01:00
{ { entityType } }
< / span >
2020-05-05 16:09:18 +02:00
< span * ngIf = "types && removeUnknown(types, true).length > 0" >
2020-07-21 11:17:50 +02:00
{ { ( entityType ? ' . ' : '' ) + removeUnknown ( types , true ) . join ( ' . ' ) } }
2020-03-16 14:09:46 +01:00
< / span >
< span >
< span * ngIf = "startDate || endDate" >
{ { ' . ' } }
< / span >
< span * ngIf = "startDate && !endDate" >
{ { 'from ' } }
< / span >
< span * ngIf = "!startDate && endDate" >
{ { 'until ' } }
< / span >
< span * ngIf = "startDate" >
{ { startDate | date : 'yyyy' } }
< / span >
< span * ngIf = "startDate && endDate" >
{ { ' - ' } }
< / span >
< span * ngIf = "endDate" >
{ { endDate | date : 'yyyy' } }
< / span >
< / span >
< span * ngIf = "status && status != ''" >
{ { ' . ' + status } }
< / span >
< span * ngIf = "year && year != ''" >
{ { ' . ' + year } }
< / span >
< span * ngIf = "embargoEndDate" >
. Embargo end date : { { embargoEndDate | date : 'dd MMM yyyy' } }
< / span >
2020-05-19 17:33:47 +02:00
< span * ngIf = "underCuration" >
. < span title = "{{buildCurationTooltip()}}"
2021-03-12 13:15:47 +01:00
uk - tooltip = "pos:bottom-right; delay:10;"
2022-04-16 09:47:30 +02:00
class = "uk-text-primary" > Under curation < / span >
2020-05-19 17:33:47 +02:00
< / span >
2020-03-16 14:09:46 +01:00
< / div >
2022-05-03 10:52:07 +02:00
< div class = "uk-margin-medium-bottom" >
< showTitle [ titleName ] = " title " classNames = "uk-margin-remove-bottom" > < / showTitle >
< div * ngIf = "subTitle" >
< span class = "uk-text-meta uk-text-small" [ innerHTML ] = " subTitle " > < / span >
< / div >
2020-03-16 14:09:46 +01:00
< / div >
2022-05-03 10:52:07 +02:00
< div * ngIf = "authors" >
2022-04-12 13:51:54 +02:00
< showAuthors [ authorsLimit ] = " authorLimit " [ modal ] = " modal " [ showAll ] = " showAllAuthors " [ authors ] = " authors " > < / showAuthors >
2020-03-16 14:09:46 +01:00
< / div >
< / div > `
} )
export class LandingHeaderComponent {
@Input ( ) entityType : string ;
@Input ( ) properties : EnvProperties ;
@Input ( ) types : string [ ] ;
@Input ( ) startDate : number ; // project landing
@Input ( ) endDate : number ; // project landing
@Input ( ) status : string ; // project landing
@Input ( ) year : string ;
@Input ( ) embargoEndDate : Date ;
@Input ( ) title : string ;
@Input ( ) subTitle : string ;
@Input ( ) authors : Author [ ] ;
2022-04-16 09:47:30 +02:00
@Input ( ) authorLimit : number = 7 ;
2020-03-16 14:09:46 +01:00
@Input ( ) showAllAuthors : boolean = true ;
@Input ( ) underCuration : boolean = false ;
@Input ( ) modal : AlertModal ;
2020-05-20 22:34:29 +02:00
@Input ( ) titleClass : string = null ;
2020-11-12 10:51:34 +01:00
@Input ( ) isTitleH1 :boolean = true ;
2020-03-16 14:09:46 +01:00
public removeUnknown ( array : string [ ] , type : boolean = false ) : string [ ] {
if ( type ) {
return this . removeDuplicates ( array ) . filter ( value = > value . toLowerCase ( ) !== 'unknown' ) ;
} else {
return array . filter ( value = > value . toLowerCase ( ) !== 'unknown' ) ;
}
}
public removeDuplicates ( array : string [ ] ) : string [ ] {
return array . filter ( value = > value . toLowerCase ( ) !== this . entityType ) ;
}
public buildCurationTooltip ( ) : string {
2021-03-12 13:15:47 +01:00
let tooltipContent : string = "<div class='uk-padding-small'>" ;
2020-03-16 14:09:46 +01:00
2021-03-12 13:15:47 +01:00
tooltipContent += "<h5>Record in preview</h5>" ;
2020-03-16 14:09:46 +01:00
tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p>" ;
tooltipContent += "</div>" ;
return tooltipContent ;
}
}