From 0b750d27e7c96e04bca96ba131dcb8bc9677bbd5 Mon Sep 17 00:00:00 2001 From: "noemi.kallweit" Date: Mon, 6 Jul 2026 22:18:56 +0200 Subject: [PATCH] feat(news-details): add pagination to 'mentioned persons' accordion, expand only one accordion at a time --- .../news-detail/news-detail.component.html | 41 +++++++++++++---- .../news-detail/news-detail.component.scss | 46 +++++++++++++++++++ .../news-detail/news-detail.component.ts | 21 ++++++++- 3 files changed, 97 insertions(+), 11 deletions(-) diff --git a/webapp/src/app/modules/news-detail/news-detail.component.html b/webapp/src/app/modules/news-detail/news-detail.component.html index c01c2b85..1857d060 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.html +++ b/webapp/src/app/modules/news-detail/news-detail.component.html @@ -83,8 +83,8 @@ - @if (personsOpen) { + @if (openPanel === 'persons') {
@if (article.authors && article.authors.length) {
- @for (person of article.authors; track person.name) { + @for (person of pagedPersons; track person.name) { @if (person.is_ude && person.person_id) { + @if (personsPageCount > 1) { +
+ + {{ personsPage + 1 }} / {{ personsPageCount }} + +
+ } } @else {

Keine erwähnten Personen gefunden.

} @@ -143,8 +166,8 @@ - @if (topicsOpen) { + @if (openPanel === 'topics') {
@if (article.topics && article.topics.length) {
diff --git a/webapp/src/app/modules/news-detail/news-detail.component.scss b/webapp/src/app/modules/news-detail/news-detail.component.scss index 413dfc53..bdc13a3c 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.scss +++ b/webapp/src/app/modules/news-detail/news-detail.component.scss @@ -314,6 +314,52 @@ main { white-space: nowrap; } +// ── Persons pagination ──────────────────────────────────────────────────────── + +.persons-pagination { + display: flex; + align-items: center; + justify-content: center; + gap: 8px; + margin-top: 8px; +} + +.page-btn { + display: grid; + place-items: center; + width: 28px; + height: 28px; + border: 1px solid #d7e4ff; + border-radius: 8px; + background: none; + cursor: pointer; + color: var(--sg-text-muted); + transition: background 0.12s; + + &:hover:not(:disabled) { + background: #f0f6ff; + color: var(--sg-text); + } + + &:disabled { + opacity: 0.35; + cursor: default; + } + + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } +} + +.page-indicator { + font-size: 12px; + color: var(--sg-text-muted); + min-width: 36px; + text-align: center; +} + // ── Topic accordion items ───────────────────────────────────────────────────── .topics-accordion { diff --git a/webapp/src/app/modules/news-detail/news-detail.component.ts b/webapp/src/app/modules/news-detail/news-detail.component.ts index b7192f6c..63100ad5 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.ts +++ b/webapp/src/app/modules/news-detail/news-detail.component.ts @@ -74,10 +74,26 @@ export class NewsDetailComponent implements OnInit { loading = false; notFound = false; - personsOpen = true; - topicsOpen = true; + openPanel: 'persons' | 'topics' | null = 'persons'; expandedTopicId: string | null = null; + personsPage = 0; + readonly personsPageSize = 5; + + get pagedPersons(): MentionedPerson[] { + const authors = this.article?.authors ?? []; + return authors.slice( + this.personsPage * this.personsPageSize, + (this.personsPage + 1) * this.personsPageSize, + ); + } + + get personsPageCount(): number { + return Math.ceil( + (this.article?.authors?.length ?? 0) / this.personsPageSize, + ); + } + getTopicColor(topic: MatchedTopic): string { return topicHierarchyColor({ id: topic.id, @@ -159,6 +175,7 @@ export class NewsDetailComponent implements OnInit { this.article = article; this.highlightedContent = this.buildHighlightedContent(article); this.expandedTopicId = null; + this.personsPage = 0; this.loading = false; }, error: () => {