diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.html b/webapp/src/app/modules/person-interesting/person-interesting.component.html index d88ebffc..650677af 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.html +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.html @@ -6,28 +6,52 @@ article Anzahl Publikationen zum Thema - @if (legendGroups().length > 0) { -
- @for (group of legendGroups(); track group.id) { - - {{ group.name }} - - @for (item of group.items; track item.id) { - - - {{ item.name }} - - } - - - } -
- } } + @if (visibleLegendGroups().length > 0) { +
+ + info_outline + + +
+ @for (group of visibleLegendGroups(); track group.id) { + + {{ group.name }} + + @for (item of group.items; track item.id) { + + + {{ item.name }} + + } + + + } + + @if (hasHiddenLegendGroups()) { + + } +
+
+ }
@if (tags().length > 0) { @for (tag of tags(); track tag.label) { diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.scss b/webapp/src/app/modules/person-interesting/person-interesting.component.scss index ebd1babb..ec4f6a04 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.scss +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.scss @@ -15,7 +15,7 @@ align-items: baseline; gap: 10px; flex-wrap: wrap; - margin: 0 0 18px; + margin: 0 0 12px; } .interest-card h3 { @@ -46,50 +46,87 @@ } .interest-legend { + display: flex; + align-items: flex-start; + gap: 9px; + width: fit-content; + max-width: 100%; + margin: 0 0 16px; + padding: 8px 10px; + border: 1px solid #dbe5f6; + border-radius: 8px; + background: #ffffff; + box-sizing: border-box; +} + +.interest-legend-content, +.interest-legend-group, +.interest-legend-items, +.interest-legend-item { display: inline-flex; - flex-wrap: wrap; align-items: center; - gap: 6px; +} + +.interest-legend-info { + flex: 0 0 auto; + width: 14px; + height: 14px; + color: #7d8aa8; + font-size: 14px; + line-height: 14px; +} + +.interest-legend-content { + gap: 7px; + flex: 0 1 auto; min-width: 0; + max-width: 100%; + flex-wrap: wrap; } .interest-legend-group { - display: inline-flex; - align-items: center; gap: 6px; + flex: 0 1 auto; + flex-wrap: wrap; + min-width: 0; max-width: 100%; - min-height: 22px; + min-height: 24px; padding: 3px 7px; border: 1px solid #dbe5f6; border-radius: 999px; - background: rgba(255, 255, 255, 0.68); + background: #fbfdff; } .interest-legend-field { - flex: 0 0 auto; - color: #1b2a4a; + flex: 0 1 auto; + min-width: 0; + color: #07163d; font-size: 10px; font-weight: 800; line-height: 1.2; } .interest-legend-items { - display: inline-flex; - flex-wrap: wrap; - align-items: center; + flex: 0 1 auto; gap: 4px 7px; min-width: 0; + flex-wrap: wrap; } .interest-legend-item { - display: inline-flex; - align-items: center; gap: 4px; + flex: 0 0 auto; min-width: 0; color: #53617e; font-size: 10px; font-weight: 600; line-height: 1.2; + white-space: nowrap; + + span:last-child { + overflow: visible; + text-overflow: clip; + } } .interest-legend-dot { @@ -101,6 +138,32 @@ box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2); } +.interest-legend-more { + display: inline-flex; + align-items: center; + flex: 0 0 auto; + min-height: 24px; + padding: 0 2px; + border: 0; + background: transparent; + color: var(--accent, #0057ff); + cursor: pointer; + font: inherit; + font-size: 11px; + font-weight: 700; + white-space: nowrap; + + &:hover { + text-decoration: underline; + } + + &:focus-visible { + outline: 2px solid var(--accent, #0057ff); + outline-offset: 2px; + border-radius: 4px; + } +} + .interest-tags .interest-empty { padding: 9px 16px; border: 1px solid #e2e8f0; diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.ts b/webapp/src/app/modules/person-interesting/person-interesting.component.ts index 0e0fd749..1a695ead 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.ts +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.ts @@ -1,5 +1,6 @@ -import { Component, input, computed, output } from '@angular/core'; +import { Component, input, computed, output, signal } from '@angular/core'; import { MatIconModule } from '@angular/material/icon'; +import { MatTooltipModule } from '@angular/material/tooltip'; import { CommonModule } from '@angular/common'; import { TopicCount } from '../../api'; @@ -33,15 +34,17 @@ interface InterestLegendItem { } const MAX_TAGS = 5; +const MAX_LEGEND_GROUPS = 3; @Component({ selector: 'app-person-interesting', - imports: [CommonModule, MatIconModule, TopicChipComponent], + imports: [CommonModule, MatIconModule, MatTooltipModule, TopicChipComponent], templateUrl: './person-interesting.component.html', styleUrl: './person-interesting.component.scss', }) export class PersonInterestingComponent { readonly topics = input(null); + readonly legendExpanded = signal(false); readonly tagClick = output<{ id: string; name: string }>(); @@ -114,8 +117,27 @@ export class PersonInterestingComponent { .sort((left, right) => left.name.localeCompare(right.name)); }); + readonly visibleLegendGroups = computed(() => { + const groups = this.legendGroups(); + return this.legendExpanded() ? groups : groups.slice(0, MAX_LEGEND_GROUPS); + }); + + readonly hasHiddenLegendGroups = computed( + () => this.legendGroups().length > MAX_LEGEND_GROUPS, + ); + + readonly hiddenLegendItemCount = computed(() => + this.legendGroups() + .slice(MAX_LEGEND_GROUPS) + .reduce((count, group) => count + group.items.length, 0), + ); + onTagClick(tag: InterestTag): void { if (!tag.id) return; this.tagClick.emit({ id: tag.id, name: tag.label }); } + + toggleLegend(): void { + this.legendExpanded.update((expanded) => !expanded); + } }