From be72d28bdaf02b9cb9fc682630d0787db17c52a3 Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 8 Jul 2026 03:29:04 +0200 Subject: [PATCH] created a template component for persons results for keyword search --- .../persons-results.component.html | 31 ++++ .../persons-results.component.scss | 29 ++++ .../persons-results.component.ts | 135 ++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.html create mode 100644 webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.scss create mode 100644 webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.ts diff --git a/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.html b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.html new file mode 100644 index 00000000..a97b0264 --- /dev/null +++ b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.html @@ -0,0 +1,31 @@ +
+ + + groups +

Personenliste

+

+ Die aktuelle Gewichtung ist unter normalized verfügbar. +

+
+
+ + + + + + +
diff --git a/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.scss b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.scss new file mode 100644 index 00000000..ffeea20d --- /dev/null +++ b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.scss @@ -0,0 +1,29 @@ +/* ============================================================ + RESULT LAYOUT + ============================================================ */ +.result-layout { + display: grid; + grid-template-columns: minmax(300px, 420px) 1fr; + grid-template-areas: 'summary results'; + gap: 0.75rem; + align-items: start; +} + +.search-summary-card { + grid-area: summary; +} + +.results-card { + grid-area: results; +} + +.search-summary-card, +.results-card { + background: var(--sg-surface, #ffffff); + border: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.12)); + box-shadow: none; + + .mat-mdc-card-content { + padding: 0.75rem; + } +} diff --git a/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.ts b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.ts new file mode 100644 index 00000000..533c28e7 --- /dev/null +++ b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.ts @@ -0,0 +1,135 @@ +import { Component, inject, signal } from '@angular/core'; + +import { MatCardModule } from '@angular/material/card'; +import { MatIconModule } from '@angular/material/icon'; + +import { + WeightMap, + WeightSliderOption, + WeightsSlidersComponent, + WeightsSlidersValue, +} from '../../../../shared/ui/weights-sliders/weights-sliders.component'; + +import { SearchResultsStateService } from '../search-results-state.service'; + +@Component({ + selector: 'app-persons-results', + standalone: true, + imports: [MatCardModule, MatIconModule, WeightsSlidersComponent], + templateUrl: './persons-results.component.html', + styleUrl: './persons-results.component.scss', +}) +export class KeywordsToPersonsResultsComponent { + // injects the state set by the parent route — no duplicate parsing here + private readonly state = inject(SearchResultsStateService); + + readonly defaultWeights: WeightMap = { + publications: 0.5, + citations: 0.5, + patents: 0.5, + projects: 0.5, + mediaVisibility: 0.5, + }; + + readonly weightOptions: WeightSliderOption[] = [ + { + key: 'publications', + label: 'Publikationen', + icon: 'article', + description: + 'Gewichtet die Anzahl und Relevanz wissenschaftlicher Arbeiten.', + defaultValue: 0.5, + queryParamName: 'wPublications', + }, + { + key: 'citations', + label: 'Zitationen', + icon: 'format_quote', + description: 'Gewichtet wissenschaftlichen Einfluss über Zitationen.', + defaultValue: 0.5, + queryParamName: 'wCitations', + }, + { + key: 'patents', + label: 'Patente', + icon: 'workspace_premium', + description: 'Gewichtet Innovations- und Transferleistung.', + defaultValue: 0.5, + queryParamName: 'wPatents', + }, + { + key: 'projects', + label: 'Projekte', + icon: 'account_tree', + description: 'Gewichtet Beteiligung an relevanten Forschungsprojekten.', + defaultValue: 0.5, + queryParamName: 'wProjects', + }, + { + key: 'mediaVisibility', + label: 'Medien-Sichtbarkeit', + icon: 'visibility', + description: 'Gewichtet öffentliche und mediale Sichtbarkeit.', + defaultValue: 0.5, + queryParamName: 'wMedia', + }, + ]; + + readonly currentWeights = signal({ + raw: this.defaultWeights, + normalized: { + publications: 0.2, + citations: 0.2, + patents: 0.2, + projects: 0.2, + mediaVisibility: 0.2, + }, + rawSum: 2.5, + normalizedSum: 1, + valid: true, + }); + + readonly persons = signal([]); // placeholder until the results service lands + + private hasLoadedInitial = false; + + onWeightsChange(value: WeightsSlidersValue): void { + this.currentWeights.set(value); + + // fires once with the query-param-aware initial state — use it to load + if (!this.hasLoadedInitial) { + this.hasLoadedInitial = true; + this.loadPersons(); + } + } + + onApplyWeights(value: WeightsSlidersValue): void { + this.currentWeights.set(value); + this.loadPersons(); + } + + private loadPersons(): void { + const weights = this.currentWeights(); + + const requestPayload = { + manualKeywords: this.state.manualKeywords(), + extractedKeywords: this.state.extractedKeywords(), + keywords: this.state.keywords(), + softSearch: this.state.softSearch(), + weights: { + raw: weights.raw, + normalized: weights.normalized, + }, + }; + + console.log(requestPayload); + + /** + * TODO: + * this.personsService.searchPersons(requestPayload).subscribe({ + * next: results => this.persons.set(results), + * error: error => console.error(error), + * }); + */ + } +}