From 44bd8c6ce514100367cf43e833f30c6225c10011 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 17:22:19 +0200 Subject: [PATCH 1/7] added persons filtering --- .../person-list/person-list.component.html | 6 +- .../person-list/person-list.component.ts | 161 ++++++++++-------- 2 files changed, 93 insertions(+), 74 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index 1ae258b0..60f62a13 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -9,7 +9,11 @@

- + + @for (opt of institutionOptions; track opt.value) { + {{ opt.label }} + } +
{{ resultRange() }}
diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index ccca7dba..40bea7e3 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -1,4 +1,9 @@ -import { Component, inject, DestroyRef, computed, signal } from '@angular/core'; +import { + Component, + inject, + DestroyRef, + computed, +} from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterLink, ActivatedRoute, Router } from '@angular/router'; import { toObservable, toSignal } from '@angular/core/rxjs-interop'; @@ -7,6 +12,8 @@ import { MatIconModule } from '@angular/material/icon'; import { MatPaginatorModule, PageEvent } from '@angular/material/paginator'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { Params } from '@angular/router'; import { Author, AuthorsListResponse, @@ -16,8 +23,26 @@ import { import { SharedStateService } from '../../shared/services/shared-state.service'; 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'; +import { distinctUntilChanged, switchMap, tap, finalize, map, filter } from 'rxjs'; +import { encodeFilters, PersonFilters, decodeFilters } from '../../shared/utils/filters'; +import { PersonSearchRequest } from '../../api'; +export interface InstitutionOption { + label: string; + value: string; +} + +export const INSTITUTION_OPTIONS: InstitutionOption[] = [ + { + label: 'Universität Duisburg-Essen', + value: 'University of Duisburg-Essen', + }, + { label: 'Ruhr-Universität Bochum', value: 'Ruhr University Bochum' }, + { label: 'TU Dortmund', value: 'TU Dortmund University' }, + { label: 'Universität Münster', value: 'University of Münster' }, + { label: 'RWTH Aachen', value: 'RWTH Aachen University' }, +]; + +export const DEFAULT_INSTITUTION = INSTITUTION_OPTIONS[0]; @Component({ selector: 'app-person-list', @@ -27,13 +52,14 @@ import { AuthorAffiliationsInner } from '../../api'; MatPaginatorModule, MatProgressSpinnerModule, MatSnackBarModule, + MatSelectModule, RouterLink, ], templateUrl: './person-list.component.html', styleUrl: './person-list.component.scss', standalone: true, }) -export class PersonListComponent { +export class PersonListComponent { private readonly personsService = inject(PersonsService); private readonly destroyRef = inject(DestroyRef); private readonly snackBar = inject(MatSnackBar); @@ -42,43 +68,38 @@ export class PersonListComponent { public readonly state = inject(SharedStateService); public readonly paginationService = inject(PaginationService); + //expose to template + readonly institutionOptions = INSTITUTION_OPTIONS; + private readonly defaultIncludes = - 'display_name,works_count,cited_by_count,topics,orcid,affiliations'; - private readonly defaultInstitutionName = 'University of Duisburg-Essen'; + 'display_name,works_count,cited_by_count,topics,orcid,last_known_institutions'; private readonly queryParams = toSignal( this.route.queryParams.pipe( map((params) => ({ - search: params['search'] as string | null, + name: params['search'] as string | null, + filters: decodeFilters(params['filters'] as string | null), page: Number(params['page'] ?? 0), size: Number(params['size'] ?? this.paginationService.options[2]), })), ), { initialValue: { - search: null, + name: null, + filters: { institution: DEFAULT_INSTITUTION.value } as PersonFilters, page: 0, size: this.paginationService.options[2], }, }, ); - - readonly searchValue = computed( - () => this.queryParams()['search'] ?? null, - ); - readonly pageIndex = computed(() => - Number(this.queryParams()['page'] ?? 0), - ); - readonly pageSize = computed( - () => - Number(this.queryParams()['size'] ?? this.paginationService.options[2]), // default 10 - ); + readonly activeFilters = computed(() => this.queryParams().filters); + readonly searchValue = computed(() => this.queryParams().name); + readonly pageIndex = computed(() => this.queryParams().page); + readonly pageSize = computed(() => this.queryParams().size); loading = false; - readonly persons = computed( - () => this.state.persons() ?? [], - ); + readonly persons = computed(() => this.state.persons()); readonly total = computed( () => this.state.persons().meta?.count ?? this.persons().results?.length, @@ -96,50 +117,35 @@ export class PersonListComponent { constructor() { toObservable(this.queryParams) .pipe( - 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 }) => { + distinctUntilChanged( + (a, b) => + a.name === b.name && + a.page === b.page && + a.size === b.size && + JSON.stringify(a.filters) === JSON.stringify(b.filters), + ), + tap(() => { this.state.hasSearched.set(false); this.loading = true; - if (!search) this.state.hasSearched.set(false); }), - switchMap(({ search, page, pageSize }) => - search - ? this.personsService - .searchPersonsByName( - search, - this.defaultIncludes, - pageSize, - page, - ) - .pipe( - tap((result) => { - this.state.persons.set(this.sortByRanking(result)); - this.state.hasSearched.set(true); - }), - ) - : this.personsService - .searchPersonsByInstitution( - this.defaultInstitutionName, - this.defaultIncludes, - pageSize, - page, - ) - .pipe( - tap((result) => { - this.state.persons.set(this.sortByRanking(result)); - }), - ), - ), + switchMap(({ name, filters, page, size }) => { + const pageOffset = page * size + const body: PersonSearchRequest = { + name: name ?? undefined, + filters, + limit: size, + page_offset: pageOffset, + include: this.defaultIncludes, + }; + return this.personsService + .searchPersonsWithFilters(body) + .pipe( + tap((result) => { + this.state.persons.set(this.sortByRanking(result)); + this.state.hasSearched.set(!!name); + }), + ); + }), finalize(() => (this.loading = false)), takeUntilDestroyed(this.destroyRef), ) @@ -156,20 +162,30 @@ export class PersonListComponent { }); } - onPage(event: PageEvent): void { + navigateRouter(params: Params): void { this.router.navigate([], { relativeTo: this.route, - queryParams: { - page: event.pageIndex, - size: event.pageSize, - }, - queryParamsHandling: 'merge', // preserve search param + queryParams: params, + queryParamsHandling: 'merge', + }); + } + + onPage(event: PageEvent): void { + this.navigateRouter({ page: event.pageIndex, size: event.pageSize }); + } + + //encode filters + onFilterChange(patch: Partial): void { + const updated = { ...this.activeFilters(), ...patch }; + this.navigateRouter({ + filters: encodeFilters(updated), + page: 0 }); } institution(person: Author): DehydratedInstitution | null { - if (!person.affiliations?.length) null; - return person.affiliations?.at(-1)?.institution ?? null; + if (!person.last_known_institutions?.length) return null; + return person.last_known_institutions?.at(-1) ?? null; } topics(person: Author): string[] { @@ -179,7 +195,6 @@ export class PersonListComponent { .filter(Boolean); } - // Sorting logic sortByRanking(response: AuthorsListResponse): AuthorsListResponse { if (!response.results) return response; return { @@ -205,7 +220,7 @@ export class PersonListComponent { } hasInstitution(person: Author): boolean { - return !!person.affiliations?.some((a) => a.institution); + return !!person.last_known_institutions?.some((a) => a.display_name); } hasOrcid(person: Author): boolean { -- 2.56.1 From 135705adc9ae366846a5c0cb931c984df1f7a48b Mon Sep 17 00:00:00 2001 From: genja Date: Sat, 6 Jun 2026 14:49:41 +0200 Subject: [PATCH 2/7] removed redundant proprerty --- webapp/src/app/modules/person-list/person-list.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index fdb2bc8b..4c170319 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -52,8 +52,6 @@ export class PersonListComponent { public readonly state = inject(SharedStateService); public readonly paginationService = inject(PaginationService); - //expose to template - readonly institutionOptions = INSTITUTION_OPTIONS; private readonly defaultIncludes = 'display_name,works_count,cited_by_count,topics,orcid,relevance_rating,last_known_institutions,affiliations'; -- 2.56.1 From cf43330206d4f965986310be7df7ebe7a8a7bc7b Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 8 Jun 2026 15:06:53 +0200 Subject: [PATCH 3/7] added loading skeleton directive for text data --- .../custom-directives/sk-text.directive.ts | 51 +++++++++++++++++++ webapp/src/styles.scss | 5 ++ 2 files changed, 56 insertions(+) create mode 100644 webapp/src/app/custom-directives/sk-text.directive.ts diff --git a/webapp/src/app/custom-directives/sk-text.directive.ts b/webapp/src/app/custom-directives/sk-text.directive.ts new file mode 100644 index 00000000..4884dde1 --- /dev/null +++ b/webapp/src/app/custom-directives/sk-text.directive.ts @@ -0,0 +1,51 @@ +import { Directive, OnChanges,Input,ElementRef,Renderer2 } from "@angular/core"; +import { SimpleChanges } from "@angular/core"; +@Directive({ selector: '[skText]', standalone: true }) +export class SkTextDirective implements OnChanges { + @Input() skText = false; + + private originalText = ''; + private originalColor = ''; + + constructor(private el: ElementRef, private renderer: Renderer2) {} + + ngOnChanges(changes: SimpleChanges) { + const change = changes['skText']; + + // skip if value didn't actually change, or is undefined + if (!change) return; + + this.skText ? this.showSkeleton() : this.hideSkeleton(); +} + + private showSkeleton() { + const el: HTMLElement = this.el.nativeElement; + this.originalText = el.textContent ?? ''; + this.originalColor = el.style.color; + + // measure natural width before blanking text + const width = Math.min(Math.max(this.originalText.length * 7.5, 48), 280); + const height = 20; + this.renderer.setStyle(el, 'color', 'transparent'); + this.renderer.setStyle(el, 'background', 'linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%)'); + this.renderer.setStyle(el, 'background-size', '600px 100%'); + this.renderer.setStyle(el, 'animation', 'sk-shimmer 1.6s infinite linear'); + this.renderer.setStyle(el, 'border-radius', '4px'); + this.renderer.setStyle(el, 'min-width', `${width}px`); + this.renderer.setStyle(el, 'max-height', `${height}px`); + this.renderer.setStyle(el, 'display', 'inline-block'); + } + + private hideSkeleton() { + const el: HTMLElement = this.el.nativeElement; + this.renderer.removeStyle(el, 'color'); + this.renderer.removeStyle(el, 'background'); + this.renderer.removeStyle(el, 'background-size'); + this.renderer.removeStyle(el, 'animation'); + this.renderer.removeStyle(el, 'border-radius'); + this.renderer.removeStyle(el, 'min-width'); + this.renderer.removeStyle(el, 'max-height'); + this.renderer.removeStyle(el, 'display'); + + } +} \ No newline at end of file diff --git a/webapp/src/styles.scss b/webapp/src/styles.scss index 271f28ac..0a3a5f8d 100644 --- a/webapp/src/styles.scss +++ b/webapp/src/styles.scss @@ -186,3 +186,8 @@ h3 { --mat-icon-button-disabled-icon-color: rgba(255, 255, 255, 0.35); --mat-icon-button-icon-color: #ffffff; } + +@keyframes sk-shimmer { + 0% { background-position: -600px 0; } + 100% { background-position: 600px 0; } +} \ No newline at end of file -- 2.56.1 From a82e76bdef0d42bc17fbbf3b44a828203497f5aa Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 8 Jun 2026 15:10:52 +0200 Subject: [PATCH 4/7] added and applied person-list resolver --- webapp/src/app/app.routes.ts | 30 ++++++ .../person-list/person-list.component.ts | 92 +++++++------------ .../src/app/resolvers/person-list.resolver.ts | 58 ++++++++++++ 3 files changed, 121 insertions(+), 59 deletions(-) create mode 100644 webapp/src/app/resolvers/person-list.resolver.ts diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 006b1c65..19a5df19 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -1,6 +1,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'; export const routes: Routes = [ { @@ -25,6 +26,35 @@ export const routes: Routes = [ import('./modules/person-list/person-list.component').then( (mod) => mod.PersonListComponent, ), + resolve: { + persons: personListResolver, + }, + runGuardsAndResolvers: (to, from) => { + const keys = [ + 'query', + 'page', + 'pageSize', + 'institutionName', + 'yearFilterEnabled', + 'filterMode', + 'filterYear', + ]; + + // scalar params + const scalarChanged = keys.some( + (key) => to.queryParamMap.get(key) !== from.queryParamMap.get(key), + ); + + // multi-value param: topics + const toTopics = to.queryParamMap.getAll('topic'); + const fromTopics = from.queryParamMap.getAll('topic'); + + const topicsChanged = + toTopics.length !== fromTopics.length || + toTopics.some((t, i) => t !== fromTopics[i]); + + return scalarChanged || topicsChanged; + } }, { path: 'publication/:publicationId', diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index 141fd937..b26a443f 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -3,7 +3,6 @@ import { Router, RouterLink, ActivatedRoute } from '@angular/router'; import { CommonModule } from '@angular/common'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms'; - import { MatIconModule } from '@angular/material/icon'; import { MatPaginatorModule } from '@angular/material/paginator'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; @@ -21,12 +20,17 @@ import { SharedStateService } from '../../shared/services/shared-state.service'; import { PaginationService } from '../../shared/services/pagination.service'; import { finalize } from 'rxjs'; import { MatSnackBar } from '@angular/material/snack-bar'; - +import { SkTextDirective } from '../../custom-directives/sk-text.directive'; +import { + NavigationError, + NavigationEnd, + NavigationStart, + NavigationCancel, +} from '@angular/router'; @Component({ selector: 'app-person-list', imports: [ CommonModule, - RouterLink, ReactiveFormsModule, MatIconModule, MatPaginatorModule, @@ -38,6 +42,7 @@ import { MatSnackBar } from '@angular/material/snack-bar'; MatRadioModule, TopicHierarchyComponent, PersonCardComponent, + SkTextDirective ], templateUrl: './person-list.component.html', styleUrl: './person-list.component.scss', @@ -47,13 +52,9 @@ export class PersonListComponent { private readonly router = inject(Router); private readonly route = inject(ActivatedRoute); private readonly personsService = inject(PersonsService); - private readonly topicsService = inject(TopicsService); private readonly destroyRef = inject(DestroyRef); - private readonly snackBar = inject(MatSnackBar); public readonly state = inject(SharedStateService); public readonly paginationService = inject(PaginationService); - - private readonly defaultIncludes = 'display_name,works_count,cited_by_count,topics,orcid,relevance_rating,last_known_institutions,affiliations'; @@ -83,12 +84,27 @@ export class PersonListComponent { // Bookmarking bookmarkedIds = new Set(); - constructor() { - // Enable/disable the year filter checkbox based on the presence of an institution value + this.router.events + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((event) => { + if (event instanceof NavigationStart) { + this.loadingState.set(true); + } + + if ( + event instanceof NavigationEnd || + event instanceof NavigationCancel || + event instanceof NavigationError + ) { + this.loadingState.set(false); + } + }); + if (!this.institutionControl.value) { this.yearFilterEnabledControl.disable(); } + this.institutionControl.valueChanges .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe((val) => { @@ -100,7 +116,6 @@ export class PersonListComponent { } }); - // Subscribe to route query parameters to trigger searches this.route.queryParams .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe((params) => { @@ -141,56 +156,15 @@ export class PersonListComponent { if (this.filterYearControl.value !== filterYear) { this.filterYearControl.setValue(filterYear); } - - this.load( - query, - page, - pageSize, - topics, - institutionName, - yearFilterEnabled, - filterMode, - filterYear, - ); }); - } - load( - query?: string, - page: number = 1, - pageSize: number = 10, - topics?: string[], - institutionName?: string, - yearFilterEnabled: boolean = false, - filterMode: 'in' | 'from' = 'from', - filterYear?: number, - ): void { - this.loadingState.set(true); - - this.personsService - .searchPersonsList( - query || undefined, - institutionName || undefined, - topics?.length ? topics : undefined, - page, - pageSize, - this.defaultIncludes, - yearFilterEnabled ? true : undefined, - yearFilterEnabled ? filterMode : undefined, - yearFilterEnabled ? filterYear : undefined, - ) - .pipe( - finalize(() => this.loadingState.set(false)), - takeUntilDestroyed(this.destroyRef), - ) - .subscribe({ - next: (response) => { - this.persons = (response.results ?? []) as CustomAuthor[]; - this.total = response.meta?.count ?? 0; - }, - error: (err) => { - console.error('Error loading persons:', err); - }, + // Use resolver value + this.route.data + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(({ persons }) => { + this.persons = (persons.results ?? []) as CustomAuthor[]; + this.total = persons.meta?.count; + this.loadingState.set(false); }); } @@ -388,7 +362,7 @@ export class PersonListComponent { this.state.searchValue.set(null); this.router.navigate([], { queryParams: { query: null, page: 1 }, - queryParamsHandling: 'merge', + queryParamsHandling:"merge", }); } diff --git a/webapp/src/app/resolvers/person-list.resolver.ts b/webapp/src/app/resolvers/person-list.resolver.ts new file mode 100644 index 00000000..a5503d67 --- /dev/null +++ b/webapp/src/app/resolvers/person-list.resolver.ts @@ -0,0 +1,58 @@ +import { ResolveFn } from '@angular/router'; +import { inject } from '@angular/core'; +import { PersonsService, CustomAuthorsListResponse } from '../api'; + +export const personListResolver: ResolveFn = ( + route, + state, +) => { + const parseQueryParamArray = (val: any): string[] => { + if (!val) return []; + if (Array.isArray(val)) return val; + return [val]; + }; + const defaultIncludes = + 'display_name,works_count,cited_by_count,topics,orcid,relevance_rating,last_known_institutions,affiliations'; + const params = route.queryParamMap; + + const query = params.get('query') || undefined; + + const page = params.get('page') + ? Number.parseInt(params.get('page')!, 10) + : 1; + + const pageSize = params.get('pageSize') + ? Number.parseInt(params.get('pageSize')!, 10) + : 10; + + const institutionName = params.get('institutionName') || undefined; + + const topicsParam = params.getAll('topic'); + + const topics = parseQueryParamArray(topicsParam) + const yearFilterEnabled = params.get('yearFilterEnabled') === 'true'; + + const filterModeRaw = params.get('filterMode'); + const filterMode = + filterModeRaw === 'in' || filterModeRaw === 'from' + ? filterModeRaw + : undefined; + + const filterYear = params.get('filterYear') + ? Number.parseInt(params.get('filterYear')!, 10) + : undefined; + + const personsService = inject(PersonsService); + + return personsService.searchPersonsList( + query, + institutionName, + topics, + page, + pageSize, + defaultIncludes, + yearFilterEnabled ? true : undefined, + yearFilterEnabled ? filterMode : undefined, + yearFilterEnabled ? filterYear : undefined, + ); +}; -- 2.56.1 From 4ff574e9f1a1716ba50db33091eb7c6cfc621f55 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 8 Jun 2026 15:16:41 +0200 Subject: [PATCH 5/7] removed search value from shared state --- .../app/modules/person-list/person-list.component.ts | 10 +++++----- webapp/src/app/shared/services/shared-state.service.ts | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index b26a443f..f7db1828 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -1,4 +1,4 @@ -import { Component, inject, signal, DestroyRef } from '@angular/core'; +import { Component, inject, signal, DestroyRef, Signal } from '@angular/core'; import { Router, RouterLink, ActivatedRoute } from '@angular/router'; import { CommonModule } from '@angular/common'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @@ -65,7 +65,7 @@ export class PersonListComponent { // Selected filter states selectedTopics = new Set(); - + searchValue = signal(null); // Forms sortControl = new FormControl('relevance', { nonNullable: true }); topicSearchControl = new FormControl('', { nonNullable: true }); @@ -141,8 +141,8 @@ export class PersonListComponent { this.paginationService.selection = pageSize; // Sync search box & institution input - if (this.state.searchValue() !== query) { - this.state.searchValue.set(query || null); + if (this.searchValue() !== query) { + this.searchValue.set(query || null); } if (this.institutionControl.value !== institutionName) { this.institutionControl.setValue(institutionName); @@ -359,7 +359,7 @@ export class PersonListComponent { } clearSearch(): void { - this.state.searchValue.set(null); + this.searchValue.set(null); this.router.navigate([], { queryParams: { query: null, page: 1 }, queryParamsHandling:"merge", diff --git a/webapp/src/app/shared/services/shared-state.service.ts b/webapp/src/app/shared/services/shared-state.service.ts index e03428ba..4dda1383 100644 --- a/webapp/src/app/shared/services/shared-state.service.ts +++ b/webapp/src/app/shared/services/shared-state.service.ts @@ -3,7 +3,6 @@ import { AuthorsListResponse } from '../../api'; @Injectable({ providedIn: 'root' }) export class SharedStateService { - searchValue = signal(null); persons = signal({ meta: null, results: [], -- 2.56.1 From 60fa0e0a45c089c37148b5681d89cd7f288a5a5b Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 8 Jun 2026 15:17:08 +0200 Subject: [PATCH 6/7] applied loading skeletion for text data --- .../person-card/person-card.component.html | 16 ++++++------- .../person-card/person-card.component.ts | 5 ++-- .../person-list/person-list.component.html | 23 ++++++++----------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/webapp/src/app/modules/person-card/person-card.component.html b/webapp/src/app/modules/person-card/person-card.component.html index 9d07452e..91fe3a64 100644 --- a/webapp/src/app/modules/person-card/person-card.component.html +++ b/webapp/src/app/modules/person-card/person-card.component.html @@ -1,13 +1,13 @@
-
+
{{ getInitials(person.display_name) }}
@if (person.relevance_rating) { - + {{ person.relevance_rating }} } @@ -16,16 +16,16 @@ {{ isBookmarked ? 'bookmark' : 'bookmark_border' }}
-

{{ person.display_name }}

+

{{ person.display_name }}

- {{ institution(person)?.display_name }} - @if (institution(person)?.country_code) { + {{ institution(person)?.display_name }} + @if (institution(person)?.country_code && !loading) { }

-

{{ getDistinguishingId(person) }}

-

+

{{ getDistinguishingId(person) }}

+

Publikationen: {{ person.works_count }} · Zitationen: {{ person.cited_by_count }}

@@ -35,7 +35,7 @@
@for (topic of topics(person); track topic) { - {{ topic }} + {{ topic }} }
diff --git a/webapp/src/app/modules/person-card/person-card.component.ts b/webapp/src/app/modules/person-card/person-card.component.ts index 89ebf0e8..f7dd52a8 100644 --- a/webapp/src/app/modules/person-card/person-card.component.ts +++ b/webapp/src/app/modules/person-card/person-card.component.ts @@ -3,17 +3,18 @@ import { CommonModule } from '@angular/common'; import { RouterLink } from '@angular/router'; import { MatIconModule } from '@angular/material/icon'; import { CustomAuthor, DehydratedInstitution } from '../../api'; - +import { SkTextDirective } from '../../custom-directives/sk-text.directive'; @Component({ selector: 'app-person-card', standalone: true, - imports: [CommonModule, RouterLink, MatIconModule], + imports: [CommonModule, RouterLink, MatIconModule,SkTextDirective], templateUrl: './person-card.component.html', styleUrl: './person-card.component.scss', }) export class PersonCardComponent { @Input({ required: true }) person!: CustomAuthor; @Input() isBookmarked = false; + @Input() loading = false; @Output() bookmarkToggle = new EventEmitter(); @Output() topicClick = new EventEmitter(); diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index f516e3d9..e8d7f6df 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -10,11 +10,11 @@ Durchsuchen Sie OpenAlex-Autorinnen und -Autoren nach Namen, Themen oder Kennungen.

- @if (state.searchValue()) { + @if (searchValue()) {
Aktive Suche - „{{ state.searchValue() }}“ + „{{ searchValue() }}“
} @@ -187,8 +184,8 @@ -- 2.56.1 From efd9d624770a0f526267df7bfdf256e967c2f970 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 8 Jun 2026 15:17:39 +0200 Subject: [PATCH 7/7] fixed FormControl <-> Query Params binding --- .../app-searchbar/app-searchbar.component.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts index 711c0211..3196c3b5 100644 --- a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts +++ b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts @@ -1,4 +1,4 @@ -import { Component, inject, ViewChild, DestroyRef} from '@angular/core'; +import { Component, inject, ViewChild, DestroyRef } from '@angular/core'; import { MatIcon } from '@angular/material/icon'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { Router, ActivatedRoute } from '@angular/router'; @@ -43,11 +43,19 @@ export class AppSearchbarComponent { private readonly router = inject(Router); private readonly route = inject(ActivatedRoute); private readonly personService = inject(PersonsService); - constructor() { - const params = new URLSearchParams(window.location.search); - const currentSearch = params.get('query') ?? ''; - this.searchControl.setValue(currentSearch, { emitEvent: false }); + const route = inject(ActivatedRoute); + const router = inject(Router); + + // Sync searchControl from query param on every URL change + route.queryParams + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((params) => { + const query = params['query'] ?? ''; + if (this.searchControl.value !== query) { + this.searchControl.setValue(query, { emitEvent: false }); + } + }); // Autocomplete suggestions this.searchControl.valueChanges -- 2.56.1