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: `
{{entityType}}
0">
{{(entityType?' . ':'') + removeUnknown(types, true).join(' . ')}}
{{' . '}}
{{'from '}}
{{'until '}}
{{startDate | date: 'yyyy'}}
{{' - '}}
{{endDate | date: 'yyyy'}}
{{' . ' + status}}
{{' . ' + year}}
. Embargo end date: {{embargoEndDate | date: 'dd MMM yyyy'}}
. Under curation
`
})
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[];
@Input() authorLimit: number = 7;
@Input() showAllAuthors: boolean = true;
@Input() underCuration: boolean = false;
@Input() modal: AlertModal;
@Input() titleClass: string = null;
@Input() isTitleH1:boolean =true;
@Input() isSticky: boolean = false;
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 {
let tooltipContent: string = "";
tooltipContent += "
Record in preview
";
tooltipContent += "
Bibliographic record accepted by the system, but not yet processed by
OpenAIRE tools for information quality improvement and de-duplication
";
tooltipContent += "
";
return tooltipContent;
}
}