import {Component, Input} from '@angular/core'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {HostedByCollectedFrom} from "../../utils/result-preview/result-preview"; import {properties} from "../../../../environments/environment"; @Component({ selector: 'availableOn', template: `
{{available.downloadName}} [{{(i + 1) | number}}] {{available.downloadName}} {{available.downloadName}}
{{available.type}} . {{available.year}}
Provider: {{available.collectedName}}
View less
View more
` }) export class AvailableOnComponent { @Input() availableOn: HostedByCollectedFrom[]; // { // "downloadName": string, "downloadUrl": string[], // "collectedName": string, "collectedId": string, // "accessMode": string[], "bestAccessMode": string, // "type": string, "year": string, icon: string // }[]; // public open = 'assets/common-assets/unlock.svg'; // public closed = 'assets/common-assets/lock.svg'; // public unknown = 'assets/common-assets/question.svg'; public threshold: number = 4; public showNum: number = 4; public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0]; constructor() { } ngOnInit() { // this.availableOn.forEach(available => { // if (available.bestAccessMode) { // if (available.bestAccessMode.toLowerCase().indexOf('open') !== -1) { // available.icon = this.open; // } else if (available.bestAccessMode.toLowerCase().indexOf('not available') !== -1) { // available.icon = this.unknown; // } else { // available.icon = this.closed; // } // } else { // available.icon = this.unknown; // } // } // ); } public removeUnknown(value: string): string { if(properties.environment === 'production') { if (value.toLowerCase() === 'unknown') { return null; } } return value; } public scroll() { HelperFunctions.scroll(); } }