feat(news): remove unmatched keywords list

This commit is contained in:
2026-07-06 22:45:19 +02:00
parent 0176eea873
commit 398ea7b56c
3 changed files with 497 additions and 111 deletions
File diff suppressed because one or more lines are too long
@@ -212,31 +212,6 @@
</div>
}
</div>
@if (orphanKeywords.length) {
<div class="chip-group" style="margin-top: 14px">
<span class="chip-group-label"
>Weitere Schlüsselwörter</span
>
<div class="chip-list">
@for (
keyword of orphanKeywords;
track keyword;
let i = $index
) {
<button
type="button"
class="topic-chip kw-chip"
[ngClass]="[
chipColor(i),
activeKeyword === keyword ? 'is-active' : '',
]"
(click)="scrollToKeyword(keyword)">
{{ keyword }}
</button>
}
</div>
</div>
}
} @else {
<p class="placeholder">
Keine Themen oder Schlüsselwörter gefunden.
@@ -6,7 +6,7 @@ import {
ViewChild,
inject,
} from '@angular/core';
import { Location, NgClass } from '@angular/common';
import { Location } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { MatButtonModule } from '@angular/material/button';
@@ -55,7 +55,6 @@ interface NewsArticleDetail {
MatProgressSpinnerModule,
MatTooltipModule,
RouterLink,
NgClass,
],
templateUrl: './news-detail.component.html',
styleUrl: './news-detail.component.scss',
@@ -77,11 +76,8 @@ export class NewsDetailComponent implements OnInit {
personsOpen = true;
topicsOpen = true;
activeKeyword: string | null = null;
expandedTopicId: string | null = null;
private readonly chipColors = ['purple', 'blue', 'green', 'orange', 'pink'];
getTopicColor(topic: MatchedTopic): string {
return topicHierarchyColor({
id: topic.id,
@@ -92,10 +88,6 @@ export class NewsDetailComponent implements OnInit {
});
}
chipColor(index: number): string {
return this.chipColors[index % this.chipColors.length];
}
personInitials(name: string): string {
const parts = name.trim().split(/\s+/);
if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
@@ -104,21 +96,11 @@ export class NewsDetailComponent implements OnInit {
).toUpperCase();
}
get orphanKeywords(): string[] {
const keywords = this.article?.keywords ?? [];
const topics = this.article?.topics ?? [];
const usedKeywords = new Set(
topics.map((t) => t.source_keyword?.toLowerCase()).filter(Boolean),
);
return keywords.filter((kw) => !usedKeywords.has(kw.toLowerCase()));
}
toggleTopic(id: string | null | undefined): void {
this.expandedTopicId = this.expandedTopicId === id ? null : (id ?? null);
}
scrollToKeyword(keyword: string): void {
this.activeKeyword = keyword;
const body = this.articleBodyRef?.nativeElement;
if (!body) return;
body
@@ -176,7 +158,6 @@ export class NewsDetailComponent implements OnInit {
next: (article) => {
this.article = article;
this.highlightedContent = this.buildHighlightedContent(article);
this.activeKeyword = null;
this.expandedTopicId = null;
this.loading = false;
},