From 9ce6d5f26e0ec234ec65395d79e7478a2eadfc8b Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Mon, 10 Aug 2026 21:18:58 +0200 Subject: [PATCH] adapted shared topic chip to accept already fetched topics instead of making another seperate call (+ error handling for possible null and undifined types as specified in the openapi generated model). Hopefully found all instances of regular material tooltip and changed to use new chip --- .../keywords-search.component.html | 4 +++ .../search-results.component.html | 2 ++ .../patent-detail.component.html | 1 + .../modules/patents/patents.component.html | 1 + .../person-card/person-card.component.html | 2 ++ .../person-interesting.component.html | 1 + .../person-list/person-list.component.html | 6 ++-- .../person-list/person-list.component.ts | 31 +++++++++++++++-- .../research-timeline.component.html | 19 +++++------ .../research-timeline.component.ts | 4 +++ .../eu-details.component.html | 1 + .../publication-detail.component.html | 2 ++ .../uni-trend-parent.component.html | 8 ++--- .../app-topic-tooltip.component.ts | 32 ++++++++++++----- .../project-oa-topics.component.html | 2 ++ .../ui/topic-chip/topic-chip.component.html | 34 +++++++++---------- 16 files changed, 104 insertions(+), 46 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 60d93b0b..4bd01fee 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -179,6 +179,8 @@
@for (keyword of keywords; track keyword.llm_keyword.keyword) { 0) { @for (tag of tags(); track tag.label) { + [appComponentTooltip]="AppTopicTooltipComponent" + [tooltipInputs]="getFilterTopicInputs(filter.value)" + [tooltipMaxWidth]="'500px'"> label {{ filter.value 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 43b342ec..4eac968f 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -46,6 +46,9 @@ import { import { SkTextDirective } from '../../custom-directives/sk-text.directive'; import { BookmarkService } from '../../shared/services/bookmark.service'; +import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive'; +import { AppTopicTooltipComponent } from '../../shared/ui/app-topic-tooltip/app-topic-tooltip.component'; + type InstitutionYearFilterMode = 'in' | 'from' | 'between'; @Component({ @@ -62,17 +65,19 @@ type InstitutionYearFilterMode = 'in' | 'from' | 'between'; MatCheckboxModule, MatRadioModule, MatTooltipModule, + MatAutocompleteModule, TopicHierarchyComponent, PersonCardComponent, - SkTextDirective, - MatAutocompleteModule, CountryFlagComponent, + SkTextDirective, + ComponentTooltipDirective, ], templateUrl: './person-list.component.html', styleUrl: './person-list.component.scss', standalone: true, }) export class PersonListComponent { + readonly AppTopicTooltipComponent = AppTopicTooltipComponent; private readonly router = inject(Router); private readonly route = inject(ActivatedRoute); private readonly personsService = inject(PersonsService); @@ -477,6 +482,28 @@ export class PersonListComponent { }); } + getFilterTopicInputs(topicName: string): { topicId?: string; topic?: any } { + const topic = this.findPersonTopic(topicName); + if (topic?.id) { + return { topicId: topic.id }; + } + return { + topic: { + display_name: topicName, + description: this.getFilterTopicDescription(topicName) ?? undefined, + subfield: this.getFilterTopicSubfieldName(topicName) + ? { display_name: this.getFilterTopicSubfieldName(topicName)! } + : undefined, + field: this.getFilterTopicFieldName(topicName) + ? { display_name: this.getFilterTopicFieldName(topicName)! } + : undefined, + domain: this.getFilterTopicDomainName(topicName) + ? { display_name: this.getFilterTopicDomainName(topicName)! } + : undefined, + }, + }; + } + clearAllFilters(): void { this.selectedTopics.set(new Set()); this.institutionControl.setValue('', { emitEvent: false }); diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html index 89bc937d..15ae9a94 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html @@ -171,11 +171,9 @@ type="button" class="main-topic-button" [disabled]="!getMainTopicItem(item)?.id" - [matTooltip]="getTopicTooltip(getMainTopicItem(item))" - matTooltipClass="topic-chip-tooltip" - [matTooltipDisabled]=" - !hasTopicTooltip(getMainTopicItem(item)) - " + [appComponentTooltip]="AppTopicTooltipComponent" + [tooltipInputs]="{ topicId: getMainTopicItem(item)?.id }" + [tooltipMaxWidth]="'500px'" (click)=" selectTopic(getMainTopicItem(item), [item.year]) "> @@ -208,6 +206,7 @@ trackBy: trackByTopic " class="timeline-topic-chip" + [topicId]="topic.id" [label]="topic.name" [count]="topic.count" [description]="getTopicDescription(topic)" @@ -289,11 +288,9 @@ type="button" class="main-topic-button" [disabled]="!phase.primaryTopic.id" - [matTooltip]="getTopicTooltip(phase.primaryTopic)" - matTooltipClass="topic-chip-tooltip" - [matTooltipDisabled]=" - !hasTopicTooltip(phase.primaryTopic) - " + [appComponentTooltip]="AppTopicTooltipComponent" + [tooltipInputs]="{ topicId: phase.primaryTopic.id }" + [tooltipMaxWidth]="'500px'" (click)=" selectTopic(phase.primaryTopic, getPhaseYears(phase)) "> @@ -309,6 +306,7 @@ ; @Input() elements: TopicTimelineElement[] = []; diff --git a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html index 57049a65..8340ff10 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html +++ b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html @@ -245,6 +245,7 @@ track keyword.id || keyword.label ) { @for (topic of publication.topics; track topic.id) { info_outline - Der CC-News-Vergleich (hinterlegte Fläche, ab 2017) ist aktuell nur bei - deaktivierter Fuzzy-Suche verfügbar, da für Web-Nachrichten kein - Themen-Mapping existiert. + Der CC-News-Vergleich (hinterlegte Fläche, ab 2017) ist aktuell + nur bei deaktivierter Fuzzy-Suche verfügbar, da für + Web-Nachrichten kein Themen-Mapping existiert.
} @@ -198,11 +198,11 @@
@for (topic of selectedTrendTopics(); track $index) { } diff --git a/webapp/src/app/shared/ui/app-topic-tooltip/app-topic-tooltip.component.ts b/webapp/src/app/shared/ui/app-topic-tooltip/app-topic-tooltip.component.ts index f86a6750..7e6b8e6e 100644 --- a/webapp/src/app/shared/ui/app-topic-tooltip/app-topic-tooltip.component.ts +++ b/webapp/src/app/shared/ui/app-topic-tooltip/app-topic-tooltip.component.ts @@ -11,22 +11,36 @@ import { AppTopicCardComponent } from '../app-topic-card/app-topic-card.componen export class AppTopicTooltipComponent { private readonly topicsService = inject(TopicsV2Service); - topicId = input.required(); + topicId = input(undefined); + topic = input(undefined); _topic = signal(undefined); - _isLoading = signal(false); + constructor() { effect(() => { + const topicObj = this.topic(); const topicId = this.topicId(); - if (!topicId) { - this._topic.set(undefined); - } - this._isLoading.set(true); - this.topicsService.getTopicById(topicId).subscribe((topic) => { - this._topic.set(topic); + + if (topicObj) { + this._topic.set(topicObj); this._isLoading.set(false); - }); + } else if (topicId) { + const cleanId = topicId.replace('https://openalex.org/', ''); + this._isLoading.set(true); + this.topicsService.getTopicById(cleanId).subscribe({ + next: (fetchedTopic) => { + this._topic.set(fetchedTopic); + this._isLoading.set(false); + }, + error: () => { + this._isLoading.set(false); + }, + }); + } else { + this._topic.set(undefined); + this._isLoading.set(false); + } }); } } diff --git a/webapp/src/app/shared/ui/project-oa-topics/project-oa-topics.component.html b/webapp/src/app/shared/ui/project-oa-topics/project-oa-topics.component.html index 733594eb..857b5ed4 100644 --- a/webapp/src/app/shared/ui/project-oa-topics/project-oa-topics.component.html +++ b/webapp/src/app/shared/ui/project-oa-topics/project-oa-topics.component.html @@ -7,6 +7,8 @@
@for (topic of getUniqueOATopics(); track $index) { - - {{ label }} + + {{ label() }} - @if (hasCount) { + @if (hasCount()) { - {{ count }} - @if (countIconName) { - {{ countIconName }} + [matTooltip]="normalizedCountTooltip()" + [matTooltipDisabled]="!normalizedCountTooltip()"> + {{ count() }} + @if (countIconName()) { + {{ + countIconName() + }} } }