Merge remote-tracking branch 'origin/dev' into ts-85-add-topic-id-to-timeline
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -7,9 +7,17 @@
|
||||
</div>
|
||||
<div class="interest-tags">
|
||||
@if (tags().length > 0) {
|
||||
@for (tag of tags(); track tag.label) {
|
||||
<button type="button" class="interest-tag-button" [matTooltip]="tag.description">
|
||||
{{ tag.label }} ({{ tag.count }}*)
|
||||
@for (tag of tags(); track tag.label; let i = $index) {
|
||||
<button
|
||||
type="button"
|
||||
class="topic-chip"
|
||||
[ngClass]="getColorClass(i)"
|
||||
[matTooltip]="tag.description"
|
||||
[disabled]="!tag.id"
|
||||
(click)="onTagClick(tag)"
|
||||
>
|
||||
<span class="topic-name">{{ tag.label }}</span>
|
||||
<span class="topic-count">{{ tag.count }}*</span>
|
||||
</button>
|
||||
}
|
||||
} @else {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<TopicCount[] | null>(null);
|
||||
|
||||
readonly tagClick = output<{ id: string; name: string }>();
|
||||
|
||||
readonly tags = computed<InterestTag[]>(() => {
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
</aside>
|
||||
<app-person-interesting
|
||||
[topics]="primaryTopicCounts()"
|
||||
(tagClick)="onInterestingTagClick($event)"
|
||||
></app-person-interesting>
|
||||
</section>
|
||||
<nav class="person-tabs" mat-tab-nav-bar [tabPanel]="tabPanel">
|
||||
|
||||
@@ -195,6 +195,19 @@ export class PersonComponent {
|
||||
{ label: 'Förderungen', path: 'funding', disabled: false },
|
||||
];
|
||||
|
||||
onInterestingTagClick(selection: { id: string; name: string }): void {
|
||||
if (!selection.id) return;
|
||||
|
||||
void this.router.navigate(['publications'], {
|
||||
relativeTo: this.activatedRoute,
|
||||
queryParams: {
|
||||
publicationPage: 1,
|
||||
publicationTopicId: selection.id,
|
||||
publicationTopicName: selection.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private getId(key: string): string | null {
|
||||
const ids = this.person()?.ids as Record<string, string> | undefined;
|
||||
if (!ids) {
|
||||
|
||||
Reference in New Issue
Block a user