adjusted UI for persons list
This commit is contained in:
@@ -1,65 +1,80 @@
|
||||
@let persons = state.persons();
|
||||
@let results = persons.results ?? [];
|
||||
@if (!isPersonsLoading()) {
|
||||
<mat-grid-list cols="1" rowHeight="65px" gutterSize="16px">
|
||||
<mat-grid-tile>
|
||||
<p class="result-count">{{ results.length }} Ergebnisse</p>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
<mat-grid-list cols="1" rowHeight="220px" gutterSize="16px">
|
||||
|
||||
<section class="person-list-page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1>Passende Personen finden</h1>
|
||||
<p>
|
||||
Durchsuchen Sie OpenAlex-Autorinnen und -Autoren nach Namen, Themen oder
|
||||
Kennungen.
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@for (person of results; track person.id) {
|
||||
<div class="toolbar">
|
||||
<span class="result-count">{{ resultRange() }}</span>
|
||||
</div>
|
||||
|
||||
<mat-grid-tile>
|
||||
@if (person.id){
|
||||
<mat-card (click)="navigateID(person.id)" class="person-card">
|
||||
<section class="results-panel">
|
||||
<div class="results-head">
|
||||
<strong>{{ total() | number: "1.0-0" }} Personen gefunden</strong>
|
||||
<span>Sortiert nach Publikationen und Zitierungen</span>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
|
||||
<div class="avatar">
|
||||
<mat-icon class="avatar-icon">person</mat-icon>
|
||||
@if (loading) {
|
||||
<div class="loading-state">
|
||||
<mat-spinner diameter="40"></mat-spinner>
|
||||
</div>
|
||||
} @else if (persons().results?.length) {
|
||||
<div class="person-grid">
|
||||
@for (person of persons().results; track person.id) {
|
||||
@let inst = institution(person);
|
||||
<article class="person-card">
|
||||
<a
|
||||
class="card-link"
|
||||
[routerLink]="['/person', person.id, 'overview']"
|
||||
>
|
||||
<div class="person-main">
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<h2>{{ person.display_name }}</h2>
|
||||
<img alt="" class="example-option-img" [src]="`https://flagcdn.io/${inst?.country_code?.toLowerCase()}.svg`" height="25">
|
||||
</div>
|
||||
<p>{{ inst?.display_name }}</p>
|
||||
<div class="topic-row">
|
||||
@for (topic of topics(person); track topic) {
|
||||
<span>{{ topic }}</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info">
|
||||
<h3 class="name">{{ person.display_name }}</h3>
|
||||
<p class="person-id">{{ getDistinguishingId(person) }}</p>
|
||||
@if (person.affiliations!=undefined){
|
||||
<p class="affiliation">
|
||||
{{ person.affiliations[0]?.institution?.display_name }}
|
||||
</p>
|
||||
}
|
||||
|
||||
|
||||
<p class="stats">
|
||||
Works: {{ person.works_count }} ·
|
||||
Citations: {{ person.cited_by_count }}
|
||||
</p>
|
||||
|
||||
<div class="topics">
|
||||
@for (t of person.topics; track t) {
|
||||
<mat-chip class="topic-chip">{{ t.display_name }}</mat-chip>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</mat-card>
|
||||
<div class="stats">
|
||||
<span>
|
||||
<mat-icon>article</mat-icon>
|
||||
{{ person.works_count | number: "1.0-0" }} Publikationen
|
||||
</span>
|
||||
<span>
|
||||
<mat-icon>format_quote</mat-icon>
|
||||
{{ person.cited_by_count | number: "1.0-0" }} Zitierungen
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
}
|
||||
</mat-grid-tile>
|
||||
|
||||
</div>
|
||||
} @else {
|
||||
<div class="empty-state">
|
||||
<mat-icon>person_search</mat-icon>
|
||||
<h2>Keine Personen gefunden</h2>
|
||||
<p>Versuchen Sie einen anderen Suchbegriff.</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
</mat-grid-list>
|
||||
} @else {
|
||||
<mat-grid-list cols="1" rowHeight="220px" gutterSize="16px">
|
||||
<mat-grid-tile>
|
||||
<div class="loading">
|
||||
<mat-spinner diameter="40"></mat-spinner>
|
||||
</div>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
}
|
||||
<mat-paginator
|
||||
[length]="total()"
|
||||
[pageIndex]="pageIndex()"
|
||||
[pageSize]="pageSize()"
|
||||
[pageSizeOptions]="paginationService.options"
|
||||
(page)="onPage($event)"
|
||||
aria-label="Personen Seitensteuerung"
|
||||
></mat-paginator>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -1,78 +1,285 @@
|
||||
.person-list-page {
|
||||
display: grid;
|
||||
gap: 24px;
|
||||
padding: 32px;
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
|
||||
gap: 32px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 8px;
|
||||
color: var(--sg-primary);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
margin: 0;
|
||||
font-size: 28px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.page-header p:not(.eyebrow) {
|
||||
max-width: 720px;
|
||||
margin: 10px 0 0;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.selection-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 80px;
|
||||
padding: 18px 20px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
}
|
||||
|
||||
.selection-summary div {
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.selection-summary strong {
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
.selection-summary span {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.selection-summary mat-icon {
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.toolbar mat-form-field {
|
||||
width: min(100%, 520px);
|
||||
}
|
||||
|
||||
.result-count {
|
||||
margin: 0 0 12px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.results-panel {
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.results-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
min-height: 64px;
|
||||
padding: 0 22px;
|
||||
}
|
||||
|
||||
.results-head strong {
|
||||
color: var(--sg-text);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.results-head span {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.person-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.person-card {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 16px;
|
||||
min-width: 0;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
transition:
|
||||
border-color 160ms ease,
|
||||
box-shadow 160ms ease,
|
||||
transform 160ms ease;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
height: 100%;
|
||||
.person-card:hover {
|
||||
border-color: var(--sg-border-strong);
|
||||
box-shadow: var(--sg-shadow-md);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.card-link {
|
||||
display: grid;
|
||||
grid-template-rows: 1fr auto;
|
||||
gap: 18px;
|
||||
min-height: 236px;
|
||||
padding: 20px;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.avatar-icon {
|
||||
font-size: 48px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
color: #9e9e9e;
|
||||
}
|
||||
|
||||
.info {
|
||||
.person-main {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.name {
|
||||
margin: 0;
|
||||
.person-main h2 {
|
||||
margin: 0 0 6px;
|
||||
font-size: 17px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.person-id {
|
||||
font-size: 11px;
|
||||
color: #aaa;
|
||||
.person-main p {
|
||||
display: -webkit-box;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.affiliation {
|
||||
color: #666;
|
||||
margin: 0;
|
||||
.topic-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.topic-row span {
|
||||
max-width: 100%;
|
||||
padding: 5px 10px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #bcd3ff;
|
||||
border-radius: 6px;
|
||||
background: #eff6ff;
|
||||
color: #064fc4;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.stats {
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.topics {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.topic-chip {
|
||||
font-size: 12px;
|
||||
}
|
||||
.loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid var(--sg-border);
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
width: 100%;
|
||||
min-height: 300px;
|
||||
.stats span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
padding: 2rem;
|
||||
}
|
||||
.stats mat-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.loading-state,
|
||||
.empty-state {
|
||||
display: grid;
|
||||
min-height: 320px;
|
||||
place-items: center;
|
||||
padding: 32px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
align-content: center;
|
||||
gap: 8px;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.empty-state mat-icon {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
color: var(--sg-text-soft);
|
||||
font-size: 42px;
|
||||
}
|
||||
|
||||
.empty-state h2 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.empty-state p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
mat-paginator {
|
||||
border-top: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
@media (max-width: 1280px) {
|
||||
.person-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.person-list-page {
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.toolbar,
|
||||
.results-head {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.results-head {
|
||||
justify-content: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.result-count {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.person-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.stats {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +1,126 @@
|
||||
import { Component, computed, inject, signal, DestroyRef } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { toObservable } from '@angular/core/rxjs-interop';
|
||||
import { Component, inject, DestroyRef, computed, signal } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterLink, ActivatedRoute, Router } from '@angular/router';
|
||||
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { MatGridListModule } from '@angular/material/grid-list';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
||||
import { Author, AuthorsListResponse, PersonsService } from '../../api';
|
||||
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import {
|
||||
Author,
|
||||
AuthorsListResponse,
|
||||
DehydratedInstitution,
|
||||
PersonsService,
|
||||
} from '../../api';
|
||||
import { SharedStateService } from '../../shared/services/shared-state.service';
|
||||
import { distinctUntilChanged, switchMap, tap, finalize } from 'rxjs';
|
||||
import { PaginationService } from '../../shared/services/pagination.service';
|
||||
import { createLoadError } from '../../shared/utils/errorHandler';
|
||||
import { distinctUntilChanged, switchMap, tap, finalize, map } from 'rxjs';
|
||||
import { AuthorAffiliationsInner } from '../../api';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-list',
|
||||
imports: [
|
||||
MatCardModule,
|
||||
MatChipsModule,
|
||||
MatGridListModule,
|
||||
CommonModule,
|
||||
MatIconModule,
|
||||
MatProgressSpinner,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSnackBarModule,
|
||||
RouterLink,
|
||||
],
|
||||
templateUrl: './person-list.component.html',
|
||||
styleUrl: './person-list.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class PersonListComponent {
|
||||
private readonly router = inject(Router);
|
||||
private readonly personsService = inject(PersonsService);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly snackBar = inject(MatSnackBar);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
public readonly state = inject(SharedStateService);
|
||||
public readonly paginationService = inject(PaginationService);
|
||||
|
||||
private readonly defaultIncludes =
|
||||
'display_name,works_count,cited_by_count,topics,orcid';
|
||||
'display_name,works_count,cited_by_count,topics,orcid,affiliations';
|
||||
private readonly defaultInstitutionName = 'University of Duisburg-Essen';
|
||||
|
||||
readonly isPersonsLoading = signal<boolean>(false);
|
||||
private readonly queryParams = toSignal(
|
||||
this.route.queryParams.pipe(
|
||||
map((params) => ({
|
||||
search: params['search'] as string | null,
|
||||
page: Number(params['page'] ?? 0),
|
||||
size: Number(params['size'] ?? this.paginationService.options[2]),
|
||||
})),
|
||||
),
|
||||
{
|
||||
initialValue: {
|
||||
search: null,
|
||||
page: 0,
|
||||
size: this.paginationService.options[2],
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
readonly searchValue = computed<string | null>(
|
||||
() => this.queryParams()['search'] ?? null,
|
||||
);
|
||||
readonly pageIndex = computed<number>(() =>
|
||||
Number(this.queryParams()['page'] ?? 0),
|
||||
);
|
||||
readonly pageSize = computed<number>(
|
||||
() =>
|
||||
Number(this.queryParams()['size'] ?? this.paginationService.options[2]), // default 10
|
||||
);
|
||||
|
||||
loading = false;
|
||||
|
||||
readonly persons = computed<AuthorsListResponse>(
|
||||
() => this.state.persons() ?? [],
|
||||
);
|
||||
|
||||
readonly total = computed<number | undefined>(
|
||||
() => this.state.persons().meta?.count ?? this.persons().results?.length,
|
||||
);
|
||||
|
||||
readonly resultRange = computed<string>(() => {
|
||||
const total = this.total();
|
||||
const persons = this.persons();
|
||||
if (!total || !persons.results?.length) return 'Keine Personen gefunden';
|
||||
const start = this.pageIndex() * this.pageSize() + 1;
|
||||
const end = start + persons.results.length - 1;
|
||||
return `${start}–${end} von ${total} Personen`;
|
||||
});
|
||||
|
||||
constructor() {
|
||||
toObservable(this.state.searchValue)
|
||||
toObservable(this.queryParams)
|
||||
.pipe(
|
||||
distinctUntilChanged(),
|
||||
tap(() => {
|
||||
map(() => ({
|
||||
search: this.searchValue(),
|
||||
page: this.pageIndex(),
|
||||
pageSize: this.pageSize(),
|
||||
})),
|
||||
distinctUntilChanged(
|
||||
(a, b) =>
|
||||
a.search === b.search &&
|
||||
a.page === b.page &&
|
||||
a.pageSize === b.pageSize,
|
||||
),
|
||||
tap(({ search }) => {
|
||||
this.state.hasSearched.set(false);
|
||||
this.isPersonsLoading.set(true);
|
||||
this.loading = true;
|
||||
if (!search) this.state.hasSearched.set(false);
|
||||
}),
|
||||
switchMap((value) =>
|
||||
value
|
||||
switchMap(({ search, page, pageSize }) =>
|
||||
search
|
||||
? this.personsService
|
||||
.searchPersonsByName(value, this.defaultIncludes)
|
||||
.searchPersonsByName(
|
||||
search,
|
||||
this.defaultIncludes,
|
||||
pageSize,
|
||||
page,
|
||||
)
|
||||
.pipe(
|
||||
tap((result) => {
|
||||
this.state.persons.set(this.sortByRanking(result));
|
||||
@@ -56,6 +131,8 @@ export class PersonListComponent {
|
||||
.searchPersonsByInstitution(
|
||||
this.defaultInstitutionName,
|
||||
this.defaultIncludes,
|
||||
pageSize,
|
||||
page,
|
||||
)
|
||||
.pipe(
|
||||
tap((result) => {
|
||||
@@ -63,35 +140,55 @@ export class PersonListComponent {
|
||||
}),
|
||||
),
|
||||
),
|
||||
finalize(() => this.isPersonsLoading.set(false)),
|
||||
finalize(() => (this.loading = false)),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe({
|
||||
next: () => this.isPersonsLoading.set(false),
|
||||
next: () => (this.loading = false),
|
||||
error: (err) => {
|
||||
console.error('Error loading persons:', err);
|
||||
this.isPersonsLoading.set(false);
|
||||
this.loading = false;
|
||||
createLoadError(
|
||||
this.snackBar,
|
||||
() => {},
|
||||
'Personen konnten nicht geladen werden',
|
||||
)(err);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// navigation
|
||||
navigateID(id: string): void {
|
||||
this.router.navigate(['/person', id]);
|
||||
onPage(event: PageEvent): void {
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: {
|
||||
page: event.pageIndex,
|
||||
size: event.pageSize,
|
||||
},
|
||||
queryParamsHandling: 'merge', // preserve search param
|
||||
});
|
||||
}
|
||||
|
||||
// sorting logic
|
||||
institution(person: Author): DehydratedInstitution | null {
|
||||
if (!person.affiliations?.length) null;
|
||||
return person.affiliations?.at(-1)?.institution ?? null;
|
||||
}
|
||||
|
||||
topics(person: Author): string[] {
|
||||
return ((person.topics ?? []) as any[])
|
||||
.slice(0, 3)
|
||||
.map((t) => (typeof t === 'string' ? t : (t?.display_name ?? '')))
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
// Sorting logic
|
||||
sortByRanking(response: AuthorsListResponse): AuthorsListResponse {
|
||||
if (!response.results) return response;
|
||||
|
||||
return {
|
||||
...response,
|
||||
results: [...response.results].sort((personA, personB) => {
|
||||
const rankDiff = this.getSortRank(personA) - this.getSortRank(personB);
|
||||
if (rankDiff !== 0) {
|
||||
return rankDiff;
|
||||
}
|
||||
return this.getWorksCount(personB) - this.getWorksCount(personA);
|
||||
results: [...response.results].sort((a, b) => {
|
||||
const rankDiff = this.getSortRank(a) - this.getSortRank(b);
|
||||
return rankDiff !== 0
|
||||
? rankDiff
|
||||
: this.getWorksCount(b) - this.getWorksCount(a);
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -108,28 +205,11 @@ export class PersonListComponent {
|
||||
}
|
||||
|
||||
hasInstitution(person: Author): boolean {
|
||||
if (!person.affiliations) {
|
||||
return false;
|
||||
}
|
||||
for (const affiliation of person.affiliations) {
|
||||
if (affiliation.institution) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return !!person.affiliations?.some((a) => a.institution);
|
||||
}
|
||||
|
||||
hasOrcid(person: Author): boolean {
|
||||
const ids = person.ids as { orcid?: string } | null | undefined;
|
||||
return !!ids?.orcid;
|
||||
}
|
||||
|
||||
getDistinguishingId(person: Author): string {
|
||||
const ids = person.ids as { orcid?: string } | null | undefined;
|
||||
const orcid = ids?.orcid;
|
||||
|
||||
return orcid
|
||||
? 'ORCID: ' + orcid.replace('https://orcid.org/', '')
|
||||
: 'OpenAlexID: ' + person.id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user