From bad95c65dd5cfbae2baf4e6f9b94301f418e02b6 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 15 Jun 2026 20:26:59 +0200 Subject: [PATCH] Timeline: show topic description on hover (frontend) --- .../research-timeline.component.html | 14 +++++++++++++ .../research-timeline.component.ts | 21 +++++++++++++++++++ .../person-overview.component.ts | 1 + 3 files changed, 36 insertions(+) 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 5376284b..9af028d2 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 @@ -225,6 +225,10 @@ type="button" class="main-topic-button" [disabled]="!getMainTopicItem(item)?.id" + [matTooltip]="getTopicDescription(getMainTopicItem(item))" + [matTooltipDisabled]=" + !hasTopicDescription(getMainTopicItem(item)) + " (click)=" selectTopic(getMainTopicItem(item), [item.year]) "> @@ -260,6 +264,8 @@ class="topic-chip" [ngClass]="getColorClass(index)" [disabled]="!topic.id" + [matTooltip]="getTopicDescription(topic)" + [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, [item.year])"> {{ topic.name }} {{ topic.count }} @@ -322,6 +328,10 @@ type="button" class="main-topic-button" [disabled]="!phase.primaryTopic.id" + [matTooltip]="getTopicDescription(phase.primaryTopic)" + [matTooltipDisabled]=" + !hasTopicDescription(phase.primaryTopic) + " (click)=" selectTopic(phase.primaryTopic, getPhaseYears(phase)) "> @@ -340,6 +350,8 @@ class="topic-chip" [ngClass]="getColorClass(index)" [disabled]="!topic.id" + [matTooltip]="getTopicDescription(topic)" + [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, getPhaseYears(phase))"> {{ topic.name }} {{ topic.count }} @@ -412,6 +424,8 @@ " class="mini-topic-chip" [disabled]="!topic.id" + [matTooltip]="getTopicDescription(topic)" + [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, [year.year])"> {{ topic.name }} {{ topic.count }} diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts index 90dfbe9f..37eb2013 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts @@ -17,6 +17,7 @@ export interface TopicTimelineTopic { id?: string; name: string; count: number; + description?: string; } export interface TopicTimelineElement { @@ -330,6 +331,14 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { ); } + getTopicDescription(topic: TopicTimelineTopic | undefined): string { + return (topic?.description ?? '').trim(); + } + + hasTopicDescription(topic: TopicTimelineTopic | undefined): boolean { + return this.getTopicDescription(topic).length > 0; + } + togglePhase(phase: ResearchTimelinePhase): void { if (this.expandedPhaseIds.has(phase.id)) { this.expandedPhaseIds.delete(phase.id); @@ -608,6 +617,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { const primaryTopicName = primaryTopic.name; let count = 0; let id = primaryTopic.id; + let description = primaryTopic.description; for (const year of years) { for (const topic of year.primary_topics ?? []) { @@ -620,6 +630,10 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { if (!id && topic.id) { id = topic.id; } + + if (!description && topic.description) { + description = topic.description; + } } } @@ -627,6 +641,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { id, name: primaryTopicName, count: count > 0 ? count : primaryTopic.count, + description, }; } @@ -637,6 +652,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { const counts = new Map(); const originalNames = new Map(); const ids = new Map(); + const descriptions = new Map(); for (const year of years) { for (const topic of year.topics ?? []) { @@ -652,6 +668,10 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { ids.set(normalizedName, topic.id); } + if (topic.description) { + descriptions.set(normalizedName, topic.description); + } + counts.set( normalizedName, (counts.get(normalizedName) ?? 0) + topic.count, @@ -664,6 +684,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { id: ids.get(normalizedName), name: originalNames.get(normalizedName) ?? normalizedName, count, + description: descriptions.get(normalizedName), })) .sort((left, right) => { if (right.count !== left.count) { diff --git a/webapp/src/app/modules/person-overview/person-overview.component.ts b/webapp/src/app/modules/person-overview/person-overview.component.ts index 5291c82a..57d2275c 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.ts +++ b/webapp/src/app/modules/person-overview/person-overview.component.ts @@ -453,6 +453,7 @@ export class PersonOverviewComponent implements OnInit { id: topic.id ?? undefined, name: topic.name, count: topic.count ?? 0, + description: topic.description ?? undefined, })); }