From 38896304e8db2fc6ab1881690b65ede6d7e55464 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 22 Jun 2026 23:31:27 +0200 Subject: [PATCH] refine timeline topic legend layout --- .../research-timeline.component.html | 120 +++++++++++------- .../research-timeline.component.scss | 96 +++++++++++--- .../research-timeline.component.ts | 43 ++----- 3 files changed, 162 insertions(+), 97 deletions(-) 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 1038e101..ac4b5a32 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 @@ -12,56 +12,71 @@ class="subfield-legend" [class.expanded]="subfieldLegendExpanded" aria-label="Aktuell sichtbare Subfields"> -
- {{ group.name }} +
+
+ Farben nach Subfield + + info_outline + +
- - - - {{ item.name }} +
- -
+
+
+ {{ group.name }} - + + + + {{ item.name }} + + +
+ + +
+ + + +
(); @@ -193,25 +196,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { return groups; } - let remainingItems = this.collapsedSubfieldLegendLimit; - const visibleGroups: TopicFieldLegendGroup[] = []; - - for (const group of groups) { - if (remainingItems <= 0) { - break; - } - - const items = group.items.slice(0, remainingItems); - - if (items.length === 0) { - continue; - } - - visibleGroups.push({ ...group, items }); - remainingItems -= items.length; - } - - return visibleGroups; + return groups.slice(0, this.collapsedSubfieldLegendGroupLimit); } get hiddenSubfieldLegendItemCount(): number { @@ -219,10 +204,9 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { return 0; } - return Math.max( - this.allSubfieldLegendItemCount - this.collapsedSubfieldLegendLimit, - 0, - ); + return this.allSubfieldLegendGroups + .slice(this.collapsedSubfieldLegendGroupLimit) + .reduce((count, group) => count + group.items.length, 0); } get showSubfieldLegendToggle(): boolean { @@ -461,6 +445,10 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { this.subfieldLegendExpanded = !this.subfieldLegendExpanded; } + toggleSubfieldLegendVisibility(): void { + this.subfieldLegendVisible = !this.subfieldLegendVisible; + } + trackByLegendGroup(_: number, group: TopicFieldLegendGroup): string { return group.id; } @@ -669,13 +657,6 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { .sort((left, right) => left.name.localeCompare(right.name)); } - private get allSubfieldLegendItemCount(): number { - return this.allSubfieldLegendGroups.reduce( - (count, group) => count + group.items.length, - 0, - ); - } - private get visibleLegendTopics(): TopicTimelineTopic[] { if (this.timelineViewMode === 'compact') { return this.compactPhases.flatMap((phase) => [