2021-05-19 13:40:29 +02:00
|
|
|
import {Component, Input, OnInit} from '@angular/core';
|
|
|
|
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
|
|
|
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
|
|
|
import {Subscription} from 'rxjs';
|
2022-07-04 20:45:20 +02:00
|
|
|
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
|
2021-05-19 13:40:29 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'community-info',
|
|
|
|
template: `
|
2022-07-04 20:45:20 +02:00
|
|
|
<ul *ngIf="community" class="uk-tab uk-flex uk-flex-center uk-flex-left@m" uk-tab>
|
|
|
|
<li [class.uk-active]="tab === 'profile'"><a routerLink="../profile">Profile</a></li>
|
|
|
|
<li [class.uk-active]="tab === 'organizations'"><a routerLink="../organizations">Organizations</a></li>
|
|
|
|
<li [class.uk-active]="tab === 'projects'"><a routerLink="../projects">{{openAIREEntities.PROJECTS}}</a></li>
|
|
|
|
<li [class.uk-active]="tab === 'content-providers'"><a routerLink="../content-providers">{{openAIREEntities.DATASOURCES}}</a></li>
|
|
|
|
<li *ngIf="community.type !='ri'" [class.uk-active]="tab === 'subjects'"><a routerLink="../subjects">Subjects</a></li>
|
|
|
|
<li [class.uk-active]="tab === 'zenodo-communities'"><a routerLink="../zenodo-communities">Zenodo Communities</a></li>
|
2021-05-19 13:40:29 +02:00
|
|
|
</ul>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
export class CommunityInfoComponent implements OnInit {
|
|
|
|
@Input()
|
|
|
|
public type: string;
|
|
|
|
@Input()
|
|
|
|
public tab: "profile"| "organizations" | "projects" | "content-providers" | "subjects" | "zenodo-communities" = 'profile';
|
|
|
|
public community: CommunityInfo;
|
2022-07-04 20:45:20 +02:00
|
|
|
public openAIREEntities = OpenaireEntities;
|
2021-05-19 13:40:29 +02:00
|
|
|
private sub;
|
|
|
|
|
|
|
|
constructor(private communityService: CommunityService) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.sub =this.communityService.getCommunityAsObservable().subscribe(community => {
|
|
|
|
this.community = community;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
|
|
if (this.sub instanceof Subscription) {
|
|
|
|
this.sub.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|