Merge branch 'dev' into network
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
Mats Paul Tončik
2026-06-07 19:10:29 +02:00
57 changed files with 4514 additions and 100 deletions
@@ -44,7 +44,7 @@
<ul>
@for (work of element.works; track $index) {
<li>
<a [routerLink]="['/work', work.id]" class="work-link">
<a [routerLink]="['/publication', work.id]" class="work-link">
{{ work.title }}
</a>
</li>
@@ -15,7 +15,7 @@
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">
<a mat-icon-button color="primary" [routerLink]="['/work', element.id]">
<a mat-icon-button color="primary" [routerLink]="['/publication', element.id]">
<mat-icon>open_in_new</mat-icon>
</a>
</td>
@@ -112,7 +112,16 @@
*ngFor="let item of timelineItems; let index = index; trackBy: trackByYear"
class="timeline-item"
>
<h3>{{ getMainTopic(item) }}</h3>
<h3>
<button
type="button"
class="main-topic-button"
[disabled]="!getMainTopicItem(item)?.id"
(click)="selectTopic(getMainTopicItem(item)!)"
>
{{ getMainTopic(item) }}
</button>
</h3>
<span class="publication-count">
{{ item.publication_count }}
@@ -121,14 +130,17 @@
<div class="topic-list">
<ng-container *ngIf="getDisplayedTopics(item).length > 0; else noTopicsForYear">
<span
<button
type="button"
*ngFor="let topic of getDisplayedTopics(item); trackBy: trackByTopic"
class="topic-chip"
[ngClass]="getColorClass(index)"
[disabled]="!topic.id"
(click)="selectTopic(topic)"
>
<span class="topic-name">{{ topic.name }}</span>
<span class="topic-count">{{ topic.count }}</span>
</span>
</button>
</ng-container>
<ng-template #noTopicsForYear>
@@ -155,7 +167,16 @@
<div class="phase-title-block">
<span class="phase-years">{{ getPhaseYearLabel(phase) }}</span>
<h3>{{ phase.primaryTopicName }}</h3>
<h3>
<button
type="button"
class="main-topic-button"
[disabled]="!phase.primaryTopic.id"
(click)="selectTopic(phase.primaryTopic)"
>
{{ phase.primaryTopicName }}
</button>
</h3>
<span class="phase-publications">
{{ phase.publication_count }}
{{ phase.publication_count === 1 ? 'Publikation' : 'Publikationen' }}
@@ -165,14 +186,17 @@
<div class="phase-topics">
<ng-container *ngIf="phase.topics.length > 0; else noPhaseTopics">
<span
<button
type="button"
*ngFor="let topic of phase.topics; trackBy: trackByTopic"
class="topic-chip"
[ngClass]="getColorClass(index)"
[disabled]="!topic.id"
(click)="selectTopic(topic)"
>
<span class="topic-name">{{ topic.name }}</span>
<span class="topic-count">{{ topic.count }}</span>
</span>
</button>
</ng-container>
<ng-template #noPhaseTopics>
@@ -208,16 +232,19 @@
else noPhaseYearTopics
"
>
<span
<button
type="button"
*ngFor="
let topic of getDisplayedTopicsForPrimaryTopic(year, phase.primaryTopicName);
trackBy: trackByTopic
"
class="mini-topic-chip"
[disabled]="!topic.id"
(click)="selectTopic(topic)"
>
<span>{{ topic.name }}</span>
<strong>{{ topic.count }}</strong>
</span>
</button>
</ng-container>
<ng-template #noPhaseYearTopics>
@@ -246,4 +273,4 @@
Keine Timeline-Daten vorhanden.
</div>
</ng-template>
</section>
</section>
@@ -315,6 +315,32 @@
font-size: 12px;
}
.main-topic-button {
padding: 0;
border: 0;
background: transparent;
color: inherit;
font: inherit;
font-weight: inherit;
line-height: inherit;
cursor: pointer;
&:hover:not(:disabled) {
color: #0057ff;
text-decoration: underline;
}
&:focus-visible {
outline: 2px solid #0057ff;
outline-offset: 3px;
border-radius: 3px;
}
&:disabled {
cursor: default;
}
}
.topic-list {
display: flex;
flex-direction: column;
@@ -335,6 +361,24 @@
font-size: 12px;
font-weight: 500;
line-height: 1.25;
border: 0;
font-family: inherit;
cursor: pointer;
transition: transform 0.15s ease, box-shadow 0.15s ease;
&:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}
&:focus-visible {
outline: 2px solid #0057ff;
outline-offset: 2px;
}
&:disabled {
cursor: default;
}
}
.topic-name {
@@ -515,6 +559,22 @@
color: #40506f;
font-size: 11px;
line-height: 1.25;
border: 0;
font-family: inherit;
cursor: pointer;
&:hover:not(:disabled) {
color: #0057ff;
}
&:focus-visible {
outline: 2px solid #0057ff;
outline-offset: 2px;
}
&:disabled {
cursor: default;
}
span {
overflow-wrap: anywhere;
@@ -686,4 +746,4 @@
.phase-year-row {
grid-template-columns: 1fr;
}
}
}
@@ -9,6 +9,7 @@ import {
} from '@angular/core';
export interface TopicTimelineTopic {
id?: string;
name: string;
count: number;
}
@@ -27,11 +28,17 @@ export interface TimelineYearRange {
endYear: number;
}
export interface TimelineTopicSelection {
topic: TopicTimelineTopic;
years: number[];
}
interface ResearchTimelinePhase {
id: string;
startYear: number;
endYear: number;
publication_count: number;
primaryTopic: TopicTimelineTopic;
primaryTopicName: string;
years: TopicTimelineElement[];
topics: TopicTimelineTopic[];
@@ -41,6 +48,7 @@ interface WorkingResearchTimelinePhase {
startYear: number;
endYear: number;
publication_count: number;
primaryTopic: TopicTimelineTopic;
primaryTopicName: string;
years: TopicTimelineElement[];
}
@@ -62,6 +70,7 @@ export class ResearchTimelineComponent implements OnChanges {
@Output() viewModeChange = new EventEmitter<TimelineViewMode>();
@Output() yearRangeChange = new EventEmitter<TimelineYearRange>();
@Output() topicSelect = new EventEmitter<TimelineTopicSelection>();
timelineViewMode: TimelineViewMode = 'years';
@@ -167,12 +176,27 @@ export class ResearchTimelineComponent implements OnChanges {
this.emitYearRangeChange();
}
selectTopic(topic: TopicTimelineTopic): void {
if (!topic.id) {
return;
}
this.topicSelect.emit({
topic,
years: this.createSelectedYears(),
});
}
getPrimaryTopic(item: TopicTimelineElement): TopicTimelineTopic | undefined {
return (item.primary_topics ?? [])[0];
}
getMainTopic(item: TopicTimelineElement): string {
return this.getPrimaryTopic(item)?.name ?? this.getFirstTopic(item)?.name ?? 'Keine Topics';
return this.getMainTopicItem(item)?.name ?? 'Keine Topics';
}
getMainTopicItem(item: TopicTimelineElement): TopicTimelineTopic | undefined {
return this.getPrimaryTopic(item) ?? this.getFirstTopic(item);
}
getDisplayedTopics(item: TopicTimelineElement): TopicTimelineTopic[] {
@@ -276,7 +300,10 @@ export class ResearchTimelineComponent implements OnChanges {
if (candidates.length === 0) {
this.pushWorkingPhase(phases, currentPhase);
currentPhase = this.createWorkingPhase(item, this.getMainTopic(item));
currentPhase = this.createWorkingPhase(
item,
this.getMainTopicItem(item) ?? { name: 'Keine Topics', count: 0 },
);
continue;
}
@@ -299,7 +326,7 @@ export class ResearchTimelineComponent implements OnChanges {
}
this.pushWorkingPhase(phases, currentPhase);
currentPhase = this.createWorkingPhase(item, candidates[0].name);
currentPhase = this.createWorkingPhase(item, candidates[0]);
}
this.pushWorkingPhase(phases, currentPhase);
@@ -309,13 +336,14 @@ export class ResearchTimelineComponent implements OnChanges {
private createWorkingPhase(
item: TopicTimelineElement,
primaryTopicName: string,
primaryTopic: TopicTimelineTopic,
): WorkingResearchTimelinePhase {
return {
startYear: item.year,
endYear: item.year,
publication_count: item.publication_count,
primaryTopicName,
primaryTopic,
primaryTopicName: primaryTopic.name,
years: [item],
};
}
@@ -343,6 +371,7 @@ export class ResearchTimelineComponent implements OnChanges {
): TopicTimelineTopic[] {
const counts = new Map<string, number>();
const originalNames = new Map<string, string>();
const ids = new Map<string, string>();
for (const year of years) {
for (const topic of year.topics ?? []) {
@@ -353,12 +382,16 @@ export class ResearchTimelineComponent implements OnChanges {
const normalizedName = this.normalizeTopicName(topic.name);
originalNames.set(normalizedName, topic.name);
if (topic.id) {
ids.set(normalizedName, topic.id);
}
counts.set(normalizedName, (counts.get(normalizedName) ?? 0) + topic.count);
}
}
return Array.from(counts.entries())
.map(([normalizedName, count]) => ({
id: ids.get(normalizedName),
name: originalNames.get(normalizedName) ?? normalizedName,
count,
}))
@@ -372,6 +405,13 @@ export class ResearchTimelineComponent implements OnChanges {
.slice(0, this.displayedPhaseTopicLimit);
}
private createSelectedYears(): number[] {
return Array.from(
{ length: this.selectedEndYear - this.selectedStartYear + 1 },
(_, index) => this.selectedStartYear + index,
);
}
private getDominantPrimaryTopicCandidates(item: TopicTimelineElement): TopicTimelineTopic[] {
const primaryTopics = item.primary_topics ?? [];
@@ -443,4 +483,4 @@ export class ResearchTimelineComponent implements OnChanges {
endYear: this.selectedEndYear,
});
}
}
}
@@ -8,5 +8,6 @@
[endYear]="timelineEndYear"
(viewModeChange)="onTimelineViewModeChange($event)"
(yearRangeChange)="onTimelineYearRangeChange($event)"
(topicSelect)="onTimelineTopicSelect($event)"
></app-research-timeline>
</section>
</section>
@@ -10,6 +10,7 @@ import {
ResearchTimelineComponent,
TimelineViewMode,
TimelineYearRange,
TimelineTopicSelection,
TopicTimelineElement,
TopicTimelineTopic,
} from './components/research-timeline/research-timeline.component';
@@ -89,6 +90,22 @@ export class PersonOverviewComponent implements OnInit {
);
}
onTimelineTopicSelect(selection: TimelineTopicSelection): void {
if (!selection.topic.id) {
return;
}
void this.router.navigate(['../publications'], {
relativeTo: this.route,
queryParams: {
publicationPage: 1,
publicationYear: selection.years,
publicationTopicId: selection.topic.id,
publicationTopicName: selection.topic.name,
},
});
}
private findAuthorId(paramMaps: readonly ParamMap[]): string {
return (
paramMaps
@@ -140,7 +157,8 @@ export class PersonOverviewComponent implements OnInit {
}
private mapTopicCounts(topics: TopicCount[] | undefined): TopicTimelineTopic[] {
return (topics ?? []).map((topic) => ({
return (topics ?? []).map((topic: TopicCount & { id?: string | null }) => ({
id: topic.id ?? undefined,
name: topic.name,
count: topic.count ?? 0,
}));
@@ -175,4 +193,4 @@ export class PersonOverviewComponent implements OnInit {
replaceUrl,
});
}
}
}
@@ -1,16 +1,16 @@
<div class="page">
<div class="section-heading">
<div>
<h6>Publikationen</h6>
<p>Übersicht der wissenschaftlichen Veröffentlichungen.</p>
</div>
<div>
<h6>Publikationen</h6>
<p>Übersicht der wissenschaftlichen Veröffentlichungen.</p>
</div>
<div class="publication-filter-stack">
<form class="publication-filters" [formGroup]="filterForm">
<mat-form-field>
<mat-label>Jahr</mat-label>
<mat-select
placeholder="Jahr"
formControlName="publicationYears"
multiple
(selectionChange)="resetAndLoad()"
(selectionChange)="applyFilters()"
>
@for (year of publicationYearOptions; track year) {
<mat-option [value]="year">{{ year }}</mat-option>
@@ -19,11 +19,11 @@
</mat-form-field>
<mat-form-field>
<mat-label>Typ</mat-label>
<mat-select
placeholder="Typ"
formControlName="types"
multiple
(selectionChange)="resetAndLoad()"
(selectionChange)="applyFilters()"
>
@for (type of typeOptions; track type.value) {
<mat-option [value]="type.value">{{ type.label }}</mat-option>
@@ -32,11 +32,11 @@
</mat-form-field>
<mat-form-field>
<mat-label>Sprache</mat-label>
<mat-select
placeholder="Sprache"
formControlName="languages"
multiple
(selectionChange)="resetAndLoad()"
(selectionChange)="applyFilters()"
>
@for (language of languageOptions; track language.value) {
<mat-option [value]="language.value">{{
@@ -46,11 +46,108 @@
</mat-select>
</mat-form-field>
<button mat-stroked-button type="button" (click)="clearFilters()">
<mat-form-field class="institution-filter">
<input
type="text"
matInput
[formControl]="institutionSearchControl"
[matAutocomplete]="institutionAutocomplete"
placeholder="Institution suchen"
/>
<mat-autocomplete
#institutionAutocomplete="matAutocomplete"
[displayWith]="displayInstitution"
(optionSelected)="selectInstitution($event)"
>
@for (institution of institutionOptions; track institution.id) {
<mat-option [value]="institution">
<span>{{ institution.display_name }}</span>
@if (institution.hint) {
<small>{{ institution.hint }}</small>
}
</mat-option>
}
@if (
!institutionLookupLoading &&
institutionOptions.length === 0 &&
institutionSearchControl.value
) {
<mat-option disabled>Keine Institution gefunden</mat-option>
}
</mat-autocomplete>
</mat-form-field>
<mat-form-field class="topic-filter">
<input
type="text"
matInput
[formControl]="topicSearchControl"
[matAutocomplete]="topicAutocomplete"
placeholder="Topic suchen"
/>
<mat-autocomplete
#topicAutocomplete="matAutocomplete"
[displayWith]="displayTopic"
(optionSelected)="selectTopic($event)"
>
@for (topic of topicOptions; track topic.id) {
<mat-option [value]="topic">
<span>{{ topic.display_name }}</span>
@if (topic.hint) {
<small>{{ topic.hint }}</small>
}
</mat-option>
}
@if (
!topicLookupLoading &&
topicOptions.length === 0 &&
topicSearchControl.value
) {
<mat-option disabled>Kein Topic gefunden</mat-option>
}
</mat-autocomplete>
</mat-form-field>
<button
class="reset-filter-btn"
mat-stroked-button
type="button"
(click)="clearFilters()"
aria-label="Filter zurücksetzen"
>
<mat-icon>filter_alt_off</mat-icon>
Zurücksetzen
<span>Zurücksetzen</span>
</button>
</form>
@if (selectedInstitutions.length || selectedTopics.length) {
<div class="selected-filter-chips" aria-label="Ausgewählte Filter">
@for (institution of selectedInstitutions; track institution.id) {
<span class="selected-filter-chip">
{{ institution.display_name }}
<button
type="button"
(click)="removeInstitution(institution)"
aria-label="Institution entfernen"
>
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (topic of selectedTopics; track topic.id) {
<span class="selected-filter-chip">
{{ topic.display_name }}
<button
type="button"
(click)="removeTopic(topic)"
aria-label="Topic entfernen"
>
<mat-icon>close</mat-icon>
</button>
</span>
}
</div>
}
</div>
<div class="table-wrap">
@@ -64,14 +161,12 @@
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef>Titel</th>
<td mat-cell *matCellDef="let publication">
@if (doiUrl(publication.doi); as url) {
<a class="title" [href]="url" target="_blank" rel="noopener">
{{ publication.title || "Ohne Titel" }}
</a>
} @else {
<div class="title">{{ publication.title || "Ohne Titel" }}</div>
}
<div class="authors">Becker, A.; Müller, T.; Zhang, L.</div>
<a
class="title"
[routerLink]="['/publication', publicationKey(publication)]"
>
{{ publication.title || "Ohne Titel" }}
</a>
</td>
</ng-container>
@@ -102,6 +197,33 @@
</td>
</ng-container>
<ng-container matColumnDef="institutions">
<th mat-header-cell *matHeaderCellDef>Institutionen</th>
<td mat-cell *matCellDef="let publication">
@let publicationInstitutions = institutions(publication);
<div class="institution-tags" aria-label="Institutionen">
@for (
institution of publicationInstitutions.slice(0, 3);
track institution.id
) {
<span
class="publication-institution-tag"
[title]="institution.name"
>
{{ institution.name }}
</span>
} @empty {
<span class="empty-text">-</span>
}
@if (publicationInstitutions.length > 3) {
<span class="publication-institution-more">
+{{ publicationInstitutions.length - 3 }}
</span>
}
</div>
</td>
</ng-container>
<ng-container matColumnDef="citations">
<th mat-header-cell *matHeaderCellDef>Zitationen</th>
<td mat-cell *matCellDef="let publication">
@@ -112,14 +234,20 @@
<ng-container matColumnDef="topics">
<th mat-header-cell *matHeaderCellDef>Themen</th>
<td mat-cell *matCellDef="let publication">
@let publicationTopics = publication.topics ?? [];
<div class="topic-chips" aria-label="Themen">
@for (topic of (publication.topics ?? []).slice(0, 3); track topic.id) {
<app-chip variant="outlined" color="primary">
@for (topic of publicationTopics.slice(0, 3); track topic.id) {
<span class="publication-topic-tag" [title]="topic.display_name">
{{ topic.display_name }}
</app-chip>
</span>
} @empty {
<span class="empty-text">-</span>
}
@if (publicationTopics.length > 3) {
<span class="publication-topic-more">
+{{ publicationTopics.length - 3 }}
</span>
}
</div>
</td>
</ng-container>
@@ -6,10 +6,10 @@
.section-heading {
display: flex;
align-items: flex-start;
align-items: center;
justify-content: space-between;
gap: 24px;
margin-bottom: 22px;
gap: 18px;
margin-bottom: 18px;
}
h2 {
@@ -25,11 +25,20 @@ h2 {
font-size: 14px;
}
.publication-filter-stack {
display: flex;
align-items: flex-start;
flex-direction: column;
gap: 8px;
padding-top: 10px;
padding-bottom: 25px;
}
.publication-filters {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
align-items: flex-start;
align-items: center;
gap: 10px;
}
@@ -37,17 +46,117 @@ h2 {
width: 150px;
}
.publication-filters button {
.publication-filters .institution-filter,
.publication-filters .topic-filter {
width: 320px;
}
.publication-filters .reset-filter-btn {
min-width: 132px;
height: 42px;
border-color: var(--sg-border);
padding: 0 14px;
border-color: #d9e2f0;
border-radius: var(--sg-radius-sm);
color: var(--sg-text);
background: #fff;
}
.publication-filters .reset-filter-btn mat-icon {
margin-right: 6px;
width: 20px;
height: 20px;
font-size: 20px;
}
::ng-deep .publication-filters .mat-mdc-form-field-subscript-wrapper {
display: none;
}
::ng-deep .publication-filters .mat-mdc-text-field-wrapper {
height: 42px;
background: #fff;
border-radius: var(--sg-radius-sm);
}
::ng-deep .publication-filters .mat-mdc-form-field-infix {
min-height: 42px;
padding-top: 11px;
padding-bottom: 9px;
}
::ng-deep .publication-filters .mdc-notched-outline__leading,
::ng-deep .publication-filters .mdc-notched-outline__notch,
::ng-deep .publication-filters .mdc-notched-outline__trailing {
border-color: #d9e2f0;
}
::ng-deep .publication-filters .mat-mdc-select-value,
::ng-deep .publication-filters input.mat-mdc-input-element {
color: var(--sg-text);
font-size: 14px;
}
::ng-deep .publication-filters .mat-mdc-select-placeholder,
::ng-deep .publication-filters input.mat-mdc-input-element::placeholder {
color: var(--sg-text-muted);
opacity: 1;
font-size: 14px;
}
::ng-deep .publication-filters .mat-mdc-form-field-icon-suffix,
::ng-deep .publication-filters .mat-mdc-select-arrow-wrapper {
transform: none;
}
::ng-deep .mat-mdc-option small {
display: block;
color: var(--sg-text-muted);
font-size: 11px;
line-height: 1.2;
}
.selected-filter-chips {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 6px;
max-width: 900px;
margin: 0;
}
.selected-filter-chip {
display: inline-flex;
align-items: center;
max-width: 320px;
min-height: 26px;
padding: 3px 4px 3px 9px;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text);
font-size: 11px;
line-height: 1.2;
}
.selected-filter-chip button {
display: inline-grid;
place-items: center;
width: 20px;
height: 20px;
margin-left: 3px;
padding: 0;
border: 0;
background: transparent;
color: var(--sg-text-muted);
cursor: pointer;
}
.selected-filter-chip mat-icon {
width: 14px;
height: 14px;
font-size: 14px;
}
.table-wrap {
position: relative;
overflow-x: auto;
@@ -55,7 +164,7 @@ h2 {
table {
width: 100%;
min-width: 980px;
min-width: 1120px;
border-collapse: separate;
border-spacing: 0 10px;
overflow: hidden;
@@ -111,6 +220,63 @@ a.title:hover {
max-width: 320px;
}
.publication-topic-tag,
.publication-topic-more {
display: inline-flex;
align-items: center;
max-width: 180px;
min-height: 24px;
padding: 3px 8px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text);
font-size: 11px;
line-height: 1.2;
}
.publication-topic-tag {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.publication-topic-more {
color: var(--sg-text-muted);
}
.institution-tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
max-width: 280px;
}
.publication-institution-tag,
.publication-institution-more {
display: inline-flex;
align-items: center;
max-width: 180px;
min-height: 24px;
padding: 3px 8px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text);
font-size: 11px;
line-height: 1.2;
}
.publication-institution-tag {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.publication-institution-more {
color: var(--sg-text-muted);
}
::ng-deep .mat-mdc-header-cell {
color: var(--sg-text-muted);
font-size: 12px;
@@ -155,12 +321,27 @@ mat-paginator {
flex-direction: column;
}
.publication-filter-stack {
align-items: stretch;
}
.publication-filters {
justify-content: stretch;
max-width: none;
}
.publication-filters mat-form-field,
.publication-filters button {
width: 100%;
}
.publication-filters .institution-filter,
.publication-filters .topic-filter {
width: 100%;
}
.selected-filter-chips {
justify-content: flex-start;
max-width: none;
}
}
@@ -1,6 +1,11 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Component, DestroyRef, OnInit, ViewChild, inject } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, ParamMap, Router, RouterLink } from '@angular/router';
import {
MatAutocompleteModule,
MatAutocompleteSelectedEvent,
} from '@angular/material/autocomplete';
import { MatIconModule } from '@angular/material/icon';
import {
MatPaginator,
@@ -12,46 +17,113 @@ import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTableModule } from '@angular/material/table';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
catchError,
combineLatest,
debounceTime,
distinctUntilChanged,
finalize,
map,
of,
switchMap,
} from 'rxjs';
import { Work, WorksService } from '../../api';
import { PaginationService } from '../../shared/services/pagination.service';
import { createLoadError } from '../../shared/utils/errorHandler';
import { ChipComponent } from '../../shared/ui/chip/chip.component';
interface InstitutionAutocompleteOption {
id?: string | null;
display_name?: string | null;
hint?: string | null;
cited_by_count?: number | null;
works_count?: number | null;
entity_type?: string | null;
external_id?: string | null;
}
interface InstitutionAutocompleteResponse {
results?: InstitutionAutocompleteOption[] | null;
}
interface TopicAutocompleteOption {
id?: string | null;
display_name?: string | null;
hint?: string | null;
cited_by_count?: number | null;
works_count?: number | null;
entity_type?: string | null;
external_id?: string | null;
}
interface TopicAutocompleteResponse {
results?: TopicAutocompleteOption[] | null;
}
interface PublicationFilterQueryState {
pageIndex: number;
pageSize: number;
publicationYears: number[];
types: string[];
languages: string[];
institutions: InstitutionAutocompleteOption[];
topics: TopicAutocompleteOption[];
}
@Component({
selector: 'app-person-publications',
imports: [
MatButtonModule,
MatAutocompleteModule,
ChipComponent,
MatIconModule,
MatFormFieldModule,
MatInputModule,
MatPaginatorModule,
MatProgressSpinnerModule,
MatSelectModule,
MatSnackBarModule,
MatTableModule,
ReactiveFormsModule,
RouterLink,
],
templateUrl: './person-publications.component.html',
styleUrl: './person-publications.component.scss',
})
export class PersonPublicationsComponent implements OnInit {
@ViewChild(MatPaginator) paginator?: MatPaginator;
private readonly destroyRef = inject(DestroyRef);
displayedColumns: string[] = [
'title',
'type',
'year',
'language',
'institutions',
'topics',
'citations',
];
publications: Work[] = [];
total = 0;
loading = false;
institutionLookupLoading = false;
topicLookupLoading = false;
authorId = '';
currentPageIndex = 0;
institutionOptions: InstitutionAutocompleteOption[] = [];
selectedInstitutions: InstitutionAutocompleteOption[] = [];
topicOptions: TopicAutocompleteOption[] = [];
selectedTopics: TopicAutocompleteOption[] = [];
readonly institutionSearchControl = new FormControl<
string | InstitutionAutocompleteOption
>('', { nonNullable: true });
readonly topicSearchControl = new FormControl<string | TopicAutocompleteOption>('', {
nonNullable: true,
});
readonly filterForm = new FormGroup({
publicationYears: new FormControl<number[]>([], { nonNullable: true }),
@@ -61,6 +133,18 @@ export class PersonPublicationsComponent implements OnInit {
readonly publicationYearOptions = this.createPublicationYearOptions();
private readonly queryParamKeys = {
page: 'publicationPage',
pageSize: 'publicationPageSize',
years: 'publicationYear',
types: 'publicationType',
languages: 'publicationLanguage',
institutionIds: 'publicationInstitutionId',
institutionNames: 'publicationInstitutionName',
topicIds: 'publicationTopicId',
topicNames: 'publicationTopicName',
} as const;
readonly typeOptions = [
{ value: 'article', label: 'article' },
{ value: 'book', label: 'book' },
@@ -90,16 +174,28 @@ export class PersonPublicationsComponent implements OnInit {
constructor(
private readonly route: ActivatedRoute,
private readonly router: Router,
private readonly workService: WorksService,
private readonly httpClient: HttpClient,
public readonly paginationService: PaginationService,
private readonly snackBar: MatSnackBar,
) {}
ngOnInit(): void {
this.route.parent?.paramMap.subscribe((params) => {
this.authorId = params.get('id') ?? '';
this.resetAndLoad();
});
this.setupInstitutionAutocomplete();
this.setupTopicAutocomplete();
const parentParamMap = this.route.parent?.paramMap;
if (!parentParamMap) return;
combineLatest([parentParamMap, this.route.queryParamMap])
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(([params, queryParams]) => {
this.authorId = params.get('id') ?? '';
const queryState = this.parsePublicationFilterQueryParams(queryParams);
this.applyPublicationFilterQueryState(queryState);
this.load(queryState.pageIndex, queryState.pageSize);
});
}
load(pageIndex = 0, pageSize = this.paginationService.selection): void {
@@ -116,6 +212,8 @@ export class PersonPublicationsComponent implements OnInit {
this.filters().publicationYears,
this.filters().types,
this.filters().languages,
this.selectedInstitutionIds(),
this.selectedTopicIds(),
)
.subscribe({
next: (page) => {
@@ -137,13 +235,19 @@ export class PersonPublicationsComponent implements OnInit {
onPage(event: PageEvent): void {
this.paginationService.selection = event.pageSize;
this.currentPageIndex = event.pageIndex;
this.load(event.pageIndex, event.pageSize);
this.updatePublicationFilterQueryParams({
[this.queryParamKeys.page]: event.pageIndex + 1,
[this.queryParamKeys.pageSize]: event.pageSize,
});
}
resetAndLoad(): void {
applyFilters(): void {
this.currentPageIndex = 0;
this.paginator?.firstPage();
this.load(0, this.paginationService.selection);
this.updatePublicationFilterQueryParams({
[this.queryParamKeys.page]: 1,
[this.queryParamKeys.pageSize]: this.paginationService.selection,
});
}
clearFilters(): void {
@@ -152,7 +256,65 @@ export class PersonPublicationsComponent implements OnInit {
types: [],
languages: [],
});
this.resetAndLoad();
this.selectedInstitutions = [];
this.selectedTopics = [];
this.institutionOptions = [];
this.topicOptions = [];
this.institutionSearchControl.setValue('', { emitEvent: false });
this.topicSearchControl.setValue('', { emitEvent: false });
this.updatePublicationFilterQueryParams({
[this.queryParamKeys.page]: 1,
[this.queryParamKeys.pageSize]: this.paginationService.selection,
[this.queryParamKeys.years]: null,
[this.queryParamKeys.types]: null,
[this.queryParamKeys.languages]: null,
[this.queryParamKeys.institutionIds]: null,
[this.queryParamKeys.institutionNames]: null,
[this.queryParamKeys.topicIds]: null,
[this.queryParamKeys.topicNames]: null,
});
}
displayInstitution(option: string | InstitutionAutocompleteOption): string {
return typeof option === 'string' ? option : (option.display_name ?? '');
}
selectInstitution(event: MatAutocompleteSelectedEvent): void {
const institution = event.option.value as InstitutionAutocompleteOption;
if (!institution.id) return;
if (!this.selectedInstitutions.some((item) => item.id === institution.id)) {
this.selectedInstitutions = [...this.selectedInstitutions, institution];
this.applyFilters();
}
this.institutionSearchControl.setValue('', { emitEvent: false });
this.institutionOptions = [];
}
removeInstitution(institution: InstitutionAutocompleteOption): void {
this.selectedInstitutions = this.selectedInstitutions.filter(
(item) => item.id !== institution.id,
);
this.applyFilters();
}
displayTopic(option: string | TopicAutocompleteOption): string {
return typeof option === 'string' ? option : (option.display_name ?? '');
}
selectTopic(event: MatAutocompleteSelectedEvent): void {
const topic = event.option.value as TopicAutocompleteOption;
if (!topic.id) return;
if (!this.selectedTopics.some((item) => item.id === topic.id)) {
this.selectedTopics = [...this.selectedTopics, topic];
this.applyFilters();
}
this.topicSearchControl.setValue('', { emitEvent: false });
this.topicOptions = [];
}
removeTopic(topic: TopicAutocompleteOption): void {
this.selectedTopics = this.selectedTopics.filter((item) => item.id !== topic.id);
this.applyFilters();
}
doiUrl(doi: string | null | undefined): string | null {
@@ -160,6 +322,11 @@ export class PersonPublicationsComponent implements OnInit {
return doi.startsWith('http') ? doi : `https://doi.org/${doi}`;
}
publicationKey(publication: Work): string {
const id = publication.id ?? publication.ids?.openalex ?? publication.doi ?? '';
return id.split('/').filter(Boolean).pop() ?? id;
}
publicationRange(): string {
if (this.total === 0 || this.publications.length === 0) {
return 'Keine Publikationen';
@@ -175,6 +342,24 @@ export class PersonPublicationsComponent implements OnInit {
return 'info';
}
institutions(publication: Work): Array<{ id: string; name: string }> {
const institutionsById = new Map<string, { id: string; name: string }>();
for (const authorship of publication.authorships ?? []) {
for (const institution of authorship.institutions ?? []) {
if (!institution.id || !institution.display_name) continue;
if (!institutionsById.has(institution.id)) {
institutionsById.set(institution.id, {
id: institution.id,
name: institution.display_name,
});
}
}
}
return Array.from(institutionsById.values());
}
private filters() {
return {
publicationYears: this.filterForm.controls.publicationYears.value,
@@ -183,6 +368,210 @@ export class PersonPublicationsComponent implements OnInit {
};
}
private setupInstitutionAutocomplete(): void {
this.institutionSearchControl.valueChanges
.pipe(
debounceTime(250),
map((value) => (typeof value === 'string' ? value.trim() : '')),
distinctUntilChanged(),
switchMap((query) => {
if (query.length < 2) {
this.institutionOptions = [];
return of([]);
}
this.institutionLookupLoading = true;
return this.searchInstitutions(query).pipe(
catchError(() => of([])),
finalize(() => {
this.institutionLookupLoading = false;
}),
);
}),
takeUntilDestroyed(this.destroyRef),
)
.subscribe((options) => {
const selectedIds = new Set(this.selectedInstitutionIds());
this.institutionOptions = options.filter(
(option) => !!option.id && !selectedIds.has(option.id),
);
});
}
private setupTopicAutocomplete(): void {
this.topicSearchControl.valueChanges
.pipe(
debounceTime(250),
map((value) => (typeof value === 'string' ? value.trim() : '')),
distinctUntilChanged(),
switchMap((query) => {
if (query.length < 2) {
this.topicOptions = [];
return of([]);
}
this.topicLookupLoading = true;
return this.searchTopics(query).pipe(
catchError(() => of([])),
finalize(() => {
this.topicLookupLoading = false;
}),
);
}),
takeUntilDestroyed(this.destroyRef),
)
.subscribe((options) => {
const selectedIds = new Set(this.selectedTopicIds());
this.topicOptions = options.filter(
(option) => !!option.id && !selectedIds.has(option.id),
);
});
}
private searchInstitutions(query: string) {
const params = new HttpParams()
.set('query', query)
.set('limit', '10');
const basePath = this.workService.configuration.basePath ?? '';
return this.httpClient
.get<InstitutionAutocompleteResponse>(`${basePath}/api/institutions/autocomplete`, {
params,
})
.pipe(map((response) => response.results ?? []));
}
private searchTopics(query: string) {
const params = new HttpParams().set('query', query).set('limit', '10');
const basePath = this.workService.configuration.basePath ?? '';
return this.httpClient
.get<TopicAutocompleteResponse>(`${basePath}/api/topics/autocomplete`, {
params,
})
.pipe(map((response) => response.results ?? []));
}
private selectedInstitutionIds(): string[] {
return this.selectedInstitutions
.map((institution) => institution.id)
.filter((id): id is string => !!id);
}
private selectedTopicIds(): string[] {
return this.selectedTopics
.map((topic) => topic.id)
.filter((id): id is string => !!id);
}
private updatePublicationFilterQueryParams(
overrides: Record<string, string | number | Array<string | number> | null>,
): void {
const filters = this.filters();
const institutionIds = this.selectedInstitutionIds();
const institutionNames = this.selectedInstitutions
.map((institution) => institution.display_name)
.filter((name): name is string => !!name);
const topicIds = this.selectedTopicIds();
const topicNames = this.selectedTopics
.map((topic) => topic.display_name)
.filter((name): name is string => !!name);
void this.router.navigate([], {
relativeTo: this.route,
queryParams: {
[this.queryParamKeys.years]: filters.publicationYears.length
? filters.publicationYears
: null,
[this.queryParamKeys.types]: filters.types.length ? filters.types : null,
[this.queryParamKeys.languages]: filters.languages.length
? filters.languages
: null,
[this.queryParamKeys.institutionIds]: institutionIds.length
? institutionIds
: null,
[this.queryParamKeys.institutionNames]: institutionNames.length
? institutionNames
: null,
[this.queryParamKeys.topicIds]: topicIds.length ? topicIds : null,
[this.queryParamKeys.topicNames]: topicNames.length ? topicNames : null,
...overrides,
},
queryParamsHandling: 'merge',
});
}
private parsePublicationFilterQueryParams(
queryParams: ParamMap,
): PublicationFilterQueryState {
const institutionIds = queryParams.getAll(this.queryParamKeys.institutionIds);
const institutionNames = queryParams.getAll(this.queryParamKeys.institutionNames);
const topicIds = queryParams.getAll(this.queryParamKeys.topicIds);
const topicNames = queryParams.getAll(this.queryParamKeys.topicNames);
return {
pageIndex:
this.parsePositiveInteger(queryParams.get(this.queryParamKeys.page), 1) - 1,
pageSize: this.parsePositiveInteger(
queryParams.get(this.queryParamKeys.pageSize),
this.paginationService.selection,
),
publicationYears: this.parseNumberParams(
queryParams.getAll(this.queryParamKeys.years),
),
types: this.parseStringParams(queryParams.getAll(this.queryParamKeys.types)),
languages: this.parseStringParams(
queryParams.getAll(this.queryParamKeys.languages),
),
institutions: institutionIds
.filter(Boolean)
.map((id, index) => ({
id,
display_name: institutionNames[index] || id,
})),
topics: topicIds
.filter(Boolean)
.map((id, index) => ({
id,
display_name: topicNames[index] || id,
})),
};
}
private applyPublicationFilterQueryState(
queryState: PublicationFilterQueryState,
): void {
this.currentPageIndex = queryState.pageIndex;
this.paginationService.selection = queryState.pageSize;
this.selectedInstitutions = queryState.institutions;
this.selectedTopics = queryState.topics;
this.filterForm.setValue(
{
publicationYears: queryState.publicationYears,
types: queryState.types,
languages: queryState.languages,
},
{ emitEvent: false },
);
}
private parseStringParams(values: string[]): string[] {
return values.map((value) => value.trim()).filter(Boolean);
}
private parseNumberParams(values: string[]): number[] {
return values
.map((value) => Number(value))
.filter((value) => Number.isInteger(value));
}
private parsePositiveInteger(value: string | null, fallback: number): number {
const parsedValue = Number(value);
if (!Number.isInteger(parsedValue) || parsedValue < 1) {
return fallback;
}
return parsedValue;
}
private createPublicationYearOptions(): number[] {
const currentYear = new Date().getFullYear();
return Array.from({ length: 90 }, (_, index) => currentYear - index);
@@ -0,0 +1,256 @@
<div class="detail-page">
<button
type="button"
class="back-link"
(click)="navigateBack()"
aria-label="Zurück zu den Publikationen"
>
<mat-icon>arrow_back</mat-icon>
Alle Publikationen
</button>
@if (loading) {
<div class="state">
<mat-spinner diameter="42"></mat-spinner>
<p>Publikation wird geladen...</p>
</div>
} @else if (notFound || !publication) {
<div class="state error-state">
<mat-icon>search_off</mat-icon>
<h2>Publikation nicht gefunden</h2>
<p>Die Publikation konnte nicht geladen werden.</p>
<a mat-stroked-button routerLink="/persons">
Zur Personensuche
</a>
</div>
} @else {
<header class="hero">
<div class="hero-copy">
<div class="eyebrow">
@if (publication.type) {
<span>{{ publication.type }}</span>
}
@if (publication.publication_year) {
<span>{{ publication.publication_year }}</span>
}
@if (publication.language) {
<span>{{ publication.language | uppercase }}</span>
}
</div>
<h1>{{ publication.title || publication.display_name || "Ohne Titel" }}</h1>
<p class="author-line">
@for (authorship of authors(); track authorship.author?.id; let last = $last) {
<span>{{ authorship.author?.display_name || authorship.raw_author_name || "Unbekannt" }}</span>@if (!last) {<span>, </span>}
} @empty {
Autorinnen und Autoren nicht angegeben
}
</p>
<div class="hero-actions">
@for (link of externalLinks().slice(0, 3); track link.url; let first = $first) {
<a
[class.primary-action]="first"
[attr.mat-flat-button]="first ? '' : null"
[attr.mat-stroked-button]="first ? null : ''"
[href]="link.url"
target="_blank"
rel="noopener"
>
{{ link.label }}
<mat-icon>open_in_new</mat-icon>
</a>
}
</div>
</div>
<div class="metrics" aria-label="Publikationskennzahlen">
<div>
<mat-icon>format_quote</mat-icon>
<strong>{{ publication.cited_by_count ?? 0 | number }}</strong>
<span>Zitationen</span>
</div>
<div>
<mat-icon>menu_book</mat-icon>
<strong>{{ publication.referenced_works_count ?? 0 | number }}</strong>
<span>Referenzen</span>
</div>
<div [class.positive]="publication.open_access?.is_oa">
<mat-icon>{{ publication.open_access?.is_oa ? "lock_open" : "lock" }}</mat-icon>
<strong>{{ publication.open_access?.is_oa ? "Ja" : "Nein" }}</strong>
<span>Open Access</span>
</div>
</div>
</header>
@if (publication.is_retracted) {
<div class="warning">
<mat-icon>warning</mat-icon>
Diese Publikation wurde zurückgezogen.
</div>
}
<div class="content-grid">
<main>
@if (abstractText(); as abstract) {
<section class="card abstract-card">
<div class="section-title">
<mat-icon>subject</mat-icon>
<h2>Abstract</h2>
</div>
<p>{{ abstract }}</p>
</section>
}
<section class="card">
<div class="section-title">
<mat-icon>group</mat-icon>
<h2>Autorinnen und Autoren</h2>
<span>{{ authors().length }}</span>
</div>
<div class="author-list">
@for (authorship of authors(); track authorship.author?.id) {
<article>
<div class="avatar">{{ (authorship.author?.display_name || authorship.raw_author_name || "?").charAt(0) }}</div>
<div>
@if (authorship.author?.id; as authorId) {
<a [routerLink]="['/person', authorId.split('/').pop(), 'overview']">
{{ authorship.author?.display_name || authorship.raw_author_name || "Unbekannt" }}
</a>
} @else {
<strong>{{ authorship.raw_author_name || "Unbekannt" }}</strong>
}
<p>
{{ authorship.author_position || "Mitautor/in" }}
@if (authorship.is_corresponding) { · Korrespondenz }
</p>
</div>
</article>
} @empty {
<p class="empty">Keine Angaben vorhanden.</p>
}
</div>
</section>
@if (publication.topics?.length || publication.keywords?.length) {
<section class="card">
<div class="section-title">
<mat-icon>interests</mat-icon>
<h2>Themen und Keywords</h2>
</div>
<div class="tags">
@for (topic of publication.topics ?? []; track topic.id) {
<span class="topic-tag" [title]="topic.field?.display_name || ''">
{{ topic.display_name }}
</span>
}
@for (keyword of publication.keywords ?? []; track keyword.id) {
<span>{{ keyword.display_name }}</span>
}
</div>
</section>
}
@if (sources().length) {
<section class="card">
<div class="section-title">
<mat-icon>library_books</mat-icon>
<h2>Quellen und Versionen</h2>
</div>
<div class="source-list">
@for (location of sources(); track location.source?.id || location.landing_page_url) {
<article>
<div>
<strong>{{ location.source?.display_name || "Externe Quelle" }}</strong>
<p>
{{ location.version || location.source?.type || "Veröffentlichte Version" }}
@if (location.license) { · {{ location.license }} }
</p>
</div>
<div class="source-actions">
@if (location.is_oa) {
<span class="oa-badge">Open Access</span>
}
@if (location.pdf_url || location.landing_page_url; as sourceUrl) {
<a [href]="sourceUrl" target="_blank" rel="noopener" aria-label="Quelle öffnen">
<mat-icon>open_in_new</mat-icon>
</a>
}
</div>
</article>
}
</div>
</section>
}
</main>
<aside>
<section class="card facts-card">
<div class="section-title">
<mat-icon>info</mat-icon>
<h2>Publikationsdaten</h2>
</div>
<dl>
<div><dt>Datum</dt><dd>{{ (publication.publication_date | date: "dd.MM.yyyy") || "-" }}</dd></div>
<div><dt>Typ</dt><dd>{{ publication.type || "-" }}</dd></div>
<div><dt>Sprache</dt><dd>{{ publication.language || "-" }}</dd></div>
<div><dt>Open Access</dt><dd>{{ openAccessLabel() }}</dd></div>
<div><dt>Volume</dt><dd>{{ publication.biblio?.volume || "-" }}</dd></div>
<div><dt>Ausgabe</dt><dd>{{ publication.biblio?.issue || "-" }}</dd></div>
<div><dt>Seiten</dt><dd>{{ pages() || "-" }}</dd></div>
<div><dt>Indexiert in</dt><dd>{{ publication.indexed_in?.join(", ") || "-" }}</dd></div>
</dl>
</section>
@if (institutions().length) {
<section class="card">
<div class="section-title">
<mat-icon>account_balance</mat-icon>
<h2>Institutionen</h2>
</div>
<div class="compact-list">
@for (institution of institutions(); track institution.id) {
<div>
<strong>{{ institution.name }}</strong>
<span>{{ institution.country || institution.type || "" }}</span>
</div>
}
</div>
</section>
}
@if (publication.funders?.length || publication.awards?.length) {
<section class="card">
<div class="section-title">
<mat-icon>paid</mat-icon>
<h2>Förderungen</h2>
</div>
<div class="compact-list">
@for (funder of publication.funders ?? []; track funder.id) {
<div><strong>{{ funder.display_name }}</strong><span>Förderorganisation</span></div>
}
@for (award of publication.awards ?? []; track award.id) {
<div><strong>{{ award.display_name || award.funder_award_id }}</strong><span>{{ award.funder_display_name || "Förderung" }}</span></div>
}
</div>
</section>
}
@if (externalLinks().length) {
<section class="card">
<div class="section-title">
<mat-icon>link</mat-icon>
<h2>Externe Links</h2>
</div>
<div class="link-list">
@for (link of externalLinks(); track link.url) {
<a [href]="link.url" target="_blank" rel="noopener">
<span>{{ link.label }}</span>
<mat-icon>north_east</mat-icon>
</a>
}
</div>
</section>
}
</aside>
</div>
}
</div>
@@ -0,0 +1,436 @@
:host {
display: block;
background: var(--sg-background);
}
.detail-page {
max-width: 1500px;
margin: 0 auto;
padding: 26px 32px 56px;
}
.back-link {
display: inline-flex;
align-items: center;
gap: 7px;
margin-bottom: 22px;
padding: 0;
border: 0;
background: transparent;
color: var(--sg-text-muted);
font-size: 13px;
font-weight: 600;
text-decoration: none;
cursor: pointer;
}
.back-link mat-icon {
width: 18px;
height: 18px;
font-size: 18px;
}
.hero {
display: grid;
grid-template-columns: minmax(0, 1fr) 420px;
gap: 42px;
padding: 38px 42px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-lg);
background:
radial-gradient(circle at 90% 10%, rgba(200, 217, 255, 0.75), transparent 35%),
linear-gradient(140deg, #fff 0%, #f8faff 100%);
box-shadow: var(--sg-shadow-sm);
}
.eyebrow,
.tags,
.hero-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.eyebrow span {
padding: 5px 10px;
border: 1px solid var(--sg-border);
border-radius: 999px;
background: rgba(255, 255, 255, 0.85);
color: var(--sg-text-muted);
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
}
h1 {
max-width: 920px;
margin: 20px 0 13px;
font-size: clamp(27px, 3vw, 42px);
line-height: 1.13;
}
.author-line {
max-width: 900px;
margin: 0;
color: var(--sg-text-muted);
font-size: 14px;
line-height: 1.7;
}
.hero-actions {
margin-top: 26px;
}
.hero-actions a {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 42px;
padding: 9px 16px;
border: 1px solid var(--sg-border-strong);
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text);
font-weight: 700;
text-decoration: none;
}
.hero-actions a.primary-action {
border-color: var(--sg-primary);
background: var(--sg-primary);
color: #fff;
}
.hero-actions mat-icon {
width: 17px;
height: 17px;
font-size: 17px;
}
.metrics {
display: grid;
grid-template-columns: repeat(3, 1fr);
align-self: center;
overflow: hidden;
border: 1px solid rgba(199, 211, 232, 0.8);
border-radius: var(--sg-radius-md);
background: rgba(255, 255, 255, 0.8);
}
.metrics div {
display: flex;
align-items: center;
flex-direction: column;
gap: 5px;
padding: 22px 10px;
text-align: center;
}
.metrics div + div {
border-left: 1px solid var(--sg-border);
}
.metrics mat-icon {
color: var(--sg-text-soft);
}
.metrics .positive mat-icon {
color: var(--sg-success);
}
.metrics strong {
color: var(--sg-text);
font-family: "Montserrat", "Open Sans", sans-serif;
font-size: 22px;
}
.metrics span {
color: var(--sg-text-muted);
font-size: 11px;
}
.warning {
display: flex;
align-items: center;
gap: 10px;
margin-top: 20px;
padding: 14px 18px;
border: 1px solid #f1c6cc;
border-radius: var(--sg-radius-sm);
background: #fff4f5;
color: #9c2637;
font-weight: 700;
}
.content-grid {
display: grid;
grid-template-columns: minmax(0, 1fr) 380px;
gap: 24px;
margin-top: 24px;
}
main,
aside {
display: flex;
flex-direction: column;
gap: 24px;
}
.card {
padding: 26px 28px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-md);
background: var(--sg-surface);
box-shadow: var(--sg-shadow-sm);
}
.section-title {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 20px;
}
.section-title mat-icon {
color: var(--sg-text-muted);
}
.section-title h2 {
margin: 0;
font-size: 16px;
}
.section-title span {
margin-left: auto;
color: var(--sg-text-muted);
font-size: 12px;
}
.abstract-card p {
margin: 0;
color: var(--sg-text);
font-size: 14px;
line-height: 1.8;
}
.author-list {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.author-list article {
display: grid;
grid-template-columns: 38px minmax(0, 1fr);
gap: 11px;
align-items: center;
padding: 12px;
border-radius: var(--sg-radius-sm);
background: var(--sg-surface-muted);
}
.avatar {
display: grid;
place-items: center;
width: 38px;
height: 38px;
border-radius: 50%;
background: #e5ecfb;
color: var(--sg-text);
font-weight: 700;
text-transform: uppercase;
}
.author-list a,
.author-list strong {
color: var(--sg-text);
font-size: 13px;
font-weight: 700;
text-decoration: none;
}
.author-list p,
.source-list p {
margin: 3px 0 0;
color: var(--sg-text-muted);
font-size: 11px;
}
.tags span {
padding: 7px 10px;
border: 1px solid var(--sg-border);
border-radius: 999px;
color: var(--sg-text-muted);
font-size: 11px;
}
.tags .topic-tag {
border-color: #cbd8f1;
background: #f5f8ff;
color: var(--sg-text);
}
.source-list,
.compact-list,
.link-list {
display: grid;
gap: 10px;
}
.source-list article,
.compact-list div {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 13px 0;
border-bottom: 1px solid var(--sg-border);
}
.source-list article:last-child,
.compact-list div:last-child {
border-bottom: 0;
}
.source-actions {
display: flex;
align-items: center;
gap: 10px;
}
.source-actions a {
height: 24px;
}
.source-actions mat-icon {
width: 20px;
height: 20px;
font-size: 20px;
}
.oa-badge {
padding: 4px 8px;
border-radius: 999px;
background: var(--sg-success-soft);
color: var(--sg-success);
font-size: 10px;
font-weight: 700;
}
dl {
margin: 0;
}
dl div {
display: grid;
grid-template-columns: 115px minmax(0, 1fr);
gap: 12px;
padding: 10px 0;
border-bottom: 1px solid var(--sg-border);
}
dl div:last-child {
border-bottom: 0;
}
dt {
color: var(--sg-text-muted);
font-size: 12px;
}
dd {
margin: 0;
overflow-wrap: anywhere;
color: var(--sg-text);
font-size: 12px;
font-weight: 600;
text-align: right;
}
.compact-list div {
align-items: flex-start;
flex-direction: column;
gap: 3px;
}
.compact-list strong {
font-size: 12px;
}
.compact-list span {
color: var(--sg-text-muted);
font-size: 11px;
}
.link-list a {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 0;
border-bottom: 1px solid var(--sg-border);
color: var(--sg-text);
font-size: 12px;
font-weight: 700;
text-decoration: none;
}
.link-list a:last-child {
border-bottom: 0;
}
.link-list mat-icon {
width: 16px;
height: 16px;
color: var(--sg-text-muted);
font-size: 16px;
}
.state {
display: grid;
place-items: center;
min-height: 380px;
color: var(--sg-text-muted);
text-align: center;
}
.error-state mat-icon {
width: 46px;
height: 46px;
font-size: 46px;
}
.empty {
color: var(--sg-text-muted);
}
@media (max-width: 1150px) {
.hero,
.content-grid {
grid-template-columns: 1fr;
}
.metrics {
width: 100%;
}
}
@media (max-width: 700px) {
.detail-page {
padding: 18px 16px 40px;
}
.hero,
.card {
padding: 22px 20px;
}
.metrics,
.author-list {
grid-template-columns: 1fr;
}
.metrics div + div {
border-top: 1px solid var(--sg-border);
border-left: 0;
}
}
@@ -0,0 +1,182 @@
import { DatePipe, DecimalPipe, UpperCasePipe } from '@angular/common';
import { Location } from '@angular/common';
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { HttpClient } from '@angular/common/http';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { finalize } from 'rxjs';
import { Authorship, Location as ApiLocation, Work, WorksService } from '../../api';
interface DetailLink {
label: string;
url: string;
}
interface InstitutionDetail {
id: string;
name: string;
country?: string | null;
type?: string | null;
}
@Component({
selector: 'app-publication-detail',
imports: [
DatePipe,
DecimalPipe,
MatButtonModule,
MatIconModule,
MatProgressSpinnerModule,
RouterLink,
UpperCasePipe,
],
templateUrl: './publication-detail.component.html',
styleUrl: './publication-detail.component.scss',
})
export class PublicationDetailComponent implements OnInit {
private readonly destroyRef = inject(DestroyRef);
private readonly route = inject(ActivatedRoute);
private readonly httpClient = inject(HttpClient);
private readonly location = inject(Location);
private readonly worksService = inject(WorksService);
publication: Work | null = null;
loading = true;
notFound = false;
ngOnInit(): void {
this.route.paramMap
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((params) => {
const publicationId = params.get('publicationId');
if (!publicationId) {
this.loading = false;
this.notFound = true;
return;
}
this.loadPublication(publicationId);
});
}
navigateBack(): void {
this.location.back();
}
abstractText(): string | null {
const index = this.publication?.abstract_inverted_index;
if (!index || typeof index !== 'object') return null;
const words: Array<{ word: string; position: number }> = [];
for (const [word, rawPositions] of Object.entries(index)) {
if (!Array.isArray(rawPositions)) continue;
for (const position of rawPositions) {
if (typeof position === 'number') words.push({ word, position });
}
}
return words
.sort((first, second) => first.position - second.position)
.map(({ word }) => word)
.join(' ') || null;
}
authors(): Authorship[] {
return this.publication?.authorships ?? [];
}
institutions(): InstitutionDetail[] {
const institutions = new Map<string, InstitutionDetail>();
for (const authorship of this.authors()) {
for (const institution of authorship.institutions ?? []) {
if (!institution.id || !institution.display_name) continue;
institutions.set(institution.id, {
id: institution.id,
name: institution.display_name,
country: institution.country_code,
type: institution.type,
});
}
}
return Array.from(institutions.values());
}
sources(): ApiLocation[] {
const locations = [
this.publication?.primary_location,
this.publication?.best_oa_location,
...(this.publication?.locations ?? []),
].filter((location): location is ApiLocation => !!location);
const unique = new Map<string, ApiLocation>();
for (const location of locations) {
const key =
location.source?.id ??
location.landing_page_url ??
location.pdf_url ??
JSON.stringify(location);
unique.set(key, location);
}
return Array.from(unique.values());
}
externalLinks(): DetailLink[] {
if (!this.publication) return [];
const links: DetailLink[] = [];
this.addLink(links, 'Open Access', this.publication.open_access?.oa_url);
this.addLink(links, 'DOI', this.doiUrl(this.publication.doi));
return links.filter(
(link, index) => links.findIndex((candidate) => candidate.url === link.url) === index,
);
}
pages(): string | null {
const first = this.publication?.biblio?.first_page;
const last = this.publication?.biblio?.last_page;
if (first && last) return `${first}-${last}`;
return first ?? last ?? null;
}
openAccessLabel(): string {
if (this.publication?.open_access?.is_oa) {
return this.publication.open_access.oa_status
? `Open Access (${this.publication.open_access.oa_status})`
: 'Open Access';
}
return 'Kein Open Access';
}
private loadPublication(publicationId: string): void {
this.loading = true;
this.notFound = false;
this.publication = null;
const basePath = this.worksService.configuration.basePath ?? '';
this.httpClient
.get<Work>(
`${basePath}/api/works/detail/${encodeURIComponent(publicationId)}`,
)
.pipe(finalize(() => (this.loading = false)))
.subscribe({
next: (publication) => {
this.publication = publication;
},
error: () => {
this.notFound = true;
},
});
}
private doiUrl(doi: string | null | undefined): string | null {
if (!doi) return null;
return doi.startsWith('http') ? doi : `https://doi.org/${doi}`;
}
private addLink(links: DetailLink[], label: string, value: string | null | undefined) {
if (!value) return;
links.push({ label, url: value.startsWith('http') ? value : `https://${value}` });
}
}
@@ -1 +0,0 @@
<p>work works!</p>
@@ -1,11 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-work',
imports: [],
templateUrl: './work.component.html',
styleUrl: './work.component.scss',
})
export class WorkComponent {
}