Merge branch 'dev' of https://project.nes.uni-due.de/gitea/lbs/smartguide into ts-82-author-overview-and-description

This commit is contained in:
2026-06-10 11:23:03 +02:00
171 changed files with 4459 additions and 369 deletions
+5
View File
@@ -2,6 +2,7 @@ import { Routes } from '@angular/router';
import { userGuard } from './shared/guards/user.guard';
import { collaborationNetworkResolver } from './resolvers/collaboration-network.resolver';
import { personListResolver } from './resolvers/person-list.resolver';
import { personBioResolver } from './resolvers/person-bio.resolver';
export const routes: Routes = [
{
@@ -73,6 +74,10 @@ export const routes: Routes = [
import('./modules/person/person.component').then(
(mod) => mod.PersonComponent,
),
resolve: {
personBio: personBioResolver,
},
runGuardsAndResolvers: (from, to) => from.params['id'] !== to.params['id'],
children: [
{
path: '',
@@ -2,7 +2,10 @@
<div class="interest-header">
<h3>Interessant für</h3>
@if (tags().length > 0) {
<span class="interest-footnote">* Anzahl Publikationen zum Thema</span>
<span class="interest-footnote">
<mat-icon class="footnote-icon">article</mat-icon>
Anzahl Publikationen zum Thema
</span>
}
</div>
<div class="interest-tags">
@@ -16,7 +19,10 @@
[disabled]="!tag.id"
(click)="onTagClick(tag)">
<span class="topic-name">{{ tag.label }}</span>
<span class="topic-count">{{ tag.count }}*</span>
<span class="topic-count">
{{ tag.count }}
<mat-icon class="count-icon">article</mat-icon>
</span>
</button>
}
} @else {
@@ -73,6 +73,7 @@
flex: 0 0 auto;
align-items: center;
justify-content: center;
gap: 2px;
min-width: 18px;
height: 18px;
padding: 0 5px;
@@ -83,6 +84,13 @@
font-weight: 700;
}
.topic-count .count-icon {
width: 13px;
height: 13px;
font-size: 13px;
line-height: 1;
}
.purple {
--topic-border: #d8cafe;
--topic-bg: #f6f0ff;
@@ -114,10 +122,20 @@
}
.interest-footnote {
display: inline-flex;
align-items: center;
gap: 4px;
color: var(--sg-text-muted);
font-size: 11px;
}
.interest-footnote .footnote-icon {
width: 14px;
height: 14px;
font-size: 14px;
line-height: 1;
}
.interest-tags .interest-empty {
padding: 9px 16px;
border: 1px solid #e2e8f0;
@@ -1,5 +1,6 @@
import { Component, input, computed, output } from '@angular/core';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatIconModule } from '@angular/material/icon';
import { CommonModule } from '@angular/common';
import { TopicCount } from '../../api';
@@ -16,7 +17,7 @@ const colors = ['purple', 'blue', 'green', 'orange', 'pink'];
@Component({
selector: 'app-person-interesting',
imports: [CommonModule, MatTooltipModule],
imports: [CommonModule, MatTooltipModule, MatIconModule],
templateUrl: './person-interesting.component.html',
styleUrl: './person-interesting.component.scss',
})
@@ -21,6 +21,7 @@ import { of, switchMap, finalize, map, catchError } from 'rxjs';
import { PersonInterestingComponent } from '../person-interesting/person-interesting.component';
import { PersonsService, WorksService } from '../../api';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
import { PersonBioResolved } from '../../resolvers/person-bio.resolver';
const PERSON_INCLUDE_TAGS =
'topics_full,topic_share,summary_stats,ids,last_known_institutions,' +
@@ -110,26 +111,17 @@ export class PersonComponent {
),
{ initialValue: null },
);
// bio data
readonly personBio = toSignal(
toObservable(this.authorId).pipe(
switchMap((id) => {
if (!id) {
this.activatedRoute.data.pipe(
switchMap((data) => {
const resolved = data['personBio'] as PersonBioResolved | undefined;
if (!resolved) {
this.isBioLoading.set(false);
return of(null);
}
this.isBioLoading.set(true);
return this.personsApi.generatePersonBio(id).pipe(
map((result) => {
this.isBioLoading.set(false);
return result.bio ?? null;
}),
catchError((err) => {
console.error('Failed to load bio:', err);
this.isBioLoading.set(false);
return of(null);
}),
);
return resolved.bio$.pipe(finalize(() => this.isBioLoading.set(false)));
}),
),
{ initialValue: null },
@@ -0,0 +1,27 @@
import { ResolveFn } from '@angular/router';
import { inject } from '@angular/core';
import { Observable, of, map, catchError } from 'rxjs';
import { PersonsService } from '../api';
export interface PersonBioResolved {
bio$: Observable<string | null>;
}
export const personBioResolver: ResolveFn<PersonBioResolved> = (route) => {
const authorId = route.paramMap.get('id');
const personsApi = inject(PersonsService);
if (!authorId) {
return { bio$: of(null) };
}
const bio$ = personsApi.generatePersonBio(authorId).pipe(
map((result) => result.bio ?? null),
catchError((err) => {
console.error('Failed to load bio:', err);
return of(null);
}),
);
return { bio$ };
};