color interest topics semantically

This commit is contained in:
2026-06-21 22:17:11 +02:00
parent 7a7e04d2f0
commit 6d2b7a9873
3 changed files with 12 additions and 10 deletions
+6
View File
@@ -19,4 +19,10 @@ export interface TopicCount {
*/
count?: number;
description?: string | null;
subfield_id?: string | null;
subfield_name?: string | null;
field_id?: string | null;
field_name?: string | null;
domain_id?: string | null;
domain_name?: string | null;
}
@@ -10,12 +10,12 @@
</div>
<div class="interest-tags">
@if (tags().length > 0) {
@for (tag of tags(); track tag.label; let i = $index) {
@for (tag of tags(); track tag.label) {
<app-topic-chip
[label]="tag.label"
[count]="tag.count"
[description]="tag.description"
[color]="getColorClass(i)"
[color]="tag.color"
[disabled]="!tag.id"
countIcon="article"
descriptionTooltipTarget="button"
@@ -3,16 +3,15 @@ import { MatIconModule } from '@angular/material/icon';
import { CommonModule } from '@angular/common';
import { TopicCount } from '../../api';
import {
TOPIC_CHIP_PALETTE,
TopicChipComponent,
} from '../../shared/ui/topic-chip/topic-chip.component';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../shared/utils/topic-colors';
interface InterestTag {
id: string;
label: string;
count: number;
description: string;
color: string;
}
const MAX_TAGS = 5;
@@ -41,16 +40,13 @@ export class PersonInterestingComponent {
label,
count: topic.count ?? 0,
description: (topic.description ?? '').trim(),
color: topicHierarchyColor(topic),
});
}
return tags.sort((a, b) => b.count - a.count).slice(0, MAX_TAGS);
});
getColorClass(index: number): string {
return TOPIC_CHIP_PALETTE[index % TOPIC_CHIP_PALETTE.length];
}
onTagClick(tag: InterestTag): void {
if (!tag.id) return;
this.tagClick.emit({ id: tag.id, name: tag.label });