From b62dd33a339bdf3210c39da0e9495034b231d94a Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Mon, 8 Jun 2026 22:20:48 +0200 Subject: [PATCH] Adapted the chip design of topics from Forschungtimeline. Implemented routing to Publication search --- .../person-interesting.component.html | 14 +- .../person-interesting.component.scss | 150 ++++++++++++------ .../person-interesting.component.ts | 22 ++- .../app/modules/person/person.component.html | 1 + .../app/modules/person/person.component.ts | 13 ++ 5 files changed, 148 insertions(+), 52 deletions(-) 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 2f26336a..b888bc77 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.html +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.html @@ -7,9 +7,17 @@
@if (tags().length > 0) { - @for (tag of tags(); track tag.label) { - } } @else { 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 b5b804d1..c1b507df 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.scss +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.scss @@ -1,71 +1,127 @@ :host { - display: block; + display: block; } .interest-card { - align-self: center; - padding: 24px 28px; - border-radius: var(--sg-radius-sm); - background: var(--sg-surface-muted); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8); + align-self: center; + padding: 24px 28px; + border-radius: var(--sg-radius-sm); + background: var(--sg-surface-muted); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8); } .interest-header { - display: flex; - align-items: baseline; - gap: 10px; - margin: 0 0 18px; + display: flex; + align-items: baseline; + gap: 10px; + margin: 0 0 18px; } .interest-card h3 { - margin: 0; - font-size: 14px; - font-weight: 700; + margin: 0; + font-size: 14px; + font-weight: 700; } .interest-tags { - display: flex; - flex-wrap: wrap; - gap: 12px; + display: flex; + flex-wrap: wrap; + gap: 12px; } -.interest-tag-button { - padding: 9px 16px; - border: 1px solid #a8c0ff; - border-radius: 7px; - background: #ffffff; - color: var(--sg-primary); - font-size: 13px; - font-weight: 600; - cursor: pointer; - outline: none; - transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease; +.topic-chip { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + justify-items: center; + column-gap: 8px; + box-sizing: border-box; + min-height: 34px; + padding: 6px 12px; + border: 1px solid var(--topic-border); + border-radius: 8px; + background: var(--topic-bg); + color: var(--topic-color); + font-family: inherit; + font-size: 12px; + font-weight: 500; + line-height: 1.25; + cursor: pointer; + transition: transform 0.15s ease, box-shadow 0.15s ease; - &:hover { - background-color: var(--sg-primary-light, #f0f4ff); - border-color: var(--sg-primary); - } + &:hover:not(:disabled) { + transform: translateY(-1px); + box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12); + text-decoration: none; + } - &:active { - transform: scale(0.96); - } + &:disabled { + cursor: default; + } +} - &:focus-visible { - box-shadow: 0 0 0 2px var(--sg-primary-light, #f0f4ff), 0 0 0 4px var(--sg-primary); - } +.topic-name { + min-width: 0; + text-align: center; + overflow-wrap: anywhere; +} + +.topic-count { + display: inline-flex; + flex: 0 0 auto; + align-items: center; + justify-content: center; + min-width: 18px; + height: 18px; + padding: 0 5px; + border-radius: 999px; + background: rgba(255, 255, 255, 0.78); + color: inherit; + font-size: 11px; + font-weight: 700; +} + +.purple { + --topic-border: #d8cafe; + --topic-bg: #f6f0ff; + --topic-color: #7255d9; +} + +.blue { + --topic-border: #bdd4ff; + --topic-bg: #f0f6ff; + --topic-color: #0b63ce; +} + +.green { + --topic-border: #bdebcf; + --topic-bg: #effaf3; + --topic-color: #24834f; +} + +.orange { + --topic-border: #ffd796; + --topic-bg: #fff7e8; + --topic-color: #c67500; +} + +.pink { + --topic-border: #ffc7d7; + --topic-bg: #fff1f5; + --topic-color: #d12f61; } .interest-footnote { - color: var(--sg-text-muted); - font-size: 11px; + color: var(--sg-text-muted); + font-size: 11px; } .interest-tags .interest-empty { - padding: 9px 16px; - border: 1px solid #e2e8f0; - border-style: dashed; - border-radius: 7px; - color: var(--sg-text-muted); - font-size: 13px; - font-weight: 600; -} + padding: 9px 16px; + border: 1px solid #e2e8f0; + border-style: dashed; + border-radius: 7px; + color: var(--sg-text-muted); + font-size: 13px; + font-weight: 600; +} \ No newline at end of file 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 6179a384..f5d0b2bf 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.ts +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.ts @@ -1,25 +1,30 @@ -import { Component, input, computed } from '@angular/core'; +import { Component, input, computed, output } from '@angular/core'; import { MatTooltipModule } from '@angular/material/tooltip'; +import { CommonModule } from '@angular/common'; import { TopicCount } from '../../api'; interface InterestTag { + id: string; label: string; count: number; description: string; } const MAX_TAGS = 5; +const colors = ['purple', 'blue', 'green', 'orange', 'pink']; @Component({ selector: 'app-person-interesting', - imports: [MatTooltipModule], + imports: [CommonModule, MatTooltipModule], templateUrl: './person-interesting.component.html', styleUrl: './person-interesting.component.scss', }) export class PersonInterestingComponent { readonly topics = input(null); + readonly tagClick = output<{ id: string; name: string }>(); + readonly tags = computed(() => { const topicsList = this.topics() ?? []; const tags: InterestTag[] = []; @@ -29,6 +34,7 @@ export class PersonInterestingComponent { if (!label) continue; tags.push({ + id: topic.id ?? '', label, count: topic.count ?? 0, description: (topic.description ?? '').trim(), @@ -37,4 +43,16 @@ export class PersonInterestingComponent { return tags.sort((a, b) => b.count - a.count).slice(0, MAX_TAGS); }); + + getColorClass(index: number): string { + + return colors[index % colors.length]; + } + + onTagClick(tag: InterestTag): void { + if (!tag.id) return; + this.tagClick.emit({ id: tag.id, name: tag.label }); + } } + + diff --git a/webapp/src/app/modules/person/person.component.html b/webapp/src/app/modules/person/person.component.html index ff1a6815..f2c6616f 100644 --- a/webapp/src/app/modules/person/person.component.html +++ b/webapp/src/app/modules/person/person.component.html @@ -58,6 +58,7 @@