Merge branch 'dev' of https://project.nes.uni-due.de/gitea/lbs/smartguide into feature/Keyword_search_rework
This commit is contained in:
@@ -186,7 +186,7 @@ export class AccountComponent {
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
this.roles = [this.accountProfile().role];
|
||||
this.roles = this.accountProfile().roles;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Rolle</mat-label>
|
||||
<mat-select formControlName="role">
|
||||
<mat-select formControlName="roles" multiple>
|
||||
@for (role of data.roles; track role) {
|
||||
<mat-option [value]="role">{{ role }}</mat-option>
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export interface AccountDialogData {
|
||||
export interface AccountPayload {
|
||||
email?: string;
|
||||
name?: string;
|
||||
role?: UserRole;
|
||||
roles?: UserRole[];
|
||||
organization_id?: string;
|
||||
password?: string;
|
||||
deleted?: boolean;
|
||||
@@ -45,7 +45,7 @@ export interface AccountPayload {
|
||||
export interface CreateAccountPayload {
|
||||
email: string;
|
||||
name: string;
|
||||
role: UserRole;
|
||||
roles: UserRole[];
|
||||
organization_id: string;
|
||||
password: string;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ export class AccountDialogComponent {
|
||||
name: new FormControl<string>(this.data.account?.name ?? '', [
|
||||
Validators.required,
|
||||
]),
|
||||
role: new FormControl<UserRole>(this.data.account?.role ?? 'USER', [
|
||||
roles: new FormControl<UserRole[]>(this.data.account?.roles ?? ['USER'], [
|
||||
Validators.required,
|
||||
]),
|
||||
organizationId: new FormControl<string>(
|
||||
@@ -115,7 +115,7 @@ export class AccountDialogComponent {
|
||||
payload: {
|
||||
email: value.email ?? '',
|
||||
name: value.name ?? '',
|
||||
role: value.role ?? 'USER',
|
||||
roles: value.roles ?? ['USER'],
|
||||
organization_id: value.organizationId ?? '',
|
||||
password: value.password ?? '',
|
||||
},
|
||||
@@ -128,7 +128,7 @@ export class AccountDialogComponent {
|
||||
|
||||
const email = (value.email ?? '').trim();
|
||||
const name = (value.name ?? '').trim();
|
||||
const role = value.role ?? account.role;
|
||||
const roles = value.roles ?? account.roles;
|
||||
const organizationId = value.organizationId ?? account.organization_id;
|
||||
const password = value.password?.trim() ?? '';
|
||||
|
||||
@@ -140,8 +140,8 @@ export class AccountDialogComponent {
|
||||
payload.name = name;
|
||||
}
|
||||
|
||||
if (role !== account.role) {
|
||||
payload.role = role;
|
||||
if (!this.sameRoles(roles, account.roles)) {
|
||||
payload.roles = roles;
|
||||
}
|
||||
|
||||
if (password) {
|
||||
@@ -166,4 +166,10 @@ export class AccountDialogComponent {
|
||||
protected close(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
private sameRoles(left: UserRole[], right: UserRole[]): boolean {
|
||||
return (
|
||||
left.length === right.length && left.every((role) => right.includes(role))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@
|
||||
</section>
|
||||
|
||||
<ng-template #accountRoleTmp let-row>
|
||||
<span class="role">{{ row.role | role }}</span>
|
||||
@for (role of row.roles; track role) {
|
||||
<span class="role">{{ role | role }}</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #accountStatusTmp let-row>
|
||||
|
||||
@@ -126,10 +126,10 @@ export class AccountsComponent implements OnInit {
|
||||
accessorKey: 'organization_name',
|
||||
},
|
||||
{
|
||||
id: 'role',
|
||||
id: 'roles',
|
||||
header: 'Rolle',
|
||||
type: 'accessor',
|
||||
accessorKey: 'role',
|
||||
accessorKey: 'roles',
|
||||
cellTemplate: this.accountRoleTmp(),
|
||||
},
|
||||
{
|
||||
@@ -325,7 +325,22 @@ export class AccountsComponent implements OnInit {
|
||||
|
||||
return (
|
||||
this.credentialService.isEffectiveAdmin() &&
|
||||
(account.role === 'MANAGER' || account.role === 'USER')
|
||||
(this.effectiveRole(account) === 'MANAGER' ||
|
||||
this.effectiveRole(account) === 'USER')
|
||||
);
|
||||
}
|
||||
|
||||
protected effectiveRole(account: AccountProfile): UserRole {
|
||||
const roles = account.roles;
|
||||
if (roles.includes('SUPER_ADMIN')) {
|
||||
return 'SUPER_ADMIN';
|
||||
}
|
||||
if (roles.includes('ADMIN')) {
|
||||
return 'ADMIN';
|
||||
}
|
||||
if (roles.includes('MANAGER')) {
|
||||
return 'MANAGER';
|
||||
}
|
||||
return 'USER';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<main class="bookmarks-page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<p class="eyebrow">Meine Sammlung</p>
|
||||
<h1>Bookmarks</h1>
|
||||
<p>Gespeicherte Personen für den schnellen Zugriff.</p>
|
||||
</div>
|
||||
<div class="bookmark-count">
|
||||
<mat-icon>bookmarks</mat-icon>
|
||||
<strong>{{ persons().length }}</strong>
|
||||
<span>Personen</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@if (loading()) {
|
||||
<div class="loading-state">
|
||||
<mat-spinner diameter="42"></mat-spinner>
|
||||
<p>Bookmarks werden geladen …</p>
|
||||
</div>
|
||||
} @else if (persons().length) {
|
||||
<section class="person-grid" aria-label="Gespeicherte Personen">
|
||||
@for (person of persons(); track person.id) {
|
||||
<app-person-card
|
||||
[person]="person"
|
||||
[isBookmarked]="bookmarkService.isBookmarked(person.id)"
|
||||
(bookmarkToggle)="toggleBookmark($event)">
|
||||
</app-person-card>
|
||||
}
|
||||
</section>
|
||||
} @else {
|
||||
<section class="empty-state">
|
||||
<mat-icon>bookmark_border</mat-icon>
|
||||
<h2>Noch keine Bookmarks</h2>
|
||||
<p>
|
||||
Speichere Personen über das Bookmark-Symbol auf einer Personenkarte.
|
||||
</p>
|
||||
</section>
|
||||
}
|
||||
</main>
|
||||
@@ -0,0 +1,98 @@
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.bookmarks-page {
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
margin-bottom: 30px;
|
||||
|
||||
h1 {
|
||||
margin: 2px 0 6px;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #667085;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
color: #3f51b5;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
.bookmark-count {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
align-items: center;
|
||||
gap: 0 10px;
|
||||
padding: 14px 18px;
|
||||
border: 1px solid #e4e7ec;
|
||||
border-radius: 14px;
|
||||
background: white;
|
||||
|
||||
mat-icon {
|
||||
grid-row: 1 / 3;
|
||||
color: #3f51b5;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #667085;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.person-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.loading-state,
|
||||
.empty-state {
|
||||
display: flex;
|
||||
min-height: 320px;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
color: #667085;
|
||||
}
|
||||
|
||||
.empty-state mat-icon {
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
font-size: 54px;
|
||||
color: #98a2b3;
|
||||
}
|
||||
|
||||
.empty-state h2 {
|
||||
margin: 16px 0 6px;
|
||||
color: #1d2939;
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.bookmarks-page {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, DestroyRef, inject, signal } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { catchError, forkJoin, map, of, switchMap } from 'rxjs';
|
||||
|
||||
import { CustomAuthor, PersonsService } from '../../api';
|
||||
import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||
import { PersonCardComponent } from '../person-card/person-card.component';
|
||||
|
||||
const PERSON_INCLUDE_TAGS =
|
||||
'display_name,works_count,cited_by_count,summary_stats,ids,' +
|
||||
'last_known_institutions,affiliations,topics,orcid,topics_full,' +
|
||||
'topic_share,career_metrics';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bookmarks',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatIconModule,
|
||||
MatProgressSpinnerModule,
|
||||
PersonCardComponent,
|
||||
],
|
||||
templateUrl: './bookmarks.component.html',
|
||||
styleUrl: './bookmarks.component.scss',
|
||||
})
|
||||
export class BookmarksComponent {
|
||||
readonly bookmarkService = inject(BookmarkService);
|
||||
private readonly personsService = inject(PersonsService);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
readonly persons = signal<CustomAuthor[]>([]);
|
||||
readonly loading = signal(true);
|
||||
|
||||
constructor() {
|
||||
this.loadBookmarks();
|
||||
}
|
||||
|
||||
toggleBookmark(person: CustomAuthor): void {
|
||||
this.bookmarkService
|
||||
.confirmToggle(person)
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe({
|
||||
next: (bookmarked) => {
|
||||
if (!bookmarked) {
|
||||
const id = this.personId(person);
|
||||
this.persons.update((persons) =>
|
||||
persons.filter((item) => this.personId(item) !== id),
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private loadBookmarks(): void {
|
||||
this.bookmarkService
|
||||
.load(true)
|
||||
.pipe(
|
||||
switchMap((bookmarks) => {
|
||||
if (!bookmarks.length) return of([] as CustomAuthor[]);
|
||||
return forkJoin(
|
||||
bookmarks.map((bookmark) =>
|
||||
this.personsService
|
||||
.getPersonByID(bookmark.person_id, PERSON_INCLUDE_TAGS)
|
||||
.pipe(
|
||||
map(
|
||||
(response) =>
|
||||
response.results?.[0] ?? {
|
||||
id: bookmark.person_id,
|
||||
display_name: bookmark.person_name,
|
||||
},
|
||||
),
|
||||
catchError(() =>
|
||||
of({
|
||||
id: bookmark.person_id,
|
||||
display_name: bookmark.person_name,
|
||||
} as CustomAuthor),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe({
|
||||
next: (persons) => {
|
||||
this.persons.set(persons);
|
||||
this.loading.set(false);
|
||||
},
|
||||
error: () => this.loading.set(false),
|
||||
});
|
||||
}
|
||||
|
||||
private personId(person: CustomAuthor): string {
|
||||
return person.id?.replace(/\/$/, '').split('/').pop() ?? '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { Configuration } from '../../api';
|
||||
|
||||
export type TopAuthorsWorksPeriod = 'all_time' | 'last_5_years';
|
||||
|
||||
export interface DashboardStatistics {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
publications: number;
|
||||
persons: number;
|
||||
projects: number;
|
||||
dfg_projects: number;
|
||||
eu_projects: number;
|
||||
bmbf_projects: number;
|
||||
}
|
||||
|
||||
export interface DashboardStatisticValue {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface TopAuthor {
|
||||
id?: string | null;
|
||||
name: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface TopAuthorStatistics {
|
||||
institution_id: string;
|
||||
works: TopAuthor[];
|
||||
projects: TopAuthor[];
|
||||
patents: TopAuthor[];
|
||||
news: TopAuthor[];
|
||||
}
|
||||
|
||||
export interface TopicHeatmapValue {
|
||||
year: number;
|
||||
count: number;
|
||||
share: number;
|
||||
}
|
||||
|
||||
export interface TopicHeatmapField {
|
||||
id: string;
|
||||
name: string;
|
||||
total: number;
|
||||
values: TopicHeatmapValue[];
|
||||
}
|
||||
|
||||
export interface TopicHeatmap {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
years: number[];
|
||||
fields: TopicHeatmapField[];
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DashboardStatisticsService {
|
||||
private readonly httpClient = inject(HttpClient);
|
||||
private readonly apiConfiguration = inject(Configuration, { optional: true });
|
||||
|
||||
getStatistics(): Observable<DashboardStatistics> {
|
||||
return this.httpClient.get<DashboardStatistics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics`,
|
||||
);
|
||||
}
|
||||
|
||||
getPublicationCount(): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/publications`,
|
||||
);
|
||||
}
|
||||
|
||||
getPersonCount(): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/persons`,
|
||||
);
|
||||
}
|
||||
|
||||
getEuProjectCount(): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/eu`,
|
||||
);
|
||||
}
|
||||
|
||||
getBmbfProjectCount(): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/bmbf`,
|
||||
);
|
||||
}
|
||||
|
||||
getDfgProjectCount(): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/dfg`,
|
||||
);
|
||||
}
|
||||
|
||||
getTopAuthors(
|
||||
worksPeriod: TopAuthorsWorksPeriod = 'all_time',
|
||||
): Observable<TopAuthorStatistics> {
|
||||
return this.httpClient.get<TopAuthorStatistics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/top-authors`,
|
||||
{
|
||||
params: { works_period: worksPeriod },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
getTopicHeatmap(
|
||||
fromYear?: number,
|
||||
toYear?: number,
|
||||
): Observable<TopicHeatmap> {
|
||||
const params: Record<string, number> = {};
|
||||
if (fromYear !== undefined) params['from_year'] = fromYear;
|
||||
if (toYear !== undefined) params['to_year'] = toYear;
|
||||
|
||||
return this.httpClient.get<TopicHeatmap>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/topic-heatmap`,
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +1,256 @@
|
||||
<div class="dashboard-wrapper">
|
||||
<header class="dashboard-header">
|
||||
<h2>University Performance Dashboard</h2>
|
||||
<div class="controls">
|
||||
<select
|
||||
[value]="selectedTopic"
|
||||
(change)="onTopicChange($any($event.target).value)">
|
||||
@for (t of topics; track t) {
|
||||
<option [value]="t">{{ t }}</option>
|
||||
}
|
||||
</select>
|
||||
|
||||
<div class="toggle-group">
|
||||
<button
|
||||
[class.active]="metric === 'publications'"
|
||||
(click)="setMetric('publications')">
|
||||
Publications
|
||||
</button>
|
||||
<button
|
||||
[class.active]="metric === 'citations'"
|
||||
(click)="setMetric('citations')">
|
||||
Citations
|
||||
</button>
|
||||
<section class="statistics-grid" aria-label="Kennzahlen">
|
||||
<a
|
||||
class="statistics-card"
|
||||
[routerLink]="['/institution', institutionRouteId(), 'publications']"
|
||||
[class.disabled]="!institutionRouteId()"
|
||||
[attr.aria-disabled]="!institutionRouteId()"
|
||||
[attr.aria-label]="
|
||||
'Publikationen von ' + organizationName() + ' anzeigen'
|
||||
">
|
||||
<div class="statistics-icon statistics-icon--publications">
|
||||
<mat-icon>menu_book</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div>
|
||||
<span>Publikationen</span>
|
||||
<strong>
|
||||
{{
|
||||
isStatisticLoading('publications')
|
||||
? '…'
|
||||
: ((statistics?.publications | number) ?? '–')
|
||||
}}
|
||||
</strong>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<div class="content-grid">
|
||||
<section class="chart-section">
|
||||
<app-university-line-chart
|
||||
[data]="rawDataSource"
|
||||
[metric]="metric"></app-university-line-chart>
|
||||
<a
|
||||
class="statistics-card"
|
||||
routerLink="/persons"
|
||||
[queryParams]="{ institutionName: organizationName() }"
|
||||
[attr.aria-label]="'Personen von ' + organizationName() + ' anzeigen'">
|
||||
<div class="statistics-icon statistics-icon--persons">
|
||||
<mat-icon>groups</mat-icon>
|
||||
</div>
|
||||
<div>
|
||||
<span>Personen</span>
|
||||
<strong>
|
||||
{{
|
||||
isStatisticLoading('persons')
|
||||
? '…'
|
||||
: ((statistics?.persons | number) ?? '–')
|
||||
}}
|
||||
</strong>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a
|
||||
class="statistics-card"
|
||||
routerLink="/projects"
|
||||
[queryParams]="{ selected_project_types: 'eu' }"
|
||||
aria-label="EU-Projekte anzeigen">
|
||||
<div class="statistics-icon statistics-icon--eu-projects">
|
||||
<mat-icon>public</mat-icon>
|
||||
</div>
|
||||
<div>
|
||||
<span>EU-Projekte</span>
|
||||
<strong>
|
||||
{{
|
||||
isStatisticLoading('eu_projects')
|
||||
? '…'
|
||||
: ((statistics?.eu_projects | number) ?? '–')
|
||||
}}
|
||||
</strong>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a
|
||||
class="statistics-card"
|
||||
routerLink="/projects"
|
||||
[queryParams]="{ selected_project_types: 'bund' }"
|
||||
aria-label="Bund-Projekte anzeigen">
|
||||
<div class="statistics-icon statistics-icon--bund-projects">
|
||||
<mat-icon>account_balance</mat-icon>
|
||||
</div>
|
||||
<div>
|
||||
<span>Bund-Projekte</span>
|
||||
<strong>
|
||||
{{
|
||||
isStatisticLoading('bmbf_projects')
|
||||
? '…'
|
||||
: ((statistics?.bmbf_projects | number) ?? '–')
|
||||
}}
|
||||
</strong>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a
|
||||
class="statistics-card"
|
||||
routerLink="/projects"
|
||||
[queryParams]="{ selected_project_types: 'dfg' }"
|
||||
aria-label="DFG-Projekte anzeigen">
|
||||
<div class="statistics-icon statistics-icon--dfg-projects">
|
||||
<mat-icon>science</mat-icon>
|
||||
</div>
|
||||
<div>
|
||||
<span>DFG-Projekte</span>
|
||||
<strong>
|
||||
{{
|
||||
isStatisticLoading('dfg_projects')
|
||||
? '…'
|
||||
: ((statistics?.dfg_projects | number) ?? '–')
|
||||
}}
|
||||
</strong>
|
||||
</div>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
@if (statisticsError) {
|
||||
<p class="statistics-error">Die Kennzahlen konnten nicht geladen werden.</p>
|
||||
}
|
||||
|
||||
@if (topicHeatmapLoading || topicHeatmapError || hasTopicHeatmapData()) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>Field Treemap</h2>
|
||||
<p>Publikationen Ihrer Organisation nach Field.</p>
|
||||
</div>
|
||||
<div class="topic-treemap-period-controls" aria-label="Zeitraum">
|
||||
<div class="topic-treemap-period-toggle">
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="topicTreemapPeriod === 'last_5_years'"
|
||||
(click)="setTopicTreemapPeriod('last_5_years')">
|
||||
5 Jahre
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="topicTreemapPeriod === 'last_10_years'"
|
||||
(click)="setTopicTreemapPeriod('last_10_years')">
|
||||
10 Jahre
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="topicTreemapPeriod === 'all_time'"
|
||||
(click)="setTopicTreemapPeriod('all_time')">
|
||||
Alle
|
||||
</button>
|
||||
</div>
|
||||
<label>
|
||||
Von
|
||||
<input
|
||||
type="number"
|
||||
min="1900"
|
||||
max="2100"
|
||||
[value]="topicTreemapFromYear"
|
||||
(change)="
|
||||
onTopicTreemapYearChange('from', $any($event.target).value)
|
||||
" />
|
||||
</label>
|
||||
<label>
|
||||
Bis
|
||||
<input
|
||||
type="number"
|
||||
min="1900"
|
||||
max="2100"
|
||||
[value]="topicTreemapToYear"
|
||||
(change)="
|
||||
onTopicTreemapYearChange('to', $any($event.target).value)
|
||||
" />
|
||||
</label>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@if (topicHeatmapError) {
|
||||
<p class="statistics-error">
|
||||
Die Field-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<app-topic-heatmap
|
||||
[heatmap]="topicHeatmap"
|
||||
[loading]="topicHeatmapLoading"></app-topic-heatmap>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
|
||||
<aside class="table-section">
|
||||
<app-university-ranking-table
|
||||
[rankings]="computedRankings"
|
||||
[loading]="isLoading"></app-university-ranking-table>
|
||||
</aside>
|
||||
</div>
|
||||
@if (topAuthorsLoading || topAuthorsError || hasTopAuthorData()) {
|
||||
<section class="top-authors-section">
|
||||
<header class="top-authors-header">
|
||||
<div>
|
||||
<h2>Top 10 Personen aller Zeiten</h2>
|
||||
<p>Nach Anzahl der Works, Patente und News Ihrer Organisation.</p>
|
||||
</div>
|
||||
<div class="top-authors-period-toggle" aria-label="Works-Zeitraum">
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="topAuthorsWorksPeriod === 'all_time'"
|
||||
(click)="setTopAuthorsWorksPeriod('all_time')">
|
||||
Alle Zeiten
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="topAuthorsWorksPeriod === 'last_5_years'"
|
||||
(click)="setTopAuthorsWorksPeriod('last_5_years')">
|
||||
Letzte 5 Jahre
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@if (topAuthorsError) {
|
||||
<p class="statistics-error">
|
||||
Die Autorenstatistiken konnten nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<div class="top-authors-grid" [class.loading]="topAuthorsLoading">
|
||||
@for (dataset of visibleTopAuthorDatasets(); track dataset.title) {
|
||||
<article class="top-authors-chart">
|
||||
<h3>
|
||||
<mat-icon>{{ dataset.icon }}</mat-icon
|
||||
>{{ dataset.title }}
|
||||
</h3>
|
||||
@for (
|
||||
entry of dataset.entries;
|
||||
track entry.id || entry.name;
|
||||
let rank = $index
|
||||
) {
|
||||
<div class="author-bar-row">
|
||||
<span class="author-rank">{{ rank + 1 }}</span>
|
||||
<div class="author-bar-content">
|
||||
<div class="author-bar-label">
|
||||
@if (entry.id) {
|
||||
<a
|
||||
class="author-link"
|
||||
[routerLink]="['/person', entry.id, 'overview']"
|
||||
[title]="entry.name">
|
||||
{{ entry.name }}
|
||||
</a>
|
||||
} @else {
|
||||
<span [title]="entry.name">{{ entry.name }}</span>
|
||||
}
|
||||
<strong>{{ entry.count | number }}</strong>
|
||||
</div>
|
||||
<div class="author-bar-track">
|
||||
<span
|
||||
class="author-bar-fill"
|
||||
[style.width.%]="
|
||||
authorBarWidth(dataset.entries, entry.count)
|
||||
"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
} @empty {
|
||||
<p class="empty-chart">
|
||||
{{
|
||||
topAuthorsLoading
|
||||
? 'Wird geladen …'
|
||||
: 'Keine Daten vorhanden.'
|
||||
}}
|
||||
</p>
|
||||
}
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -4,92 +4,349 @@
|
||||
font-family: 'Inter', sans-serif;
|
||||
color: #333;
|
||||
|
||||
.dashboard-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.statistics-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||
gap: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.content-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 1fr;
|
||||
gap: 2rem;
|
||||
.statistics-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
min-height: 120px;
|
||||
padding: 1.25rem;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 4px 14px rgb(15 23 42 / 6%);
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
transition:
|
||||
border-color 160ms ease,
|
||||
box-shadow 160ms ease,
|
||||
transform 160ms ease;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
&:hover {
|
||||
border-color: #93c5fd;
|
||||
box-shadow: 0 8px 24px rgb(15 23 42 / 12%);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 3px solid #93c5fd;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
span,
|
||||
small {
|
||||
display: block;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
strong {
|
||||
display: block;
|
||||
margin: 0.2rem 0;
|
||||
color: #0f172a;
|
||||
font-size: clamp(1.7rem, 3vw, 2.3rem);
|
||||
line-height: 1.1;
|
||||
}
|
||||
}
|
||||
|
||||
.statistics-icon {
|
||||
display: grid;
|
||||
flex: 0 0 52px;
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
place-items: center;
|
||||
border-radius: 12px;
|
||||
background: #dbeafe;
|
||||
color: #1d4ed8;
|
||||
|
||||
&--persons {
|
||||
background: #dcfce7;
|
||||
color: #15803d;
|
||||
}
|
||||
|
||||
&--eu-projects {
|
||||
background: #e0f2fe;
|
||||
color: #0369a1;
|
||||
}
|
||||
|
||||
&--bund-projects {
|
||||
background: #fef3c7;
|
||||
color: #b45309;
|
||||
}
|
||||
|
||||
&--dfg-projects {
|
||||
background: #f3e8ff;
|
||||
color: #7e22ce;
|
||||
}
|
||||
}
|
||||
|
||||
.statistics-error {
|
||||
margin: -1rem 0 2rem;
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.top-authors-section {
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
.topic-heatmap-section {
|
||||
margin-bottom: 2.5rem;
|
||||
padding: 1.25rem;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.topic-heatmap-header {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
h2,
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0.35rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
@media (max-width: 820px) {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-treemap-period-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.65rem;
|
||||
|
||||
label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
color: #475569;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 5.5rem;
|
||||
padding: 0.45rem 0.55rem;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
color: #0f172a;
|
||||
font: inherit;
|
||||
|
||||
&:focus {
|
||||
border-color: #93c5fd;
|
||||
outline: 3px solid #bfdbfe;
|
||||
outline-offset: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.topic-treemap-period-toggle {
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
|
||||
button {
|
||||
padding: 0.5rem 0.7rem;
|
||||
border: 0;
|
||||
border-right: 1px solid #cbd5e1;
|
||||
background: transparent;
|
||||
color: #334155;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
font-weight: 600;
|
||||
|
||||
&:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #1d4ed8;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 3px solid #93c5fd;
|
||||
outline-offset: -3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top-authors-header {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
h2,
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0.35rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.top-authors-period-toggle {
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
|
||||
button {
|
||||
padding: 0.55rem 0.8rem;
|
||||
border: 0;
|
||||
border-right: 1px solid #cbd5e1;
|
||||
background: transparent;
|
||||
color: #334155;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
|
||||
&:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #1d4ed8;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 3px solid #93c5fd;
|
||||
outline-offset: -3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top-authors-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 1rem;
|
||||
|
||||
&.loading {
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.controls {
|
||||
.top-authors-chart {
|
||||
padding: 1.25rem;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
|
||||
h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin: 0 0 1rem;
|
||||
color: #0f172a;
|
||||
}
|
||||
}
|
||||
|
||||
.author-bar-row {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
|
||||
select {
|
||||
padding: 0.5rem;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.toggle-group {
|
||||
button {
|
||||
padding: 0.5rem 1rem;
|
||||
border: 1px solid #0056b3;
|
||||
background: white;
|
||||
color: #0056b3;
|
||||
cursor: pointer;
|
||||
&:first-child {
|
||||
border-radius: 4px 0 0 4px;
|
||||
}
|
||||
&:last-child {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
&.active {
|
||||
background: #0056b3;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Table styling
|
||||
.ranking-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.9rem;
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 0.75rem;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
align-items: center;
|
||||
gap: 0.65rem;
|
||||
margin-top: 0.7rem;
|
||||
}
|
||||
|
||||
.top-tier {
|
||||
background-color: #f8fbff;
|
||||
font-weight: 600;
|
||||
}
|
||||
.positive {
|
||||
color: #28a745;
|
||||
}
|
||||
.negative {
|
||||
color: #dc3545;
|
||||
}
|
||||
.mover-badge {
|
||||
margin-left: 4px;
|
||||
.author-rank {
|
||||
flex: 0 0 1.4rem;
|
||||
color: #64748b;
|
||||
font-size: 0.8rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.trend-col {
|
||||
font-weight: bold;
|
||||
&[data-trend='up'] {
|
||||
color: #28a745;
|
||||
}
|
||||
&[data-trend='down'] {
|
||||
color: #dc3545;
|
||||
.author-bar-content {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.author-bar-label {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 0.85rem;
|
||||
|
||||
span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.author-link {
|
||||
overflow: hidden;
|
||||
color: #1d4ed8;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
border-radius: 2px;
|
||||
outline: 2px solid #93c5fd;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.author-bar-track {
|
||||
overflow: hidden;
|
||||
height: 7px;
|
||||
border-radius: 999px;
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.author-bar-fill {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-radius: inherit;
|
||||
background: linear-gradient(90deg, #2563eb, #60a5fa);
|
||||
transition: width 220ms ease;
|
||||
}
|
||||
|
||||
.empty-chart {
|
||||
margin: 2rem 0;
|
||||
color: #64748b;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +1,275 @@
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { UniversityLineChartComponent } from '../university-ranking/uni-line-chart/uni-line-chart.component';
|
||||
import { UniversityRankingTableComponent } from '../university-ranking/uni-ranking-table/uni-ranking-table.component';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { Observable, finalize } from 'rxjs';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { TopicHeatmapComponent } from './topic-heatmap/topic-heatmap.component';
|
||||
import {
|
||||
UniversityTopicData,
|
||||
UniversityRanking,
|
||||
UniversityRankingsService,
|
||||
} from '../../api';
|
||||
|
||||
export type ResearchTopic = string;
|
||||
export type DashboardMetric = 'publications' | 'citations';
|
||||
DashboardStatisticValue,
|
||||
DashboardStatistics,
|
||||
DashboardStatisticsService,
|
||||
TopAuthor,
|
||||
TopAuthorStatistics,
|
||||
TopAuthorsWorksPeriod,
|
||||
TopicHeatmap,
|
||||
} from './dashboard-statistics.service';
|
||||
type DashboardStatisticKey =
|
||||
| 'publications'
|
||||
| 'persons'
|
||||
| 'eu_projects'
|
||||
| 'bmbf_projects'
|
||||
| 'dfg_projects';
|
||||
type TopicTreemapPeriod =
|
||||
| 'last_5_years'
|
||||
| 'last_10_years'
|
||||
| 'all_time'
|
||||
| 'custom';
|
||||
|
||||
@Component({
|
||||
selector: 'dashboard',
|
||||
imports: [UniversityLineChartComponent, UniversityRankingTableComponent],
|
||||
imports: [DecimalPipe, MatIconModule, RouterLink, TopicHeatmapComponent],
|
||||
templateUrl: './dashboard.component.html',
|
||||
styleUrl: './dashboard.component.scss',
|
||||
})
|
||||
export class DashboardComponent implements OnInit {
|
||||
private readonly dataService = inject(UniversityRankingsService);
|
||||
statistics?: Partial<DashboardStatistics>;
|
||||
statisticsLoading = false;
|
||||
statisticsError = false;
|
||||
statisticLoading: Record<DashboardStatisticKey, boolean> = {
|
||||
publications: false,
|
||||
persons: false,
|
||||
eu_projects: false,
|
||||
bmbf_projects: false,
|
||||
dfg_projects: false,
|
||||
};
|
||||
statisticErrors: Record<DashboardStatisticKey, boolean> = {
|
||||
publications: false,
|
||||
persons: false,
|
||||
eu_projects: false,
|
||||
bmbf_projects: false,
|
||||
dfg_projects: false,
|
||||
};
|
||||
private pendingStatisticRequests = 0;
|
||||
topAuthors?: TopAuthorStatistics;
|
||||
topAuthorsLoading = false;
|
||||
topAuthorsError = false;
|
||||
topAuthorsWorksPeriod: TopAuthorsWorksPeriod = 'all_time';
|
||||
topicHeatmap?: TopicHeatmap;
|
||||
topicHeatmapLoading = false;
|
||||
topicHeatmapError = false;
|
||||
topicTreemapPeriod: TopicTreemapPeriod = 'last_5_years';
|
||||
topicTreemapFromYear = new Date().getFullYear() - 4;
|
||||
topicTreemapToYear = new Date().getFullYear();
|
||||
|
||||
topics: ResearchTopic[] = [
|
||||
'Quantum Computing',
|
||||
'Renewable Energy',
|
||||
'Artificial Intelligence and Decision Support Systems',
|
||||
];
|
||||
selectedTopic: ResearchTopic = 'Quantum Computing';
|
||||
metric: DashboardMetric = 'publications';
|
||||
|
||||
rawDataSource: UniversityTopicData[] = [];
|
||||
computedRankings: UniversityRanking[] = [];
|
||||
isLoading = false;
|
||||
constructor(private statisticsService: DashboardStatisticsService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadData();
|
||||
this.loadStatistics();
|
||||
this.loadTopAuthors();
|
||||
this.loadTopicHeatmap();
|
||||
}
|
||||
|
||||
onTopicChange(topic: ResearchTopic) {
|
||||
this.selectedTopic = topic;
|
||||
this.loadData(); // Re-fetch as rankings depend on the topic
|
||||
private loadStatistics(): void {
|
||||
this.statisticsError = false;
|
||||
this.loadStatistic(
|
||||
'publications',
|
||||
this.statisticsService.getPublicationCount(),
|
||||
);
|
||||
this.loadStatistic('persons', this.statisticsService.getPersonCount());
|
||||
this.loadStatistic(
|
||||
'eu_projects',
|
||||
this.statisticsService.getEuProjectCount(),
|
||||
);
|
||||
this.loadStatistic(
|
||||
'bmbf_projects',
|
||||
this.statisticsService.getBmbfProjectCount(),
|
||||
);
|
||||
this.loadStatistic(
|
||||
'dfg_projects',
|
||||
this.statisticsService.getDfgProjectCount(),
|
||||
);
|
||||
}
|
||||
|
||||
setMetric(metric: DashboardMetric) {
|
||||
this.metric = metric;
|
||||
this.loadData(); // Re-fetch as ranking order changes based on metric
|
||||
isStatisticLoading(key: DashboardStatisticKey): boolean {
|
||||
return this.statisticLoading[key];
|
||||
}
|
||||
|
||||
private loadData() {
|
||||
this.isLoading = true;
|
||||
this.dataService
|
||||
.getRankingsApiInseServiceUniversityRankingsGet(
|
||||
this.selectedTopic,
|
||||
this.metric,
|
||||
topAuthorDatasets(): Array<{
|
||||
title: string;
|
||||
icon: string;
|
||||
entries: TopAuthor[];
|
||||
}> {
|
||||
return [
|
||||
{
|
||||
title: 'Publikationen',
|
||||
icon: 'menu_book',
|
||||
entries: this.topAuthors?.works ?? [],
|
||||
},
|
||||
{
|
||||
title: 'Patente',
|
||||
icon: 'description',
|
||||
entries: this.topAuthors?.patents ?? [],
|
||||
},
|
||||
{ title: 'News', icon: 'article', entries: this.topAuthors?.news ?? [] },
|
||||
];
|
||||
}
|
||||
|
||||
visibleTopAuthorDatasets(): Array<{
|
||||
title: string;
|
||||
icon: string;
|
||||
entries: TopAuthor[];
|
||||
}> {
|
||||
const datasets = this.topAuthorDatasets();
|
||||
return this.topAuthorsLoading
|
||||
? datasets
|
||||
: datasets.filter((dataset) => dataset.entries.length > 0);
|
||||
}
|
||||
|
||||
hasTopAuthorData(): boolean {
|
||||
return this.topAuthorDatasets().some(
|
||||
(dataset) => dataset.entries.length > 0,
|
||||
);
|
||||
}
|
||||
|
||||
hasTopicHeatmapData(): boolean {
|
||||
return (this.topicHeatmap?.fields ?? []).some(
|
||||
(field) =>
|
||||
field.total > 0 || field.values.some((value) => value.count > 0),
|
||||
);
|
||||
}
|
||||
|
||||
setTopAuthorsWorksPeriod(period: TopAuthorsWorksPeriod): void {
|
||||
if (period === this.topAuthorsWorksPeriod) return;
|
||||
this.topAuthorsWorksPeriod = period;
|
||||
this.loadTopAuthors();
|
||||
}
|
||||
|
||||
authorBarWidth(entries: TopAuthor[], count: number): number {
|
||||
const maximum = Math.max(...entries.map((entry) => entry.count), 1);
|
||||
return (count / maximum) * 100;
|
||||
}
|
||||
|
||||
organizationName(): string {
|
||||
return this.statistics?.organization_name ?? 'Ihre Organisation';
|
||||
}
|
||||
|
||||
institutionRouteId(): string {
|
||||
return (
|
||||
this.statistics?.institution_id?.replace('https://openalex.org/', '') ??
|
||||
this.topAuthors?.institution_id?.replace('https://openalex.org/', '') ??
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
setTopicTreemapPeriod(period: TopicTreemapPeriod): void {
|
||||
if (period === this.topicTreemapPeriod && period !== 'custom') return;
|
||||
|
||||
const currentYear = new Date().getFullYear();
|
||||
this.topicTreemapPeriod = period;
|
||||
if (period === 'last_5_years') {
|
||||
this.topicTreemapFromYear = currentYear - 4;
|
||||
this.topicTreemapToYear = currentYear;
|
||||
} else if (period === 'last_10_years') {
|
||||
this.topicTreemapFromYear = currentYear - 9;
|
||||
this.topicTreemapToYear = currentYear;
|
||||
} else if (period === 'all_time') {
|
||||
this.topicTreemapFromYear = 1900;
|
||||
this.topicTreemapToYear = currentYear;
|
||||
}
|
||||
this.loadTopicHeatmap();
|
||||
}
|
||||
|
||||
onTopicTreemapYearChange(field: 'from' | 'to', value: string): void {
|
||||
const year = Number(value);
|
||||
if (!Number.isInteger(year)) return;
|
||||
|
||||
if (field === 'from') {
|
||||
this.topicTreemapFromYear = year;
|
||||
} else {
|
||||
this.topicTreemapToYear = year;
|
||||
}
|
||||
this.topicTreemapPeriod = 'custom';
|
||||
this.loadTopicHeatmap();
|
||||
}
|
||||
|
||||
private loadStatistic(
|
||||
key: DashboardStatisticKey,
|
||||
request: Observable<DashboardStatisticValue>,
|
||||
): void {
|
||||
this.statisticLoading[key] = true;
|
||||
this.statisticErrors[key] = false;
|
||||
this.pendingStatisticRequests += 1;
|
||||
this.statisticsLoading = true;
|
||||
|
||||
request
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
this.statisticLoading[key] = false;
|
||||
this.pendingStatisticRequests -= 1;
|
||||
this.statisticsLoading = this.pendingStatisticRequests > 0;
|
||||
}),
|
||||
)
|
||||
.subscribe({
|
||||
next: (response) => {
|
||||
this.rawDataSource = (response.timeseries as any) || [];
|
||||
this.computedRankings = (response.rankings as any) || [];
|
||||
this.isLoading = false;
|
||||
next: (statistic) => {
|
||||
this.applyStatisticValue(key, statistic);
|
||||
},
|
||||
error: () => {
|
||||
this.rawDataSource = [];
|
||||
this.computedRankings = [];
|
||||
this.isLoading = false;
|
||||
this.statisticErrors[key] = true;
|
||||
this.statisticsError = true;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private applyStatisticValue(
|
||||
key: DashboardStatisticKey,
|
||||
statistic: DashboardStatisticValue,
|
||||
): void {
|
||||
const nextStatistics = {
|
||||
...(this.statistics ?? {}),
|
||||
institution_id: statistic.institution_id,
|
||||
organization_name: statistic.organization_name,
|
||||
[key]: statistic.value,
|
||||
};
|
||||
nextStatistics.projects =
|
||||
(nextStatistics.eu_projects ?? 0) +
|
||||
(nextStatistics.bmbf_projects ?? 0) +
|
||||
(nextStatistics.dfg_projects ?? 0);
|
||||
this.statistics = nextStatistics;
|
||||
}
|
||||
|
||||
private loadTopAuthors(): void {
|
||||
this.topAuthorsLoading = true;
|
||||
this.topAuthorsError = false;
|
||||
this.statisticsService
|
||||
.getTopAuthors(this.topAuthorsWorksPeriod)
|
||||
.pipe(finalize(() => (this.topAuthorsLoading = false)))
|
||||
.subscribe({
|
||||
next: (statistics) => {
|
||||
this.topAuthors = statistics;
|
||||
},
|
||||
error: () => {
|
||||
this.topAuthorsError = true;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private loadTopicHeatmap(): void {
|
||||
if (this.topicTreemapFromYear > this.topicTreemapToYear) {
|
||||
this.topicHeatmapError = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.topicHeatmapLoading = true;
|
||||
this.topicHeatmapError = false;
|
||||
this.statisticsService
|
||||
.getTopicHeatmap(this.topicTreemapFromYear, this.topicTreemapToYear)
|
||||
.pipe(finalize(() => (this.topicHeatmapLoading = false)))
|
||||
.subscribe({
|
||||
next: (heatmap) => {
|
||||
this.topicHeatmap = heatmap;
|
||||
},
|
||||
error: () => {
|
||||
this.topicHeatmapError = true;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
@if (heatmap?.fields?.length) {
|
||||
<div echarts [options]="options" class="topic-treemap-chart"></div>
|
||||
} @else {
|
||||
<p class="topic-treemap-empty">
|
||||
{{ loading ? 'Wird geladen ...' : 'Keine Field-Daten vorhanden.' }}
|
||||
</p>
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
.topic-treemap-chart {
|
||||
width: 100%;
|
||||
height: 560px;
|
||||
}
|
||||
|
||||
.topic-treemap-empty {
|
||||
display: grid;
|
||||
min-height: 260px;
|
||||
margin: 0;
|
||||
place-items: center;
|
||||
color: #64748b;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
import { Component, Input, OnChanges } from '@angular/core';
|
||||
import { EChartsOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
|
||||
import { TopicHeatmap } from '../dashboard-statistics.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-topic-heatmap',
|
||||
imports: [NgxEchartsDirective],
|
||||
templateUrl: './topic-heatmap.component.html',
|
||||
styleUrl: './topic-heatmap.component.scss',
|
||||
})
|
||||
export class TopicHeatmapComponent implements OnChanges {
|
||||
@Input() heatmap?: TopicHeatmap;
|
||||
@Input() loading = false;
|
||||
|
||||
options: EChartsOption = {};
|
||||
private readonly colors = [
|
||||
'#2563eb',
|
||||
'#059669',
|
||||
'#d97706',
|
||||
'#dc2626',
|
||||
'#7c3aed',
|
||||
'#0284c7',
|
||||
'#ea580c',
|
||||
'#4f46e5',
|
||||
'#0f766e',
|
||||
'#be123c',
|
||||
];
|
||||
|
||||
ngOnChanges(): void {
|
||||
this.options = this.buildOptions();
|
||||
}
|
||||
|
||||
private buildOptions(): EChartsOption {
|
||||
const fields = this.heatmap?.fields ?? [];
|
||||
const data = fields.map((field) => ({
|
||||
id: field.id,
|
||||
name: field.name,
|
||||
value: field.total || this.totalCount(field.values),
|
||||
label: {
|
||||
show: true,
|
||||
formatter: (params: any) =>
|
||||
`${params.name}\n${this.formatCount(params.value)}`,
|
||||
color: '#ffffff',
|
||||
fontWeight: 700,
|
||||
lineHeight: 18,
|
||||
overflow: 'truncate' as const,
|
||||
},
|
||||
children: field.values
|
||||
.filter((value) => value.count > 0)
|
||||
.map((value) => ({
|
||||
name: String(value.year),
|
||||
value: value.count,
|
||||
share: value.share,
|
||||
})),
|
||||
}));
|
||||
|
||||
return {
|
||||
tooltip: {
|
||||
formatter: (params: any) => {
|
||||
const count = Number(params.value ?? 0);
|
||||
const share =
|
||||
typeof params.data?.share === 'number'
|
||||
? `<br />Anteil im Jahr: <strong>${(params.data.share * 100).toFixed(1)}%</strong>`
|
||||
: '';
|
||||
return `${params.name}<br /><strong>${count}</strong> Publikationen${share}`;
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'Fields',
|
||||
type: 'treemap',
|
||||
data,
|
||||
roam: false,
|
||||
nodeClick: 'zoomToNode',
|
||||
sort: 'desc',
|
||||
drillDownIcon: '',
|
||||
breadcrumb: {
|
||||
show: true,
|
||||
bottom: 0,
|
||||
height: 24,
|
||||
left: 8,
|
||||
right: 8,
|
||||
emptyItemWidth: 80,
|
||||
itemStyle: {
|
||||
color: '#f8fafc',
|
||||
borderColor: '#cbd5e1',
|
||||
borderWidth: 1,
|
||||
textStyle: {
|
||||
color: '#334155',
|
||||
fontWeight: 600,
|
||||
},
|
||||
},
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
color: '#e0f2fe',
|
||||
borderColor: '#93c5fd',
|
||||
textStyle: {
|
||||
color: '#0f172a',
|
||||
fontWeight: 700,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
color: this.colors,
|
||||
colorMappingBy: 'id',
|
||||
label: {
|
||||
show: true,
|
||||
formatter: (params: any) =>
|
||||
`${params.name}\n${this.formatCount(params.value)}`,
|
||||
color: '#ffffff',
|
||||
fontWeight: 600,
|
||||
lineHeight: 18,
|
||||
position: 'inside',
|
||||
align: 'center',
|
||||
verticalAlign: 'middle',
|
||||
overflow: 'truncate',
|
||||
},
|
||||
upperLabel: {
|
||||
show: true,
|
||||
formatter: (params: any) =>
|
||||
`${params.name} · ${this.formatCount(params.value)}`,
|
||||
height: 30,
|
||||
color: '#ffffff',
|
||||
fontWeight: 700,
|
||||
overflow: 'truncate',
|
||||
},
|
||||
levels: [
|
||||
{
|
||||
color: this.colors,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
align: 'center',
|
||||
verticalAlign: 'middle',
|
||||
},
|
||||
upperLabel: { show: false },
|
||||
itemStyle: {
|
||||
borderColor: '#ffffff',
|
||||
borderWidth: 3,
|
||||
gapWidth: 3,
|
||||
},
|
||||
},
|
||||
{
|
||||
color: this.colors,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
align: 'center',
|
||||
verticalAlign: 'middle',
|
||||
},
|
||||
upperLabel: { show: false },
|
||||
itemStyle: {
|
||||
borderColor: '#ffffff',
|
||||
borderWidth: 3,
|
||||
gapWidth: 3,
|
||||
},
|
||||
},
|
||||
{
|
||||
colorSaturation: [0.45, 0.78],
|
||||
label: {
|
||||
show: true,
|
||||
formatter: (params: any) =>
|
||||
`${params.name}\n${this.formatCount(params.value)}`,
|
||||
position: 'inside',
|
||||
align: 'center',
|
||||
verticalAlign: 'middle',
|
||||
color: '#ffffff',
|
||||
fontWeight: 700,
|
||||
lineHeight: 18,
|
||||
overflow: 'truncate',
|
||||
},
|
||||
upperLabel: { show: false },
|
||||
itemStyle: {
|
||||
borderColor: '#ffffff',
|
||||
borderWidth: 2,
|
||||
gapWidth: 2,
|
||||
},
|
||||
},
|
||||
],
|
||||
leafDepth: 1,
|
||||
top: 8,
|
||||
right: 8,
|
||||
bottom: 32,
|
||||
left: 8,
|
||||
animationDurationUpdate: 450,
|
||||
emphasis: {
|
||||
focus: 'self',
|
||||
label: {
|
||||
color: '#ffffff',
|
||||
},
|
||||
},
|
||||
itemStyle: {
|
||||
borderRadius: 4,
|
||||
borderColor: '#ffffff',
|
||||
borderWidth: 3,
|
||||
gapWidth: 3,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
private totalCount(values: Array<{ count: number }>): number {
|
||||
return values.reduce((sum, value) => sum + value.count, 0);
|
||||
}
|
||||
|
||||
private formatCount(value: unknown): string {
|
||||
return Number(value ?? 0).toLocaleString('de-DE');
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,8 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
this.patentsApi
|
||||
.getOrgPatentsByInstitution(
|
||||
institutionId,
|
||||
this.activeMatchType,
|
||||
|
||||
this.activeMatchType !== 'all' ? this.activeMatchType : undefined,
|
||||
this.selectedPage - 1,
|
||||
this.pageSize,
|
||||
this.activeFilter !== 'all' ? this.activeFilter : undefined,
|
||||
@@ -197,7 +198,7 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
formatDate(date: string | null): string {
|
||||
formatDate(date: string | null | undefined): string {
|
||||
return formatPatentDate(date);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,25 +43,25 @@
|
||||
</mat-card>
|
||||
|
||||
<div class="funding-info-cards">
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[description]="'Gesamte Förderung durch Bund'"
|
||||
[value]="
|
||||
(bundTotalFunding()
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
|
||||
" />
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[description]="'Durchschnittliche jährliche Förderung durch Bund'"
|
||||
[value]="
|
||||
(bundAverageAnnualFunding()
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
|
||||
" />
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[description]="'Gesamte Förderung durch die Europäische Union'"
|
||||
[value]="
|
||||
(euTotalFunding() | currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ??
|
||||
undefined
|
||||
" />
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[description]="'Durchschnittliche jährliche Förderung durch die Europäische Union'"
|
||||
[value]="
|
||||
(euAverageAnnualFunding()
|
||||
|
||||
@@ -24,7 +24,7 @@ mat-paginator {
|
||||
flex-direction: row;
|
||||
gap: 1rem;
|
||||
|
||||
app-person-network-info-card {
|
||||
app-info-card {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { InstitutionProjectsFundingGraphComponent } from '../institution-projects-funding-graph/institution-projects-funding-graph.component';
|
||||
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
|
||||
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
|
||||
|
||||
@@ -64,7 +64,7 @@ type EuProjectRow = {
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
InstitutionProjectsFundingGraphComponent,
|
||||
PersonNetworkInfoCardComponent,
|
||||
AppInfoCardComponent,
|
||||
RouterModule,
|
||||
QueryParamPaginatorComponent,
|
||||
QueryParamInputComponent,
|
||||
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
@if (loading()) {
|
||||
<p class="message">Lade passende Patente...</p>
|
||||
} @else if (error()) {
|
||||
<p class="message">Fehler beim Laden der Patente.</p>
|
||||
} @else if (matches().length === 0) {
|
||||
<p class="message">Keine passenden Patente gefunden.</p>
|
||||
} @else {
|
||||
<div class="patents-container">
|
||||
<h2 class="section-title">Passende Patente</h2>
|
||||
|
||||
<div class="patents-content">
|
||||
<div class="patents-list">
|
||||
<div class="patents-list-toolbar">
|
||||
<label class="sort-control">
|
||||
<span>Filter nach Quelle:</span>
|
||||
|
||||
<select
|
||||
[value]="activeFilter()"
|
||||
(change)="setFilter($any($event.target).value)">
|
||||
<option value="all">Alle</option>
|
||||
|
||||
<option value="EPO">EPO</option>
|
||||
|
||||
<option value="USPTO">USPTO</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Patent</th>
|
||||
|
||||
<th>Score</th>
|
||||
|
||||
<th>Quelle</th>
|
||||
|
||||
<th>Jahr</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@for (item of pagedMatches(); track trackMatch($index, item)) {
|
||||
<tr
|
||||
[class.selected]="selectedMatch() === item"
|
||||
(click)="selectMatch(item)">
|
||||
<td class="patent-title">
|
||||
{{ item.patent.title ?? item.patent.patent_id }}
|
||||
</td>
|
||||
|
||||
<td class="match-score">{{ formatScore(item.match_score) }}</td>
|
||||
|
||||
<td>
|
||||
<span
|
||||
class="source-badge source-badge--{{
|
||||
item.patent.source.toLowerCase()
|
||||
}}">
|
||||
{{ item.patent.source }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>{{ item.patent.publication_year ?? '-' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if (hasPagination()) {
|
||||
<div class="pagination">
|
||||
<button
|
||||
[disabled]="selectedPage() === 1"
|
||||
(click)="setPage(selectedPage() - 1)">
|
||||
Zurück
|
||||
</button>
|
||||
|
||||
<span>Seite {{ selectedPage() }} von {{ pageCount() }}</span>
|
||||
|
||||
<button
|
||||
[disabled]="selectedPage() === pageCount()"
|
||||
(click)="setPage(selectedPage() + 1)">
|
||||
Weiter
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (selectedMatch(); as match) {
|
||||
<div class="patent-detail">
|
||||
<h3>{{ match.patent.title ?? match.patent.patent_id }}</h3>
|
||||
|
||||
<div class="detail-stats">
|
||||
<div class="stat">
|
||||
<span class="stat-label">Match-Score</span>
|
||||
|
||||
<span class="stat-value">{{
|
||||
formatScore(match.match_score)
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Gematchte Keywords</span>
|
||||
|
||||
<span class="stat-value">{{
|
||||
formatMatchList(match.matched_keywords)
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Gematchte IPC/CPC</span>
|
||||
|
||||
<span class="stat-value">{{
|
||||
formatMatchList(match.matched_ipc_symbols)
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Quelle</span>
|
||||
|
||||
<span class="stat-value">
|
||||
<span
|
||||
class="source-badge source-badge--{{
|
||||
match.patent.source.toLowerCase()
|
||||
}}">
|
||||
{{ match.patent.source }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Patent-Nr.</span>
|
||||
|
||||
<span class="stat-value">{{ match.patent.patent_id }}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Datum</span>
|
||||
|
||||
<span class="stat-value">{{
|
||||
formatDate(match.patent.publication_date)
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
@if (getPublicationStageLabel(match.patent); as stageLabel) {
|
||||
<div class="stat">
|
||||
<span class="stat-label">Publikationsstufe</span>
|
||||
|
||||
<span class="stat-value">{{ stageLabel }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="patent-detail-action"
|
||||
(click)="openDetail()">
|
||||
<span class="patent-detail-action__label"
|
||||
>Patentdetails anzeigen</span
|
||||
>
|
||||
|
||||
<span class="material-icons" aria-hidden="true">chevron_right</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
.message {
|
||||
padding: 16px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin: 0 0 16px;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.patents-container {
|
||||
margin-top: 1.5rem;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.sort-control {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 20px;
|
||||
background: #f2f2f2;
|
||||
font-size: 14px;
|
||||
|
||||
select {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.patents-content {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.patents-list {
|
||||
flex: 1;
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 2px solid #e0e0e0;
|
||||
}
|
||||
|
||||
tr {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
}
|
||||
|
||||
.patent-title {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.source-badge {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
|
||||
&--epo {
|
||||
background: #dbeafe;
|
||||
color: #1e40af;
|
||||
}
|
||||
|
||||
&--uspto {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.patent-detail {
|
||||
flex: 0 0 320px;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.detail-stats {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.match-score {
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #374151;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
display: block;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.patent-detail-action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
margin-top: 12px;
|
||||
padding: 10px 12px;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
background: #111827;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.patents-content {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.patent-detail {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
import { Component, input, signal } from '@angular/core';
|
||||
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { PatentEntry } from '../../../api/model/patentEntry';
|
||||
|
||||
import {
|
||||
formatPatentDate,
|
||||
getPublicationStageLabel,
|
||||
} from '../../patent-detail/patent-detail.utils';
|
||||
import { KeywordPatentMatch } from '../../../api';
|
||||
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
|
||||
@Component({
|
||||
selector: 'app-keywords-patents',
|
||||
|
||||
templateUrl: './keywords-patents.component.html',
|
||||
|
||||
styleUrl: './keywords-patents.component.scss',
|
||||
})
|
||||
export class KeywordsPatentsComponent {
|
||||
readonly matches = input<KeywordPatentMatch[]>([]);
|
||||
|
||||
readonly loading = input(false);
|
||||
|
||||
readonly error = input(false);
|
||||
|
||||
activeFilter = signal<SourceFilter>('all');
|
||||
|
||||
selectedMatch = signal<KeywordPatentMatch | null>(null);
|
||||
|
||||
selectedPage = signal(1);
|
||||
|
||||
readonly pageSize = 10;
|
||||
|
||||
constructor(private readonly router: Router) {}
|
||||
|
||||
filteredMatches(): KeywordPatentMatch[] {
|
||||
const filter = this.activeFilter();
|
||||
|
||||
const items = this.matches();
|
||||
|
||||
if (filter === 'all') {
|
||||
return items;
|
||||
}
|
||||
|
||||
return items.filter((item) => item.patent.source === filter);
|
||||
}
|
||||
|
||||
pagedMatches(): KeywordPatentMatch[] {
|
||||
const start = (this.selectedPage() - 1) * this.pageSize;
|
||||
|
||||
return this.filteredMatches().slice(start, start + this.pageSize);
|
||||
}
|
||||
|
||||
pageCount(): number {
|
||||
return Math.max(
|
||||
1,
|
||||
Math.ceil(this.filteredMatches().length / this.pageSize),
|
||||
);
|
||||
}
|
||||
|
||||
hasPagination(): boolean {
|
||||
return this.pageCount() > 1;
|
||||
}
|
||||
|
||||
setFilter(filter: SourceFilter): void {
|
||||
this.activeFilter.set(filter);
|
||||
|
||||
this.selectedPage.set(1);
|
||||
|
||||
this.selectedMatch.set(null);
|
||||
}
|
||||
|
||||
setPage(page: number): void {
|
||||
this.selectedPage.set(Math.min(Math.max(page, 1), this.pageCount()));
|
||||
}
|
||||
|
||||
selectMatch(item: KeywordPatentMatch): void {
|
||||
this.selectedMatch.set(item);
|
||||
}
|
||||
|
||||
openDetail(): void {
|
||||
const match = this.selectedMatch();
|
||||
|
||||
if (!match) return;
|
||||
|
||||
void this.router.navigate(['/patent', match.patent.patent_id]);
|
||||
}
|
||||
|
||||
formatDate(date: string | null | undefined): string {
|
||||
return formatPatentDate(date);
|
||||
}
|
||||
|
||||
getPublicationStageLabel(patent: PatentEntry): string | null {
|
||||
return getPublicationStageLabel(patent);
|
||||
}
|
||||
|
||||
formatScore(score: number | null | undefined): string {
|
||||
if (score == null || Number.isNaN(score)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return score.toFixed(2);
|
||||
}
|
||||
|
||||
formatMatchList(values: string[] | null | undefined): string {
|
||||
if (!values || values.length === 0) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return values.join(', ');
|
||||
}
|
||||
|
||||
trackMatch(_index: number, item: KeywordPatentMatch): string {
|
||||
const patent = item.patent;
|
||||
|
||||
return [
|
||||
patent.source,
|
||||
|
||||
patent.patent_id,
|
||||
|
||||
patent.publication_date ?? '',
|
||||
|
||||
patent.kind ?? patent.application_type ?? '',
|
||||
|
||||
item.match_score,
|
||||
].join('|');
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
mat-flat-button
|
||||
type="button"
|
||||
class="extract-btn"
|
||||
[disabled]="!form.controls.urlInput.value"
|
||||
[color]="isExtracting() ? 'warn' : 'primary'"
|
||||
(click)="onExtractKeywordsClick()">
|
||||
<mat-icon>
|
||||
@@ -43,6 +44,7 @@
|
||||
<button
|
||||
mat-flat-button
|
||||
type="button"
|
||||
[disabled]="!form.controls.textInput.value"
|
||||
[color]="isExtracting() ? 'warn' : 'primary'"
|
||||
class="extract-btn"
|
||||
(click)="onExtractKeywordsClick()">
|
||||
@@ -54,6 +56,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="Datei">
|
||||
<div class="tab-content">
|
||||
<app-file-upload
|
||||
[requiredFileType]="'text/plain,application/pdf'"
|
||||
[maxFileSize]="5 * 1024 * 1024"
|
||||
[maxFiles]="3"
|
||||
[uploadedFiles]="uploadedFiles()"
|
||||
(filesChange)="onFilesSelected($event)">
|
||||
</app-file-upload>
|
||||
<div class="actions">
|
||||
<button
|
||||
mat-flat-button
|
||||
type="button"
|
||||
[color]="isExtracting() ? 'warn' : 'primary'"
|
||||
[disabled]="uploadedFiles().length === 0"
|
||||
class="extract-btn"
|
||||
(click)="onExtractKeywordsClick()">
|
||||
<mat-icon>
|
||||
{{ isExtracting() ? 'close' : 'troubleshoot' }}
|
||||
</mat-icon>
|
||||
{{ isExtracting() ? 'Abbrechen' : 'Keywords extrahieren' }}
|
||||
</button>
|
||||
<!-- Add this inside your form or section -->
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
<!-- Extraction Table -->
|
||||
<mat-card
|
||||
@@ -110,38 +138,28 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="toolbar-divider"></div>
|
||||
<mat-button-toggle-group
|
||||
[value]="keywordView()"
|
||||
(change)="onViewToggleChange($event.value)"
|
||||
aria-label="Keyword Ansicht wählen">
|
||||
<mat-button-toggle
|
||||
[disabled]="isExtracting()"
|
||||
value="llm"
|
||||
matTooltip="Extrahierte Keywords">
|
||||
<mat-icon>text_fields</mat-icon>
|
||||
<span>Extrahierte Keywords</span>
|
||||
</mat-button-toggle>
|
||||
@if (topicMappingSearch()) {
|
||||
<div class="toolbar-group toolbar-group--view">
|
||||
<mat-button-toggle-group
|
||||
[value]="keywordView()"
|
||||
(change)="onViewToggleChange($event.value)"
|
||||
aria-label="Keyword Ansicht wählen">
|
||||
<mat-button-toggle
|
||||
[disabled]="isExtracting()"
|
||||
value="llm"
|
||||
matTooltip="Extrahierte Keywords">
|
||||
<mat-icon>text_fields</mat-icon>
|
||||
<span>Extrahierte Keywords</span>
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle
|
||||
[disabled]="isExtracting()"
|
||||
value="topic"
|
||||
matTooltip="Topic Mapping">
|
||||
matTooltip="Die Abbildung der extrahierten Keywords auf die bekannten Themenbereiche">
|
||||
<mat-icon>account_tree</mat-icon>
|
||||
<span>Topic Mapping</span>
|
||||
<span>Ähnliche Themen</span>
|
||||
</mat-button-toggle>
|
||||
}
|
||||
</mat-button-toggle-group>
|
||||
<div class="toolbar-divider"></div>
|
||||
|
||||
<div class="toolbar-group toolbar-group--view">
|
||||
<mat-slide-toggle
|
||||
(change)="onToggleTopicMappingSearch($event)"
|
||||
labelPosition="before"
|
||||
[checked]="topicMappingSearch()"
|
||||
class="mapping-toggle">
|
||||
Topic Mapping
|
||||
</mat-slide-toggle>
|
||||
</mat-button-toggle-group>
|
||||
</div>
|
||||
<div class="toolbar-divider"></div>
|
||||
</div>
|
||||
|
||||
<div class="spacer toolbar-controls manual-input-controls">
|
||||
@@ -243,36 +261,48 @@
|
||||
|
||||
<div class="table-body">
|
||||
<div class="table-col broad-col">
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: broadKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
@if (isExtracting() && broadKeywords().length === 0) {
|
||||
<app-loading icon="manage_search" [size]="60" [diameter]="60" />
|
||||
} @else {
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: broadKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="table-col coarse-col">
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: coarseKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
@if (isExtracting() && coarseKeywords().length === 0) {
|
||||
<app-loading icon="manage_search" [size]="60" [diameter]="60" />
|
||||
} @else {
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: coarseKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="table-col fine-col thick-border">
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: fineKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
@if (isExtracting() && fineKeywords().length === 0) {
|
||||
<app-loading icon="manage_search" [size]="60" [diameter]="60" />
|
||||
} @else {
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: fineKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="table-col own-col">
|
||||
@@ -289,14 +319,18 @@
|
||||
<span class="tab-count">{{ broadKeywords().length }}</span>
|
||||
</ng-template>
|
||||
<div class="mobile-tab-panel">
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: broadKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
@if (isExtracting() && broadKeywords().length === 0) {
|
||||
<app-loading icon="manage_search" [size]="60" [diameter]="60" />
|
||||
} @else {
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: broadKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
}
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
@@ -306,14 +340,18 @@
|
||||
<span class="tab-count">{{ coarseKeywords().length }}</span>
|
||||
</ng-template>
|
||||
<div class="mobile-tab-panel">
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: coarseKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
@if (isExtracting() && coarseKeywords().length === 0) {
|
||||
<app-loading icon="manage_search" [size]="60" [diameter]="60" />
|
||||
} @else {
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: coarseKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
}
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
@@ -323,14 +361,18 @@
|
||||
<span class="tab-count">{{ fineKeywords().length }}</span>
|
||||
</ng-template>
|
||||
<div class="mobile-tab-panel">
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: fineKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
@if (isExtracting() && fineKeywords().length === 0) {
|
||||
<app-loading icon="manage_search" [size]="60" [diameter]="60" />
|
||||
} @else {
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
keywordChipStack;
|
||||
context: {
|
||||
keywords: fineKeywords(),
|
||||
emptyText: 'Nichts extrahiert',
|
||||
}
|
||||
"></ng-container>
|
||||
}
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
@@ -345,45 +387,79 @@
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
}
|
||||
|
||||
<!-- Source content display -->
|
||||
@if (sourceContent().length > 0) {
|
||||
<mat-divider></mat-divider>
|
||||
<mat-expansion-panel class="source-expansion">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Quellentext: {{ sourceUrl() }}</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div
|
||||
class="source-text"
|
||||
[innerHTML]="highlightedSourceContent()"></div>
|
||||
</mat-expansion-panel>
|
||||
}
|
||||
</mat-card-content>
|
||||
@if (isExtracting() && !keywordsExist()) {
|
||||
<!-- @if (isExtracting() && !keywordsExist()) {
|
||||
<app-loading
|
||||
text="{{ statusMessage() }}"
|
||||
icon="manage_search"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} -->
|
||||
<!-- Source content display -->
|
||||
@if (sourceContent().length > 0) {
|
||||
<mat-divider></mat-divider>
|
||||
<mat-expansion-panel class="source-expansion">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Quellentext: {{ sourceUrl() }}</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div class="source-text" [innerHTML]="highlightedSourceContent()"></div>
|
||||
</mat-expansion-panel>
|
||||
}
|
||||
</mat-card>
|
||||
|
||||
@if (isExtracting() && keywordsExist()) {
|
||||
@if (isExtracting()) {
|
||||
<div class="status-message">{{ statusMessage() }}</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (keywordsExist()) {
|
||||
<!-- Search buttons -->
|
||||
<div class="search-actions">
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
class="search-btn"
|
||||
[disabled]="isSearchDisabled()"
|
||||
(click)="search()">
|
||||
<mat-icon>search</mat-icon>
|
||||
Suchen
|
||||
</button>
|
||||
<div class="search-container">
|
||||
<div class="search-actions">
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
class="search-btn"
|
||||
[disabled]="isSearchDisabled()"
|
||||
(click)="search()">
|
||||
<mat-icon>search</mat-icon>
|
||||
Suchen
|
||||
</button>
|
||||
|
||||
<button
|
||||
mat-flat-button
|
||||
color="accent"
|
||||
class="visualize-btn"
|
||||
[disabled]="isSearchDisabled()"
|
||||
(click)="visualize()">
|
||||
<mat-icon>show_chart</mat-icon>
|
||||
Visualisierung
|
||||
</button>
|
||||
|
||||
<button
|
||||
mat-flat-button
|
||||
class="patents-btn"
|
||||
[disabled]="isSearchDisabled()"
|
||||
(click)="loadPatentsForSelection()">
|
||||
<mat-icon>description</mat-icon>
|
||||
Patente
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (showPatents()) {
|
||||
<app-keywords-patents
|
||||
[matches]="patentMatches()"
|
||||
[loading]="loadingPatents()"
|
||||
[error]="patentsError()">
|
||||
</app-keywords-patents>
|
||||
}
|
||||
}
|
||||
|
||||
<!-- Trend Comparison Section -->
|
||||
@if (showVisualization() && selectedKeywords().length > 0) {
|
||||
<div style="margin-top: 2rem">
|
||||
<app-uni-trend-parent
|
||||
[keywords]="selectedKeywords()"></app-uni-trend-parent>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -19,10 +19,12 @@ $touch-target: 44px;
|
||||
|
||||
.tab-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 0.5rem;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
align-items: top;
|
||||
app-file-upload {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.full-width {
|
||||
@@ -87,7 +89,6 @@ $touch-target: 44px;
|
||||
gap: auto;
|
||||
|
||||
::ng-deep .mdc-switch {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
::ng-deep .mdc-form-field {
|
||||
@@ -444,6 +445,7 @@ mat-button-toggle-group {
|
||||
============================================================ */
|
||||
.search-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
@@ -459,13 +461,19 @@ mat-button-toggle-group {
|
||||
}
|
||||
|
||||
.search-btn,
|
||||
.visualize-btn {
|
||||
.visualize-btn,
|
||||
.patents-btn {
|
||||
min-width: 220px;
|
||||
min-height: $touch-target;
|
||||
align-self: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.patents-btn {
|
||||
background: #0f766e !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
/* Tablet */
|
||||
@media (max-width: $tablet) {
|
||||
.search-container {
|
||||
@@ -477,7 +485,8 @@ mat-button-toggle-group {
|
||||
}
|
||||
|
||||
.search-btn,
|
||||
.visualize-btn {
|
||||
.visualize-btn,
|
||||
.patents-btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -500,7 +509,8 @@ mat-button-toggle-group {
|
||||
}
|
||||
|
||||
.search-btn,
|
||||
.visualize-btn {
|
||||
.visualize-btn,
|
||||
.patents-btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -525,7 +535,7 @@ mat-button-toggle-group {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
.search-btn {
|
||||
.action-btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -564,7 +574,7 @@ mat-button-toggle-group {
|
||||
SOURCE EXPANSION PANEL
|
||||
============================================================ */
|
||||
.source-expansion {
|
||||
margin: 0.75rem 0;
|
||||
margin: 0.5rem 1rem;
|
||||
background: var(--sg-background-muted, #f5f5f5);
|
||||
border-radius: 4px;
|
||||
//border-left: 4px solid var(--sg-primary, #1976d2);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, computed, signal, inject } from '@angular/core';
|
||||
import { Component, computed, signal, inject, effect } from '@angular/core';
|
||||
import { BreakpointObserver } from '@angular/cdk/layout';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
||||
@@ -31,6 +31,12 @@ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { MatSliderModule } from '@angular/material/slider';
|
||||
import { FileUpload } from '../../api/model/fileUpload';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import {
|
||||
FileUploadComponent,
|
||||
FileUploadItem,
|
||||
} from '../../shared/ui/file-upload/file-upload.component';
|
||||
import {
|
||||
MatButtonToggleModule,
|
||||
MatButtonToggleGroup,
|
||||
@@ -46,11 +52,19 @@ import {
|
||||
} from '../../resolvers/utils/topic-legend';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { A11yModule } from '@angular/cdk/a11y';
|
||||
import { PatentsService } from '../../api/api/patents.service';
|
||||
import { KeywordsPatentsComponent } from './keywords-patents/keywords-patents.component';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { SearchResultsPayload } from './search-results/search-results-state.service';
|
||||
type InputMode = 'url' | 'text';
|
||||
import {
|
||||
KeywordPatentMatch,
|
||||
KeywordPatentSearchItem,
|
||||
KeywordsService,
|
||||
} from '../../api';
|
||||
type InputMode = 'url' | 'text' | 'file';
|
||||
type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual';
|
||||
type KeywordView = 'llm' | 'topic';
|
||||
type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom';
|
||||
@Component({
|
||||
selector: 'app-keywords-search',
|
||||
imports: [
|
||||
@@ -72,9 +86,11 @@ type KeywordView = 'llm' | 'topic';
|
||||
MatTooltipModule,
|
||||
A11yModule,
|
||||
NgTemplateOutlet,
|
||||
KeywordsPatentsComponent,
|
||||
LoadingComponent,
|
||||
MatSlideToggleModule,
|
||||
MatSliderModule,
|
||||
FileUploadComponent,
|
||||
],
|
||||
templateUrl: './keywords-search.component.html',
|
||||
styleUrl: './keywords-search.component.scss',
|
||||
@@ -84,22 +100,23 @@ export class KeywordsSearchComponent {
|
||||
private readonly sanitizer = inject(DomSanitizer);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
private readonly _snackBar = inject(MatSnackBar);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly websocketService = inject(KeywordWebSocketService);
|
||||
private readonly topicsService = inject(TopicsService);
|
||||
private readonly breakpointObserver = inject(BreakpointObserver);
|
||||
private readonly keywordsService = inject(KeywordsService);
|
||||
|
||||
readonly form = this.formBuilder.nonNullable.group({
|
||||
selectedInputType: 'url' as InputMode,
|
||||
urlInput: '',
|
||||
textInput: '',
|
||||
fileInput: '',
|
||||
});
|
||||
|
||||
private readonly SESSION_KEY = 'keywords-search-source';
|
||||
private readonly SEARCH_RESULTS_HANDOFF_KEY = 'search-results-handoff';
|
||||
|
||||
// in component class:
|
||||
private breakpointObserver = inject(BreakpointObserver);
|
||||
|
||||
isMobile = toSignal(
|
||||
this.breakpointObserver
|
||||
.observe('(max-width: 768px)')
|
||||
@@ -123,7 +140,14 @@ export class KeywordsSearchComponent {
|
||||
readonly loadingNewKeyword = signal(false);
|
||||
readonly extractionSource = signal<InputMode | null>(null);
|
||||
readonly topicMappingSearch = signal<boolean>(false);
|
||||
readonly showVisualization = signal<boolean>(false);
|
||||
readonly showPatents = signal(false);
|
||||
readonly patentMatches = signal<KeywordPatentMatch[]>([]);
|
||||
readonly loadingPatents = signal(false);
|
||||
readonly patentsError = signal(false);
|
||||
readonly patentsLoaded = signal(false);
|
||||
|
||||
readonly uploadedFiles = signal<FileUploadItem[]>([]);
|
||||
readonly keywordsExist = computed(
|
||||
() =>
|
||||
this.broadKeywords().length > 0 ||
|
||||
@@ -144,43 +168,58 @@ export class KeywordsSearchComponent {
|
||||
|
||||
let highlightedContent = content;
|
||||
|
||||
// replace the keyword with highlighted spans
|
||||
const normalizeText = (text: string): string => {
|
||||
return text
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/[\u2010-\u2015\u2026—–]/g, '-')
|
||||
.replace(/[\u2018\u2019\u201b\u201c\u201d\u201f]/g, "'")
|
||||
.replace(/[\s\n\r\t]+/g, ' ')
|
||||
.replace(/[^a-zA-Z0-9\s\-]/g, '');
|
||||
};
|
||||
|
||||
// Normalize keyword for matching
|
||||
const normalizeKeyword = (keyword: string): string => {
|
||||
return keyword
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/[\s\-]+/g, '')
|
||||
.replace(/[^a-zA-Z0-9]/g, '');
|
||||
};
|
||||
|
||||
for (const keyword of selectedKeywords) {
|
||||
const normalizedKeyword = this.normalizeKeyword(keyword);
|
||||
const normalizedKeyword = normalizeKeyword(keyword);
|
||||
|
||||
// Find the first keyword entry that matches this normalized keyword
|
||||
const entry = this.allKeywordEntries().find(
|
||||
(e) =>
|
||||
this.normalizeKeyword(this.getKeywordLabel(e)) === normalizedKeyword,
|
||||
);
|
||||
const entry = this.allKeywordEntries().find((e) => {
|
||||
const label = this.getKeywordLabel(e);
|
||||
return normalizeKeyword(label) === normalizedKeyword;
|
||||
});
|
||||
|
||||
if (entry) {
|
||||
const topic = this.getTopic(entry);
|
||||
if (topic) {
|
||||
const color = this.getTopicColor(topic);
|
||||
// Escape HTML special characters in the keyword before using it in HTML
|
||||
const escapedKeyword = keyword
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
if (!entry) continue;
|
||||
|
||||
// Create the replacement span HTML
|
||||
const replacement = `<span style="text-decoration: underline; background-color: color-mix(in srgb, ${color} 27%, #ffffff); 100%); font-weight: bold;" title="Keyword: ${keyword}">${escapedKeyword}</span>`;
|
||||
const topic = this.getTopic(entry);
|
||||
if (!topic) continue;
|
||||
|
||||
const escapedRegexKeyword = keyword.replace(
|
||||
/[.*+?^${}()|[\]\\]/g,
|
||||
'\\$&',
|
||||
);
|
||||
const regex = new RegExp(escapedRegexKeyword, 'g');
|
||||
const color = this.getTopicColor(topic);
|
||||
|
||||
highlightedContent = highlightedContent.replace(regex, replacement);
|
||||
}
|
||||
}
|
||||
const escapedKeyword = keyword
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
|
||||
const escapedRegexKeyword = keyword
|
||||
.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
.replace(/\s+/g, '\\s*');
|
||||
|
||||
const regex = new RegExp(escapedRegexKeyword, 'gi');
|
||||
|
||||
const replacement = `<span style="text-decoration: underline; background-color: color-mix(in srgb, ${color} 27%, #ffffff); font-weight: bold;" title="Keyword: ${escapedKeyword}">${escapedKeyword}</span>`;
|
||||
|
||||
highlightedContent = highlightedContent.replace(regex, replacement);
|
||||
}
|
||||
console.log(
|
||||
'Highlighted content:',
|
||||
this.sanitizer.bypassSecurityTrustHtml(highlightedContent),
|
||||
);
|
||||
|
||||
return this.sanitizer.bypassSecurityTrustHtml(highlightedContent);
|
||||
});
|
||||
|
||||
@@ -196,6 +235,7 @@ export class KeywordsSearchComponent {
|
||||
|
||||
readonly progress = signal(0);
|
||||
readonly statusMessage = signal('');
|
||||
readonly errorMessage = signal('');
|
||||
readonly keywordView = signal<KeywordView>('llm');
|
||||
readonly subfieldLegendVisible = signal(true);
|
||||
readonly subfieldLegendExpanded = signal(false);
|
||||
@@ -239,6 +279,14 @@ export class KeywordsSearchComponent {
|
||||
.getMessages()
|
||||
.subscribe((event: WsEvent) => this.handleWsEvent(event));
|
||||
|
||||
effect(() => {
|
||||
const message = this.errorMessage();
|
||||
if (message) {
|
||||
this._snackBar.open(message, 'Schließen', {
|
||||
duration: 5000,
|
||||
});
|
||||
}
|
||||
});
|
||||
// this.destroyRef.onDestroy(() => {
|
||||
// this.websocketService.close();
|
||||
// const isReload = this.router.lastSuccessfulNavigation === null;
|
||||
@@ -278,14 +326,22 @@ export class KeywordsSearchComponent {
|
||||
this.statusMessage.set('Fertig!');
|
||||
this.websocketService.close();
|
||||
this.isExtracting.set(false);
|
||||
if (!this.keywordsExist()) {
|
||||
this.errorMessage.set('Keine Keywords extrahiert');
|
||||
}
|
||||
}
|
||||
|
||||
private handleErrorEvent(event: WsEvent): void {
|
||||
this.progress.set(0);
|
||||
this.statusMessage.set('Fehler: ' + event.message);
|
||||
this.errorMessage.set(event.message || 'Unbekannter Fehler');
|
||||
//this.statusMessage.set('Fehler: ' + event.message);
|
||||
this.broadKeywordEntries.set([]);
|
||||
this.coarseKeywordEntries.set([]);
|
||||
this.fineKeywordEntries.set([]);
|
||||
this.patentMatches.set([]);
|
||||
this.patentsLoaded.set(false);
|
||||
this.patentsError.set(false);
|
||||
this.showPatents.set(false);
|
||||
this.websocketService.close();
|
||||
this.isExtracting.set(false);
|
||||
this.loadingNewKeyword.set(false);
|
||||
@@ -353,14 +409,49 @@ export class KeywordsSearchComponent {
|
||||
// --- Tabs ---------------------------------------------------------------
|
||||
|
||||
selectedTabIndex(): number {
|
||||
return this.form.controls.selectedInputType.value === 'text' ? 1 : 0;
|
||||
if (this.form.controls.selectedInputType.value === 'url') return 0;
|
||||
if (this.form.controls.selectedInputType.value === 'text') return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
onTabChange(index: number): void {
|
||||
const nextMode: InputMode = index === 1 ? 'text' : 'url';
|
||||
let nextMode: InputMode;
|
||||
if (index === 0) {
|
||||
nextMode = 'url';
|
||||
} else if (index === 1) {
|
||||
nextMode = 'text';
|
||||
} else {
|
||||
nextMode = 'file';
|
||||
}
|
||||
this.form.controls.selectedInputType.setValue(nextMode);
|
||||
}
|
||||
// fileupload
|
||||
onFilesSelected(files: FileUploadItem[]): void {
|
||||
this.uploadedFiles.set(files);
|
||||
}
|
||||
|
||||
// Helper: Send files to WebSocket for server-side extraction
|
||||
private sendFilesToWebSocket(files: FileUpload[]) {
|
||||
const keywordsRequest: KeywordsRequest = {
|
||||
query: '',
|
||||
files,
|
||||
mode: 'files',
|
||||
limit: undefined,
|
||||
};
|
||||
|
||||
this.statusMessage.set('Files uploaded. Extracting keywords...');
|
||||
|
||||
this.websocketService
|
||||
.sendRequest(keywordsRequest)
|
||||
.then(() => {
|
||||
this.statusMessage.set('Extracting keywords...');
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('WebSocket error: OPA', err);
|
||||
this.errorMessage.set('Failed to send content');
|
||||
this.isExtracting.set(false);
|
||||
});
|
||||
}
|
||||
// --- Keyword selection & manual entry ------------------------------------
|
||||
|
||||
private keywordExists(keyword: string): boolean {
|
||||
@@ -377,7 +468,7 @@ export class KeywordsSearchComponent {
|
||||
if (!normalizedKeyword) return;
|
||||
|
||||
if (this.keywordExists(normalizedKeyword)) {
|
||||
this.statusMessage.set(`"${normalizedKeyword}" ist bereits vorhanden.`);
|
||||
this.errorMessage.set(`"${normalizedKeyword}" ist bereits vorhanden.`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -408,7 +499,7 @@ export class KeywordsSearchComponent {
|
||||
error: (err) => {
|
||||
console.error('vectorSearchTopics failed', err);
|
||||
this.loadingNewKeyword.set(false);
|
||||
this.statusMessage.set(
|
||||
this.errorMessage.set(
|
||||
`Fehler beim Hinzufügen von "${normalizedKeyword}".`,
|
||||
);
|
||||
},
|
||||
@@ -501,6 +592,10 @@ export class KeywordsSearchComponent {
|
||||
this.manualKeywordEntries.set([]);
|
||||
this.sourceContent.set('');
|
||||
this.sourceUrl.set(null);
|
||||
this.patentMatches.set([]);
|
||||
this.patentsLoaded.set(false);
|
||||
this.patentsError.set(false);
|
||||
this.showPatents.set(false);
|
||||
|
||||
// Keep only selected keywords that are in the manual list
|
||||
const manualSet = new Set(this.getKeywordLabels(this.manualKeywords()));
|
||||
@@ -532,10 +627,72 @@ export class KeywordsSearchComponent {
|
||||
}
|
||||
|
||||
onExtractKeywordsClick(): void {
|
||||
this.clearKeywords();
|
||||
if (this.isExtracting()) {
|
||||
this.cancelKeywordExtraction();
|
||||
return;
|
||||
}
|
||||
|
||||
const mode = this.form.controls.selectedInputType.value;
|
||||
|
||||
if (mode === 'file') {
|
||||
const files = this.uploadedFiles();
|
||||
if (!files || files.length === 0) {
|
||||
this.errorMessage.set('Bitte Datei hochladen.');
|
||||
return;
|
||||
}
|
||||
|
||||
this.isExtracting.set(true);
|
||||
this.progress.set(0);
|
||||
this.statusMessage.set('Dateien werden verarbeitet...');
|
||||
|
||||
const totalFiles = files.length;
|
||||
let processedFiles = 0;
|
||||
const fileUploads: FileUpload[] = new Array(totalFiles);
|
||||
|
||||
files.forEach((fileItem, index) => {
|
||||
const file = fileItem.file;
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = (e) => {
|
||||
const dataUrl = e.target?.result as string;
|
||||
const base64 = dataUrl.split(',')[1] ?? '';
|
||||
|
||||
fileUploads[index] = {
|
||||
filename: file.name,
|
||||
content_base64: base64,
|
||||
mime_type: file.type || 'application/octet-stream',
|
||||
};
|
||||
|
||||
processedFiles++;
|
||||
|
||||
if (processedFiles === totalFiles) {
|
||||
this.sendFilesToWebSocket(fileUploads);
|
||||
}
|
||||
};
|
||||
|
||||
reader.onerror = () => {
|
||||
console.error('Error reading file:', file.name);
|
||||
fileUploads[index] = {
|
||||
filename: file.name,
|
||||
content_base64: '',
|
||||
mime_type: file.type || 'application/octet-stream',
|
||||
};
|
||||
|
||||
processedFiles++;
|
||||
|
||||
if (processedFiles === totalFiles) {
|
||||
this.sendFilesToWebSocket(fileUploads);
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// For URL and text, fall back to original behavior
|
||||
void this.extractKeywords();
|
||||
}
|
||||
|
||||
@@ -592,7 +749,7 @@ export class KeywordsSearchComponent {
|
||||
} catch (error) {
|
||||
console.error('WebSocket send error:', error);
|
||||
this.isExtracting.set(false);
|
||||
this.statusMessage.set('Fehler beim Senden der Anfrage');
|
||||
this.errorMessage.set('Fehler beim Senden der Anfrage');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,16 +757,20 @@ export class KeywordsSearchComponent {
|
||||
this.websocketService.close();
|
||||
this.isExtracting.set(false);
|
||||
this.progress.set(0);
|
||||
this.statusMessage.set('Extraktion abgebrochen');
|
||||
this.errorMessage.set('Extraktion abgebrochen');
|
||||
}
|
||||
|
||||
search(): void {
|
||||
this.showVisualization.set(false);
|
||||
this.showPatents.set(false);
|
||||
const fuzzySearch =
|
||||
this.route.snapshot.queryParamMap.get('fuzzy') === 'true';
|
||||
const payload: SearchResultsPayload = {
|
||||
extractedKeywords: this.getSelectedExtractedKeywordEntries(),
|
||||
manualKeywords: this.getSelectedManualKeywordEntries(),
|
||||
keywords: this.selectedKeywords(),
|
||||
options: {
|
||||
softSearch: this.topicMappingSearch(),
|
||||
fuzzy: fuzzySearch,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -628,11 +789,22 @@ export class KeywordsSearchComponent {
|
||||
this.router.navigate(['keywords/search-results'], {
|
||||
queryParams: {
|
||||
keywords: this.serializeKeywords(payload.keywords),
|
||||
softSearch: payload.options.softSearch ? true : false,
|
||||
fuzzy: fuzzySearch,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
visualize(): void {
|
||||
this.showPatents.set(false);
|
||||
this.showVisualization.set(true);
|
||||
}
|
||||
|
||||
loadPatentsForSelection(): void {
|
||||
this.showVisualization.set(false);
|
||||
this.showPatents.set(true);
|
||||
this.loadMatchingPatents();
|
||||
}
|
||||
|
||||
// --- Helpers --------------------------------------------------------------
|
||||
|
||||
private applyExtractedKeywords(keywords: ExtractedKeywords): void {
|
||||
@@ -691,10 +863,6 @@ export class KeywordsSearchComponent {
|
||||
}
|
||||
this.updateQueryParams();
|
||||
}
|
||||
onToggleTopicMappingSearch(event: any): void {
|
||||
this.topicMappingSearch.set(event.checked);
|
||||
this.updateQueryParams();
|
||||
}
|
||||
onSubfieldLegendVisibleChange(visible: boolean): void {
|
||||
this.subfieldLegendVisible.set(visible);
|
||||
this.updateQueryParams();
|
||||
@@ -825,9 +993,7 @@ export class KeywordsSearchComponent {
|
||||
const view = queryParams.get('view') ?? 'llm';
|
||||
const legend = queryParams.get('legend') ?? 'on';
|
||||
const legendExpanded = queryParams.get('legendExpanded') ?? 'off';
|
||||
const softSearch = queryParams.get('softSearch') === 'true';
|
||||
this.isRestoringState = true;
|
||||
|
||||
this.form.patchValue(
|
||||
{
|
||||
selectedInputType: mode,
|
||||
@@ -840,7 +1006,6 @@ export class KeywordsSearchComponent {
|
||||
this.subfieldLegendVisible.set(legend === 'on');
|
||||
this.subfieldLegendExpanded.set(legendExpanded === 'on');
|
||||
this.extractionSource.set(source as InputMode);
|
||||
this.topicMappingSearch.set(softSearch);
|
||||
this.restoreStateFromSession();
|
||||
|
||||
const merged = this.uniqueKeywordEntries([
|
||||
@@ -852,12 +1017,6 @@ export class KeywordsSearchComponent {
|
||||
// enrich only newly added keywords that have no topic yet
|
||||
this.enrichManualKeywordsWithTopics(manual);
|
||||
|
||||
// User intent (the current selection): the URL is always authoritative
|
||||
// here, deliberately overriding whatever the session cache had. This
|
||||
// is what makes a deep link like ?selected=foo&manual=bar from another
|
||||
// page reliably preselect keywords, instead of getting merged with (or
|
||||
// hidden behind) leftover state from a previous visit in the same tab.
|
||||
|
||||
// clean up the selection to only include keywords that actually exist in
|
||||
const manualKeywordSet = new Set(
|
||||
this.getKeywordLabels(this.manualKeywords()).map((k) =>
|
||||
@@ -906,7 +1065,6 @@ export class KeywordsSearchComponent {
|
||||
view: this.keywordView(),
|
||||
legend: this.subfieldLegendVisible() ? 'on' : 'off',
|
||||
legendExpanded: this.subfieldLegendExpanded() ? 'on' : 'off',
|
||||
softSearch: this.topicMappingSearch() ? true : false,
|
||||
broad: this.serializeKeywords(
|
||||
this.getKeywordLabels(this.broadKeywords()),
|
||||
),
|
||||
@@ -1009,7 +1167,10 @@ export class KeywordsSearchComponent {
|
||||
}
|
||||
|
||||
private parseMode(mode: string | null): InputMode {
|
||||
return mode === 'text' ? 'text' : 'url';
|
||||
if (mode === 'url') return 'url';
|
||||
if (mode === 'text') return 'text';
|
||||
if (mode === 'file') return 'file';
|
||||
return 'url';
|
||||
}
|
||||
|
||||
private parseKeywordList(rawValue: string | null): string[] {
|
||||
@@ -1067,4 +1228,76 @@ export class KeywordsSearchComponent {
|
||||
return 50; // fallback for unknown steps
|
||||
}
|
||||
}
|
||||
|
||||
private loadMatchingPatents(): void {
|
||||
const keywords = this.buildPatentSearchItems(
|
||||
this.getSelectedPatentKeywordEntries(),
|
||||
);
|
||||
if (keywords.length === 0) {
|
||||
this.patentMatches.set([]);
|
||||
this.patentsLoaded.set(true);
|
||||
return;
|
||||
}
|
||||
|
||||
this.loadingPatents.set(true);
|
||||
this.patentsError.set(false);
|
||||
|
||||
this.keywordsService.getPatentsByKeywords({ keywords }).subscribe({
|
||||
next: (response) => {
|
||||
this.patentMatches.set(response.patents ?? []);
|
||||
this.patentsLoaded.set(true);
|
||||
this.loadingPatents.set(false);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Patent search failed:', error);
|
||||
this.patentMatches.set([]);
|
||||
this.patentsLoaded.set(true);
|
||||
this.patentsError.set(true);
|
||||
this.loadingPatents.set(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private getSelectedPatentKeywordEntries(): Array<{
|
||||
entry: KeywordEntryWithTopic;
|
||||
level: KeywordPatentLevel;
|
||||
}> {
|
||||
const selected = new Set(
|
||||
this.selectedKeywords().map((k) => this.normalizeKeyword(k)),
|
||||
);
|
||||
const isSelected = (item: KeywordEntryWithTopic) =>
|
||||
selected.has(this.normalizeKeyword(this.getKeywordLabel(item)));
|
||||
|
||||
return [
|
||||
...this.broadKeywordEntries()
|
||||
.filter(isSelected)
|
||||
.map((entry) => ({ entry, level: 'broad' as const })),
|
||||
...this.coarseKeywordEntries()
|
||||
.filter(isSelected)
|
||||
.map((entry) => ({ entry, level: 'coarse' as const })),
|
||||
...this.fineKeywordEntries()
|
||||
.filter(isSelected)
|
||||
.map((entry) => ({ entry, level: 'fine' as const })),
|
||||
...this.manualKeywordEntries()
|
||||
.filter(isSelected)
|
||||
.map((entry) => ({ entry, level: 'custom' as const })),
|
||||
];
|
||||
}
|
||||
|
||||
private buildPatentSearchItems(
|
||||
items: Array<{ entry: KeywordEntryWithTopic; level: KeywordPatentLevel }>,
|
||||
): KeywordPatentSearchItem[] {
|
||||
return items
|
||||
.map(({ entry, level }) => ({
|
||||
keyword: entry.llm_keyword.keyword,
|
||||
keyword_level: level,
|
||||
topic_id: entry.topic_mapping?.topic?.id ?? null,
|
||||
topic_display_name: entry.topic_mapping?.topic?.display_name ?? null,
|
||||
subfield_name:
|
||||
entry.topic_mapping?.topic?.subfield?.display_name ?? null,
|
||||
field_name: entry.topic_mapping?.topic?.field?.display_name ?? null,
|
||||
relevance_score: entry.llm_keyword.relevance_score ?? 1,
|
||||
}))
|
||||
.filter((item) => item.keyword.trim().length > 0);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ export class KeywordsToNewsResultsComponent {
|
||||
manualKeywords: this.state.manualKeywords(),
|
||||
extractedKeywords: this.state.extractedKeywords(),
|
||||
keywords: this.state.keywords(),
|
||||
softSearch: this.state.softSearch(),
|
||||
fuzzy: this.state.fuzzySearch(),
|
||||
weights: {
|
||||
raw: weights.raw,
|
||||
normalized: weights.normalized,
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ export class KeywordsToPatentsResultsComponent {
|
||||
manualKeywords: this.state.manualKeywords(),
|
||||
extractedKeywords: this.state.extractedKeywords(),
|
||||
keywords: this.state.keywords(),
|
||||
softSearch: this.state.softSearch(),
|
||||
fuzzy: this.state.fuzzySearch(),
|
||||
weights: {
|
||||
raw: weights.raw,
|
||||
normalized: weights.normalized,
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ export class KeywordsToPersonsResultsComponent {
|
||||
manualKeywords: this.state.manualKeywords(),
|
||||
extractedKeywords: this.state.extractedKeywords(),
|
||||
keywords: this.state.keywords(),
|
||||
softSearch: this.state.softSearch(),
|
||||
fuzzy: this.state.fuzzySearch(),
|
||||
weights: {
|
||||
raw: weights.raw,
|
||||
normalized: weights.normalized,
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ export class KeywordsToProjectsResultsComponent {
|
||||
manualKeywords: this.state.manualKeywords(),
|
||||
extractedKeywords: this.state.extractedKeywords(),
|
||||
keywords: this.state.keywords(),
|
||||
softSearch: this.state.softSearch(),
|
||||
fuzzy: this.state.fuzzySearch(),
|
||||
weights: {
|
||||
raw: weights.raw,
|
||||
normalized: weights.normalized,
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ export interface SearchResultsPayload {
|
||||
manualKeywords: KeywordEntryWithTopic[];
|
||||
keywords: string[];
|
||||
options: {
|
||||
softSearch: boolean;
|
||||
fuzzy: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ export class SearchResultsStateService {
|
||||
});
|
||||
|
||||
readonly keywords = computed(() => this._payload()?.keywords ?? []);
|
||||
readonly softSearch = computed(
|
||||
() => this._payload()?.options.softSearch ?? false,
|
||||
readonly fuzzySearch = computed(
|
||||
() => this._payload()?.options.fuzzy ?? false,
|
||||
);
|
||||
readonly extractedKeywords = computed(
|
||||
() => this._payload()?.extractedKeywords ?? [],
|
||||
|
||||
+13
-4
@@ -10,14 +10,23 @@
|
||||
<mat-card-content>
|
||||
<div class="summary-header">
|
||||
<div>
|
||||
<span class="summary-label">Suchprofil</span>
|
||||
<span class="summary-label">
|
||||
{{
|
||||
state.fuzzySearch() ? 'Topic Mapping' : 'Keyword Matching'
|
||||
}}</span
|
||||
>
|
||||
<span class="summary-count"
|
||||
>{{ selectedKeywordCount() }} Keywords</span
|
||||
>
|
||||
</div>
|
||||
<span class="mode-badge">
|
||||
<mat-icon>account_tree</mat-icon>
|
||||
{{ state.softSearch() ? 'Topic Mapping' : 'Keyword Matching' }}
|
||||
<mat-slide-toggle
|
||||
labelPosition="before"
|
||||
(change)="onToggleFuzzySearch($event)"
|
||||
[checked]="fuzzySearch()"
|
||||
matTooltip="Wenn aktiviert, werden die extrahierten Keywords auf bekannte Themenbereiche abgebildet, was die Suchergebnisse vermehrt">
|
||||
Fuzzy Search
|
||||
</mat-slide-toggle>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -58,7 +67,7 @@
|
||||
[active]="rla.isActive"
|
||||
[queryParams]="{
|
||||
keywords: state.payload()?.keywords?.join(','),
|
||||
softSearch: state.payload()?.options?.softSearch,
|
||||
fuzzy: state.payload()?.options?.fuzzy,
|
||||
}">
|
||||
<mat-icon>{{ route.icon }}</mat-icon>
|
||||
{{ route.label }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, computed, inject } from '@angular/core';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import {
|
||||
ActivatedRoute,
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { KeywordEntryWithTopic } from '../../../api/model/keywordEntryWithTopic';
|
||||
import { Topic } from '../../../api/model/topic';
|
||||
import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component';
|
||||
@@ -37,6 +37,7 @@ import {
|
||||
MatIconModule,
|
||||
TopicChipComponent,
|
||||
MatTabsModule,
|
||||
MatSlideToggleModule,
|
||||
],
|
||||
providers: [SearchResultsStateService],
|
||||
templateUrl: './search-results.component.html',
|
||||
@@ -62,6 +63,55 @@ export class KeywordsSearchResultsComponent {
|
||||
];
|
||||
|
||||
readonly selectedKeywordCount = computed(() => this.state.keywords().length);
|
||||
readonly fuzzySearch = signal<boolean>(false);
|
||||
readonly selectedKeywordEntries = computed(() => {
|
||||
const payload = this.state.payload();
|
||||
if (!payload) return [];
|
||||
|
||||
const allEntries = [
|
||||
...(payload.extractedKeywords ?? []),
|
||||
...(payload.manualKeywords ?? []),
|
||||
];
|
||||
|
||||
const entryByKeyword = new Map<string, KeywordEntryWithTopic>();
|
||||
|
||||
for (const entry of allEntries) {
|
||||
entryByKeyword.set(
|
||||
this.normalizeKeyword(this.getKeywordLabel(entry)),
|
||||
entry,
|
||||
);
|
||||
}
|
||||
|
||||
const result: KeywordEntryWithTopic[] = [];
|
||||
const seen = new Set<string>();
|
||||
|
||||
for (const keyword of payload.keywords) {
|
||||
const normalized = this.normalizeKeyword(keyword);
|
||||
const entry = entryByKeyword.get(normalized);
|
||||
|
||||
if (!entry || seen.has(normalized)) continue;
|
||||
|
||||
seen.add(normalized);
|
||||
result.push(entry);
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
readonly missingKeywordLabels = computed(() => {
|
||||
const payload = this.state.payload();
|
||||
if (!payload) return [];
|
||||
|
||||
const entryKeywordSet = new Set(
|
||||
this.selectedKeywordEntries().map((entry) =>
|
||||
this.normalizeKeyword(this.getKeywordLabel(entry)),
|
||||
),
|
||||
);
|
||||
|
||||
return payload.keywords.filter(
|
||||
(keyword) => !entryKeywordSet.has(this.normalizeKeyword(keyword)),
|
||||
);
|
||||
});
|
||||
|
||||
constructor() {
|
||||
// Query params are authoritative (URL survives reload, deep links,
|
||||
@@ -71,7 +121,7 @@ export class KeywordsSearchResultsComponent {
|
||||
// previous search never gets silently applied to a new one.
|
||||
this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((params) => {
|
||||
const keywords = this.parseKeywordList(params.get('keywords'));
|
||||
const softSearch = params.get('softSearch') === 'on';
|
||||
const fuzzySearch = params.get('fuzzy') === 'true';
|
||||
|
||||
const cached = this.readHandoffCache();
|
||||
const cacheMatches =
|
||||
@@ -79,19 +129,30 @@ export class KeywordsSearchResultsComponent {
|
||||
|
||||
this.state.setPayload({
|
||||
keywords,
|
||||
options: { softSearch },
|
||||
options: { fuzzy: fuzzySearch },
|
||||
extractedKeywords: cacheMatches ? cached!.extractedKeywords : [],
|
||||
manualKeywords: cacheMatches ? cached!.manualKeywords : [],
|
||||
});
|
||||
|
||||
this.fuzzySearch.set(fuzzySearch);
|
||||
});
|
||||
}
|
||||
|
||||
goBackToSearch(): void {
|
||||
void this.router.navigate(['/keywords']);
|
||||
void this.router.navigate(['/keywords'], {
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
|
||||
getChipLabel(keyword: KeywordEntryWithTopic): string {
|
||||
return keyword.llm_keyword?.keyword ?? '';
|
||||
if (!this.fuzzySearch()) {
|
||||
return keyword.llm_keyword?.keyword ?? '';
|
||||
}
|
||||
return (
|
||||
keyword.topic_mapping?.topic?.display_name ??
|
||||
keyword.llm_keyword?.keyword ??
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
getChipDescription(item: KeywordEntryWithTopic): string | null {
|
||||
@@ -155,7 +216,7 @@ export class KeywordsSearchResultsComponent {
|
||||
manualKeywords: maybePayload.manualKeywords ?? [],
|
||||
keywords: maybePayload.keywords ?? [],
|
||||
options: {
|
||||
softSearch: maybePayload.options?.softSearch ?? false,
|
||||
fuzzy: maybePayload.options?.fuzzy ?? false,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -185,4 +246,15 @@ export class KeywordsSearchResultsComponent {
|
||||
private normalizeKeyword(value: string): string {
|
||||
return value.trim().toLowerCase();
|
||||
}
|
||||
onToggleFuzzySearch(event: any): void {
|
||||
this.fuzzySearch.set(event.checked);
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: {
|
||||
fuzzy: this.fuzzySearch(),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ export class KeywordsToWorksResultsComponent {
|
||||
manualKeywords: this.state.manualKeywords(),
|
||||
extractedKeywords: this.state.extractedKeywords(),
|
||||
keywords: this.state.keywords(),
|
||||
softSearch: this.state.softSearch(),
|
||||
fuzzy: this.state.fuzzySearch(),
|
||||
weights: {
|
||||
raw: weights.raw,
|
||||
normalized: weights.normalized,
|
||||
|
||||
@@ -39,8 +39,9 @@
|
||||
</div>
|
||||
<h1>{{ patent.title || patent.patent_id || 'Ohne Titel' }}</h1>
|
||||
<p class="meta-line">
|
||||
@if (patent.publication_date; as date) {
|
||||
<span>· {{ formatDate(date) }}</span>
|
||||
<span>{{ patent.patent_id }}</span>
|
||||
@if (patent.publication_date) {
|
||||
<span>· {{ formatDate(patent.publication_date) }}</span>
|
||||
}
|
||||
</p>
|
||||
<div class="hero-actions">
|
||||
@@ -62,12 +63,12 @@
|
||||
<div class="metrics" aria-label="Patentkennzahlen">
|
||||
<div>
|
||||
<mat-icon>groups</mat-icon>
|
||||
<strong>{{ patent.inventors && patent.inventors.length }}</strong>
|
||||
<strong>{{ patent.inventors?.length ?? 0 }}</strong>
|
||||
<span>Erfinder</span>
|
||||
</div>
|
||||
<div>
|
||||
<mat-icon>business</mat-icon>
|
||||
<strong>{{ patent.assignees && patent.assignees.length }}</strong>
|
||||
<strong>{{ patent.assignees?.length ?? 0 }}</strong>
|
||||
<span>Anmelder</span>
|
||||
</div>
|
||||
<div>
|
||||
@@ -96,7 +97,7 @@
|
||||
<div class="section-title">
|
||||
<mat-icon>engineering</mat-icon>
|
||||
<h2>Erfinder</h2>
|
||||
<span>{{ patent.inventors && patent.inventors.length }}</span>
|
||||
<span>{{ patent.inventors?.length ?? 0 }}</span>
|
||||
</div>
|
||||
<div class="tags">
|
||||
@for (inventor of patent.inventors; track inventor) {
|
||||
@@ -107,12 +108,12 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@if (patent.assignees && patent.assignees.length > 0) {
|
||||
@if (patent.assignees?.length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<mat-icon>account_balance</mat-icon>
|
||||
<h2>Anmelder</h2>
|
||||
<span>{{ patent.assignees.length }}</span>
|
||||
<span>{{ patent.assignees?.length ?? 0 }}</span>
|
||||
</div>
|
||||
<div class="compact-list">
|
||||
@for (assignee of patent.assignees; track assignee) {
|
||||
@@ -124,7 +125,30 @@
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (patent.ipc_descriptions && patent.ipc_descriptions.length > 0) {
|
||||
@if (patent.openalex_topics?.length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<mat-icon>topic</mat-icon>
|
||||
<h2>OpenAlex Themen</h2>
|
||||
</div>
|
||||
<div class="tags">
|
||||
@for (
|
||||
topic of patent.openalex_topics;
|
||||
track topic.topic_id ?? topic.topic_display_name
|
||||
) {
|
||||
<app-topic-chip
|
||||
[label]="topic.topic_display_name"
|
||||
[fieldName]="topic.field_name"
|
||||
[domainName]="topic.domain_name"
|
||||
[color]="topicColor(topic)"
|
||||
size="mini">
|
||||
</app-topic-chip>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (patent.ipc_descriptions?.length) {
|
||||
<section
|
||||
class="card classification-card-section classification-card-section--ipc">
|
||||
<div class="section-title">
|
||||
@@ -140,7 +164,17 @@
|
||||
<header class="classification-card__header">
|
||||
<div class="classification-card__codes">
|
||||
@for (symbol of card.symbols; track symbol) {
|
||||
<span class="classification-code">{{ symbol }}</span>
|
||||
<span
|
||||
class="classification-code"
|
||||
[style.border]="'1px solid ' + sectionColor(card)"
|
||||
[style.color]="sectionColor(card)"
|
||||
[style.background]="
|
||||
'color-mix(in srgb, ' +
|
||||
sectionColor(card) +
|
||||
' 12%, white)'
|
||||
">
|
||||
{{ symbol }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<div class="classification-card__badges">
|
||||
@@ -189,7 +223,7 @@
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
} @else if (patent.ipc && patent.ipc.length > 0) {
|
||||
} @else if (patent.ipc?.length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<mat-icon>label</mat-icon>
|
||||
@@ -203,7 +237,7 @@
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (patent.cpc_descriptions && patent.cpc_descriptions.length > 0) {
|
||||
@if (patent.cpc_descriptions?.length) {
|
||||
<section
|
||||
class="card classification-card-section classification-card-section--cpc">
|
||||
<div class="section-title">
|
||||
@@ -219,7 +253,17 @@
|
||||
<header class="classification-card__header">
|
||||
<div class="classification-card__codes">
|
||||
@for (symbol of card.symbols; track symbol) {
|
||||
<span class="classification-code">{{ symbol }}</span>
|
||||
<span
|
||||
class="classification-code"
|
||||
[style.border]="'1px solid ' + sectionColor(card)"
|
||||
[style.color]="sectionColor(card)"
|
||||
[style.background]="
|
||||
'color-mix(in srgb, ' +
|
||||
sectionColor(card) +
|
||||
' 12%, white)'
|
||||
">
|
||||
{{ symbol }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<div class="classification-card__badges">
|
||||
@@ -268,7 +312,7 @@
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
} @else if (patent.cpc && patent.cpc.length > 0) {
|
||||
} @else if (patent.cpc?.length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<mat-icon>label</mat-icon>
|
||||
|
||||
@@ -9,6 +9,9 @@ import { finalize } from 'rxjs';
|
||||
|
||||
import { PatentsService } from '../../api/api/patents.service';
|
||||
import { PatentEntry } from '../../api/model/patentEntry';
|
||||
import { OpenAlexTopicTag } from '../../api/model/openAlexTopicTag';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import {
|
||||
ClassificationCard,
|
||||
ClassificationSystem,
|
||||
@@ -28,6 +31,7 @@ import {
|
||||
MatIconModule,
|
||||
MatProgressSpinnerModule,
|
||||
RouterLink,
|
||||
TopicChipComponent,
|
||||
],
|
||||
templateUrl: './patent-detail.component.html',
|
||||
styleUrl: './patent-detail.component.scss',
|
||||
@@ -93,6 +97,19 @@ export class PatentDetailComponent implements OnInit {
|
||||
return getClassificationCards(entries, system);
|
||||
}
|
||||
|
||||
topicColor(topic: OpenAlexTopicTag): string {
|
||||
return topicHierarchyColor({
|
||||
id: topic.topic_id,
|
||||
name: topic.topic_display_name,
|
||||
field_name: topic.field_name,
|
||||
domain_name: topic.domain_name,
|
||||
});
|
||||
}
|
||||
|
||||
sectionColor(card: ClassificationCard): string {
|
||||
return topicHierarchyColor({ field_name: card.sectionName });
|
||||
}
|
||||
|
||||
toggleClassificationExpanded(key: string): void {
|
||||
if (this.expandedClassificationKeys.has(key)) {
|
||||
this.expandedClassificationKeys.delete(key);
|
||||
@@ -128,7 +145,7 @@ export class PatentDetailComponent implements OnInit {
|
||||
.getPatentByIdOrTitle(patentId, prefix, title, fillingDate)
|
||||
.pipe(finalize(() => (this.loading = false)))
|
||||
.subscribe({
|
||||
next: (patent) => {
|
||||
next: (patent: PatentEntry) => {
|
||||
this.patent = patent;
|
||||
},
|
||||
error: () => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { PatentEntry } from '../../api/model/patentEntry';
|
||||
import { IpcClassification } from '../../api/model/ipcClassification';
|
||||
|
||||
export type ClassificationSystem = 'IPC' | 'CPC';
|
||||
|
||||
export interface ClassificationCard {
|
||||
@@ -9,6 +10,7 @@ export interface ClassificationCard {
|
||||
levelLabel: string;
|
||||
primaryDescription: string | null;
|
||||
hierarchy: { label: string; value: string }[];
|
||||
sectionName: string | null;
|
||||
}
|
||||
|
||||
export interface PatentMetadataRow {
|
||||
@@ -156,6 +158,7 @@ function buildClassificationCard(
|
||||
levelLabel: level.label,
|
||||
primaryDescription,
|
||||
hierarchy: buildHierarchyRows(entry, primaryDescription),
|
||||
sectionName: entry.section ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -190,9 +193,10 @@ function buildHierarchyRows(
|
||||
seen.add(normalized);
|
||||
rows.push({ label, value });
|
||||
};
|
||||
if (entry.section) addRow('Sektion', entry.section);
|
||||
if (entry.class) addRow('Klasse', entry.class);
|
||||
if (entry.subclass) addRow('Unterklasse', entry.subclass);
|
||||
|
||||
addRow('Sektion', entry.section ?? null);
|
||||
addRow('Klasse', entry.class ?? null);
|
||||
addRow('Unterklasse', entry.subclass ?? null);
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,55 @@
|
||||
<mat-chip-option value="USPTO">USPTO</mat-chip-option>
|
||||
</mat-chip-listbox>
|
||||
|
||||
<app-query-param-selector
|
||||
[options]="sortingDirectionOptions"
|
||||
[queryParamKey]="'sort_direction'"
|
||||
label="Sortierreihenfolge"
|
||||
(handleSelectionChange)="setSortDirection($event.value)" />
|
||||
<div class="year-filter">
|
||||
<div class="year-filter-top">
|
||||
<span class="year-filter-label">Zeitraum</span>
|
||||
<button
|
||||
type="button"
|
||||
class="reset-range-button"
|
||||
[disabled]="!canResetYearRange"
|
||||
(click)="resetYearRange()">
|
||||
Zurücksetzen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="year-filter-values">
|
||||
<span>{{ selectedStartYear }}</span>
|
||||
<span>bis</span>
|
||||
<span>{{ selectedEndYear }}</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="year-range-slider"
|
||||
[style.--range-start]="rangeStartPercent"
|
||||
[style.--range-end]="rangeEndPercent">
|
||||
<div class="range-track"></div>
|
||||
<input
|
||||
class="range-input range-input-start"
|
||||
type="range"
|
||||
[min]="minYear"
|
||||
[max]="maxYear"
|
||||
[value]="selectedStartYear"
|
||||
[style.z-index]="selectedStartYear >= selectedEndYear - 5 ? 4 : 2"
|
||||
(input)="onStartYearDrag($event)"
|
||||
(change)="onStartYearInput($event)"
|
||||
aria-label="Startjahr" />
|
||||
<input
|
||||
class="range-input range-input-end"
|
||||
type="range"
|
||||
[min]="minYear"
|
||||
[max]="maxYear"
|
||||
[value]="selectedEndYear"
|
||||
(input)="onEndYearDrag($event)"
|
||||
(change)="onEndYearInput($event)"
|
||||
aria-label="Endjahr" />
|
||||
</div>
|
||||
|
||||
<div class="year-filter-bounds">
|
||||
<span>{{ minYear }}</span>
|
||||
<span>{{ maxYear }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -98,6 +142,26 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@if ((selectedPatent.openalex_topics?.length ?? 0) > 0) {
|
||||
<div class="detail-section">
|
||||
<h4>OpenAlex Themen</h4>
|
||||
<div class="tag-list">
|
||||
@for (
|
||||
topic of selectedPatent.openalex_topics;
|
||||
track topic.topic_id ?? topic.topic_display_name
|
||||
) {
|
||||
<app-topic-chip
|
||||
[label]="topic.topic_display_name"
|
||||
[fieldName]="topic.field_name"
|
||||
[domainName]="topic.domain_name"
|
||||
[color]="topicColor(topic)"
|
||||
size="mini">
|
||||
</app-topic-chip>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if ((selectedPatent.ipc_descriptions?.length ?? 0) > 0) {
|
||||
<div
|
||||
class="detail-section classification-section classification-section--ipc">
|
||||
@@ -114,7 +178,17 @@
|
||||
<header class="classification-card__header">
|
||||
<div class="classification-card__codes">
|
||||
@for (sym of card.symbols; track sym) {
|
||||
<span class="classification-code">{{ sym }}</span>
|
||||
<span
|
||||
class="classification-code"
|
||||
[style.border]="'1px solid ' + sectionColor(card)"
|
||||
[style.color]="sectionColor(card)"
|
||||
[style.background]="
|
||||
'color-mix(in srgb, ' +
|
||||
sectionColor(card) +
|
||||
' 12%, white)'
|
||||
">
|
||||
{{ sym }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<div class="classification-card__badges">
|
||||
@@ -190,7 +264,17 @@
|
||||
<header class="classification-card__header">
|
||||
<div class="classification-card__codes">
|
||||
@for (sym of card.symbols; track sym) {
|
||||
<span class="classification-code">{{ sym }}</span>
|
||||
<span
|
||||
class="classification-code"
|
||||
[style.border]="'1px solid ' + sectionColor(card)"
|
||||
[style.color]="sectionColor(card)"
|
||||
[style.background]="
|
||||
'color-mix(in srgb, ' +
|
||||
sectionColor(card) +
|
||||
' 12%, white)'
|
||||
">
|
||||
{{ sym }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<div class="classification-card__badges">
|
||||
@@ -302,12 +386,10 @@
|
||||
|
||||
<mat-divider />
|
||||
|
||||
@if (!showDetail) {
|
||||
<mat-paginator
|
||||
[length]="total"
|
||||
[pageSize]="pageSize"
|
||||
[pageIndex]="page"
|
||||
[pageSizeOptions]="[10, 25, 50]"
|
||||
(page)="handlePageChange($event)" />
|
||||
}
|
||||
<mat-paginator
|
||||
[length]="total"
|
||||
[pageSize]="pageSize"
|
||||
[pageIndex]="page"
|
||||
[pageSizeOptions]="[10, 25, 50]"
|
||||
(page)="handlePageChange($event)" />
|
||||
</div>
|
||||
|
||||
@@ -15,12 +15,12 @@ import { debounceTime, distinctUntilChanged, Subject } from 'rxjs';
|
||||
import { PatentsService } from '../../api/api/patents.service';
|
||||
import { PatentEntry } from '../../api/model/patentEntry';
|
||||
import { IpcClassification } from '../../api';
|
||||
import {
|
||||
QueryParamSelectorComponent,
|
||||
SelectorOption,
|
||||
} from '../../shared/ui/query-param-selector/query-param-selector.component';
|
||||
import { OpenAlexTopicTag } from '../../api/model/openAlexTopicTag';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
|
||||
type ClassificationSystem = 'IPC' | 'CPC';
|
||||
|
||||
interface ClassificationCard {
|
||||
@@ -30,9 +30,11 @@ interface ClassificationCard {
|
||||
levelLabel: string;
|
||||
primaryDescription: string | null;
|
||||
hierarchy: { label: string; value: string }[];
|
||||
sectionName: string | null;
|
||||
}
|
||||
|
||||
const DESCRIPTION_PREVIEW_LENGTH = 140;
|
||||
const MIN_YEAR = 1978;
|
||||
|
||||
@Component({
|
||||
selector: 'app-patents',
|
||||
@@ -48,7 +50,7 @@ const DESCRIPTION_PREVIEW_LENGTH = 140;
|
||||
MatProgressSpinnerModule,
|
||||
MatChipsModule,
|
||||
MatDividerModule,
|
||||
QueryParamSelectorComponent,
|
||||
TopicChipComponent,
|
||||
],
|
||||
templateUrl: './patents.component.html',
|
||||
styleUrl: './patents.component.scss',
|
||||
@@ -68,19 +70,19 @@ export class PatentsComponent implements OnInit {
|
||||
|
||||
searchTerm = '';
|
||||
activeFilter: SourceFilter = 'all';
|
||||
sortDirection: string = 'desc';
|
||||
sortDirection: string = 'asc';
|
||||
|
||||
selectedPatent: PatentEntry | null = null;
|
||||
showDetail = false;
|
||||
private expandedClassificationKeys = new Set<string>();
|
||||
// Jahr-Slider
|
||||
readonly minYear = MIN_YEAR;
|
||||
readonly maxYear = new Date().getFullYear();
|
||||
selectedStartYear = MIN_YEAR;
|
||||
selectedEndYear = new Date().getFullYear();
|
||||
|
||||
private searchSubject = new Subject<string>();
|
||||
|
||||
sortingDirectionOptions: SelectorOption[] = [
|
||||
{ value: '', display_name: '' },
|
||||
{ value: 'asc', display_name: 'Aufsteigend' },
|
||||
{ value: 'desc', display_name: 'Absteigend' },
|
||||
];
|
||||
showDetail = false;
|
||||
selectedPatent: PatentEntry | null = null;
|
||||
readonly expandedClassificationKeys = new Set<string>();
|
||||
|
||||
constructor() {
|
||||
this.searchSubject
|
||||
@@ -88,8 +90,6 @@ export class PatentsComponent implements OnInit {
|
||||
.subscribe((term) => {
|
||||
this.searchTerm = term;
|
||||
this.page = 0;
|
||||
this.selectedPatent = null;
|
||||
this.showDetail = false;
|
||||
this.loadPatents();
|
||||
this.updateQueryParams();
|
||||
});
|
||||
@@ -104,10 +104,82 @@ export class PatentsComponent implements OnInit {
|
||||
if (f === 'EPO' || f === 'USPTO') this.activeFilter = f;
|
||||
const d = qp.get('sort_direction');
|
||||
if (d === 'asc' || d === 'desc') this.sortDirection = d;
|
||||
const sy = parseInt(qp.get('year_from') ?? '', 10);
|
||||
const ey = parseInt(qp.get('year_to') ?? '', 10);
|
||||
if (!isNaN(sy)) this.selectedStartYear = sy;
|
||||
if (!isNaN(ey)) this.selectedEndYear = ey;
|
||||
|
||||
this.loadPatents();
|
||||
}
|
||||
|
||||
get rangeStartPercent(): string {
|
||||
const total = this.maxYear - this.minYear;
|
||||
return `${((this.selectedStartYear - this.minYear) / total) * 100}%`;
|
||||
}
|
||||
|
||||
get rangeEndPercent(): string {
|
||||
const total = this.maxYear - this.minYear;
|
||||
return `${((this.selectedEndYear - this.minYear) / total) * 100}%`;
|
||||
}
|
||||
|
||||
get canResetYearRange(): boolean {
|
||||
return (
|
||||
this.selectedStartYear !== this.minYear ||
|
||||
this.selectedEndYear !== this.maxYear
|
||||
);
|
||||
}
|
||||
|
||||
// Fired continuously while dragging: only updates the displayed value/handle
|
||||
// position, no HTTP request yet.
|
||||
onStartYearDrag(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
this.selectedStartYear = Math.min(
|
||||
parseInt(input.value, 10),
|
||||
this.selectedEndYear,
|
||||
);
|
||||
}
|
||||
|
||||
onEndYearDrag(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
this.selectedEndYear = Math.max(
|
||||
parseInt(input.value, 10),
|
||||
this.selectedStartYear,
|
||||
);
|
||||
}
|
||||
|
||||
// Fired once on release: commits the value and triggers the search request.
|
||||
onStartYearInput(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
this.selectedStartYear = Math.min(
|
||||
parseInt(input.value, 10),
|
||||
this.selectedEndYear,
|
||||
);
|
||||
input.value = String(this.selectedStartYear);
|
||||
this.page = 0;
|
||||
this.loadPatents();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
onEndYearInput(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
this.selectedEndYear = Math.max(
|
||||
parseInt(input.value, 10),
|
||||
this.selectedStartYear,
|
||||
);
|
||||
input.value = String(this.selectedEndYear);
|
||||
this.page = 0;
|
||||
this.loadPatents();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
resetYearRange(): void {
|
||||
this.selectedStartYear = this.minYear;
|
||||
this.selectedEndYear = this.maxYear;
|
||||
this.page = 0;
|
||||
this.loadPatents();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
private loadPatents(): void {
|
||||
this.loading = true;
|
||||
this.error = false;
|
||||
@@ -121,6 +193,8 @@ export class PatentsComponent implements OnInit {
|
||||
source,
|
||||
'date',
|
||||
this.sortDirection,
|
||||
this.selectedStartYear,
|
||||
this.selectedEndYear,
|
||||
)
|
||||
.subscribe({
|
||||
next: (res) => {
|
||||
@@ -142,8 +216,6 @@ export class PatentsComponent implements OnInit {
|
||||
clearSearch(): void {
|
||||
this.searchTerm = '';
|
||||
this.page = 0;
|
||||
this.selectedPatent = null;
|
||||
this.showDetail = false;
|
||||
this.loadPatents();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
@@ -152,8 +224,6 @@ export class PatentsComponent implements OnInit {
|
||||
const val = event.value;
|
||||
this.activeFilter = val === 'EPO' || val === 'USPTO' ? val : 'all';
|
||||
this.page = 0;
|
||||
this.selectedPatent = null;
|
||||
this.showDetail = false;
|
||||
this.loadPatents();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
@@ -167,12 +237,14 @@ export class PatentsComponent implements OnInit {
|
||||
handlePageChange(event: PageEvent): void {
|
||||
this.page = event.pageIndex;
|
||||
this.pageSize = event.pageSize;
|
||||
this.selectedPatent = null;
|
||||
this.showDetail = false;
|
||||
this.loadPatents();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
openPatent(patent: PatentEntry): void {
|
||||
this.router.navigate(['/patent', patent.patent_id]);
|
||||
}
|
||||
|
||||
selectPatent(patent: PatentEntry): void {
|
||||
this.selectedPatent = patent;
|
||||
this.showDetail = true;
|
||||
@@ -194,6 +266,12 @@ export class PatentsComponent implements OnInit {
|
||||
size: this.pageSize,
|
||||
source: this.activeFilter === 'all' ? null : this.activeFilter,
|
||||
sort_direction: this.sortDirection,
|
||||
year_from:
|
||||
this.selectedStartYear !== this.minYear
|
||||
? this.selectedStartYear
|
||||
: null,
|
||||
year_to:
|
||||
this.selectedEndYear !== this.maxYear ? this.selectedEndYear : null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
@@ -312,9 +390,23 @@ export class PatentsComponent implements OnInit {
|
||||
levelLabel: level.label,
|
||||
primaryDescription,
|
||||
hierarchy: this.buildHierarchyRows(entry, primaryDescription),
|
||||
sectionName: entry.section ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
topicColor(topic: OpenAlexTopicTag): string {
|
||||
return topicHierarchyColor({
|
||||
id: topic.topic_id,
|
||||
name: topic.topic_display_name,
|
||||
field_name: topic.field_name,
|
||||
domain_name: topic.domain_name,
|
||||
});
|
||||
}
|
||||
|
||||
sectionColor(card: ClassificationCard): string {
|
||||
return topicHierarchyColor({ field_name: card.sectionName });
|
||||
}
|
||||
|
||||
private getClassificationLevel(entry: IpcClassification): {
|
||||
label: string;
|
||||
field: keyof IpcClassification;
|
||||
|
||||
@@ -5,25 +5,31 @@
|
||||
{{ initials() }}
|
||||
</div>
|
||||
<div class="header-main">
|
||||
<div class="bookmark">
|
||||
<div class="name-row">
|
||||
<h2
|
||||
[skText]="loading()"
|
||||
class="person-name"
|
||||
[title]="person().display_name ?? ''">
|
||||
{{ person().display_name ?? '' }}
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
class="bookmark-btn"
|
||||
(click)="
|
||||
toggleBookmark(); $event.stopPropagation(); $event.preventDefault()
|
||||
"
|
||||
[class.bookmarked]="isBookmarked()"
|
||||
aria-label="Bookmark person">
|
||||
[attr.aria-label]="
|
||||
isBookmarked() ? 'Bookmark entfernen' : 'Person speichern'
|
||||
"
|
||||
[matTooltip]="
|
||||
isBookmarked() ? 'Bookmark entfernen' : 'Person speichern'
|
||||
">
|
||||
<mat-icon>{{
|
||||
isBookmarked() ? 'bookmark' : 'bookmark_border'
|
||||
}}</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<h2
|
||||
[skText]="loading()"
|
||||
class="person-name"
|
||||
[title]="person().display_name ?? ''">
|
||||
{{ person().display_name ?? '' }}
|
||||
</h2>
|
||||
<p [skText]="loading()" class="person-id">
|
||||
{{ distinguishingId() }}
|
||||
</p>
|
||||
@@ -95,6 +101,14 @@
|
||||
>{{ inst.country_code.toUpperCase() }}</span
|
||||
>
|
||||
}
|
||||
@if (institutionPageId() && !loading()) {
|
||||
<mat-icon
|
||||
class="institution-open-icon"
|
||||
(click)="openInstitutionPage($event)"
|
||||
aria-label="Institutionsseite öffnen"
|
||||
>open_in_new</mat-icon
|
||||
>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
.card-header {
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
border-bottom: 1px solid var(--sg-surface-soft);
|
||||
text-decoration: none;
|
||||
@@ -52,6 +53,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.name-row {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
min-height: 40px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.rating-and-bookmark {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -82,18 +91,30 @@
|
||||
}
|
||||
|
||||
.bookmark-btn {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex: 0 0 32px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
padding: 2px;
|
||||
padding: 0;
|
||||
color: var(--sg-text-soft);
|
||||
transition:
|
||||
color 0.15s ease,
|
||||
background-color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--sg-primary-soft);
|
||||
color: var(--sg-primary);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&.bookmarked {
|
||||
color: #e53935;
|
||||
color: var(--sg-success);
|
||||
}
|
||||
|
||||
mat-icon {
|
||||
@@ -104,11 +125,12 @@
|
||||
}
|
||||
|
||||
.person-name {
|
||||
margin: 6px 0 2px;
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--sg-text);
|
||||
min-height: 24px;
|
||||
line-height: 24px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
@@ -162,6 +184,31 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.institution-open-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover .institution-open-icon {
|
||||
opacity: 0.7;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, input, computed, output } from '@angular/core';
|
||||
import { Component, inject, input, computed, output } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api';
|
||||
@@ -23,6 +23,8 @@ import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
styleUrl: './person-card.component.scss',
|
||||
})
|
||||
export class PersonCardComponent {
|
||||
private readonly router = inject(Router);
|
||||
|
||||
person = input.required<CustomAuthor>();
|
||||
isBookmarked = input<boolean>(false);
|
||||
loading = input<boolean>(false);
|
||||
@@ -66,6 +68,20 @@ export class PersonCardComponent {
|
||||
return newestInstitution;
|
||||
});
|
||||
|
||||
institutionPageId = computed<string | null>(
|
||||
() => this.institution()?.id?.split('/').pop() ?? null,
|
||||
);
|
||||
|
||||
openInstitutionPage(event: Event): void {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
const id = this.institutionPageId();
|
||||
if (!id) return;
|
||||
|
||||
void this.router.navigate(['/institution', id]);
|
||||
}
|
||||
|
||||
isInstitutionActive = computed<boolean>(() => {
|
||||
const active = this.activeInstitutionName().trim().toLowerCase();
|
||||
if (!active) return false;
|
||||
|
||||
@@ -82,6 +82,14 @@
|
||||
filter.countryCode.toUpperCase()
|
||||
}}</span>
|
||||
}
|
||||
@if (findInstitutionPageIdByName(filter.value)) {
|
||||
<mat-icon
|
||||
class="institution-open-icon"
|
||||
(click)="openInstitutionPage(filter.value, $event)"
|
||||
aria-label="Institutionsseite öffnen"
|
||||
>open_in_new</mat-icon
|
||||
>
|
||||
}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -217,6 +217,27 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.filter-institution-chip:hover .institution-open-icon {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.filter-chip button,
|
||||
.active-topic-filter button,
|
||||
.active-institution-filter button,
|
||||
|
||||
@@ -42,6 +42,7 @@ import {
|
||||
MatAutocompleteSelectedEvent,
|
||||
} from '@angular/material/autocomplete';
|
||||
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
||||
import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-list',
|
||||
@@ -73,6 +74,7 @@ export class PersonListComponent {
|
||||
private readonly topicsService = inject(TopicsService);
|
||||
private readonly institutionsService = inject(InstitutionsService);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly bookmarkService = inject(BookmarkService);
|
||||
public readonly state = inject(SharedStateService);
|
||||
public readonly paginationService = inject(PaginationService);
|
||||
public readonly resolverStateService = inject(ResolverStateService);
|
||||
@@ -120,9 +122,12 @@ export class PersonListComponent {
|
||||
],
|
||||
});
|
||||
|
||||
// Bookmarking
|
||||
bookmarkedIds = new Set<string>();
|
||||
constructor() {
|
||||
this.bookmarkService
|
||||
.load()
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe();
|
||||
|
||||
if (!this.institutionControl.value) {
|
||||
this.yearFilterEnabledControl.disable();
|
||||
}
|
||||
@@ -328,6 +333,41 @@ export class PersonListComponent {
|
||||
return filter.label.replace(/^Institution:\s*/, '');
|
||||
}
|
||||
|
||||
findInstitutionPageIdByName(institutionName: string): string | null {
|
||||
const normalized = institutionName.trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (const person of this.persons) {
|
||||
const candidates: Array<DehydratedInstitution | undefined> = [
|
||||
...(person.last_known_institutions ?? []),
|
||||
...(person.affiliations ?? []).map((a) => a.institution ?? undefined),
|
||||
];
|
||||
|
||||
for (const inst of candidates) {
|
||||
if (
|
||||
inst?.id &&
|
||||
(inst.display_name ?? '').trim().toLowerCase() === normalized
|
||||
) {
|
||||
return inst.id.split('/').pop() ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
openInstitutionPage(institutionName: string, event: Event): void {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
const id = this.findInstitutionPageIdByName(institutionName);
|
||||
if (!id) return;
|
||||
|
||||
void this.router.navigate(['/institution', id]);
|
||||
}
|
||||
|
||||
private findInstitutionCountryCode(institutionName: string): string | null {
|
||||
const normalized = institutionName.trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
@@ -475,12 +515,10 @@ export class PersonListComponent {
|
||||
|
||||
// Bookmarks
|
||||
toggleBookmark(person: CustomAuthor): void {
|
||||
if (!person.id) return;
|
||||
if (this.bookmarkedIds.has(person.id)) {
|
||||
this.bookmarkedIds.delete(person.id);
|
||||
} else {
|
||||
this.bookmarkedIds.add(person.id);
|
||||
}
|
||||
this.bookmarkService
|
||||
.confirmToggle(person)
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
onTopicSelectionChange(newSelection: Set<string>): void {
|
||||
@@ -505,7 +543,7 @@ export class PersonListComponent {
|
||||
}
|
||||
|
||||
isBookmarked(person: CustomAuthor): boolean {
|
||||
return !!person.id && this.bookmarkedIds.has(person.id);
|
||||
return this.bookmarkService.isBookmarked(person.id);
|
||||
}
|
||||
|
||||
clearSearch(): void {
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
<mat-card appearance="outlined" class="info-card">
|
||||
<mat-card-content>
|
||||
<mat-icon>{{ icon() }}</mat-icon>
|
||||
<div>
|
||||
<span class="number">{{ value() }}</span>
|
||||
<span class="description">{{ description() }}</span>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
.info-card {
|
||||
--info-card-icon-size: 40px;
|
||||
|
||||
background-color: var(--sg-background);
|
||||
padding: 10px 20px;
|
||||
}
|
||||
.info-card mat-card-content {
|
||||
display: flex;
|
||||
align-items: start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.info-card mat-icon {
|
||||
width: var(--info-card-icon-size);
|
||||
height: var(--info-card-icon-size);
|
||||
font-size: var(--info-card-icon-size);
|
||||
color: var(--sg-blue-highlight);
|
||||
}
|
||||
|
||||
.info-card div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.info-card .number {
|
||||
font-weight: var(--sg-default-bold-weight);
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.info-card .description {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component, input } from '@angular/core';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-network-info-card',
|
||||
imports: [MatIconModule, MatCardModule],
|
||||
templateUrl: './person-network-info-card.component.html',
|
||||
styleUrl: './person-network-info-card.component.scss',
|
||||
})
|
||||
export class PersonNetworkInfoCardComponent {
|
||||
readonly icon = input<string>();
|
||||
readonly value = input<string>();
|
||||
readonly description = input<string>();
|
||||
}
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
<div class="summary-container">
|
||||
@for (summary of this.summaryCards(); track $index) {
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[icon]="summary.icon"
|
||||
[value]="summary.value.toString()"
|
||||
[description]="summary.description" />
|
||||
|
||||
@@ -47,7 +47,7 @@ form > div > mat-button-toggle-group {
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.summary-container app-person-network-info-card {
|
||||
.summary-container app-info-card {
|
||||
flex: 1 1 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { PersonNetworkFilterDialogComponent } from '../person-network-filter-dialog/person-network-filter-dialog.component';
|
||||
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
|
||||
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
||||
import {
|
||||
GenericColumn,
|
||||
DataTableComponent,
|
||||
@@ -95,7 +95,7 @@ type IInstitution = {
|
||||
MatSelectModule,
|
||||
MatExpansionModule,
|
||||
MatDialogModule,
|
||||
PersonNetworkInfoCardComponent,
|
||||
AppInfoCardComponent,
|
||||
DataTableComponent,
|
||||
],
|
||||
templateUrl: './person-network.component.html',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
} @else if (error) {
|
||||
<p class="message">Fehler beim Laden der Patente.</p>
|
||||
} @else if (patents.length === 0) {
|
||||
<p class="message">Keine Patente gefunden.</p>
|
||||
<p class="message">{{ getEmptyMessage() }}</p>
|
||||
} @else {
|
||||
<div class="patents-container">
|
||||
<div class="patents-content">
|
||||
@@ -136,9 +136,7 @@
|
||||
} @else {
|
||||
<div class="patent-detail overview">
|
||||
<p class="overview-title">Patentübersicht</p>
|
||||
<p class="overview-subtitle">
|
||||
Alle Patente dieser Person im Überblick.
|
||||
</p>
|
||||
<p class="overview-subtitle">Patente mit passendem Erfindername.</p>
|
||||
<div class="overview-stats">
|
||||
<div class="overview-stat">
|
||||
<span class="overview-value">{{ patents.length }}</span>
|
||||
@@ -154,7 +152,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<p class="overview-hint">
|
||||
Wähle links ein Patent aus, um Kurzinfos und Details zu sehen.
|
||||
Wähle links ein Patent aus, um Details zu sehen.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -97,6 +97,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
.match-badges {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.match-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
background: #f3f4f6;
|
||||
border: 1px solid #e5e7eb;
|
||||
color: #374151;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 600;
|
||||
|
||||
&--signal {
|
||||
padding: 4px 10px;
|
||||
font-size: 0.75rem;
|
||||
background: #ecfdf5;
|
||||
border-color: #a7f3d0;
|
||||
color: #047857;
|
||||
}
|
||||
}
|
||||
|
||||
.match-badges--detail {
|
||||
margin-top: 14px;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.source-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,30 +1,17 @@
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { Component, DestroyRef, inject } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { PatentsService } from '../../api/api/patents.service';
|
||||
import { finalize, of, switchMap } from 'rxjs';
|
||||
import { PatentEntry } from '../../api/model/patentEntry';
|
||||
import { IpcClassification } from '../../api';
|
||||
import { PersonPatentsResolved } from '../../resolvers/person-patents.resolver';
|
||||
import {
|
||||
formatPatentDate,
|
||||
getPublicationStageLabel,
|
||||
} from '../patent-detail/patent-detail.utils';
|
||||
|
||||
type SortMode = 'date' | 'title';
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
type ClassificationSystem = 'IPC' | 'CPC';
|
||||
|
||||
interface ClassificationCard {
|
||||
key: string;
|
||||
symbols: string[];
|
||||
system: ClassificationSystem;
|
||||
levelLabel: string;
|
||||
primaryDescription: string | null;
|
||||
hierarchy: { label: string; value: string }[];
|
||||
}
|
||||
|
||||
interface PatentMetadataRow {
|
||||
label: string;
|
||||
value: string;
|
||||
variant?: 'source';
|
||||
}
|
||||
|
||||
const DESCRIPTION_PREVIEW_LENGTH = 140;
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-patents',
|
||||
@@ -32,16 +19,15 @@ const DESCRIPTION_PREVIEW_LENGTH = 140;
|
||||
templateUrl: './person-patents.component.html',
|
||||
styleUrl: './person-patents.component.scss',
|
||||
})
|
||||
export class PersonPatentsComponent implements OnInit {
|
||||
export class PersonPatentsComponent {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private patentsApi = inject(PatentsService);
|
||||
private destroyRef = inject(DestroyRef);
|
||||
|
||||
patents: PatentEntry[] = [];
|
||||
filteredPatents: PatentEntry[] = [];
|
||||
authorName: string | null = null;
|
||||
selectedPatent: PatentEntry | null = null;
|
||||
showDetail = false;
|
||||
|
||||
loading = true;
|
||||
error = false;
|
||||
@@ -51,44 +37,54 @@ export class PersonPatentsComponent implements OnInit {
|
||||
|
||||
selectedPage = 1;
|
||||
readonly pageSize = 10;
|
||||
private expandedClassificationKeys = new Set<string>();
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.parent?.paramMap.subscribe((params) => {
|
||||
const authorId = params.get('id') ?? '';
|
||||
constructor() {
|
||||
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||
|
||||
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||
if (this.isValidFilter(filterFromUrl)) {
|
||||
this.activeFilter = filterFromUrl;
|
||||
}
|
||||
if (this.isValidSortMode(sortFromUrl)) {
|
||||
this.sortMode = sortFromUrl;
|
||||
}
|
||||
|
||||
if (this.isValidFilter(filterFromUrl)) {
|
||||
this.activeFilter = filterFromUrl;
|
||||
}
|
||||
if (this.isValidSortMode(sortFromUrl)) {
|
||||
this.sortMode = sortFromUrl;
|
||||
}
|
||||
this.route.parent?.data
|
||||
.pipe(
|
||||
switchMap((data) => {
|
||||
const resolved = data['personPatents'] as
|
||||
| PersonPatentsResolved
|
||||
| undefined;
|
||||
if (!resolved?.patents$) {
|
||||
return of(null);
|
||||
}
|
||||
|
||||
if (authorId) {
|
||||
this.patentsApi.getPatentsByAuthor(authorId, 'body').subscribe({
|
||||
next: (result) => {
|
||||
this.patents = result.patents ?? [];
|
||||
this.authorName = result.author_name ?? null;
|
||||
this.applyFilter();
|
||||
this.loading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.error = true;
|
||||
this.loading = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
this.loading = true;
|
||||
this.error = false;
|
||||
return resolved.patents$.pipe(
|
||||
finalize(() => {
|
||||
this.loading = false;
|
||||
}),
|
||||
);
|
||||
}),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((result) => {
|
||||
if (!result) {
|
||||
this.error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.patents = result.patents ?? [];
|
||||
this.authorName = result.author_name ?? null;
|
||||
this.applyFilter();
|
||||
});
|
||||
}
|
||||
|
||||
setFilter(filter: SourceFilter): void {
|
||||
this.activeFilter = filter;
|
||||
this.selectedPage = 1;
|
||||
this.selectedPatent = null;
|
||||
this.showDetail = false;
|
||||
this.applyFilter();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
@@ -101,19 +97,12 @@ export class PersonPatentsComponent implements OnInit {
|
||||
|
||||
selectPatent(patent: PatentEntry): void {
|
||||
this.selectedPatent = patent;
|
||||
this.showDetail = false;
|
||||
this.expandedClassificationKeys.clear();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
openDetail(): void {
|
||||
this.showDetail = true;
|
||||
this.expandedClassificationKeys.clear();
|
||||
}
|
||||
|
||||
closeDetail(): void {
|
||||
this.showDetail = false;
|
||||
this.expandedClassificationKeys.clear();
|
||||
if (!this.selectedPatent) return;
|
||||
this.router.navigate(['/patent', this.selectedPatent.patent_id]);
|
||||
}
|
||||
|
||||
private applyFilter(): void {
|
||||
@@ -178,9 +167,7 @@ export class PersonPatentsComponent implements OnInit {
|
||||
}
|
||||
|
||||
formatDate(date: string | null | undefined): string {
|
||||
if (!date) return '-';
|
||||
const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
|
||||
return new Intl.DateTimeFormat('de-DE').format(new Date(d));
|
||||
return formatPatentDate(date);
|
||||
}
|
||||
|
||||
getEpoCount(): number {
|
||||
@@ -212,223 +199,10 @@ export class PersonPatentsComponent implements OnInit {
|
||||
}
|
||||
|
||||
getPublicationStageLabel(patent: PatentEntry): string | null {
|
||||
if (patent.kind) {
|
||||
return patent.kind;
|
||||
}
|
||||
if (patent.application_type) {
|
||||
return patent.application_type;
|
||||
}
|
||||
return null;
|
||||
return getPublicationStageLabel(patent);
|
||||
}
|
||||
|
||||
hasPatentMetadata(_patent: PatentEntry): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] {
|
||||
const rows: PatentMetadataRow[] = [];
|
||||
|
||||
rows.push({ label: 'Quelle', value: patent.source, variant: 'source' });
|
||||
rows.push({ label: 'Patent-Nr.', value: patent.patent_id });
|
||||
|
||||
if (patent.publication_date) {
|
||||
rows.push({
|
||||
label: 'Veröffentlichungsdatum',
|
||||
value: this.formatDate(patent.publication_date),
|
||||
});
|
||||
}
|
||||
if (patent.application_number) {
|
||||
rows.push({
|
||||
label: 'Anmeldungsnummer',
|
||||
value: patent.application_number,
|
||||
});
|
||||
}
|
||||
if (patent.application_date) {
|
||||
rows.push({
|
||||
label: 'Anmeldedatum',
|
||||
value: this.formatDate(patent.application_date),
|
||||
});
|
||||
}
|
||||
|
||||
const stageLabel = this.getPublicationStageLabel(patent);
|
||||
if (stageLabel) {
|
||||
rows.push({
|
||||
label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp',
|
||||
value: patent.kind ? stageLabel : this.formatMetadataLabel(stageLabel),
|
||||
});
|
||||
}
|
||||
if (patent.number_of_claims != null) {
|
||||
rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) });
|
||||
}
|
||||
if (patent.status) {
|
||||
rows.push({
|
||||
label: 'Status',
|
||||
value: this.formatMetadataLabel(patent.status),
|
||||
});
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
private formatMetadataLabel(value: string): string {
|
||||
return value
|
||||
.replace(/_/g, ' ')
|
||||
.toLowerCase()
|
||||
.replace(/\b\w/g, (char) => char.toUpperCase());
|
||||
}
|
||||
|
||||
getClassificationCards(
|
||||
entries: IpcClassification[] | undefined,
|
||||
system: ClassificationSystem,
|
||||
): ClassificationCard[] {
|
||||
if (!entries?.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const merged = new Map<string, ClassificationCard>();
|
||||
|
||||
for (const entry of entries) {
|
||||
const card = this.buildClassificationCard(entry, system);
|
||||
const mergeKey =
|
||||
card.primaryDescription?.toLocaleLowerCase('en') ??
|
||||
card.symbols[0] ??
|
||||
card.key;
|
||||
|
||||
const existing = merged.get(mergeKey);
|
||||
if (existing) {
|
||||
for (const symbol of card.symbols) {
|
||||
if (!existing.symbols.includes(symbol)) {
|
||||
existing.symbols.push(symbol);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
merged.set(mergeKey, card);
|
||||
}
|
||||
|
||||
return [...merged.values()];
|
||||
}
|
||||
|
||||
toggleClassificationExpanded(key: string): void {
|
||||
if (this.expandedClassificationKeys.has(key)) {
|
||||
this.expandedClassificationKeys.delete(key);
|
||||
return;
|
||||
}
|
||||
this.expandedClassificationKeys.add(key);
|
||||
}
|
||||
|
||||
isClassificationExpanded(key: string): boolean {
|
||||
return this.expandedClassificationKeys.has(key);
|
||||
}
|
||||
|
||||
isLongDescription(text: string | null): boolean {
|
||||
return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH;
|
||||
}
|
||||
|
||||
getDescriptionPreview(text: string | null): string {
|
||||
if (!text) {
|
||||
return '';
|
||||
}
|
||||
if (text.length <= DESCRIPTION_PREVIEW_LENGTH) {
|
||||
return text;
|
||||
}
|
||||
return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`;
|
||||
}
|
||||
|
||||
private buildClassificationCard(
|
||||
entry: IpcClassification,
|
||||
system: ClassificationSystem,
|
||||
): ClassificationCard {
|
||||
const level = this.getClassificationLevel(entry);
|
||||
const primaryDescription = this.extractDescriptionText(entry[level.field]);
|
||||
|
||||
return {
|
||||
key: `${system}-${entry.symbol}`,
|
||||
symbols: [entry.symbol],
|
||||
system,
|
||||
levelLabel: level.label,
|
||||
primaryDescription,
|
||||
hierarchy: this.buildHierarchyRows(entry, primaryDescription),
|
||||
};
|
||||
}
|
||||
|
||||
private getClassificationLevel(entry: IpcClassification): {
|
||||
label: string;
|
||||
field: keyof IpcClassification;
|
||||
} {
|
||||
if (entry.subgroup) {
|
||||
return { label: 'Untergruppe', field: 'subgroup' };
|
||||
}
|
||||
if (entry.main_group) {
|
||||
return { label: 'Hauptgruppe', field: 'main_group' };
|
||||
}
|
||||
if (entry.subclass) {
|
||||
return { label: 'Unterklasse', field: 'subclass' };
|
||||
}
|
||||
if (entry.section) {
|
||||
return { label: 'Sektion', field: 'section' };
|
||||
}
|
||||
return { label: 'Code', field: 'symbol' };
|
||||
}
|
||||
|
||||
private buildHierarchyRows(
|
||||
entry: IpcClassification,
|
||||
primaryDescription: string | null,
|
||||
): { label: string; value: string }[] {
|
||||
const rows: { label: string; value: string }[] = [];
|
||||
const seen = new Set<string>();
|
||||
|
||||
const addRow = (label: string, raw: string | null) => {
|
||||
const value = this.extractDescriptionText(raw);
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
const normalized = value.toLocaleLowerCase('en');
|
||||
if (
|
||||
seen.has(normalized) ||
|
||||
normalized === primaryDescription?.toLocaleLowerCase('en')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
seen.add(normalized);
|
||||
rows.push({ label, value });
|
||||
};
|
||||
if (entry.section) {
|
||||
addRow('Sektion', entry.section);
|
||||
}
|
||||
if (entry.class) {
|
||||
addRow('Klasse', entry.class);
|
||||
}
|
||||
if (entry.subclass) {
|
||||
addRow('Unterklasse', entry.subclass);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
private extractDescriptionText(
|
||||
value: string | null | undefined,
|
||||
): string | null {
|
||||
if (!value?.trim()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const text = value.includes(' - ')
|
||||
? value.split(' - ').slice(1).join(' - ').trim()
|
||||
: value.trim();
|
||||
if (!text) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const firstSentence = text.split(/[;|]/)[0]?.trim() ?? text;
|
||||
return this.normalizeDescriptionCase(firstSentence);
|
||||
}
|
||||
|
||||
private normalizeDescriptionCase(text: string): string {
|
||||
if (text !== text.toUpperCase()) {
|
||||
return text;
|
||||
}
|
||||
return text.charAt(0) + text.slice(1).toLowerCase();
|
||||
getEmptyMessage(): string {
|
||||
return 'Keine Patente gefunden.';
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,27 +4,6 @@
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.section-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0 0 6px;
|
||||
font-size: 22px;
|
||||
line-height: 1.2;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.section-heading p {
|
||||
margin: 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.publication-filter-stack {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
@@ -54,6 +33,10 @@ h2 {
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.publication-filters .sort-field {
|
||||
width: 235px;
|
||||
}
|
||||
|
||||
.publication-filters .reset-filter-btn {
|
||||
min-width: 132px;
|
||||
height: 42px;
|
||||
@@ -161,27 +144,18 @@ h2 {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.filter-chip,
|
||||
.filter-meta-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--sg-border-strong);
|
||||
border-radius: 4px;
|
||||
background: var(--sg-surface-soft);
|
||||
color: var(--sg-text);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.filter-chip {
|
||||
gap: 4px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.filter-meta-chip {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.filter-topic-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -301,6 +275,29 @@ h2 {
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon,
|
||||
.publication-institution-tag .institution-open-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.filter-institution-chip:hover .institution-open-icon,
|
||||
.publication-institution-tag:hover .institution-open-icon {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon:hover,
|
||||
.publication-institution-tag .institution-open-icon:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.filter-meta-chip__label,
|
||||
.filter-topic-chip__label {
|
||||
overflow: hidden;
|
||||
@@ -309,7 +306,6 @@ h2 {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.filter-chip button,
|
||||
.active-institution-filter button,
|
||||
.active-meta-filter button {
|
||||
display: flex;
|
||||
@@ -324,7 +320,6 @@ h2 {
|
||||
}
|
||||
}
|
||||
|
||||
.filter-chip button mat-icon,
|
||||
.active-institution-filter button mat-icon,
|
||||
.active-meta-filter button mat-icon {
|
||||
width: 12px;
|
||||
@@ -361,12 +356,6 @@ a.title:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.authors {
|
||||
margin-top: 7px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.is-hidden {
|
||||
display: none;
|
||||
}
|
||||
@@ -508,13 +497,8 @@ table.is-hidden {
|
||||
.mat-column-type,
|
||||
.mat-column-year,
|
||||
.mat-column-language,
|
||||
.mat-column-citations {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mat-mdc-header-cell.mat-column-title,
|
||||
.mat-mdc-header-cell.mat-column-institutions,
|
||||
.mat-mdc-header-cell.mat-column-topics {
|
||||
.mat-column-citations,
|
||||
.mat-mdc-header-cell {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -549,7 +533,6 @@ mat-paginator {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.section-heading,
|
||||
.table-footer {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
@@ -578,3 +561,25 @@ mat-paginator {
|
||||
align-self: stretch;
|
||||
}
|
||||
}
|
||||
|
||||
mat-expansion-panel {
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-none);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
mat-expansion-panel-header {
|
||||
padding: 0 16px;
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
mat-panel-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
mat-panel-description {
|
||||
font-size: 14px;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,27 @@
|
||||
<div class="name-line">
|
||||
<span>Person</span>
|
||||
<h1>{{ displayName() }}</h1>
|
||||
<button
|
||||
type="button"
|
||||
class="profile-bookmark-button"
|
||||
[class.bookmarked]="bookmarkService.isBookmarked(person()?.id)"
|
||||
[attr.aria-label]="
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? 'Bookmark entfernen'
|
||||
: 'Person bookmarken'
|
||||
"
|
||||
[matTooltip]="
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? 'Bookmark entfernen'
|
||||
: 'Person bookmarken'
|
||||
"
|
||||
(click)="toggleBookmark()">
|
||||
<mat-icon>{{
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? 'bookmark'
|
||||
: 'bookmark_border'
|
||||
}}</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="institution-line">
|
||||
<mat-icon class="institution-icon">apartment</mat-icon>
|
||||
@@ -31,12 +52,14 @@
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
@if (worksCount() !== null || citedByCount() !== null) {
|
||||
@if (
|
||||
worksCount() !== null || citedByCount() !== null || h_index() !== null
|
||||
) {
|
||||
<span class="stats-line">
|
||||
@if (worksCount() !== null) {
|
||||
<span class="stat-item">
|
||||
<mat-icon class="stat-icon">menu_book</mat-icon>
|
||||
{{ worksCount() }} Publikationen
|
||||
{{ worksCount() | number }} Publikationen
|
||||
</span>
|
||||
}
|
||||
@if (worksCount() !== null && citedByCount() !== null) {
|
||||
@@ -45,50 +68,66 @@
|
||||
@if (citedByCount() !== null) {
|
||||
<span class="stat-item">
|
||||
<mat-icon class="stat-icon">format_quote</mat-icon>
|
||||
{{ citedByCount() }} Zitationen
|
||||
{{ citedByCount() | number }} Zitationen
|
||||
</span>
|
||||
}
|
||||
@if (
|
||||
(worksCount() !== null || citedByCount() !== null) &&
|
||||
h_index() !== null
|
||||
) {
|
||||
·
|
||||
}
|
||||
@if (h_index() !== null) {
|
||||
<span
|
||||
class="stat-item has-tooltip"
|
||||
[matTooltip]="
|
||||
'Der h-Index beträgt ' +
|
||||
h_index() +
|
||||
': ' +
|
||||
h_index() +
|
||||
' Publikationen wurden jeweils mindestens ' +
|
||||
h_index() +
|
||||
'-mal zitiert.'
|
||||
"
|
||||
matTooltipPosition="right"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon class="stat-icon">trending_up</mat-icon>
|
||||
h-Index {{ h_index() }}
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
<span>
|
||||
@if (h_index() !== null) {
|
||||
h_index: {{ h_index() }}
|
||||
}
|
||||
@if (displayCareerStage() || orcid()) {
|
||||
<div class="meta-line">
|
||||
@if (displayCareerStage()) {
|
||||
<div class="career-stage-line">
|
||||
<span class="career-stage-label">Career Stage:</span>
|
||||
<span
|
||||
class="career-stage-chip"
|
||||
[matTooltip]="careerStageTooltip()"
|
||||
matTooltipPosition="right"
|
||||
matTooltipClass="career-stage-tooltip"
|
||||
[matTooltipShowDelay]="250">
|
||||
{{ displayCareerStage() }}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
@if (orcid(); as orcidId) {
|
||||
<a
|
||||
class="orcid-chip"
|
||||
[href]="orcidUrl()"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
matTooltip="ORCID-Profil öffnen"
|
||||
matTooltipPosition="right"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon>verified</mat-icon>
|
||||
{{ orcidId }}
|
||||
</a>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
@if (displayCareerStage()) {
|
||||
<div class="career-stage-line">
|
||||
<span class="career-stage-label">Career Stage:</span>
|
||||
<span
|
||||
class="career-stage-chip"
|
||||
[matTooltip]="careerStageTooltip()"
|
||||
matTooltipPosition="right"
|
||||
matTooltipClass="career-stage-tooltip"
|
||||
[matTooltipShowDelay]="250">
|
||||
{{ displayCareerStage() }}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="profile-contact">
|
||||
<div>
|
||||
<mat-icon>mail</mat-icon>
|
||||
<span>uni-email@uni-due.de</span>
|
||||
</div>
|
||||
@if (orcid()) {
|
||||
<div>
|
||||
<mat-icon class="orcid">verified</mat-icon>
|
||||
<a [href]="orcidUrl()" target="_blank" rel="noopener">{{
|
||||
orcid()
|
||||
}}</a>
|
||||
</div>
|
||||
}
|
||||
<div>
|
||||
<mat-icon>language</mat-icon>
|
||||
<a href="https://ude.de/anna-becker" target="_blank" rel="noopener">
|
||||
ude.de/anna-becker
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<aside class="sidebar">
|
||||
<div class="bio-card">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
.profile-card {
|
||||
grid-area: profile;
|
||||
display: grid;
|
||||
grid-template-columns: 112px minmax(240px, 1fr) minmax(260px, 360px);
|
||||
grid-template-columns: 112px minmax(240px, 1fr);
|
||||
gap: 36px;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -62,8 +62,11 @@
|
||||
}
|
||||
|
||||
.name-line span {
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.name-line h1 {
|
||||
@@ -73,6 +76,32 @@
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.profile-bookmark-button {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
margin-left: 4px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 50%;
|
||||
background: white;
|
||||
color: var(--sg-text-muted);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover,
|
||||
&.bookmarked {
|
||||
border-color: var(--sg-primary);
|
||||
color: var(--sg-primary);
|
||||
}
|
||||
|
||||
mat-icon {
|
||||
width: 21px;
|
||||
height: 21px;
|
||||
font-size: 21px;
|
||||
}
|
||||
}
|
||||
|
||||
.institution-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -140,6 +169,18 @@
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.stat-item.has-tooltip {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.meta-line {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px 18px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.career-stage-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -167,34 +208,32 @@
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.profile-contact {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
.orcid-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 24px;
|
||||
padding: 2px 10px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 999px;
|
||||
background: var(--sg-surface-muted);
|
||||
color: var(--sg-text);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.profile-contact div {
|
||||
display: grid;
|
||||
grid-template-columns: 24px 1fr;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.profile-contact mat-icon {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.profile-contact .orcid {
|
||||
color: #6cc24a;
|
||||
}
|
||||
|
||||
.profile-contact a {
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
text-decoration: none;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
|
||||
.orcid-chip:hover {
|
||||
border-color: #6cc24a;
|
||||
}
|
||||
|
||||
.orcid-chip mat-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
font-size: 16px;
|
||||
color: #6cc24a;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
@@ -277,16 +316,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
@container (max-width: 780px) {
|
||||
.profile-card {
|
||||
grid-template-columns: 112px 1fr;
|
||||
}
|
||||
|
||||
.profile-contact {
|
||||
grid-column: 2;
|
||||
}
|
||||
}
|
||||
|
||||
@container (max-width: 720px) {
|
||||
.person-hero {
|
||||
padding: 24px 16px;
|
||||
@@ -297,10 +326,6 @@
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.profile-contact {
|
||||
grid-column: auto;
|
||||
}
|
||||
|
||||
.person-tabs {
|
||||
padding: 0 16px;
|
||||
overflow-x: auto;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { Component, computed, inject, signal, DestroyRef } from '@angular/core';
|
||||
import {
|
||||
toSignal,
|
||||
@@ -23,10 +24,12 @@ import { PersonInterestingComponent } from '../person-interesting/person-interes
|
||||
import { WorksService } from '../../api';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import { PersonBioResolved } from '../../resolvers/person-bio.resolver';
|
||||
import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person',
|
||||
imports: [
|
||||
DecimalPipe,
|
||||
MatIconModule,
|
||||
MatTabsModule,
|
||||
MatTooltipModule,
|
||||
@@ -45,6 +48,14 @@ export class PersonComponent {
|
||||
|
||||
private readonly worksApi = inject(WorksService);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
readonly bookmarkService = inject(BookmarkService);
|
||||
|
||||
constructor() {
|
||||
this.bookmarkService
|
||||
.load()
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
readonly params = toSignal(this.activatedRoute.paramMap);
|
||||
readonly routerEvents = toSignal(this.router.events);
|
||||
@@ -97,6 +108,15 @@ export class PersonComponent {
|
||||
{ initialValue: null },
|
||||
);
|
||||
|
||||
toggleBookmark(): void {
|
||||
const person = this.person();
|
||||
if (!person) return;
|
||||
this.bookmarkService
|
||||
.confirmToggle(person)
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
readonly personBio = toSignal(
|
||||
this.activatedRoute.data.pipe(
|
||||
switchMap((data) => {
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
<div class="hero-copy">
|
||||
<div class="eyebrow">
|
||||
@if (publication.type) {
|
||||
<span>{{ publication.type }}</span>
|
||||
<span>{{ publication.type | workType }}</span>
|
||||
}
|
||||
@if (publication.publication_year) {
|
||||
<span>{{ publication.publication_year }}</span>
|
||||
}
|
||||
@if (publication.language) {
|
||||
<span>{{ publication.language | uppercase }}</span>
|
||||
<span>{{ publication.language | languageCode }}</span>
|
||||
}
|
||||
</div>
|
||||
<h1>
|
||||
@@ -117,55 +117,99 @@
|
||||
</section>
|
||||
}
|
||||
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<section class="card accordion-card">
|
||||
<button
|
||||
type="button"
|
||||
class="accordion-header"
|
||||
(click)="authorsExpanded = !authorsExpanded"
|
||||
[attr.aria-expanded]="authorsExpanded">
|
||||
<mat-icon>group</mat-icon>
|
||||
<h2>Autorinnen und Autoren</h2>
|
||||
<span>{{ authors().length }}</span>
|
||||
</div>
|
||||
<div class="author-list">
|
||||
@for (authorship of authors(); track authorship.author?.id) {
|
||||
<article>
|
||||
<div class="avatar">
|
||||
{{
|
||||
(
|
||||
authorship.author?.display_name ||
|
||||
authorship.raw_author_name ||
|
||||
'?'
|
||||
).charAt(0)
|
||||
}}
|
||||
</div>
|
||||
<div>
|
||||
@if (authorship.author?.id; as authorId) {
|
||||
<a
|
||||
[routerLink]="[
|
||||
'/person',
|
||||
authorId.split('/').pop(),
|
||||
'overview',
|
||||
]">
|
||||
{{
|
||||
authorship.author?.display_name ||
|
||||
authorship.raw_author_name ||
|
||||
'Unbekannt'
|
||||
}}
|
||||
</a>
|
||||
} @else {
|
||||
<strong>{{
|
||||
authorship.raw_author_name || 'Unbekannt'
|
||||
}}</strong>
|
||||
}
|
||||
<p>
|
||||
{{ authorship.author_position || 'Mitautor/in' }}
|
||||
@if (authorship.is_corresponding) {
|
||||
· Korrespondenz
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
} @empty {
|
||||
<p class="empty">Keine Angaben vorhanden.</p>
|
||||
<span class="accordion-title">Autorinnen und Autoren</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
matTooltip="Autorinnen und Autoren dieser Publikation. Klicke auf eine Person, um zu ihrem Profil zu gelangen."
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
>info_outline</mat-icon
|
||||
>
|
||||
@if (authors().length) {
|
||||
<span class="count-badge">{{ authors().length }}</span>
|
||||
}
|
||||
</div>
|
||||
<mat-icon class="chevron" [class.rotated]="!authorsExpanded"
|
||||
>expand_more</mat-icon
|
||||
>
|
||||
</button>
|
||||
@if (authorsExpanded) {
|
||||
<div class="accordion-body">
|
||||
<div class="author-list">
|
||||
@for (
|
||||
authorship of pagedAuthors();
|
||||
track authorship.author?.id
|
||||
) {
|
||||
<article>
|
||||
<div class="avatar">
|
||||
{{
|
||||
(
|
||||
authorship.author?.display_name ||
|
||||
authorship.raw_author_name ||
|
||||
'?'
|
||||
).charAt(0)
|
||||
}}
|
||||
</div>
|
||||
<div>
|
||||
@if (authorship.author?.id; as authorId) {
|
||||
<a
|
||||
[routerLink]="[
|
||||
'/person',
|
||||
authorId.split('/').pop(),
|
||||
'overview',
|
||||
]">
|
||||
{{
|
||||
authorship.author?.display_name ||
|
||||
authorship.raw_author_name ||
|
||||
'Unbekannt'
|
||||
}}
|
||||
</a>
|
||||
} @else {
|
||||
<strong>{{
|
||||
authorship.raw_author_name || 'Unbekannt'
|
||||
}}</strong>
|
||||
}
|
||||
<p>
|
||||
{{ authorship.author_position || 'Mitautor/in' }}
|
||||
@if (authorship.is_corresponding) {
|
||||
· Korrespondenz
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
} @empty {
|
||||
<p class="empty">Keine Angaben vorhanden.</p>
|
||||
}
|
||||
</div>
|
||||
@if (authorsPageCount() > 1) {
|
||||
<div class="list-pagination">
|
||||
<button
|
||||
type="button"
|
||||
class="page-btn"
|
||||
[disabled]="authorsPage === 0"
|
||||
(click)="authorsPage = authorsPage - 1">
|
||||
<mat-icon>chevron_left</mat-icon>
|
||||
</button>
|
||||
<span class="page-indicator"
|
||||
>{{ authorsPage + 1 }} / {{ authorsPageCount() }}</span
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="page-btn"
|
||||
[disabled]="authorsPage === authorsPageCount() - 1"
|
||||
(click)="authorsPage = authorsPage + 1">
|
||||
<mat-icon>chevron_right</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
|
||||
@if (publication.topics?.length) {
|
||||
@@ -182,7 +226,8 @@
|
||||
[subfieldName]="topic.subfield?.display_name"
|
||||
[fieldName]="topic.field?.display_name"
|
||||
[domainName]="topic.domain?.display_name"
|
||||
[color]="getTopicColor(topic)">
|
||||
[color]="getTopicColor(topic)"
|
||||
(chipClick)="findAuthorsForTopic(topic)">
|
||||
</app-topic-chip>
|
||||
}
|
||||
</div>
|
||||
@@ -204,52 +249,71 @@
|
||||
}
|
||||
|
||||
@if (sources().length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<section class="card accordion-card">
|
||||
<button
|
||||
type="button"
|
||||
class="accordion-header"
|
||||
(click)="sourcesExpanded = !sourcesExpanded"
|
||||
[attr.aria-expanded]="sourcesExpanded">
|
||||
<mat-icon>library_books</mat-icon>
|
||||
<h2>Quellen und Versionen</h2>
|
||||
</div>
|
||||
<div class="source-list">
|
||||
@for (
|
||||
location of sources();
|
||||
track location.source?.id || location.landing_page_url
|
||||
) {
|
||||
<article>
|
||||
<div>
|
||||
<strong>{{
|
||||
location.source?.display_name || 'Externe Quelle'
|
||||
}}</strong>
|
||||
<p>
|
||||
{{
|
||||
location.version ||
|
||||
location.source?.type ||
|
||||
'Veröffentlichte Version'
|
||||
}}
|
||||
@if (location.license) {
|
||||
· {{ location.license }}
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
<div class="source-actions">
|
||||
@if (location.is_oa) {
|
||||
<span class="oa-badge">Open Access</span>
|
||||
}
|
||||
@if (
|
||||
location.pdf_url || location.landing_page_url;
|
||||
as sourceUrl
|
||||
) {
|
||||
<a
|
||||
[href]="sourceUrl"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
aria-label="Quelle öffnen">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
<span class="accordion-title">Quellen und Versionen</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
matTooltip="Quellen und Versionen, unter denen die Publikation verfügbar ist. Klicke auf das Symbol, um die Quelle zu öffnen."
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
>info_outline</mat-icon
|
||||
>
|
||||
<span class="count-badge">{{ sources().length }}</span>
|
||||
<mat-icon class="chevron" [class.rotated]="!sourcesExpanded"
|
||||
>expand_more</mat-icon
|
||||
>
|
||||
</button>
|
||||
@if (sourcesExpanded) {
|
||||
<div class="accordion-body">
|
||||
<div class="source-list">
|
||||
@for (
|
||||
location of sources();
|
||||
track location.source?.id || location.landing_page_url
|
||||
) {
|
||||
<article>
|
||||
<div>
|
||||
<strong>{{
|
||||
location.source?.display_name || 'Externe Quelle'
|
||||
}}</strong>
|
||||
<p>
|
||||
{{
|
||||
location.version ||
|
||||
location.source?.type ||
|
||||
'Veröffentlichte Version'
|
||||
}}
|
||||
@if (location.license) {
|
||||
· {{ location.license }}
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
<div class="source-actions">
|
||||
@if (location.is_oa) {
|
||||
<span class="oa-badge">Open Access</span>
|
||||
}
|
||||
@if (
|
||||
location.pdf_url || location.landing_page_url;
|
||||
as sourceUrl
|
||||
) {
|
||||
<a
|
||||
[href]="sourceUrl"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
aria-label="Quelle öffnen">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
</main>
|
||||
@@ -269,11 +333,11 @@
|
||||
</div>
|
||||
<div>
|
||||
<dt>Typ</dt>
|
||||
<dd>{{ publication.type || '-' }}</dd>
|
||||
<dd>{{ publication.type | workType }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Sprache</dt>
|
||||
<dd>{{ publication.language || '-' }}</dd>
|
||||
<dd>{{ publication.language | languageCode }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Open Access</dt>
|
||||
@@ -299,83 +363,169 @@
|
||||
</section>
|
||||
|
||||
@if (institutions().length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<section class="card accordion-card">
|
||||
<button
|
||||
type="button"
|
||||
class="accordion-header"
|
||||
(click)="institutionsExpanded = !institutionsExpanded"
|
||||
[attr.aria-expanded]="institutionsExpanded">
|
||||
<mat-icon>account_balance</mat-icon>
|
||||
<h2>Institutionen</h2>
|
||||
</div>
|
||||
<div class="compact-list">
|
||||
@for (institution of institutions(); track institution.id) {
|
||||
<div>
|
||||
<a
|
||||
class="institution-link"
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
institution.id.split('/').pop() ?? '',
|
||||
]">
|
||||
{{ institution.name }}
|
||||
</a>
|
||||
@if (institution.country) {
|
||||
<span class="institution-country">
|
||||
<img
|
||||
alt=""
|
||||
class="flag-img"
|
||||
[src]="
|
||||
'https://flagcdn.io/' +
|
||||
institution.country.toLowerCase() +
|
||||
'.svg'
|
||||
"
|
||||
height="14" />
|
||||
{{ institution.country.toUpperCase() }}
|
||||
</span>
|
||||
} @else if (institution.type) {
|
||||
<span>{{ institution.type }}</span>
|
||||
<span class="accordion-title">Institutionen</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
matTooltip="Institutionen, denen die Autorinnen und Autoren angehören. Klicke auf eine Institution, um zu ihrer Seite zu gelangen."
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
>info_outline</mat-icon
|
||||
>
|
||||
<span class="count-badge">{{ institutions().length }}</span>
|
||||
<mat-icon class="chevron" [class.rotated]="!institutionsExpanded"
|
||||
>expand_more</mat-icon
|
||||
>
|
||||
</button>
|
||||
@if (institutionsExpanded) {
|
||||
<div class="accordion-body">
|
||||
<div class="compact-list">
|
||||
@for (
|
||||
institution of pagedInstitutions();
|
||||
track institution.id
|
||||
) {
|
||||
<div>
|
||||
<a
|
||||
class="institution-link"
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
institution.id.split('/').pop() ?? '',
|
||||
]">
|
||||
{{ institution.name }}
|
||||
</a>
|
||||
@if (institution.country) {
|
||||
<span class="institution-country">
|
||||
<img
|
||||
alt=""
|
||||
class="flag-img"
|
||||
[src]="
|
||||
'https://flagcdn.io/' +
|
||||
institution.country.toLowerCase() +
|
||||
'.svg'
|
||||
"
|
||||
height="14" />
|
||||
{{ institution.country.toUpperCase() }}
|
||||
</span>
|
||||
} @else if (institution.type) {
|
||||
<span>{{ institution.type }}</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (institutionsPageCount() > 1) {
|
||||
<div class="list-pagination">
|
||||
<button
|
||||
type="button"
|
||||
class="page-btn"
|
||||
[disabled]="institutionsPage === 0"
|
||||
(click)="institutionsPage = institutionsPage - 1">
|
||||
<mat-icon>chevron_left</mat-icon>
|
||||
</button>
|
||||
<span class="page-indicator"
|
||||
>{{ institutionsPage + 1 }} /
|
||||
{{ institutionsPageCount() }}</span
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="page-btn"
|
||||
[disabled]="
|
||||
institutionsPage === institutionsPageCount() - 1
|
||||
"
|
||||
(click)="institutionsPage = institutionsPage + 1">
|
||||
<mat-icon>chevron_right</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (publication.funders?.length || publication.awards?.length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<section class="card accordion-card">
|
||||
<button
|
||||
type="button"
|
||||
class="accordion-header"
|
||||
(click)="fundingExpanded = !fundingExpanded"
|
||||
[attr.aria-expanded]="fundingExpanded">
|
||||
<mat-icon>paid</mat-icon>
|
||||
<h2>Förderungen</h2>
|
||||
</div>
|
||||
<div class="compact-list">
|
||||
@for (funder of publication.funders ?? []; track funder.id) {
|
||||
<div>
|
||||
<strong>{{ funder.display_name }}</strong
|
||||
><span>Förderorganisation</span>
|
||||
<span class="accordion-title">Förderungen</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
matTooltip="Förderorganisationen und Förderungen, die zu dieser Publikation beigetragen haben."
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
>info_outline</mat-icon
|
||||
>
|
||||
<span class="count-badge">{{ fundingCount() }}</span>
|
||||
<mat-icon class="chevron" [class.rotated]="!fundingExpanded"
|
||||
>expand_more</mat-icon
|
||||
>
|
||||
</button>
|
||||
@if (fundingExpanded) {
|
||||
<div class="accordion-body">
|
||||
<div class="compact-list">
|
||||
@for (funder of publication.funders ?? []; track funder.id) {
|
||||
<div>
|
||||
<strong>{{ funder.display_name }}</strong
|
||||
><span>Förderorganisation</span>
|
||||
</div>
|
||||
}
|
||||
@for (award of publication.awards ?? []; track award.id) {
|
||||
<div>
|
||||
<strong>{{
|
||||
award.display_name || award.funder_award_id
|
||||
}}</strong
|
||||
><span>{{
|
||||
award.funder_display_name || 'Förderung'
|
||||
}}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@for (award of publication.awards ?? []; track award.id) {
|
||||
<div>
|
||||
<strong>{{
|
||||
award.display_name || award.funder_award_id
|
||||
}}</strong
|
||||
><span>{{ award.funder_display_name || 'Förderung' }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (externalLinks().length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<section class="card accordion-card">
|
||||
<button
|
||||
type="button"
|
||||
class="accordion-header"
|
||||
(click)="linksExpanded = !linksExpanded"
|
||||
[attr.aria-expanded]="linksExpanded">
|
||||
<mat-icon>link</mat-icon>
|
||||
<h2>Externe Links</h2>
|
||||
</div>
|
||||
<div class="link-list">
|
||||
@for (link of externalLinks(); track link.url) {
|
||||
<a [href]="link.url" target="_blank" rel="noopener">
|
||||
<span>{{ link.label }}</span>
|
||||
<mat-icon>north_east</mat-icon>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
<span class="accordion-title">Externe Links</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
matTooltip="Externe Links zur Publikation, z. B. DOI oder Open-Access-Version. Klicke auf einen Link, um ihn in einem neuen Tab zu öffnen."
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
>info_outline</mat-icon
|
||||
>
|
||||
<span class="count-badge">{{ externalLinks().length }}</span>
|
||||
<mat-icon class="chevron" [class.rotated]="!linksExpanded"
|
||||
>expand_more</mat-icon
|
||||
>
|
||||
</button>
|
||||
@if (linksExpanded) {
|
||||
<div class="accordion-body">
|
||||
<div class="link-list">
|
||||
@for (link of externalLinks(); track link.url) {
|
||||
<a [href]="link.url" target="_blank" rel="noopener">
|
||||
<span>{{ link.label }}</span>
|
||||
<mat-icon>north_east</mat-icon>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
</aside>
|
||||
|
||||
@@ -188,6 +188,79 @@ aside {
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
}
|
||||
|
||||
.accordion-card {
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.accordion-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 18px 22px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
font-family: inherit;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text);
|
||||
transition: background 0.12s;
|
||||
|
||||
&:hover {
|
||||
background: #f6f9ff;
|
||||
}
|
||||
|
||||
mat-icon {
|
||||
flex-shrink: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 20px;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-title {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.count-badge {
|
||||
padding: 2px 7px;
|
||||
border-radius: 999px;
|
||||
background: #e8effe;
|
||||
color: #3b5bd6;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.info-icon {
|
||||
flex-shrink: 0;
|
||||
width: 16px !important;
|
||||
height: 16px !important;
|
||||
font-size: 16px !important;
|
||||
color: var(--sg-text-muted);
|
||||
opacity: 0.7;
|
||||
cursor: default;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.chevron {
|
||||
transition: transform 0.2s ease;
|
||||
|
||||
&.rotated {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-body {
|
||||
padding: 4px 22px 22px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -371,6 +444,50 @@ dd {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.list-pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.page-btn {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 8px;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
color: var(--sg-text-muted);
|
||||
transition: background 0.12s;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: var(--sg-surface-muted);
|
||||
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;
|
||||
}
|
||||
|
||||
.institution-country {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -445,6 +562,18 @@ dd {
|
||||
padding: 22px 20px;
|
||||
}
|
||||
|
||||
.accordion-card {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.accordion-header {
|
||||
padding: 16px 20px;
|
||||
}
|
||||
|
||||
.accordion-body {
|
||||
padding: 4px 20px 20px;
|
||||
}
|
||||
|
||||
.metrics,
|
||||
.author-list {
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { DatePipe, DecimalPipe, UpperCasePipe } from '@angular/common';
|
||||
import { Location } from '@angular/common';
|
||||
import { DatePipe, DecimalPipe, Location } from '@angular/common';
|
||||
|
||||
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { finalize } from 'rxjs';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import {
|
||||
Authorship,
|
||||
Location as ApiLocation,
|
||||
@@ -17,6 +17,8 @@ import {
|
||||
} from '../../api';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import { WorkTypePipe } from '../../shared/pipes/work-type.pipe';
|
||||
import { LanguageCodePipe } from '../../shared/pipes/language-code.pipe';
|
||||
|
||||
interface DetailLink {
|
||||
label: string;
|
||||
@@ -38,9 +40,11 @@ interface InstitutionDetail {
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatTooltipModule,
|
||||
RouterLink,
|
||||
TopicChipComponent,
|
||||
UpperCasePipe,
|
||||
WorkTypePipe,
|
||||
LanguageCodePipe,
|
||||
],
|
||||
templateUrl: './publication-detail.component.html',
|
||||
styleUrl: './publication-detail.component.scss',
|
||||
@@ -50,18 +54,33 @@ export class PublicationDetailComponent implements OnInit {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly httpClient = inject(HttpClient);
|
||||
private readonly location = inject(Location);
|
||||
private readonly router = inject(Router);
|
||||
private readonly worksService = inject(WorksService);
|
||||
|
||||
publication: Work | null = null;
|
||||
loading = true;
|
||||
notFound = false;
|
||||
|
||||
authorsExpanded = true;
|
||||
institutionsExpanded = false;
|
||||
sourcesExpanded = false;
|
||||
fundingExpanded = false;
|
||||
linksExpanded = false;
|
||||
|
||||
authorsPage = 0;
|
||||
readonly authorsPageSize = 10;
|
||||
|
||||
institutionsPage = 0;
|
||||
readonly institutionsPageSize = 5;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loading = true;
|
||||
|
||||
this.route.data.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
|
||||
next: ({ publication }) => {
|
||||
this.publication = publication;
|
||||
this.authorsPage = 0;
|
||||
this.institutionsPage = 0;
|
||||
this.loading = false;
|
||||
},
|
||||
error: () => {
|
||||
@@ -75,6 +94,17 @@ export class PublicationDetailComponent implements OnInit {
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
findAuthorsForTopic(topic: WorkTopic): void {
|
||||
const topicName = topic.display_name?.trim();
|
||||
if (!topicName) return;
|
||||
|
||||
// Deep link into the person search with this topic preset as filter,
|
||||
// so matching authors show up directly.
|
||||
void this.router.navigate(['/persons'], {
|
||||
queryParams: { topic: topicName },
|
||||
});
|
||||
}
|
||||
|
||||
getTopicColor(topic: WorkTopic): string {
|
||||
return topicHierarchyColor({
|
||||
id: topic.id,
|
||||
@@ -110,6 +140,28 @@ export class PublicationDetailComponent implements OnInit {
|
||||
return this.publication?.authorships ?? [];
|
||||
}
|
||||
|
||||
pagedAuthors(): Authorship[] {
|
||||
return this.authors().slice(
|
||||
this.authorsPage * this.authorsPageSize,
|
||||
(this.authorsPage + 1) * this.authorsPageSize,
|
||||
);
|
||||
}
|
||||
|
||||
authorsPageCount(): number {
|
||||
return Math.ceil(this.authors().length / this.authorsPageSize);
|
||||
}
|
||||
|
||||
pagedInstitutions(): InstitutionDetail[] {
|
||||
return this.institutions().slice(
|
||||
this.institutionsPage * this.institutionsPageSize,
|
||||
(this.institutionsPage + 1) * this.institutionsPageSize,
|
||||
);
|
||||
}
|
||||
|
||||
institutionsPageCount(): number {
|
||||
return Math.ceil(this.institutions().length / this.institutionsPageSize);
|
||||
}
|
||||
|
||||
institutions(): InstitutionDetail[] {
|
||||
const institutions = new Map<string, InstitutionDetail>();
|
||||
for (const authorship of this.authors()) {
|
||||
@@ -155,6 +207,13 @@ export class PublicationDetailComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
fundingCount(): number {
|
||||
return (
|
||||
(this.publication?.funders?.length ?? 0) +
|
||||
(this.publication?.awards?.length ?? 0)
|
||||
);
|
||||
}
|
||||
|
||||
pages(): string | null {
|
||||
const first = this.publication?.biblio?.first_page;
|
||||
const last = this.publication?.biblio?.last_page;
|
||||
|
||||
Reference in New Issue
Block a user