Merge pull request 'feature/keywords-analysis' (#299) from feature/keywords-analysis into dev
LocationBasedServices/smartguide/pipeline/head This commit looks good

Reviewed-on: #299
This commit was merged in pull request #299.
This commit is contained in:
2026-08-23 11:10:45 +02:00
15 changed files with 155 additions and 69 deletions
@@ -623,7 +623,11 @@ export class KeywordsSearchComponent {
}
isSearchDisabled(): boolean {
return this.selectedKeywords().length === 0 || this.isExtracting();
return (
this.selectedKeywords().length === 0 ||
this.isExtracting() ||
this.loadingNewKeyword()
);
}
onExtractKeywordsClick(): void {
@@ -59,29 +59,9 @@
</mat-card-content>
</mat-card>
<nav
mat-tab-nav-bar
[tabPanel]="resultTabPanel"
class="result-nav sg-tab-nav">
@for (route of childRoutes; track route.path) {
<a
mat-tab-link
[routerLink]="route.path"
routerLinkActive
#rla="routerLinkActive"
[active]="rla.isActive"
[queryParams]="{
keywords: state.payload()?.keywords?.join(','),
fuzzy: state.payload()?.options?.fuzzy,
topics: state.payload()?.options?.fuzzy ? state.topicIds() : null,
topicId: null,
}"
queryParamsHandling="replace">
<mat-icon>{{ route.icon }}</mat-icon>
{{ route.label }}
</a>
}
</nav>
@if (resultTabPanel) {
<app-link-tab-nav-bar [links]="_links()" [tabPanel]="resultTabPanel" />
}
<mat-tab-nav-panel #resultTabPanel>
<router-outlet />
@@ -101,13 +101,6 @@ $touch-target: 44px;
}
}
/* ============================================================
CHILD ROUTE NAV
============================================================ */
.result-nav {
margin-top: 0.5rem;
}
/* ============================================================
EMPTY STATE
============================================================ */
@@ -170,8 +163,4 @@ $touch-target: 44px;
width: 100%;
justify-content: center;
}
.result-nav {
overflow-x: auto;
}
}
@@ -1,12 +1,6 @@
import { Component, computed, inject } from '@angular/core';
import { Component, computed, inject, signal } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
ActivatedRoute,
Router,
RouterLink,
RouterLinkActive,
RouterOutlet,
} from '@angular/router';
import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
@@ -34,19 +28,21 @@ import {
PERSONS_ICON,
PROJECT_ICON,
} from '../../../shared/ui/icons';
import {
LinkTabNavBarComponent,
LinkTabNavBarItem,
} from '../../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
@Component({
selector: 'app-keywords-search-results',
standalone: true,
imports: [
RouterLink,
RouterLinkActive,
RouterOutlet,
MatButtonModule,
MatCardModule,
MatIconModule,
TopicChipComponent,
MatTabsModule,
LinkTabNavBarComponent,
MatSlideToggleModule,
MatTooltipModule,
],
@@ -76,6 +72,92 @@ export class KeywordsSearchResultsComponent {
{ path: 'trends', label: 'Visualisierung', icon: BAR_CHART_ICON },
];
_links = computed<LinkTabNavBarItem[]>(() => {
const links: LinkTabNavBarItem[] = [
{
label: 'Personen',
icon: PERSONS_ICON,
path: 'persons',
queryParams: {
keywords: this.state.payload()?.keywords?.join(','),
fuzzy: this.tabFuzzyValue('persons'),
topics: this.tabFuzzyValue('persons') ? this.state.topicIds() : null,
topicId: null,
},
queryParamsHandling: 'replace',
disabled: false,
},
{
label: 'Projekte',
icon: PROJECT_ICON,
path: 'projects',
queryParams: {
keywords: this.state.payload()?.keywords?.join(','),
fuzzy: this.tabFuzzyValue('projects'),
topics: this.tabFuzzyValue('projects') ? this.state.topicIds() : null,
topicId: null,
},
queryParamsHandling: 'replace',
disabled: false,
},
{
label: 'Patente',
icon: PATENT_ICON,
path: 'patents',
queryParams: {
keywords: this.state.payload()?.keywords?.join(','),
fuzzy: this.tabFuzzyValue('patents'),
topics: this.tabFuzzyValue('patents') ? this.state.topicIds() : null,
topicId: null,
},
queryParamsHandling: 'replace',
disabled: false,
},
{
label: 'Publikationen',
icon: ARTICLE_ICON,
path: 'works',
queryParams: {
keywords: this.state.payload()?.keywords?.join(','),
fuzzy: this.tabFuzzyValue('works'),
topics: this.tabFuzzyValue('works') ? this.state.topicIds() : null,
topicId: null,
},
queryParamsHandling: 'replace',
disabled: false,
},
{
label: 'Nachrichten',
icon: NEWS_ICON,
path: 'news',
queryParams: {
keywords: this.state.payload()?.keywords?.join(','),
fuzzy: this.tabFuzzyValue('news'),
topics: this.tabFuzzyValue('news') ? this.state.topicIds() : null,
topicId: null,
},
queryParamsHandling: 'replace',
disabled: false,
},
{
label: 'Visualisierung',
icon: BAR_CHART_ICON,
path: 'trends',
queryParams: {
keywords: this.state.payload()?.keywords?.join(','),
fuzzy: this.tabFuzzyValue('trends'),
topics: this.tabFuzzyValue('trends') ? this.state.topicIds() : null,
topicId: null,
},
queryParamsHandling: 'replace',
disabled: false,
},
];
return links;
});
private readonly lastUserFuzzy = signal(false);
readonly selectedKeywordCount = computed(() => this.state.keywords().length);
readonly allKeywordEntries = computed(() => {
const seen = new Set<string>();
@@ -116,6 +198,15 @@ export class KeywordsSearchResultsComponent {
});
}
// the Fuzzy Search toggle is locked on while the Personen tab is active
isPersonsTab(): boolean {
return this.route.snapshot.firstChild?.routeConfig?.path === 'persons';
}
tabFuzzyValue(path: string): boolean {
if (path === 'persons') return true;
return this.lastUserFuzzy();
}
goBackToSearch(): void {
void this.router.navigate(['/keywords'], {
queryParamsHandling: 'merge',
@@ -87,6 +87,7 @@ export class AppAuthorChipComponent {
}
_onChipClick(event: MouseEvent | KeyboardEvent) {
event.stopPropagation();
const author = this._author();
if (this.handleChipClick && author) {
this.handleChipClick.emit(author);
@@ -90,6 +90,7 @@ export class AppTopicChipComponent {
});
_onChipClick(event: MouseEvent | KeyboardEvent) {
event.stopPropagation();
const topic = this.topic();
if (this.isClickable() && this.handleChipClick && topic) {
this.handleChipClick.emit(topic);
@@ -55,7 +55,7 @@
[matTooltip]="getInstitutionTooltipText(institutions[0])"
matTooltipPosition="above"
[attr.aria-label]="getInstitutionTooltipText(institutions[0])"
(click)="filterByInstitution(institutions[0])">
(click)="filterByInstitution($event, institutions[0])">
<mat-icon class="institution-icon">{{ APARTMENT_ICON }}</mat-icon>
<span class="institution-name">{{
institutions[0].name || institutions[0].recepient || '-'
@@ -72,7 +72,7 @@
[class.active]="isFundingTypeActive(project.funding_type)"
matTooltip="Nach Typ filtern"
matTooltipPosition="above"
(click)="toggleFundingTypeFilter(project.funding_type)">
(click)="toggleFundingTypeFilter($event, project.funding_type)">
<app-chip [color]="getFundingTypeColor(project.funding_type)">
<span>{{ project.funding_type }}</span>
</app-chip>
@@ -203,7 +203,8 @@ export class BundProjectTableComponent implements OnInit {
if (normalized == 'übrige indirekte projektförderung') return 'help';
return 'info';
}
toggleFundingTypeFilter(type: string): void {
toggleFundingTypeFilter(event: Event, type: string): void {
event.stopPropagation();
const selectedTypes = this.selectedFundingTypesQueryParams();
if (selectedTypes.includes(type)) {
this.router.navigate([], {
@@ -271,7 +272,8 @@ export class BundProjectTableComponent implements OnInit {
);
}
filterByInstitution(institution: any): void {
filterByInstitution(event: Event, institution: any): void {
event.stopPropagation();
const institutionName = institution.name ?? institution.recepient;
if (!institutionName || !this.institutionFilterEnabled()) return;
@@ -2,6 +2,6 @@
type="button"
class="chip-overflow-toggle"
[attr.aria-expanded]="expanded()"
(click)="toggle.emit()">
(click)="handleToggleClick($event)">
{{ expanded() ? 'weniger' : '+' + hiddenCount() }}
</button>
@@ -10,5 +10,9 @@ export class ChipOverflowToggleComponent {
expanded = input<boolean>(false);
hiddenCount = input<number>(0);
toggle = output<void>();
toggle = output<MouseEvent>();
handleToggleClick(event: MouseEvent): void {
event.stopPropagation();
this.toggle.emit(event);
}
}
@@ -37,10 +37,7 @@
@let isClassificationsExpanded = isProjectClassificationsExpanded(project);
@let visibleClassifications =
isClassificationsExpanded ? classifications : classifications.slice(0, 3);
<div
class="classification-tags"
aria-label="Fachsystematik"
style="padding: 0.5rem 0.5rem">
<div class="classification-tags" aria-label="Fachsystematik">
@for (classification of visibleClassifications; track $index) {
<span
class="publication-institution-tag classification-tag"
@@ -183,7 +180,7 @@
[matTooltip]="getAuthorTooltipText(author)"
matTooltipPosition="above"
[attr.aria-label]="getAuthorTooltipText(author)"
(click)="filterByAuthor(author.person_id!)">
(click)="filterByAuthor($event, author.person_id!)">
<mat-icon class="institution-icon">{{ PERSON_ICON }}</mat-icon>
<span class="institution-name">{{ author.full_name }}</span>
</button>
@@ -219,7 +216,7 @@
[matTooltip]="getInstitutionTooltipText(institution)"
matTooltipPosition="above"
[attr.aria-label]="getInstitutionTooltipText(institution)"
(click)="filterByInstitution(institution)">
(click)="filterByInstitution($event, institution)">
<mat-icon class="institution-icon">{{ APARTMENT_ICON }}</mat-icon>
<span class="institution-name">{{
institution.institute_name_de || institution.institute_name_en
@@ -112,7 +112,9 @@
flex-wrap: wrap;
gap: 6px;
}
.classification-tags {
padding: 0.5rem 0.5rem;
}
.topic-chips {
max-width: 320px;
}
@@ -234,7 +234,8 @@ export class DfgProjectTableComponent implements OnInit {
}
return `Autor: ${author.full_name}`;
}
filterByAuthor(authorId: number): void {
filterByAuthor(event: Event, authorId: number): void {
event.stopPropagation();
if (!authorId || !this.authorFilterEnabled()) return;
const selectedAuthorIds = this.selectedAuthorIdsQueryParams();
if (selectedAuthorIds.includes(String(authorId))) {
@@ -317,7 +318,8 @@ export class DfgProjectTableComponent implements OnInit {
);
}
filterByInstitution(institution: any): void {
filterByInstitution(event: Event, institution: any): void {
event.stopPropagation();
const institutionId = this.getProjectInstitutionId(institution);
if (!institutionId || !this.institutionFilterEnabled()) return;
@@ -19,7 +19,7 @@
[class.active]="isTypeActive(project.project_type)"
matTooltip="Nach Typ filtern"
matTooltipPosition="above"
(click)="toggleTypeFilter(project.project_type)">
(click)="toggleTypeFilter($event, project.project_type)">
<app-chip [color]="getProjectTypeColor(project.project_type)">
<span>{{ getProjectTypeLabel(project) }}</span>
</app-chip>
@@ -92,7 +92,7 @@
[matTooltip]="getOrganizationTooltipText(organization)"
matTooltipPosition="above"
[attr.aria-label]="getOrganizationTooltipText(organization)"
(click)="filterByOrganization(organization)">
(click)="filterByOrganization($event, organization)">
<mat-icon class="institution-icon">{{ APARTMENT_ICON }}</mat-icon>
<span class="institution-name">
{{ getOrganizationName(organization) }}
@@ -106,7 +106,7 @@
<app-chip-overflow-toggle
[expanded]="isExpanded"
[hiddenCount]="organizations.length - 3"
(toggle)="toggleProjectOrganizationsExpansion(project)" />
(toggle)="toggleProjectOrganizationsExpansion($event, project)" />
}
</div>
</ng-template>
@@ -133,7 +133,7 @@
<app-chip-overflow-toggle
[expanded]="isExpanded"
[hiddenCount]="projectTopics.length - 3"
(toggle)="toggleProjectTopicsExpansion(project)" />
(toggle)="toggleProjectTopicsExpansion($event, project)" />
}
</div>
</ng-template>
@@ -207,7 +207,8 @@ export class EuProjectTableComponent {
isTypeActive(type: string): boolean {
return this.selectedTypesQueryParams().includes(type);
}
toggleTypeFilter(type: string): void {
toggleTypeFilter(event: Event, type: string): void {
event.stopPropagation();
const selectedTypes = this.selectedTypesQueryParams();
if (selectedTypes.includes(type)) {
this.router.navigate([], {
@@ -427,7 +428,11 @@ export class EuProjectTableComponent {
return `Organisation: ${name}`;
}
filterByOrganization(organization: EuCordisOrganizationSummary | any): void {
filterByOrganization(
event: Event,
organization: EuCordisOrganizationSummary | any,
): void {
event.stopPropagation();
const organizationId = this.getOrganizationId(organization);
if (!organizationId || !this.institutionFilterEnabled()) return;
@@ -452,7 +457,11 @@ export class EuProjectTableComponent {
return this.expandedProjectOrganizationsIds.includes(projectId);
}
toggleProjectOrganizationsExpansion(project: EuCordisProjectSummary): void {
toggleProjectOrganizationsExpansion(
event: Event,
project: EuCordisProjectSummary,
): void {
event.stopPropagation();
const projectId = this.getProjectId(project);
if (!projectId) return;
@@ -523,7 +532,11 @@ export class EuProjectTableComponent {
return this.expandedProjectTopicsIds.includes(projectId);
}
toggleProjectTopicsExpansion(project: EuCordisProjectSummary): void {
toggleProjectTopicsExpansion(
event: Event,
project: EuCordisProjectSummary,
): void {
event.stopPropagation();
const projectId = this.getProjectId(project);
if (!projectId) return;