Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis

This commit is contained in:
2026-07-05 20:01:34 +02:00
249 changed files with 13855 additions and 8894 deletions
@@ -46,11 +46,7 @@
<mat-form-field appearance="outline">
<mat-label>
{{
data.mode === 'create'
? 'Initiales Passwort'
: 'Neues Passwort'
}}
{{ data.mode === 'create' ? 'Initiales Passwort' : 'Neues Passwort' }}
</mat-label>
<input matInput type="password" formControlName="password" />
@if (form.controls.password.hasError('required')) {
@@ -64,7 +64,7 @@ import { StatusPipe } from '../../shared/pipes/status.pipe';
QueryParamInputComponent,
QueryParamSelectorComponent,
MatCardModule,
StatusPipe
StatusPipe,
],
templateUrl: './accounts.component.html',
styleUrl: './accounts.component.scss',
@@ -53,9 +53,13 @@
mat-icon-button
matSuffix
type="button"
[attr.aria-label]="showPassword ? 'Passwort verbergen' : 'Passwort anzeigen'"
[attr.aria-label]="
showPassword ? 'Passwort verbergen' : 'Passwort anzeigen'
"
(click)="showPassword = !showPassword">
<mat-icon>{{ showPassword ? 'visibility' : 'visibility_off' }}</mat-icon>
<mat-icon>{{
showPassword ? 'visibility' : 'visibility_off'
}}</mat-icon>
</button>
@if (credentialsForm.controls.password.hasError('required')) {
<mat-error>Passwort ist erforderlich.</mat-error>
@@ -90,7 +94,9 @@
<strong>Code eingeben</strong>
<span>
Wir haben den Code an
{{ credentialsForm.controls.email.value || 'Deine E-Mail-Adresse' }}
{{
credentialsForm.controls.email.value || 'Deine E-Mail-Adresse'
}}
gesendet.
</span>
</div>
@@ -4,7 +4,11 @@
place-items: center;
padding: 48px 20px;
background:
radial-gradient(circle at top left, rgba(61, 124, 255, 0.12), transparent 34%),
radial-gradient(
circle at top left,
rgba(61, 124, 255, 0.12),
transparent 34%
),
linear-gradient(160deg, #f7f9ff 0%, #ffffff 64%);
}
@@ -316,7 +316,10 @@
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
transition:
border-color 0.15s,
background 0.15s,
box-shadow 0.15s;
&:hover {
border-color: #0b63ce;
@@ -1,313 +1,313 @@
<div class="content">
<h1>Patente</h1>
<mat-divider />
<div class="search-and-filter">
<mat-form-field style="width: 100%">
<mat-label>Suche nach Titel oder Patent-Nr.</mat-label>
<input
matInput
type="search"
[value]="searchTerm"
(input)="onSearchInput($event)" />
<mat-icon matPrefix>search</mat-icon>
<button matIconButton matSuffix (click)="clearSearch()">
<mat-icon>clear</mat-icon>
</button>
</mat-form-field>
<div class="filter-row">
<mat-chip-listbox
[value]="activeFilter"
(change)="setFilterFromChip($event)">
<mat-chip-option value="all">Alle</mat-chip-option>
<mat-chip-option value="EPO">EPO</mat-chip-option>
<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>
</div>
<mat-divider />
@if (loading) {
<div class="state-message">
<mat-progress-spinner diameter="36" mode="indeterminate" />
<span>Lade Patente...</span>
</div>
} @else if (error) {
<p class="state-message error">Fehler beim Laden der Patente.</p>
} @else if (showDetail && selectedPatent) {
<div class="detail-view">
<button type="button" class="back-btn" (click)="closeDetail()">
← Zurück zu den Patenten
</button>
<h2>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h2>
<div class="patent-meta__list">
@for (row of getPatentMetadataRows(selectedPatent); track row.label) {
<div class="patent-meta__row">
<dt>{{ row.label }}</dt>
<dd>
@if (row.variant === 'source') {
<span
class="source-badge source-badge--{{
row.value.toLowerCase()
}}"
>{{ row.value }}</span
>
} @else {
{{ row.value }}
}
</dd>
</div>
}
</div>
@if (selectedPatent.abstract) {
<div class="detail-section">
<h4>Abstract</h4>
<p>{{ selectedPatent.abstract }}</p>
</div>
}
<div class="detail-section">
<h4>Erfinder</h4>
<ul class="tag-list">
@for (inv of selectedPatent.inventors; track inv) {
<li class="tag">{{ inv }}</li>
}
</ul>
</div>
@if ((selectedPatent.assignees?.length ?? 0) > 0) {
<div class="detail-section">
<h4>Anmelder</h4>
<ul class="tag-list">
@for (a of selectedPatent.assignees; track a) {
<li class="tag">{{ a }}</li>
}
</ul>
</div>
}
@if ((selectedPatent.ipc_descriptions?.length ?? 0) > 0) {
<div
class="detail-section classification-section classification-section--ipc">
<h4>Klassifikation (IPC)</h4>
<div class="classification-cards">
@for (
card of getClassificationCards(
selectedPatent.ipc_descriptions,
'IPC'
);
track card.key
) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (sym of card.symbols; track sym) {
<span class="classification-code">{{ sym }}</span>
}
</div>
<div class="classification-card__badges">
<span
class="classification-badge classification-badge--system"
>{{ card.system }}</span
>
<span
class="classification-badge classification-badge--level"
>{{ card.levelLabel }}</span
>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{
isClassificationExpanded(card.key)
? card.primaryDescription
: getDescriptionPreview(card.primaryDescription)
}}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button
type="button"
class="classification-toggle"
(click)="toggleClassificationExpanded(card.key)">
{{
isClassificationExpanded(card.key)
? 'Weniger anzeigen'
: 'Mehr anzeigen'
}}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</div>
} @else if ((selectedPatent.ipc?.length ?? 0) > 0) {
<div class="detail-section">
<h4>Klassifikation (IPC)</h4>
<ul class="tag-list tag-list--compact">
@for (ipc of selectedPatent.ipc; track ipc) {
<li class="tag">{{ ipc }}</li>
}
</ul>
</div>
}
@if ((selectedPatent.cpc_descriptions?.length ?? 0) > 0) {
<div
class="detail-section classification-section classification-section--cpc">
<h4>Klassifikation (CPC)</h4>
<div class="classification-cards">
@for (
card of getClassificationCards(
selectedPatent.cpc_descriptions,
'CPC'
);
track card.key
) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (sym of card.symbols; track sym) {
<span class="classification-code">{{ sym }}</span>
}
</div>
<div class="classification-card__badges">
<span
class="classification-badge classification-badge--system"
>{{ card.system }}</span
>
<span
class="classification-badge classification-badge--level"
>{{ card.levelLabel }}</span
>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{
isClassificationExpanded(card.key)
? card.primaryDescription
: getDescriptionPreview(card.primaryDescription)
}}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button
type="button"
class="classification-toggle"
(click)="toggleClassificationExpanded(card.key)">
{{
isClassificationExpanded(card.key)
? 'Weniger anzeigen'
: 'Mehr anzeigen'
}}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</div>
} @else if ((selectedPatent.cpc?.length ?? 0) > 0) {
<div class="detail-section">
<h4>Klassifikation (CPC)</h4>
<ul class="tag-list tag-list--compact">
@for (cpc of selectedPatent.cpc; track cpc) {
<li class="tag">{{ cpc }}</li>
}
</ul>
</div>
}
</div>
} @else if (patents.length === 0) {
<div class="no-results">
<p>Keine Patente gefunden.</p>
</div>
} @else {
<div class="cards">
@for (
patent of patents;
track patent.patent_id + (patent.publication_date ?? '')
) {
<mat-card
class="card"
appearance="outlined"
(click)="selectPatent(patent)">
<mat-card-header>
<mat-card-title>{{
patent.title ?? patent.patent_id
}}</mat-card-title>
<mat-card-subtitle>
<span
class="source-badge source-badge--{{
patent.source.toLowerCase()
}}"
>{{ patent.source }}</span
>
</mat-card-subtitle>
</mat-card-header>
<mat-card-content class="card-content">
<mat-divider />
<div class="card-metadata">
<span>{{ patent.patent_id }}</span>
<span>{{ formatDate(patent.publication_date ?? '') }}</span>
</div>
<mat-divider />
</mat-card-content>
<mat-card-footer>
<mat-card-actions>
<button
mat-button
(click)="selectPatent(patent); $event.stopPropagation()">
<mat-icon>info</mat-icon>
Übersicht
</button>
</mat-card-actions>
</mat-card-footer>
</mat-card>
}
</div>
}
<mat-divider />
@if (!showDetail) {
<mat-paginator
[length]="total"
[pageSize]="pageSize"
[pageIndex]="page"
[pageSizeOptions]="[10, 25, 50]"
(page)="handlePageChange($event)" />
}
</div>
<div class="content">
<h1>Patente</h1>
<mat-divider />
<div class="search-and-filter">
<mat-form-field style="width: 100%">
<mat-label>Suche nach Titel oder Patent-Nr.</mat-label>
<input
matInput
type="search"
[value]="searchTerm"
(input)="onSearchInput($event)" />
<mat-icon matPrefix>search</mat-icon>
<button matIconButton matSuffix (click)="clearSearch()">
<mat-icon>clear</mat-icon>
</button>
</mat-form-field>
<div class="filter-row">
<mat-chip-listbox
[value]="activeFilter"
(change)="setFilterFromChip($event)">
<mat-chip-option value="all">Alle</mat-chip-option>
<mat-chip-option value="EPO">EPO</mat-chip-option>
<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>
</div>
<mat-divider />
@if (loading) {
<div class="state-message">
<mat-progress-spinner diameter="36" mode="indeterminate" />
<span>Lade Patente...</span>
</div>
} @else if (error) {
<p class="state-message error">Fehler beim Laden der Patente.</p>
} @else if (showDetail && selectedPatent) {
<div class="detail-view">
<button type="button" class="back-btn" (click)="closeDetail()">
← Zurück zu den Patenten
</button>
<h2>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h2>
<div class="patent-meta__list">
@for (row of getPatentMetadataRows(selectedPatent); track row.label) {
<div class="patent-meta__row">
<dt>{{ row.label }}</dt>
<dd>
@if (row.variant === 'source') {
<span
class="source-badge source-badge--{{
row.value.toLowerCase()
}}"
>{{ row.value }}</span
>
} @else {
{{ row.value }}
}
</dd>
</div>
}
</div>
@if (selectedPatent.abstract) {
<div class="detail-section">
<h4>Abstract</h4>
<p>{{ selectedPatent.abstract }}</p>
</div>
}
<div class="detail-section">
<h4>Erfinder</h4>
<ul class="tag-list">
@for (inv of selectedPatent.inventors; track inv) {
<li class="tag">{{ inv }}</li>
}
</ul>
</div>
@if ((selectedPatent.assignees?.length ?? 0) > 0) {
<div class="detail-section">
<h4>Anmelder</h4>
<ul class="tag-list">
@for (a of selectedPatent.assignees; track a) {
<li class="tag">{{ a }}</li>
}
</ul>
</div>
}
@if ((selectedPatent.ipc_descriptions?.length ?? 0) > 0) {
<div
class="detail-section classification-section classification-section--ipc">
<h4>Klassifikation (IPC)</h4>
<div class="classification-cards">
@for (
card of getClassificationCards(
selectedPatent.ipc_descriptions,
'IPC'
);
track card.key
) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (sym of card.symbols; track sym) {
<span class="classification-code">{{ sym }}</span>
}
</div>
<div class="classification-card__badges">
<span
class="classification-badge classification-badge--system"
>{{ card.system }}</span
>
<span
class="classification-badge classification-badge--level"
>{{ card.levelLabel }}</span
>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{
isClassificationExpanded(card.key)
? card.primaryDescription
: getDescriptionPreview(card.primaryDescription)
}}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button
type="button"
class="classification-toggle"
(click)="toggleClassificationExpanded(card.key)">
{{
isClassificationExpanded(card.key)
? 'Weniger anzeigen'
: 'Mehr anzeigen'
}}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</div>
} @else if ((selectedPatent.ipc?.length ?? 0) > 0) {
<div class="detail-section">
<h4>Klassifikation (IPC)</h4>
<ul class="tag-list tag-list--compact">
@for (ipc of selectedPatent.ipc; track ipc) {
<li class="tag">{{ ipc }}</li>
}
</ul>
</div>
}
@if ((selectedPatent.cpc_descriptions?.length ?? 0) > 0) {
<div
class="detail-section classification-section classification-section--cpc">
<h4>Klassifikation (CPC)</h4>
<div class="classification-cards">
@for (
card of getClassificationCards(
selectedPatent.cpc_descriptions,
'CPC'
);
track card.key
) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (sym of card.symbols; track sym) {
<span class="classification-code">{{ sym }}</span>
}
</div>
<div class="classification-card__badges">
<span
class="classification-badge classification-badge--system"
>{{ card.system }}</span
>
<span
class="classification-badge classification-badge--level"
>{{ card.levelLabel }}</span
>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{
isClassificationExpanded(card.key)
? card.primaryDescription
: getDescriptionPreview(card.primaryDescription)
}}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button
type="button"
class="classification-toggle"
(click)="toggleClassificationExpanded(card.key)">
{{
isClassificationExpanded(card.key)
? 'Weniger anzeigen'
: 'Mehr anzeigen'
}}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</div>
} @else if ((selectedPatent.cpc?.length ?? 0) > 0) {
<div class="detail-section">
<h4>Klassifikation (CPC)</h4>
<ul class="tag-list tag-list--compact">
@for (cpc of selectedPatent.cpc; track cpc) {
<li class="tag">{{ cpc }}</li>
}
</ul>
</div>
}
</div>
} @else if (patents.length === 0) {
<div class="no-results">
<p>Keine Patente gefunden.</p>
</div>
} @else {
<div class="cards">
@for (
patent of patents;
track patent.patent_id + (patent.publication_date ?? '')
) {
<mat-card
class="card"
appearance="outlined"
(click)="selectPatent(patent)">
<mat-card-header>
<mat-card-title>{{
patent.title ?? patent.patent_id
}}</mat-card-title>
<mat-card-subtitle>
<span
class="source-badge source-badge--{{
patent.source.toLowerCase()
}}"
>{{ patent.source }}</span
>
</mat-card-subtitle>
</mat-card-header>
<mat-card-content class="card-content">
<mat-divider />
<div class="card-metadata">
<span>{{ patent.patent_id }}</span>
<span>{{ formatDate(patent.publication_date ?? '') }}</span>
</div>
<mat-divider />
</mat-card-content>
<mat-card-footer>
<mat-card-actions>
<button
mat-button
(click)="selectPatent(patent); $event.stopPropagation()">
<mat-icon>info</mat-icon>
Übersicht
</button>
</mat-card-actions>
</mat-card-footer>
</mat-card>
}
</div>
}
<mat-divider />
@if (!showDetail) {
<mat-paginator
[length]="total"
[pageSize]="pageSize"
[pageIndex]="page"
[pageSizeOptions]="[10, 25, 50]"
(page)="handlePageChange($event)" />
}
</div>
@@ -1,394 +1,499 @@
.content {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
}
h1 {
margin: 0;
font-size: 2rem;
font-weight: 700;
padding: 1rem 0 0;
}
.search-and-filter {
padding: 0 1rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.filter-row {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
.year-filter {
width: min(285px, 100%);
padding: 8px 10px;
border: 1px solid #dbe5f6;
border-radius: 10px;
background: #fbfdff;
box-sizing: border-box;
}
.year-filter-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 4px;
}
.year-filter-label {
color: #07163d;
font-size: 12px;
font-weight: 700;
}
.reset-range-button {
border: 0;
background: transparent;
color: #0057ff;
font-size: 11px;
cursor: pointer;
padding: 0;
font-family: inherit;
&:disabled {
color: #9aa5bc;
cursor: default;
}
}
.year-filter-values {
display: flex;
align-items: center;
justify-content: center;
gap: 7px;
margin-bottom: 5px;
color: #40506f;
font-size: 12px;
font-weight: 600;
}
.year-filter-bounds {
display: flex;
justify-content: space-between;
margin-top: 1px;
color: #7c88a3;
font-size: 10px;
}
.year-range-slider {
--range-start: 0%;
--range-end: 100%;
--accent: #0057ff;
position: relative;
height: 22px;
}
.range-track {
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 5px;
transform: translateY(-50%);
border-radius: 999px;
background: linear-gradient(
to right,
#d8e2f4 0%,
#d8e2f4 var(--range-start),
var(--accent) var(--range-start),
var(--accent) var(--range-end),
#d8e2f4 var(--range-end),
#d8e2f4 100%
);
}
.range-input {
position: absolute;
inset: 0;
width: 100%;
height: 22px;
margin: 0;
appearance: none;
background: transparent;
pointer-events: none;
&::-webkit-slider-runnable-track,
&::-moz-range-track {
height: 5px;
background: transparent;
border: none;
}
&::-webkit-slider-thumb {
appearance: none;
width: 15px;
height: 15px;
margin-top: -5px;
border: 2px solid #ffffff;
border-radius: 50%;
background: #0057ff;
box-shadow: 0 0 0 1px #9ab7ff, 0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
pointer-events: auto;
}
&::-moz-range-thumb {
width: 15px;
height: 15px;
border: 2px solid #ffffff;
border-radius: 50%;
background: #0057ff;
box-shadow: 0 0 0 1px #9ab7ff, 0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
pointer-events: auto;
}
}
.range-input-start { z-index: 2; }
.range-input-end { z-index: 3; }
.state-message {
display: flex;
align-items: center;
gap: 12px;
padding: 24px 1rem;
color: #666;
font-size: 14px;
&.error { color: #c0392b; }
}
.cards {
display: grid;
gap: 1.5rem;
grid-template-columns: repeat(4, 1fr);
padding: 0 1rem;
}
@media (max-width: 900px) {
.cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
.cards { grid-template-columns: 1fr; }
}
mat-paginator {
background-color: var(--sg-background);
}
.card {
padding: 0.5rem;
background-color: var(--sg-background);
transition: transform 0.3s ease;
display: flex;
flex-direction: column;
gap: 0.5rem;
&:hover {
cursor: pointer;
transform: scale(1.05);
}
mat-card-title {
font-size: 14px;
font-weight: 600;
line-height: 1.4;
}
}
.card-content {
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 0.5rem;
flex: 1;
}
.card-metadata {
display: flex;
flex-direction: column;
gap: 0.2rem;
font-size: 0.9rem;
color: var(--sg-text-secondary);
}
mat-card-actions {
padding-top: 0.5rem;
display: flex;
gap: 0.5rem;
button {
width: 100%;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
}
}
.source-badge {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 700;
&--epo { background: #effaf3; color: #24834f; border: 1px solid #bdebcf; }
&--uspto { background: #f0f6ff; color: #0b63ce; border: 1px solid #bdd4ff; }
}
.no-results {
text-align: center;
padding: 2rem;
color: var(--sg-text-secondary);
}
.detail-view {
padding: 1rem;
h2 { margin: 0 0 1rem; font-size: 1.4rem; color: #333; line-height: 1.4; }
h4 { margin: 16px 0 8px; font-size: 14px; color: #555; font-weight: 600; }
p { font-size: 13px; color: #444; line-height: 1.6; margin: 0; }
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 0.4rem;
margin-bottom: 1rem;
padding: 0.5rem 0.85rem;
border: 1px solid #d6e3f8;
border-radius: 999px;
background: #f8fbff;
color: #2563eb;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
&:hover { background: #eef5ff; border-color: #bcd3f7; }
}
.patent-meta__list {
margin: 12px 0 20px;
border: 1px solid #e2e8f4;
border-radius: 12px;
background: linear-gradient(180deg, #fff 0%, #f8faff 100%);
overflow: hidden;
}
.patent-meta__row {
display: grid;
grid-template-columns: minmax(130px, 38%) 1fr;
gap: 12px 16px;
align-items: center;
padding: 11px 16px;
border-top: 1px solid #eef2f8;
&:first-child { border-top: 0; }
dt { margin: 0; font-size: 12px; font-weight: 500; color: #64748b; }
dd { margin: 0; font-size: 14px; font-weight: 600; color: #1e293b; word-break: break-word; }
}
.detail-section {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #eee;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 0;
padding: 0;
list-style: none;
&--compact .tag { font-size: 0.75rem; padding: 3px 8px; }
}
.tag {
padding: 4px 10px;
border-radius: 999px;
background: #f0f6ff;
border: 1px solid #dbeafe;
color: #1e40af;
font-size: 0.8rem;
}
.classification-section {
&--ipc .classification-card { background: #f0f6ff; border-color: #bfdbfe; }
&--ipc .classification-badge--system { background: #dbeafe; color: #1d4ed8; }
&--cpc .classification-card { background: #f0fdf4; border-color: #bbf7d0; }
&--cpc .classification-badge--system { background: #dcfce7; color: #15803d; }
}
.classification-cards { display: flex; flex-direction: column; gap: 10px; }
.classification-card {
padding: 12px 14px;
border-radius: 10px;
border: 1px solid #dbeafe;
}
.classification-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.classification-card__codes { display: flex; flex-wrap: wrap; gap: 6px; }
.classification-card__badges { display: flex; flex-wrap: wrap; gap: 6px; }
.classification-code { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.classification-badge {
display: inline-flex;
align-items: center;
padding: 2px 8px;
border-radius: 999px;
font-size: 0.68rem;
font-weight: 700;
text-transform: uppercase;
}
.classification-badge--level { background: #e2e8f0; color: #475569; }
.classification-summary { margin: 10px 0 0; font-size: 0.84rem; line-height: 1.5; color: #334155; }
.classification-toggle {
margin-top: 6px;
padding: 0;
border: 0;
background: none;
color: #2563eb;
font-size: 0.78rem;
cursor: pointer;
&:hover { text-decoration: underline; }
}
.classification-hierarchy {
margin: 10px 0 0;
padding-top: 10px;
border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.classification-hierarchy__row {
display: grid;
grid-template-columns: 88px 1fr;
gap: 8px;
margin-bottom: 6px;
dt { margin: 0; font-size: 0.72rem; font-weight: 700; color: #64748b; text-transform: uppercase; }
dd { margin: 0; font-size: 0.8rem; line-height: 1.45; color: #334155; }
}
.content {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
}
h1 {
margin: 0;
font-size: 2rem;
font-weight: 700;
padding: 1rem 0 0;
}
.search-and-filter {
padding: 0 1rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.filter-row {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
.year-filter {
width: min(285px, 100%);
padding: 8px 10px;
border: 1px solid #dbe5f6;
border-radius: 10px;
background: #fbfdff;
box-sizing: border-box;
}
.year-filter-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 4px;
}
.year-filter-label {
color: #07163d;
font-size: 12px;
font-weight: 700;
}
.reset-range-button {
border: 0;
background: transparent;
color: #0057ff;
font-size: 11px;
cursor: pointer;
padding: 0;
font-family: inherit;
&:disabled {
color: #9aa5bc;
cursor: default;
}
}
.year-filter-values {
display: flex;
align-items: center;
justify-content: center;
gap: 7px;
margin-bottom: 5px;
color: #40506f;
font-size: 12px;
font-weight: 600;
}
.year-filter-bounds {
display: flex;
justify-content: space-between;
margin-top: 1px;
color: #7c88a3;
font-size: 10px;
}
.year-range-slider {
--range-start: 0%;
--range-end: 100%;
--accent: #0057ff;
position: relative;
height: 22px;
}
.range-track {
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 5px;
transform: translateY(-50%);
border-radius: 999px;
background: linear-gradient(
to right,
#d8e2f4 0%,
#d8e2f4 var(--range-start),
var(--accent) var(--range-start),
var(--accent) var(--range-end),
#d8e2f4 var(--range-end),
#d8e2f4 100%
);
}
.range-input {
position: absolute;
inset: 0;
width: 100%;
height: 22px;
margin: 0;
appearance: none;
background: transparent;
pointer-events: none;
&::-webkit-slider-runnable-track,
&::-moz-range-track {
height: 5px;
background: transparent;
border: none;
}
&::-webkit-slider-thumb {
appearance: none;
width: 15px;
height: 15px;
margin-top: -5px;
border: 2px solid #ffffff;
border-radius: 50%;
background: #0057ff;
box-shadow:
0 0 0 1px #9ab7ff,
0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
pointer-events: auto;
}
&::-moz-range-thumb {
width: 15px;
height: 15px;
border: 2px solid #ffffff;
border-radius: 50%;
background: #0057ff;
box-shadow:
0 0 0 1px #9ab7ff,
0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
pointer-events: auto;
}
}
.range-input-start {
z-index: 2;
}
.range-input-end {
z-index: 3;
}
.state-message {
display: flex;
align-items: center;
gap: 12px;
padding: 24px 1rem;
color: #666;
font-size: 14px;
&.error {
color: #c0392b;
}
}
.cards {
display: grid;
gap: 1.5rem;
grid-template-columns: repeat(4, 1fr);
padding: 0 1rem;
}
@media (max-width: 900px) {
.cards {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 600px) {
.cards {
grid-template-columns: 1fr;
}
}
mat-paginator {
background-color: var(--sg-background);
}
.card {
padding: 0.5rem;
background-color: var(--sg-background);
transition: transform 0.3s ease;
display: flex;
flex-direction: column;
gap: 0.5rem;
&:hover {
cursor: pointer;
transform: scale(1.05);
}
mat-card-title {
font-size: 14px;
font-weight: 600;
line-height: 1.4;
}
}
.card-content {
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 0.5rem;
flex: 1;
}
.card-metadata {
display: flex;
flex-direction: column;
gap: 0.2rem;
font-size: 0.9rem;
color: var(--sg-text-secondary);
}
mat-card-actions {
padding-top: 0.5rem;
display: flex;
gap: 0.5rem;
button {
width: 100%;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
}
}
.source-badge {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 700;
&--epo {
background: #effaf3;
color: #24834f;
border: 1px solid #bdebcf;
}
&--uspto {
background: #f0f6ff;
color: #0b63ce;
border: 1px solid #bdd4ff;
}
}
.no-results {
text-align: center;
padding: 2rem;
color: var(--sg-text-secondary);
}
.detail-view {
padding: 1rem;
h2 {
margin: 0 0 1rem;
font-size: 1.4rem;
color: #333;
line-height: 1.4;
}
h4 {
margin: 16px 0 8px;
font-size: 14px;
color: #555;
font-weight: 600;
}
p {
font-size: 13px;
color: #444;
line-height: 1.6;
margin: 0;
}
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 0.4rem;
margin-bottom: 1rem;
padding: 0.5rem 0.85rem;
border: 1px solid #d6e3f8;
border-radius: 999px;
background: #f8fbff;
color: #2563eb;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
&:hover {
background: #eef5ff;
border-color: #bcd3f7;
}
}
.patent-meta__list {
margin: 12px 0 20px;
border: 1px solid #e2e8f4;
border-radius: 12px;
background: linear-gradient(180deg, #fff 0%, #f8faff 100%);
overflow: hidden;
}
.patent-meta__row {
display: grid;
grid-template-columns: minmax(130px, 38%) 1fr;
gap: 12px 16px;
align-items: center;
padding: 11px 16px;
border-top: 1px solid #eef2f8;
&:first-child {
border-top: 0;
}
dt {
margin: 0;
font-size: 12px;
font-weight: 500;
color: #64748b;
}
dd {
margin: 0;
font-size: 14px;
font-weight: 600;
color: #1e293b;
word-break: break-word;
}
}
.detail-section {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #eee;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 0;
padding: 0;
list-style: none;
&--compact .tag {
font-size: 0.75rem;
padding: 3px 8px;
}
}
.tag {
padding: 4px 10px;
border-radius: 999px;
background: #f0f6ff;
border: 1px solid #dbeafe;
color: #1e40af;
font-size: 0.8rem;
}
.classification-section {
&--ipc .classification-card {
background: #f0f6ff;
border-color: #bfdbfe;
}
&--ipc .classification-badge--system {
background: #dbeafe;
color: #1d4ed8;
}
&--cpc .classification-card {
background: #f0fdf4;
border-color: #bbf7d0;
}
&--cpc .classification-badge--system {
background: #dcfce7;
color: #15803d;
}
}
.classification-cards {
display: flex;
flex-direction: column;
gap: 10px;
}
.classification-card {
padding: 12px 14px;
border-radius: 10px;
border: 1px solid #dbeafe;
}
.classification-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.classification-card__codes {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.classification-card__badges {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.classification-code {
font-size: 0.9rem;
font-weight: 700;
color: #0f172a;
}
.classification-badge {
display: inline-flex;
align-items: center;
padding: 2px 8px;
border-radius: 999px;
font-size: 0.68rem;
font-weight: 700;
text-transform: uppercase;
}
.classification-badge--level {
background: #e2e8f0;
color: #475569;
}
.classification-summary {
margin: 10px 0 0;
font-size: 0.84rem;
line-height: 1.5;
color: #334155;
}
.classification-toggle {
margin-top: 6px;
padding: 0;
border: 0;
background: none;
color: #2563eb;
font-size: 0.78rem;
cursor: pointer;
&:hover {
text-decoration: underline;
}
}
.classification-hierarchy {
margin: 10px 0 0;
padding-top: 10px;
border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.classification-hierarchy__row {
display: grid;
grid-template-columns: 88px 1fr;
gap: 8px;
margin-bottom: 6px;
dt {
margin: 0;
font-size: 0.72rem;
font-weight: 700;
color: #64748b;
text-transform: uppercase;
}
dd {
margin: 0;
font-size: 0.8rem;
line-height: 1.45;
color: #334155;
}
}
@@ -1,366 +1,366 @@
import { Component, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatChipsModule } from '@angular/material/chips';
import { MatDividerModule } from '@angular/material/divider';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
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';
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 }[];
}
const DESCRIPTION_PREVIEW_LENGTH = 140;
@Component({
selector: 'app-patents',
imports: [
CommonModule,
RouterModule,
MatIconModule,
MatButtonModule,
MatCardModule,
MatFormFieldModule,
MatInputModule,
MatPaginatorModule,
MatProgressSpinnerModule,
MatChipsModule,
MatDividerModule,
QueryParamSelectorComponent,
],
templateUrl: './patents.component.html',
styleUrl: './patents.component.scss',
})
export class PatentsComponent implements OnInit {
private router = inject(Router);
private route = inject(ActivatedRoute);
private patentsApi = inject(PatentsService);
patents: PatentEntry[] = [];
total = 0;
page = 0;
pageSize = 10;
loading = true;
error = false;
searchTerm = '';
activeFilter: SourceFilter = 'all';
sortDirection: string = 'desc';
selectedPatent: PatentEntry | null = null;
showDetail = false;
private expandedClassificationKeys = new Set<string>();
private searchSubject = new Subject<string>();
sortingDirectionOptions: SelectorOption[] = [
{ value: '', display_name: '' },
{ value: 'asc', display_name: 'Aufsteigend' },
{ value: 'desc', display_name: 'Absteigend' },
];
constructor() {
this.searchSubject
.pipe(debounceTime(300), distinctUntilChanged(), takeUntilDestroyed())
.subscribe((term) => {
this.searchTerm = term;
this.page = 0;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
});
}
ngOnInit(): void {
const qp = this.route.snapshot.queryParamMap;
this.searchTerm = qp.get('search') ?? '';
this.page = parseInt(qp.get('page') ?? '0', 10);
this.pageSize = parseInt(qp.get('size') ?? '10', 10);
const f = qp.get('source');
if (f === 'EPO' || f === 'USPTO') this.activeFilter = f;
const d = qp.get('sort_direction');
if (d === 'asc' || d === 'desc') this.sortDirection = d;
this.loadPatents();
}
private loadPatents(): void {
this.loading = true;
this.error = false;
const source = this.activeFilter === 'all' ? undefined : this.activeFilter;
this.patentsApi
.getAllPatents(
this.page,
this.pageSize,
this.searchTerm || undefined,
source,
'date',
this.sortDirection,
)
.subscribe({
next: (res) => {
this.patents = res.patents;
this.total = res.total;
this.loading = false;
},
error: () => {
this.error = true;
this.loading = false;
},
});
}
onSearchInput(event: Event): void {
this.searchSubject.next((event.target as HTMLInputElement).value);
}
clearSearch(): void {
this.searchTerm = '';
this.page = 0;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
}
setFilterFromChip(event: any): void {
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();
}
setSortDirection(direction: string): void {
this.sortDirection = direction;
this.loadPatents();
this.updateQueryParams();
}
handlePageChange(event: PageEvent): void {
this.page = event.pageIndex;
this.pageSize = event.pageSize;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
}
selectPatent(patent: PatentEntry): void {
this.selectedPatent = patent;
this.showDetail = true;
this.expandedClassificationKeys.clear();
}
closeDetail(): void {
this.showDetail = false;
this.selectedPatent = null;
this.expandedClassificationKeys.clear();
}
private updateQueryParams(): void {
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
search: this.searchTerm || null,
page: this.page,
size: this.pageSize,
source: this.activeFilter === 'all' ? null : this.activeFilter,
sort_direction: this.sortDirection,
},
queryParamsHandling: 'merge',
replaceUrl: true,
});
}
formatDate(date: string | null): string {
if (!date) return '-';
const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
const parsed = new Date(d);
if (isNaN(parsed.getTime())) return date;
return new Intl.DateTimeFormat('de-DE').format(parsed);
}
getPublicationStageLabel(patent: PatentEntry): string | null {
return patent.kind ?? patent.application_type ?? null;
}
getPatentMetadataRows(patent: PatentEntry) {
const rows: { label: string; value: string; variant?: 'source' }[] = [];
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 stage = this.getPublicationStageLabel(patent);
if (stage)
rows.push({
label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp',
value: this.formatMetadataLabel(stage),
});
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, (c) => c.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 s of card.symbols) {
if (!existing.symbols.includes(s)) existing.symbols.push(s);
}
continue;
}
merged.set(mergeKey, card);
}
return [...merged.values()];
}
toggleClassificationExpanded(key: string): void {
this.expandedClassificationKeys.has(key)
? this.expandedClassificationKeys.delete(key)
: 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 '';
return text.length <= DESCRIPTION_PREVIEW_LENGTH
? text
: `${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,
) {
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 norm = value.toLocaleLowerCase('en');
if (
seen.has(norm) ||
norm === primaryDescription?.toLocaleLowerCase('en')
)
return;
seen.add(norm);
rows.push({ label, value });
};
addRow('Sektion', entry.section ?? null);
addRow('Klasse', entry.class ?? null);
addRow('Unterklasse', entry.subclass ?? null);
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 first = text.split(/[;|]/)[0]?.trim() ?? text;
return first === first.toUpperCase()
? first.charAt(0) + first.slice(1).toLowerCase()
: first;
}
}
import { Component, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatChipsModule } from '@angular/material/chips';
import { MatDividerModule } from '@angular/material/divider';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
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';
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 }[];
}
const DESCRIPTION_PREVIEW_LENGTH = 140;
@Component({
selector: 'app-patents',
imports: [
CommonModule,
RouterModule,
MatIconModule,
MatButtonModule,
MatCardModule,
MatFormFieldModule,
MatInputModule,
MatPaginatorModule,
MatProgressSpinnerModule,
MatChipsModule,
MatDividerModule,
QueryParamSelectorComponent,
],
templateUrl: './patents.component.html',
styleUrl: './patents.component.scss',
})
export class PatentsComponent implements OnInit {
private router = inject(Router);
private route = inject(ActivatedRoute);
private patentsApi = inject(PatentsService);
patents: PatentEntry[] = [];
total = 0;
page = 0;
pageSize = 10;
loading = true;
error = false;
searchTerm = '';
activeFilter: SourceFilter = 'all';
sortDirection: string = 'desc';
selectedPatent: PatentEntry | null = null;
showDetail = false;
private expandedClassificationKeys = new Set<string>();
private searchSubject = new Subject<string>();
sortingDirectionOptions: SelectorOption[] = [
{ value: '', display_name: '' },
{ value: 'asc', display_name: 'Aufsteigend' },
{ value: 'desc', display_name: 'Absteigend' },
];
constructor() {
this.searchSubject
.pipe(debounceTime(300), distinctUntilChanged(), takeUntilDestroyed())
.subscribe((term) => {
this.searchTerm = term;
this.page = 0;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
});
}
ngOnInit(): void {
const qp = this.route.snapshot.queryParamMap;
this.searchTerm = qp.get('search') ?? '';
this.page = parseInt(qp.get('page') ?? '0', 10);
this.pageSize = parseInt(qp.get('size') ?? '10', 10);
const f = qp.get('source');
if (f === 'EPO' || f === 'USPTO') this.activeFilter = f;
const d = qp.get('sort_direction');
if (d === 'asc' || d === 'desc') this.sortDirection = d;
this.loadPatents();
}
private loadPatents(): void {
this.loading = true;
this.error = false;
const source = this.activeFilter === 'all' ? undefined : this.activeFilter;
this.patentsApi
.getAllPatents(
this.page,
this.pageSize,
this.searchTerm || undefined,
source,
'date',
this.sortDirection,
)
.subscribe({
next: (res) => {
this.patents = res.patents;
this.total = res.total;
this.loading = false;
},
error: () => {
this.error = true;
this.loading = false;
},
});
}
onSearchInput(event: Event): void {
this.searchSubject.next((event.target as HTMLInputElement).value);
}
clearSearch(): void {
this.searchTerm = '';
this.page = 0;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
}
setFilterFromChip(event: any): void {
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();
}
setSortDirection(direction: string): void {
this.sortDirection = direction;
this.loadPatents();
this.updateQueryParams();
}
handlePageChange(event: PageEvent): void {
this.page = event.pageIndex;
this.pageSize = event.pageSize;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
}
selectPatent(patent: PatentEntry): void {
this.selectedPatent = patent;
this.showDetail = true;
this.expandedClassificationKeys.clear();
}
closeDetail(): void {
this.showDetail = false;
this.selectedPatent = null;
this.expandedClassificationKeys.clear();
}
private updateQueryParams(): void {
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
search: this.searchTerm || null,
page: this.page,
size: this.pageSize,
source: this.activeFilter === 'all' ? null : this.activeFilter,
sort_direction: this.sortDirection,
},
queryParamsHandling: 'merge',
replaceUrl: true,
});
}
formatDate(date: string | null): string {
if (!date) return '-';
const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
const parsed = new Date(d);
if (isNaN(parsed.getTime())) return date;
return new Intl.DateTimeFormat('de-DE').format(parsed);
}
getPublicationStageLabel(patent: PatentEntry): string | null {
return patent.kind ?? patent.application_type ?? null;
}
getPatentMetadataRows(patent: PatentEntry) {
const rows: { label: string; value: string; variant?: 'source' }[] = [];
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 stage = this.getPublicationStageLabel(patent);
if (stage)
rows.push({
label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp',
value: this.formatMetadataLabel(stage),
});
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, (c) => c.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 s of card.symbols) {
if (!existing.symbols.includes(s)) existing.symbols.push(s);
}
continue;
}
merged.set(mergeKey, card);
}
return [...merged.values()];
}
toggleClassificationExpanded(key: string): void {
this.expandedClassificationKeys.has(key)
? this.expandedClassificationKeys.delete(key)
: 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 '';
return text.length <= DESCRIPTION_PREVIEW_LENGTH
? text
: `${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,
) {
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 norm = value.toLocaleLowerCase('en');
if (
seen.has(norm) ||
norm === primaryDescription?.toLocaleLowerCase('en')
)
return;
seen.add(norm);
rows.push({ label, value });
};
addRow('Sektion', entry.section ?? null);
addRow('Klasse', entry.class ?? null);
addRow('Unterklasse', entry.subclass ?? null);
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 first = text.split(/[;|]/)[0]?.trim() ?? text;
return first === first.toUpperCase()
? first.charAt(0) + first.slice(1).toLowerCase()
: first;
}
}
@@ -57,7 +57,10 @@
<button
type="button"
class="institution-tag"
[class.active]="isInstitutionActive()"
[class.is-loading]="loading()"
[matTooltip]="inst.display_name || ''"
[matTooltipDisabled]="loading()"
matTooltipPosition="above"
(click)="
institutionClick.emit(inst.display_name || '');
@@ -98,18 +101,19 @@
<div class="topic-row">
@for (topic of topics(); track topic.id) {
<button
type="button"
<app-topic-chip
[skText]="loading()"
class="topic-tag"
[class.active]="selectedTopics().has(topic.display_name || '')"
[matTooltip]="getTopicTooltip(topic)"
matTooltipPosition="above"
(click)="
topicClick.emit(topic.display_name || ''); $event.stopPropagation()
">
{{ topic.display_name }}
</button>
class="person-topic-chip"
size="mini"
[label]="topic.display_name || ''"
[description]="topic.description"
[subfieldName]="topic.subfield?.display_name"
[fieldName]="topic.field?.display_name"
[domainName]="topic.domain?.display_name"
[color]="getTopicColor(topic)"
[active]="isTopicSelected(topic)"
(chipClick)="handleTopicClick(topic)">
</app-topic-chip>
}
</div>
</div>
@@ -172,6 +172,27 @@
0 0 0 2px var(--sg-background),
0 0 0 4px var(--sg-primary);
}
&.active {
border-color: var(--sg-primary);
box-shadow:
0 0 0 1px #ffffff,
0 0 0 3px var(--sg-primary);
}
&.active:hover,
&.active:focus-visible {
background: var(--sg-primary);
color: #fff;
}
&.is-loading {
pointer-events: none;
background: var(--sg-surface-soft);
border-color: var(--sg-border);
color: var(--sg-text-soft);
box-shadow: none;
}
}
.flag-img {
@@ -246,55 +267,25 @@
.topic-row {
display: flex;
flex-wrap: wrap;
gap: 4px;
gap: 5px;
}
.topic-tag {
background: var(--sg-surface-soft);
border: 1px solid var(--sg-border);
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 600;
padding: 2px 6px;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s ease;
app-topic-chip.person-topic-chip {
min-width: 0;
max-width: 100%;
}
:host ::ng-deep app-topic-chip.person-topic-chip .topic-chip__button {
max-width: 100%;
}
:host ::ng-deep app-topic-chip.person-topic-chip .topic-chip__label {
justify-self: stretch;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
box-sizing: border-box;
margin: 0;
line-height: normal;
font-family: inherit;
display: inline-flex;
align-items: center;
&:hover,
&:focus-visible {
background: var(--sg-primary-soft);
border-color: var(--sg-primary);
color: var(--sg-primary);
outline: none;
box-shadow:
0 0 0 2px var(--sg-background),
0 0 0 4px var(--sg-primary);
}
&.active {
background: var(--sg-primary-soft);
border-color: var(--sg-primary);
color: var(--sg-primary);
font-weight: 700;
box-shadow: 0 0 0 1.5px var(--sg-primary);
&:hover,
&:focus-visible {
box-shadow:
0 0 0 2px var(--sg-background),
0 0 0 4px var(--sg-primary);
}
}
overflow-wrap: normal;
}
.card-footer {
@@ -5,6 +5,8 @@ import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api';
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
@Component({
selector: 'app-person-card',
@@ -15,6 +17,7 @@ import { SkTextDirective } from '../../custom-directives/sk-text.directive';
MatIconModule,
SkTextDirective,
MatTooltipModule,
TopicChipComponent,
],
templateUrl: './person-card.component.html',
styleUrl: './person-card.component.scss',
@@ -24,6 +27,7 @@ export class PersonCardComponent {
isBookmarked = input<boolean>(false);
loading = input<boolean>(false);
selectedTopics = input<Set<string>>(new Set<string>());
activeInstitutionName = input<string>('');
bookmarkToggle = output<CustomAuthor>();
topicClick = output<string>();
@@ -62,6 +66,14 @@ export class PersonCardComponent {
return newestInstitution;
});
isInstitutionActive = computed<boolean>(() => {
const active = this.activeInstitutionName().trim().toLowerCase();
if (!active) return false;
return (
(this.institution()?.display_name ?? '').trim().toLowerCase() === active
);
});
topics = computed<WorkTopic[]>(() => {
return (this.person().topics ?? [])
.filter((t): t is WorkTopic => !!t.display_name)
@@ -117,17 +129,29 @@ export class PersonCardComponent {
return 'possible';
}
getTopicTooltip(topic: WorkTopic): string {
const parts: string[] = [];
if (topic.domain?.display_name) parts.push(topic.domain.display_name);
if (topic.field?.display_name) parts.push(topic.field.display_name);
if (topic.subfield?.display_name) parts.push(topic.subfield.display_name);
isTopicSelected(topic: WorkTopic): boolean {
return this.selectedTopics().has(topic.display_name || '');
}
const path = parts.join(' - ');
if (topic.display_name) {
return path ? `${topic.display_name}\n(${path})` : topic.display_name;
getTopicColor(topic: WorkTopic): string {
return topicHierarchyColor({
id: topic.id,
name: topic.display_name,
field_id: topic.field?.id,
field_name: topic.field?.display_name,
domain_id: topic.domain?.id,
domain_name: topic.domain?.display_name,
});
}
handleTopicClick(topic: WorkTopic): void {
const topicName = topic.display_name || '';
if (!topicName) {
return;
}
return path;
this.topicClick.emit(topicName);
}
getCareerStageTooltip(careerStage: string): string {
@@ -11,10 +11,15 @@
<app-topic-legend
[groups]="legendGroups()"
[expanded]="legendExpanded()"
[selectable]="true"
[activeFieldIds]="activeLegendFieldIds()"
[activeSubfieldIds]="activeLegendSubfieldIds()"
[showTitle]="false"
[showVisibilityToggle]="false"
[collapsedGroupLimit]="3"
variant="compact"
(fieldToggle)="onLegendFieldToggle($event)"
(subfieldToggle)="onLegendSubfieldToggle($event)"
(expandedChange)="onLegendExpandedChange($event)">
</app-topic-legend>
<div class="interest-tags">
@@ -29,6 +34,7 @@
[domainName]="tag.domainName"
[color]="tag.color"
[disabled]="!tag.id"
[active]="isTagActive(tag)"
countIcon="article"
descriptionTooltipTarget="button"
(chipClick)="onTagClick(tag)">
@@ -17,7 +17,15 @@ import { TopicCount } from '../../api';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { TopicLegendComponent } from '../../shared/ui/topic-legend/topic-legend.component';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
import { buildTopicLegendGroups } from '../../resolvers/utils/topic-legend';
import {
buildTopicLegendGroups,
getTopicLegendFieldId,
getTopicLegendSubfieldId,
TopicLegendGroup,
TopicLegendSubfieldSelection,
toggleTopicLegendFieldSelection,
toggleTopicLegendSubfieldSelection,
} from '../../resolvers/utils/topic-legend';
interface InterestTag {
id: string;
@@ -59,6 +67,8 @@ export class PersonInterestingComponent implements OnInit {
readonly topics = input<TopicCount[] | null>(null);
readonly legendExpanded = signal(false);
readonly activeLegendFieldIds = signal<ReadonlySet<string>>(new Set());
readonly activeLegendSubfieldIds = signal<ReadonlySet<string>>(new Set());
readonly tagClick = output<{ id: string; name: string }>();
@@ -144,6 +154,45 @@ export class PersonInterestingComponent implements OnInit {
});
}
onLegendFieldToggle(group: TopicLegendGroup): void {
const selection = toggleTopicLegendFieldSelection(
this.activeLegendFieldIds(),
this.activeLegendSubfieldIds(),
group,
);
this.activeLegendFieldIds.set(selection.fieldIds);
this.activeLegendSubfieldIds.set(selection.subfieldIds);
}
onLegendSubfieldToggle(selection: TopicLegendSubfieldSelection): void {
const nextSelection = toggleTopicLegendSubfieldSelection(
this.activeLegendFieldIds(),
this.activeLegendSubfieldIds(),
selection,
);
this.activeLegendFieldIds.set(nextSelection.fieldIds);
this.activeLegendSubfieldIds.set(nextSelection.subfieldIds);
}
isTagActive(tag: InterestTag): boolean {
const fieldLegendId = getTopicLegendFieldId({
field_id: tag.fieldId,
field_name: tag.fieldName,
});
const subfieldLegendId = getTopicLegendSubfieldId({
subfield_id: tag.subfieldId,
subfield_name: tag.subfieldName,
});
return (
this.activeLegendFieldIds().has(fieldLegendId) ||
(subfieldLegendId.length > 0 &&
this.activeLegendSubfieldIds().has(subfieldLegendId))
);
}
private parseBooleanQueryParam(
value: string | null,
fallback: boolean,
@@ -32,16 +32,74 @@
<div class="active-filters-row">
<span class="active-filters-label">Aktive Filter:</span>
<div class="chips-container">
@for (filter of activeFilters; track filter.value) {
<span [skText]="loading" class="filter-chip">
{{ filter.label }}
<button
class="remove-chip-btn"
(click)="removeFilter(filter)"
aria-label="Filter entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
@for (
filter of activeFilters;
track filter.category + filter.value
) {
@if (filter.category === 'topic') {
<span [skText]="loading" class="active-topic-filter">
<span
class="filter-topic-chip"
[style.--topic-color]="getFilterTopicColor(filter.value)">
<mat-icon class="filter-topic-chip__icon">label</mat-icon>
<span class="filter-topic-chip__label">{{
filter.value
}}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="removeFilter(filter)"
[attr.aria-label]="
'Themenfilter ' + filter.value + ' entfernen'
">
<mat-icon>close</mat-icon>
</button>
</span>
} @else if (filter.category === 'institutionName') {
<span [skText]="loading" class="active-institution-filter">
<span class="filter-institution-chip">
<mat-icon class="filter-institution-chip__icon"
>apartment</mat-icon
>
<span class="filter-institution-chip__name">{{
institutionFilterLabel(filter)
}}</span>
@if (filter.countryCode) {
<img
alt=""
class="filter-institution-chip__flag"
[src]="
'https://flagcdn.io/' +
filter.countryCode.toLowerCase() +
'.svg'
"
height="10" />
<span class="filter-institution-chip__country">{{
filter.countryCode.toUpperCase()
}}</span>
}
</span>
<button
type="button"
class="remove-chip-btn"
(click)="removeFilter(filter)"
aria-label="Institutionsfilter entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
} @else {
<span [skText]="loading" class="filter-chip">
{{ filter.label }}
<button
type="button"
class="remove-chip-btn"
(click)="removeFilter(filter)"
aria-label="Filter entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
}
}
<button
class="clear-all-btn"
@@ -96,6 +154,7 @@
[person]="person"
[isBookmarked]="isBookmarked(person)"
[selectedTopics]="selectedTopics()"
[activeInstitutionName]="appliedInstitutionName"
(bookmarkToggle)="toggleBookmark($event)"
(topicClick)="onCardTopicClick($event)"
(institutionClick)="onCardInstitutionClick($event)">
@@ -165,7 +224,7 @@
<!-- Section 2: Institution Filter -->
<div class="filter-section">
<h3 class="filter-section-title">Institution</h3>
<div class="topic-search-wrapper">
<div class="topic-search-wrapper" [class.is-loading]="loading">
<mat-icon>apartment</mat-icon>
<input
type="text"
@@ -41,7 +41,8 @@
align-items: center;
}
.filter-chip {
.filter-chip,
.active-topic-filter {
display: inline-flex;
align-items: center;
}
@@ -133,8 +134,92 @@
color: var(--sg-text);
}
// Shared button resets
.active-topic-filter {
gap: 4px;
max-width: 100%;
}
.filter-topic-chip {
display: inline-flex;
align-items: center;
gap: 4px;
max-width: min(320px, 46vw);
padding: 3px 8px;
border-radius: 7px;
background: color-mix(in srgb, var(--topic-color) 22%, #ffffff);
color: color-mix(in srgb, var(--topic-color) 45%, #07163d);
font-size: 11px;
font-weight: 700;
box-shadow: inset 0 0 0 1px
color-mix(in srgb, var(--topic-color) 45%, transparent);
}
.filter-topic-chip__icon {
flex: 0 0 auto;
width: 14px;
height: 14px;
font-size: 14px;
}
.filter-topic-chip__label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}
.active-institution-filter {
display: inline-flex;
align-items: center;
gap: 4px;
max-width: 100%;
}
.filter-institution-chip {
display: inline-flex;
align-items: center;
max-width: min(280px, 46vw);
padding: 2px 6px;
border: 1px solid var(--sg-primary-border, var(--sg-border));
border-radius: 4px;
background: var(--sg-primary-soft);
color: var(--sg-primary);
font-size: 11px;
font-weight: 600;
}
.filter-institution-chip__icon {
flex-shrink: 0;
width: 12px;
height: 12px;
margin-right: 4px;
font-size: 12px;
}
.filter-institution-chip__name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}
.filter-institution-chip__flag {
flex-shrink: 0;
margin-left: 6px;
border: 1px solid var(--sg-primary-border, var(--sg-border));
vertical-align: middle;
}
.filter-institution-chip__country {
flex-shrink: 0;
margin-left: 2px;
font-size: 9px;
white-space: nowrap;
}
.filter-chip button,
.active-topic-filter button,
.active-institution-filter button,
.clear-topic-search,
.clear-all-btn {
border: none;
@@ -143,6 +228,8 @@
}
.filter-chip button,
.active-topic-filter button,
.active-institution-filter button,
.clear-topic-search {
padding: 0;
display: flex;
@@ -153,7 +240,9 @@
}
}
.filter-chip button mat-icon {
.filter-chip button mat-icon,
.active-topic-filter button mat-icon,
.active-institution-filter button mat-icon {
font-size: 12px;
width: 12px;
height: 12px;
@@ -284,7 +373,13 @@ mat-paginator {
padding: 4px 8px;
transition:
border-color 0.15s,
box-shadow 0.15s;
box-shadow 0.15s,
opacity 0.15s;
&.is-loading {
opacity: 0.55;
pointer-events: none;
}
&:focus-within {
border-color: var(--sg-primary);
@@ -13,10 +13,18 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatRadioModule } from '@angular/material/radio';
import { ResolverStateService } from '../../shared/services/resolver-state.service';
import { CustomAuthor, PersonsService, InstitutionsService } from '../../api';
import {
CustomAuthor,
DehydratedInstitution,
PersonsService,
InstitutionsService,
WorkTopic,
} from '../../api';
import { TopicsService } from '../../api/api/topics.service';
import { TopicHierarchyComponent } from '../topic-hierarchy/topic-hierarchy.component';
import { PersonCardComponent } from '../person-card/person-card.component';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
import { SharedStateService } from '../../shared/services/shared-state.service';
import { PaginationService } from '../../shared/services/pagination.service';
import {
@@ -49,6 +57,7 @@ import { SkTextDirective } from '../../custom-directives/sk-text.directive';
MatRadioModule,
TopicHierarchyComponent,
PersonCardComponent,
TopicChipComponent,
SkTextDirective,
MatAutocompleteModule,
],
@@ -281,13 +290,18 @@ export class PersonListComponent {
this.applySidebarFilters();
}
// Active filters tags row
get activeFilters(): Array<{
category: string;
value: string;
label: string;
countryCode?: string | null;
}> {
const list: Array<{ category: string; value: string; label: string }> = [];
const list: Array<{
category: string;
value: string;
label: string;
countryCode?: string | null;
}> = [];
this.selectedTopics().forEach((t) => {
list.push({ category: 'topic', value: t, label: `Thema: ${t}` });
});
@@ -301,11 +315,43 @@ export class PersonListComponent {
category: 'institutionName',
value: this.appliedInstitutionName,
label: label,
countryCode: this.findInstitutionCountryCode(
this.appliedInstitutionName,
),
});
}
return list;
}
institutionFilterLabel(filter: { label: string }): string {
return filter.label.replace(/^Institution:\s*/, '');
}
private findInstitutionCountryCode(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?.country_code &&
(inst.display_name ?? '').trim().toLowerCase() === normalized
) {
return inst.country_code;
}
}
}
return null;
}
removeFilter(filter: { category: string; value: string }): void {
if (filter.category === 'topic') {
this.selectedTopics.update((set) => {
@@ -324,6 +370,35 @@ export class PersonListComponent {
this.applySidebarFilters();
}
getFilterTopicColor(topicName: string): string {
const topic = this.findPersonTopic(topicName);
return topicHierarchyColor({
id: topic?.id,
name: topicName,
field_id: topic?.field?.id,
field_name: topic?.field?.display_name,
domain_id: topic?.domain?.id,
domain_name: topic?.domain?.display_name,
});
}
getFilterTopicDescription(topicName: string): string | null | undefined {
return this.findPersonTopic(topicName)?.description;
}
getFilterTopicSubfieldName(topicName: string): string | null | undefined {
return this.findPersonTopic(topicName)?.subfield?.display_name;
}
getFilterTopicFieldName(topicName: string): string | null | undefined {
return this.findPersonTopic(topicName)?.field?.display_name;
}
getFilterTopicDomainName(topicName: string): string | null | undefined {
return this.findPersonTopic(topicName)?.domain?.display_name;
}
clearAllFilters(): void {
this.selectedTopics.set(new Set<string>());
this.institutionControl.setValue('', { emitEvent: false });
@@ -456,6 +531,24 @@ export class PersonListComponent {
});
}
private findPersonTopic(topicName: string): WorkTopic | undefined {
const normalizedTopicName = topicName.trim().toLowerCase();
for (const person of this.persons) {
const topic = person.topics?.find(
(item) =>
(item.display_name ?? '').trim().toLowerCase() ===
normalizedTopicName,
);
if (topic) {
return topic;
}
}
return undefined;
}
private searchInstitutions(query: string) {
return this.institutionsService
.autocompleteInstitutions(query, undefined, undefined, 10)
@@ -7,15 +7,6 @@
<span>(basierend auf Publikationen)</span>
</p>
<app-topic-legend
[groups]="topicLegendGroups"
[visible]="subfieldLegendVisible"
[expanded]="subfieldLegendExpanded"
[collapsedGroupLimit]="3"
(visibleChange)="onSubfieldLegendVisibleChange($event)"
(expandedChange)="onSubfieldLegendExpandedChange($event)">
</app-topic-legend>
<span
*ngIf="
earlierYearsLoadFailed &&
@@ -27,6 +18,21 @@
</span>
</div>
<app-topic-legend
class="timeline-legend"
[groups]="topicLegendGroups"
[visible]="subfieldLegendVisible"
[expanded]="subfieldLegendExpanded"
[collapsedGroupLimit]="3"
[selectable]="true"
[activeFieldIds]="activeLegendFieldIds"
[activeSubfieldIds]="activeLegendSubfieldIds"
(fieldToggle)="onLegendFieldToggle($event)"
(subfieldToggle)="onLegendSubfieldToggle($event)"
(visibleChange)="onSubfieldLegendVisibleChange($event)"
(expandedChange)="onSubfieldLegendExpandedChange($event)">
</app-topic-legend>
<div class="view-toggle" aria-label="Ansicht wechseln">
<button
type="button"
@@ -57,6 +63,10 @@
<div class="year-filter-top">
<span class="year-filter-label">Zeitraum</span>
<span class="year-filter-values">
{{ selectedStartYear }} bis {{ selectedEndYear }}
</span>
<button
type="button"
class="reset-range-button"
@@ -66,12 +76,6 @@
</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"
@@ -254,6 +258,7 @@
[countTooltip]="getYearTopicCountTooltip(topic, item)"
[color]="getTopicColor(topic)"
[disabled]="!topic.id"
[active]="isTopicActiveByLegend(topic)"
(chipClick)="selectTopic(topic, [item.year])">
</app-topic-chip>
</ng-container>
@@ -354,6 +359,7 @@
[countTooltip]="getPhaseTopicCountTooltip(topic, phase)"
[color]="getTopicColor(topic)"
[disabled]="!topic.id"
[active]="isTopicActiveByLegend(topic)"
(chipClick)="selectTopic(topic, getPhaseYears(phase))">
</app-topic-chip>
</ng-container>
@@ -431,6 +437,7 @@
[countTooltip]="getYearTopicCountTooltip(topic, year)"
[color]="getTopicColor(topic)"
[disabled]="!topic.id"
[active]="isTopicActiveByLegend(topic)"
(chipClick)="selectTopic(topic, [year.year])">
</app-topic-chip>
</ng-container>
@@ -34,14 +34,18 @@
}
.timeline-header {
--year-filter-width: 285px;
--header-gap: 24px;
display: grid;
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
align-items: flex-start;
gap: 24px;
gap: 10px var(--header-gap);
margin-bottom: 28px;
}
.timeline-title {
grid-column: 1;
grid-row: 1;
min-width: 0;
h2 {
@@ -64,7 +68,20 @@
}
}
.timeline-legend {
grid-column: 1 / -1;
grid-row: 2;
min-width: 0;
::ng-deep .topic-legend {
width: 100%;
margin-top: 0;
}
}
.view-toggle {
grid-column: 2;
grid-row: 1;
justify-self: center;
display: flex;
gap: 4px;
@@ -94,9 +111,11 @@
}
.year-filter {
grid-column: 3;
grid-row: 1;
justify-self: end;
width: min(285px, 100%);
padding: 8px 10px;
width: min(var(--year-filter-width), 100%);
padding: 5px 10px;
border: 1px solid #dbe5f6;
border-radius: 10px;
background: #fbfdff;
@@ -137,17 +156,16 @@
}
.year-filter-values {
justify-content: center;
gap: 7px;
margin-bottom: 5px;
gap: 5px;
color: #40506f;
font-size: 12px;
font-weight: 600;
white-space: nowrap;
}
.year-filter-bounds {
justify-content: space-between;
margin-top: 1px;
margin-top: 0;
color: #7c88a3;
font-size: 10px;
}
@@ -157,7 +175,7 @@
--range-end: 100%;
position: relative;
height: 22px;
height: 16px;
}
.range-track {
@@ -586,6 +604,18 @@ app-topic-chip.timeline-topic-chip {
grid-template-columns: 1fr;
}
.timeline-title,
.timeline-legend,
.view-toggle,
.year-filter {
grid-column: auto;
grid-row: auto;
}
.timeline-legend {
margin-right: 0;
}
.view-toggle {
justify-self: start;
}
@@ -14,9 +14,18 @@ import {
} from '@angular/core';
import { TopicChipComponent } from '../../../../shared/ui/topic-chip/topic-chip.component';
import { TopicLegendComponent } from '../../../../shared/ui/topic-legend/topic-legend.component';
import { buildTopicLegendGroups, TopicLegendGroup, TopicLegendTopic } from '../../../../resolvers/utils/topic-legend';
import { buildTopicHierarchyTooltip } from '../../../../resolvers/utils/topic-tooltip';
import { topicHierarchyColor } from '../../../../resolvers/utils/topic-colors';
import {
buildTopicLegendGroups,
getTopicLegendFieldId,
getTopicLegendSubfieldId,
TopicLegendGroup,
TopicLegendSubfieldSelection,
TopicLegendTopic,
toggleTopicLegendFieldSelection,
toggleTopicLegendSubfieldSelection,
} from '../../../../resolvers/utils/topic-legend';
import { buildTopicHierarchyTooltip } from '../../../../resolvers/utils/topic-tooltip';
export interface TopicTimelineTopic {
id?: string;
@@ -128,6 +137,8 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
private readonly displayedPhaseTopicLimit = 4;
private readonly scrollRestoreThreshold = 24;
private readonly expandedPhaseIds = new Set<string>();
activeLegendFieldIds: ReadonlySet<string> = new Set();
activeLegendSubfieldIds: ReadonlySet<string> = new Set();
private pendingTimelineScrollAnchor: TimelineScrollAnchor | undefined;
@@ -421,6 +432,39 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
this.subfieldLegendVisibleChange.emit(this.subfieldLegendVisible);
}
onLegendFieldToggle(group: TopicLegendGroup): void {
const selection = toggleTopicLegendFieldSelection(
this.activeLegendFieldIds,
this.activeLegendSubfieldIds,
group,
);
this.activeLegendFieldIds = selection.fieldIds;
this.activeLegendSubfieldIds = selection.subfieldIds;
}
onLegendSubfieldToggle(selection: TopicLegendSubfieldSelection): void {
const nextSelection = toggleTopicLegendSubfieldSelection(
this.activeLegendFieldIds,
this.activeLegendSubfieldIds,
selection,
);
this.activeLegendFieldIds = nextSelection.fieldIds;
this.activeLegendSubfieldIds = nextSelection.subfieldIds;
}
isTopicActiveByLegend(topic: TopicTimelineTopic): boolean {
const fieldLegendId = getTopicLegendFieldId(topic);
const subfieldLegendId = getTopicLegendSubfieldId(topic);
return (
this.activeLegendFieldIds.has(fieldLegendId) ||
(subfieldLegendId.length > 0 &&
this.activeLegendSubfieldIds.has(subfieldLegendId))
);
}
trackByYear(_: number, item: TopicTimelineElement): number {
return item.year;
}
@@ -556,7 +600,6 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
return `im Zeitraum ${this.getPhaseYearLabel(phase)}`;
}
private get earlierYearsColumnCount(): number {
return this.showEarlierYearsControl ? 1 : 0;
}
@@ -1,126 +1,163 @@
@if (loading) {
<p class="message">Lade Patente...</p>
} @else if (error) {
<p class="message">Fehler beim Laden der Patente.</p>
} @else if (patents.length === 0) {
<p class="message">Keine Patente gefunden.</p>
} @else {
<div class="patents-container">
<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>
<label class="sort-control">
<span>Sortieren nach:</span>
<select [value]="sortMode" (change)="setSortMode($any($event.target).value)">
<option value="date">Datum</option>
<option value="title">Titel</option>
</select>
</label>
</div>
<table>
<thead>
<tr>
<th>Patent</th>
<th>Quelle</th>
<th>Jahr</th>
</tr>
</thead>
<tbody>
@for (patent of getPagedPatents(); track trackPatent($index, patent)) {
<tr
[class.selected]="selectedPatent === patent"
(click)="selectPatent(patent)">
<td class="patent-title">{{ patent.title ?? patent.patent_id }}</td>
<td>
<span class="source-badge source-badge--{{ patent.source.toLowerCase() }}">
{{ patent.source }}
</span>
</td>
<td>{{ 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 {{ getPageCount() }}</span>
<button [disabled]="selectedPage === getPageCount()" (click)="setPage(selectedPage + 1)">Weiter</button>
</div>
}
</div>
@if (selectedPatent) {
<div class="patent-detail">
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
<div class="detail-stats">
<div class="stat">
<span class="stat-label">Quelle</span>
<span class="stat-value">
<span class="source-badge source-badge--{{ selectedPatent.source.toLowerCase() }}">
{{ selectedPatent.source }}
</span>
</span>
</div>
<div class="stat">
<span class="stat-label">Patent-Nr.</span>
<span class="stat-value">{{ selectedPatent.patent_id }}</span>
</div>
<div class="stat">
<span class="stat-label">Datum</span>
<span class="stat-value">{{ formatDate(selectedPatent.publication_date) }}</span>
</div>
@if (getPublicationStageLabel(selectedPatent); as stageLabel) {
<div class="stat">
<span class="stat-label">Publikationsstufe</span>
<span class="stat-value">{{ stageLabel }}</span>
</div>
}
</div>
@if (getAbstractPreview(selectedPatent.abstract); as abstractPreview) {
<p class="patent-detail-preview">{{ abstractPreview }}</p>
}
<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>
<p class="patent-detail-hint">
Abstract, Erfinder, Anmelder und IPC/CPC-Klassifikation
</p>
</div>
} @else {
<div class="patent-detail overview">
<p class="overview-title">Patentübersicht</p>
<p class="overview-subtitle">Alle Patente dieser Person im Überblick.</p>
<div class="overview-stats">
<div class="overview-stat">
<span class="overview-value">{{ patents.length }}</span>
<span class="overview-label">Patente</span>
</div>
<div class="overview-stat">
<span class="overview-value">{{ getEpoCount() }}</span>
<span class="overview-label">EPO</span>
</div>
<div class="overview-stat">
<span class="overview-value">{{ getUsptoCount() }}</span>
<span class="overview-label">USPTO</span>
</div>
</div>
<p class="overview-hint">Wähle links ein Patent aus, um Kurzinfos und Details zu sehen.</p>
</div>
}
</div>
</div>
}
@if (loading) {
<p class="message">Lade Patente...</p>
} @else if (error) {
<p class="message">Fehler beim Laden der Patente.</p>
} @else if (patents.length === 0) {
<p class="message">Keine Patente gefunden.</p>
} @else {
<div class="patents-container">
<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>
<label class="sort-control">
<span>Sortieren nach:</span>
<select
[value]="sortMode"
(change)="setSortMode($any($event.target).value)">
<option value="date">Datum</option>
<option value="title">Titel</option>
</select>
</label>
</div>
<table>
<thead>
<tr>
<th>Patent</th>
<th>Quelle</th>
<th>Jahr</th>
</tr>
</thead>
<tbody>
@for (
patent of getPagedPatents();
track trackPatent($index, patent)
) {
<tr
[class.selected]="selectedPatent === patent"
(click)="selectPatent(patent)">
<td class="patent-title">
{{ patent.title ?? patent.patent_id }}
</td>
<td>
<span
class="source-badge source-badge--{{
patent.source.toLowerCase()
}}">
{{ patent.source }}
</span>
</td>
<td>{{ 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 {{ getPageCount() }}</span>
<button
[disabled]="selectedPage === getPageCount()"
(click)="setPage(selectedPage + 1)">
Weiter
</button>
</div>
}
</div>
@if (selectedPatent) {
<div class="patent-detail">
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
<div class="detail-stats">
<div class="stat">
<span class="stat-label">Quelle</span>
<span class="stat-value">
<span
class="source-badge source-badge--{{
selectedPatent.source.toLowerCase()
}}">
{{ selectedPatent.source }}
</span>
</span>
</div>
<div class="stat">
<span class="stat-label">Patent-Nr.</span>
<span class="stat-value">{{ selectedPatent.patent_id }}</span>
</div>
<div class="stat">
<span class="stat-label">Datum</span>
<span class="stat-value">{{
formatDate(selectedPatent.publication_date)
}}</span>
</div>
@if (getPublicationStageLabel(selectedPatent); as stageLabel) {
<div class="stat">
<span class="stat-label">Publikationsstufe</span>
<span class="stat-value">{{ stageLabel }}</span>
</div>
}
</div>
@if (
getAbstractPreview(selectedPatent.abstract);
as abstractPreview
) {
<p class="patent-detail-preview">{{ abstractPreview }}</p>
}
<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>
<p class="patent-detail-hint">
Abstract, Erfinder, Anmelder und IPC/CPC-Klassifikation
</p>
</div>
} @else {
<div class="patent-detail overview">
<p class="overview-title">Patentübersicht</p>
<p class="overview-subtitle">
Alle Patente dieser Person im Überblick.
</p>
<div class="overview-stats">
<div class="overview-stat">
<span class="overview-value">{{ patents.length }}</span>
<span class="overview-label">Patente</span>
</div>
<div class="overview-stat">
<span class="overview-value">{{ getEpoCount() }}</span>
<span class="overview-label">EPO</span>
</div>
<div class="overview-stat">
<span class="overview-value">{{ getUsptoCount() }}</span>
<span class="overview-label">USPTO</span>
</div>
</div>
<p class="overview-hint">
Wähle links ein Patent aus, um Kurzinfos und Details zu sehen.
</p>
</div>
}
</div>
</div>
}
File diff suppressed because it is too large Load Diff
@@ -1,434 +1,434 @@
import { Component, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
import { PatentsService } from '../../api/api/patents.service';
import { PatentEntry } from '../../api/model/patentEntry';
import { IpcClassification } from '../../api';
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',
imports: [CommonModule],
templateUrl: './person-patents.component.html',
styleUrl: './person-patents.component.scss',
})
export class PersonPatentsComponent implements OnInit {
private route = inject(ActivatedRoute);
private router = inject(Router);
private patentsApi = inject(PatentsService);
patents: PatentEntry[] = [];
filteredPatents: PatentEntry[] = [];
authorName: string | null = null;
selectedPatent: PatentEntry | null = null;
showDetail = false;
loading = true;
error = false;
activeFilter: SourceFilter = 'all';
sortMode: SortMode = 'date';
selectedPage = 1;
readonly pageSize = 10;
private expandedClassificationKeys = new Set<string>();
ngOnInit(): void {
this.route.parent?.paramMap.subscribe((params) => {
const authorId = params.get('id') ?? '';
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 (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;
},
});
}
});
}
setFilter(filter: SourceFilter): void {
this.activeFilter = filter;
this.selectedPage = 1;
this.selectedPatent = null;
this.showDetail = false;
this.applyFilter();
this.updateQueryParams();
}
setSortMode(sortMode: SortMode): void {
this.sortMode = sortMode;
this.applyFilter();
this.updateQueryParams();
}
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();
}
private applyFilter(): void {
let patents = this.patents;
if (this.activeFilter !== 'all') {
patents = patents.filter((p) => p.source === this.activeFilter);
}
this.filteredPatents = this.sortPatents(patents);
}
private sortPatents(patents: PatentEntry[]): PatentEntry[] {
return [...patents].sort((a, b) => {
if (this.sortMode === 'date') {
return (b.publication_date ?? '').localeCompare(
a.publication_date ?? '',
);
}
return (a.title ?? '').localeCompare(b.title ?? '', 'de', {
sensitivity: 'base',
});
});
}
private updateQueryParams(): void {
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
filter: this.activeFilter,
sortBy: this.sortMode,
},
queryParamsHandling: 'merge',
replaceUrl: true,
});
}
private isValidFilter(value: string | null): value is SourceFilter {
return value === 'all' || value === 'EPO' || value === 'USPTO';
}
private isValidSortMode(value: string | null): value is SortMode {
return value === 'date' || value === 'title';
}
getPagedPatents(): PatentEntry[] {
const start = (this.selectedPage - 1) * this.pageSize;
return this.filteredPatents.slice(start, start + this.pageSize);
}
getPageCount(): number {
return Math.max(1, Math.ceil(this.filteredPatents.length / this.pageSize));
}
hasPagination(): boolean {
return this.getPageCount() > 1;
}
setPage(page: number): void {
this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount());
this.updateQueryParams();
}
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));
}
getEpoCount(): number {
return this.patents.filter((p) => p.source === 'EPO').length;
}
getUsptoCount(): number {
return this.patents.filter((p) => p.source === 'USPTO').length;
}
trackPatent(_index: number, patent: PatentEntry): string {
return [
patent.source,
patent.patent_id,
patent.publication_date ?? '',
patent.kind ?? patent.application_type ?? '',
].join('|');
}
getAbstractPreview(abstract: string | null | undefined): string | null {
if (!abstract?.trim()) {
return null;
}
const text = abstract.trim();
if (text.length <= 160) {
return text;
}
return `${text.slice(0, 160).trimEnd()}…`;
}
getPublicationStageLabel(patent: PatentEntry): string | null {
if (patent.kind) {
return patent.kind;
}
if (patent.application_type) {
return patent.application_type;
}
return null;
}
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();
}
}
import { Component, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
import { PatentsService } from '../../api/api/patents.service';
import { PatentEntry } from '../../api/model/patentEntry';
import { IpcClassification } from '../../api';
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',
imports: [CommonModule],
templateUrl: './person-patents.component.html',
styleUrl: './person-patents.component.scss',
})
export class PersonPatentsComponent implements OnInit {
private route = inject(ActivatedRoute);
private router = inject(Router);
private patentsApi = inject(PatentsService);
patents: PatentEntry[] = [];
filteredPatents: PatentEntry[] = [];
authorName: string | null = null;
selectedPatent: PatentEntry | null = null;
showDetail = false;
loading = true;
error = false;
activeFilter: SourceFilter = 'all';
sortMode: SortMode = 'date';
selectedPage = 1;
readonly pageSize = 10;
private expandedClassificationKeys = new Set<string>();
ngOnInit(): void {
this.route.parent?.paramMap.subscribe((params) => {
const authorId = params.get('id') ?? '';
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 (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;
},
});
}
});
}
setFilter(filter: SourceFilter): void {
this.activeFilter = filter;
this.selectedPage = 1;
this.selectedPatent = null;
this.showDetail = false;
this.applyFilter();
this.updateQueryParams();
}
setSortMode(sortMode: SortMode): void {
this.sortMode = sortMode;
this.applyFilter();
this.updateQueryParams();
}
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();
}
private applyFilter(): void {
let patents = this.patents;
if (this.activeFilter !== 'all') {
patents = patents.filter((p) => p.source === this.activeFilter);
}
this.filteredPatents = this.sortPatents(patents);
}
private sortPatents(patents: PatentEntry[]): PatentEntry[] {
return [...patents].sort((a, b) => {
if (this.sortMode === 'date') {
return (b.publication_date ?? '').localeCompare(
a.publication_date ?? '',
);
}
return (a.title ?? '').localeCompare(b.title ?? '', 'de', {
sensitivity: 'base',
});
});
}
private updateQueryParams(): void {
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
filter: this.activeFilter,
sortBy: this.sortMode,
},
queryParamsHandling: 'merge',
replaceUrl: true,
});
}
private isValidFilter(value: string | null): value is SourceFilter {
return value === 'all' || value === 'EPO' || value === 'USPTO';
}
private isValidSortMode(value: string | null): value is SortMode {
return value === 'date' || value === 'title';
}
getPagedPatents(): PatentEntry[] {
const start = (this.selectedPage - 1) * this.pageSize;
return this.filteredPatents.slice(start, start + this.pageSize);
}
getPageCount(): number {
return Math.max(1, Math.ceil(this.filteredPatents.length / this.pageSize));
}
hasPagination(): boolean {
return this.getPageCount() > 1;
}
setPage(page: number): void {
this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount());
this.updateQueryParams();
}
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));
}
getEpoCount(): number {
return this.patents.filter((p) => p.source === 'EPO').length;
}
getUsptoCount(): number {
return this.patents.filter((p) => p.source === 'USPTO').length;
}
trackPatent(_index: number, patent: PatentEntry): string {
return [
patent.source,
patent.patent_id,
patent.publication_date ?? '',
patent.kind ?? patent.application_type ?? '',
].join('|');
}
getAbstractPreview(abstract: string | null | undefined): string | null {
if (!abstract?.trim()) {
return null;
}
const text = abstract.trim();
if (text.length <= 160) {
return text;
}
return `${text.slice(0, 160).trimEnd()}…`;
}
getPublicationStageLabel(patent: PatentEntry): string | null {
if (patent.kind) {
return patent.kind;
}
if (patent.application_type) {
return patent.application_type;
}
return null;
}
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();
}
}
@@ -6,44 +6,98 @@
<div class="publication-filter-stack">
<form class="publication-filters" [formGroup]="filterForm">
<mat-form-field>
<mat-icon matPrefix class="filter-prefix-icon">calendar_today</mat-icon>
<mat-select
placeholder="Jahr"
formControlName="publicationYears"
multiple
(selectionChange)="applyFilters()">
@for (year of publicationYearOptions; track year) {
[panelWidth]="null"
(selectionChange)="applyFilters()"
(opened)="focusSelectSearch(yearSearchInput)"
(closed)="yearSearchControl.setValue('')">
<mat-select-trigger>{{ yearSelectionSummary() }}</mat-select-trigger>
<div class="select-search" (click)="$event.stopPropagation()">
<mat-icon class="select-search__icon">search</mat-icon>
<input
#yearSearchInput
type="text"
class="select-search__input"
[formControl]="yearSearchControl"
placeholder="Jahr suchen…"
(keydown)="$event.stopPropagation()" />
</div>
@for (year of filteredYearOptions(); track year) {
<mat-option [value]="year">{{ year }}</mat-option>
} @empty {
<div class="select-search__empty">Keine Treffer</div>
}
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-icon matPrefix class="filter-prefix-icon">category</mat-icon>
<mat-select
placeholder="Typ"
formControlName="types"
multiple
(selectionChange)="applyFilters()">
@for (type of typeOptions; track type.value) {
[panelWidth]="null"
(selectionChange)="applyFilters()"
(opened)="focusSelectSearch(typeSearchInput)"
(closed)="typeSearchControl.setValue('')">
<mat-select-trigger>{{ typeSelectionSummary() }}</mat-select-trigger>
<div class="select-search" (click)="$event.stopPropagation()">
<mat-icon class="select-search__icon">search</mat-icon>
<input
#typeSearchInput
type="text"
class="select-search__input"
[formControl]="typeSearchControl"
placeholder="Typ suchen…"
(keydown)="$event.stopPropagation()" />
</div>
@for (type of filteredTypeOptions(); track type.value) {
<mat-option [value]="type.value">{{ type.label }}</mat-option>
} @empty {
<div class="select-search__empty">Keine Treffer</div>
}
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-icon matPrefix class="filter-prefix-icon">translate</mat-icon>
<mat-select
placeholder="Sprache"
formControlName="languages"
multiple
(selectionChange)="applyFilters()">
@for (language of languageOptions; track language.value) {
[panelWidth]="null"
(selectionChange)="applyFilters()"
(opened)="focusSelectSearch(languageSearchInput)"
(closed)="languageSearchControl.setValue('')">
<mat-select-trigger>{{
languageSelectionSummary()
}}</mat-select-trigger>
<div class="select-search" (click)="$event.stopPropagation()">
<mat-icon class="select-search__icon">search</mat-icon>
<input
#languageSearchInput
type="text"
class="select-search__input"
[formControl]="languageSearchControl"
placeholder="Sprache suchen…"
(keydown)="$event.stopPropagation()" />
</div>
@for (language of filteredLanguageOptions(); track language.value) {
<mat-option [value]="language.value">{{
language.label
}}</mat-option>
} @empty {
<div class="select-search__empty">Keine Treffer</div>
}
</mat-select>
</mat-form-field>
<mat-form-field class="institution-filter">
<mat-icon matPrefix class="filter-prefix-icon">apartment</mat-icon>
<input
type="text"
matInput
@@ -73,12 +127,13 @@
</mat-form-field>
<mat-form-field class="topic-filter">
<mat-icon matPrefix class="filter-prefix-icon">label</mat-icon>
<input
type="text"
matInput
[formControl]="topicSearchControl"
[matAutocomplete]="topicAutocomplete"
placeholder="Topic suchen" />
placeholder="Thema suchen" />
<mat-autocomplete
#topicAutocomplete="matAutocomplete"
[displayWith]="displayTopic"
@@ -96,7 +151,7 @@
topicOptions.length === 0 &&
topicSearchControl.value
) {
<mat-option disabled>Kein Topic gefunden</mat-option>
<mat-option disabled>Kein Thema gefunden</mat-option>
}
</mat-autocomplete>
</mat-form-field>
@@ -112,42 +167,141 @@
</button>
</form>
@if (selectedInstitutions.length || selectedTopics.length) {
<div class="selected-filter-chips" aria-label="Ausgewählte Filter">
@for (institution of selectedInstitutions; track institution.id) {
<span class="selected-filter-chip">
{{ institution.display_name }}
<button
type="button"
(click)="removeInstitution(institution)"
aria-label="Institution entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (topic of selectedTopics; track topic.id) {
<span class="selected-filter-chip">
{{ topic.display_name }}
<button
type="button"
(click)="removeTopic(topic)"
aria-label="Topic entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
}
@let selectedYears = filterForm.controls.publicationYears.value;
@let selectedTypes = filterForm.controls.types.value;
@let selectedLanguages = filterForm.controls.languages.value;
@if (
selectedInstitutions.length ||
selectedTopics.length ||
selectedYears.length ||
selectedTypes.length ||
selectedLanguages.length
) {
<div class="active-filters-row" aria-label="Aktive Filter">
<span class="active-filters-label">Aktive Filter:</span>
<div class="chips-container">
@for (year of selectedYears; track year) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon"
>calendar_today</mat-icon
>
<span class="filter-meta-chip__label">{{ year }}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleYearFilter(year)"
[attr.aria-label]="'Jahresfilter ' + year + ' entfernen'">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (type of selectedTypes; track type) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon">category</mat-icon>
<span class="filter-meta-chip__label">{{ type }}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleTypeFilter(type)"
[attr.aria-label]="'Typfilter ' + type + ' entfernen'">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (language of selectedLanguages; track language) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon">translate</mat-icon>
<span class="filter-meta-chip__label">{{
languageLabel(language)
}}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleLanguageFilter(language)"
[attr.aria-label]="
'Sprachfilter ' + languageLabel(language) + ' entfernen'
">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (topic of selectedTopics; track topic.id) {
<span class="active-meta-filter">
<span
class="filter-topic-chip"
[style.--topic-color]="getSelectedTopicColor(topic)">
<mat-icon class="filter-topic-chip__icon">label</mat-icon>
<span class="filter-topic-chip__label">{{
topic.display_name
}}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="removeTopic(topic)"
[attr.aria-label]="
'Themenfilter ' + topic.display_name + ' entfernen'
">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (institution of selectedInstitutions; track institution.id) {
@let instCountry = selectedInstitutionCountry(institution);
<span class="active-institution-filter">
<span class="filter-institution-chip">
<mat-icon class="institution-icon">apartment</mat-icon>
<span class="institution-name">{{
institution.display_name
}}</span>
@if (instCountry) {
<img
alt=""
class="flag-img"
[src]="
'https://flagcdn.io/' + instCountry.toLowerCase() + '.svg'
"
height="10" />
<span class="country-code">{{
instCountry.toUpperCase()
}}</span>
}
</span>
<button
type="button"
class="remove-chip-btn"
(click)="removeInstitution(institution)"
aria-label="Institutionsfilter entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
}
</div>
</div>
}
</div>
<div class="table-wrap">
@if (loading) {
<div class="loading">
<div class="table-status">
<mat-spinner diameter="36"></mat-spinner>
<span>Publikationen werden geladen …</span>
</div>
} @else if (publications.length === 0) {
<div class="table-status empty-state">Keine Publikationen gefunden.</div>
}
<table mat-table [dataSource]="publications" class="mat-elevation-z2">
<table
mat-table
[dataSource]="publications"
class="mat-elevation-z2"
[class.is-hidden]="loading || publications.length === 0">
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef>Titel</th>
<td mat-cell *matCellDef="let publication">
@@ -162,7 +316,19 @@
<ng-container matColumnDef="year">
<th mat-header-cell *matHeaderCellDef>Jahr</th>
<td mat-cell *matCellDef="let publication">
{{ publication.publication_year || '-' }}
@if (publication.publication_year) {
<button
type="button"
class="cell-filter-pill"
[class.active]="isYearActive(publication.publication_year)"
matTooltip="Nach Jahr filtern"
matTooltipPosition="above"
(click)="toggleYearFilter(publication.publication_year)">
{{ publication.publication_year }}
</button>
} @else {
<span class="empty-text">-</span>
}
</td>
</ng-container>
@@ -170,9 +336,17 @@
<th mat-header-cell *matHeaderCellDef>Typ</th>
<td mat-cell *matCellDef="let publication">
@if (publication.type) {
<app-chip [color]="typeColor(publication.type)">
{{ publication.type }}
</app-chip>
<button
type="button"
class="type-filter-btn"
[class.active]="isTypeActive(publication.type)"
matTooltip="Nach Typ filtern"
matTooltipPosition="above"
(click)="toggleTypeFilter(publication.type)">
<app-chip [color]="typeColor(publication.type)">
{{ publication.type }}
</app-chip>
</button>
} @else {
<span class="empty-text">-</span>
}
@@ -182,7 +356,19 @@
<ng-container matColumnDef="language">
<th mat-header-cell *matHeaderCellDef>Sprache / Quelle</th>
<td mat-cell *matCellDef="let publication">
{{ publication.language || '-' }}
@if (publication.language) {
<button
type="button"
class="cell-filter-pill"
[class.active]="isLanguageActive(publication.language)"
matTooltip="Nach Sprache filtern"
matTooltipPosition="above"
(click)="toggleLanguageFilter(publication.language)">
{{ publication.language }}
</button>
} @else {
<span class="empty-text">-</span>
}
</td>
</ng-container>
@@ -190,23 +376,55 @@
<th mat-header-cell *matHeaderCellDef>Institutionen</th>
<td mat-cell *matCellDef="let publication">
@let publicationInstitutions = institutions(publication);
@let institutionsExpanded = isInstitutionsExpanded(publication);
@let visibleInstitutions =
institutionsExpanded
? publicationInstitutions
: publicationInstitutions.slice(0, 3);
<div class="institution-tags" aria-label="Institutionen">
@for (
institution of publicationInstitutions.slice(0, 3);
track institution.id
) {
<span
@for (institution of visibleInstitutions; track institution.id) {
<button
type="button"
class="publication-institution-tag"
[title]="institution.name">
{{ institution.name }}
</span>
[class.active]="isInstitutionActive(institution.id)"
[matTooltip]="institution.name"
matTooltipPosition="above"
[attr.aria-label]="
'Nach Institution ' + institution.name + ' filtern'
"
(click)="filterByInstitution(institution)">
<mat-icon class="institution-icon">apartment</mat-icon>
<span class="institution-name">{{ institution.name }}</span>
@if (institution.country) {
<img
alt=""
class="flag-img"
[src]="
'https://flagcdn.io/' +
institution.country.toLowerCase() +
'.svg'
"
height="10" />
<span class="country-code">{{
institution.country.toUpperCase()
}}</span>
}
</button>
} @empty {
<span class="empty-text">-</span>
}
@if (publicationInstitutions.length > 3) {
<span class="publication-institution-more">
+{{ publicationInstitutions.length - 3 }}
</span>
<button
type="button"
class="publication-institution-more"
[attr.aria-expanded]="institutionsExpanded"
(click)="toggleInstitutions(publication)">
{{
institutionsExpanded
? 'weniger'
: '+' + (publicationInstitutions.length - 3)
}}
</button>
}
</div>
</td>
@@ -223,18 +441,38 @@
<th mat-header-cell *matHeaderCellDef>Themen</th>
<td mat-cell *matCellDef="let publication">
@let publicationTopics = publication.topics ?? [];
@let topicsExpanded = isTopicsExpanded(publication);
@let visibleTopics =
topicsExpanded ? publicationTopics : publicationTopics.slice(0, 3);
<div class="topic-chips" aria-label="Themen">
@for (topic of publicationTopics.slice(0, 3); track topic.id) {
<span class="publication-topic-tag" [title]="topic.display_name">
{{ topic.display_name }}
</span>
@for (topic of visibleTopics; track topic.id) {
<app-topic-chip
size="mini"
[label]="topic.display_name || ''"
[description]="topic.description"
[subfieldName]="topic.subfield?.display_name"
[fieldName]="topic.field?.display_name"
[domainName]="topic.domain?.display_name"
[color]="getTopicColor(topic)"
[disabled]="!topic.id"
[active]="isTopicActive(topic)"
(chipClick)="filterByTopic(topic)">
</app-topic-chip>
} @empty {
<span class="empty-text">-</span>
}
@if (publicationTopics.length > 3) {
<span class="publication-topic-more">
+{{ publicationTopics.length - 3 }}
</span>
<button
type="button"
class="publication-topic-more"
[attr.aria-expanded]="topicsExpanded"
(click)="toggleTopics(publication)">
{{
topicsExpanded
? 'weniger'
: '+' + (publicationTopics.length - 3)
}}
</button>
}
</div>
</td>
@@ -243,10 +481,6 @@
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
@if (!loading && publications.length === 0) {
<div class="empty-state">Keine Publikationen gefunden.</div>
}
</div>
<div class="table-footer">
@@ -43,12 +43,15 @@ h2 {
}
.publication-filters mat-form-field {
width: 150px;
width: 175px;
}
.publication-filters .institution-filter,
.publication-filters .topic-filter {
width: 320px;
flex: 1 1 200px;
width: auto;
min-width: 180px;
max-width: 320px;
}
.publication-filters .reset-filter-btn {
@@ -74,20 +77,46 @@ h2 {
::ng-deep .publication-filters .mat-mdc-text-field-wrapper {
height: 42px;
background: #fff;
background: var(--sg-surface-soft);
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
transition:
border-color 0.15s,
box-shadow 0.15s;
}
::ng-deep .publication-filters .mat-focused .mat-mdc-text-field-wrapper {
border-color: var(--sg-primary);
box-shadow: 0 0 0 2px var(--sg-primary-soft);
}
::ng-deep .publication-filters .mat-mdc-form-field-flex {
height: 100%;
align-items: center;
}
::ng-deep .publication-filters .mat-mdc-form-field-infix {
min-height: 42px;
padding-top: 11px;
padding-bottom: 9px;
min-height: 0;
padding-top: 0;
padding-bottom: 0;
}
::ng-deep .publication-filters .mdc-notched-outline__leading,
::ng-deep .publication-filters .mdc-notched-outline__notch,
::ng-deep .publication-filters .mdc-notched-outline__trailing {
border-color: #d9e2f0;
border: none;
}
.filter-prefix-icon {
width: 18px;
height: 18px;
font-size: 18px;
color: var(--sg-text-soft);
}
::ng-deep .publication-filters .mat-mdc-form-field-icon-prefix {
padding: 0 4px 0 10px;
color: var(--sg-text-soft);
}
::ng-deep .publication-filters .mat-mdc-select-value,
@@ -108,55 +137,201 @@ h2 {
transform: none;
}
::ng-deep .mat-mdc-option small {
display: block;
color: var(--sg-text-muted);
font-size: 11px;
line-height: 1.2;
}
.selected-filter-chips {
.active-filters-row {
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: flex-end;
gap: 6px;
max-width: 900px;
margin: 0;
gap: 10px;
padding: 8px 16px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: var(--sg-surface);
font-size: 13px;
}
.selected-filter-chip {
.active-filters-label {
font-weight: 600;
color: var(--sg-text-muted);
}
.chips-container {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
}
.filter-chip,
.filter-meta-chip {
display: inline-flex;
align-items: center;
max-width: 320px;
min-height: 26px;
padding: 3px 4px 3px 9px;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
background: #fff;
padding: 2px 8px;
border: 1px solid var(--sg-border-strong);
background: var(--sg-surface-soft);
color: var(--sg-text);
font-size: 11px;
line-height: 1.2;
font-weight: 600;
}
.selected-filter-chip button {
display: inline-grid;
place-items: center;
width: 20px;
height: 20px;
margin-left: 3px;
padding: 0;
border: 0;
background: transparent;
color: var(--sg-text-muted);
cursor: pointer;
.filter-chip {
gap: 4px;
border-radius: 12px;
}
.selected-filter-chip mat-icon {
.filter-meta-chip {
border-radius: 4px;
}
.filter-topic-chip {
display: inline-flex;
align-items: center;
gap: 4px;
max-width: min(320px, 46vw);
padding: 3px 8px;
border-radius: 7px;
background: color-mix(in srgb, var(--topic-color) 22%, #ffffff);
color: color-mix(in srgb, var(--topic-color) 45%, #07163d);
font-size: 11px;
font-weight: 700;
box-shadow: inset 0 0 0 1px
color-mix(in srgb, var(--topic-color) 45%, transparent);
}
.filter-topic-chip__icon {
flex: 0 0 auto;
width: 14px;
height: 14px;
font-size: 14px;
}
.active-institution-filter,
.active-meta-filter {
display: inline-flex;
align-items: center;
gap: 4px;
max-width: 100%;
}
.filter-institution-chip,
.publication-institution-tag {
display: inline-flex;
align-items: center;
padding: 2px 6px;
border: 1px solid var(--sg-primary-border, var(--sg-border));
border-radius: 4px;
background: var(--sg-primary-soft);
color: var(--sg-primary);
font-size: 10px;
font-weight: 600;
line-height: normal;
}
.filter-institution-chip {
max-width: 340px;
}
.publication-institution-tag {
max-width: 100%;
margin: 0;
font-family: inherit;
cursor: pointer;
transition: all 0.2s ease;
&:hover,
&:focus-visible {
background: var(--sg-primary);
color: #fff;
border-color: var(--sg-primary);
outline: none;
box-shadow:
0 0 0 2px var(--sg-background),
0 0 0 4px var(--sg-primary);
}
&.active {
border-color: var(--sg-primary);
box-shadow:
0 0 0 1px #ffffff,
0 0 0 3px var(--sg-primary);
}
&.active:hover,
&.active:focus-visible {
background: var(--sg-primary);
color: #fff;
}
}
.filter-institution-chip .institution-icon,
.publication-institution-tag .institution-icon,
.filter-meta-chip__icon {
flex-shrink: 0;
width: 12px;
height: 12px;
margin-right: 4px;
font-size: 12px;
}
.filter-meta-chip__icon {
color: var(--sg-text-soft);
}
.filter-institution-chip .institution-name,
.publication-institution-tag .institution-name {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
min-width: 0;
white-space: normal;
overflow-wrap: anywhere;
}
.filter-institution-chip .flag-img,
.publication-institution-tag .flag-img {
flex-shrink: 0;
margin-left: 6px;
border: 1px solid;
}
.filter-institution-chip .country-code,
.publication-institution-tag .country-code {
flex-shrink: 0;
margin-left: 2px;
font-size: 9px;
}
.filter-meta-chip__label,
.filter-topic-chip__label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}
.filter-chip button,
.active-institution-filter button,
.active-meta-filter button {
display: flex;
padding: 0;
border: 0;
background: transparent;
color: var(--sg-text-soft);
cursor: pointer;
&:hover {
color: var(--sg-text);
}
}
.filter-chip button mat-icon,
.active-institution-filter button mat-icon,
.active-meta-filter button mat-icon {
width: 12px;
height: 12px;
font-size: 12px;
}
.table-wrap {
position: relative;
overflow-x: auto;
@@ -167,7 +342,6 @@ table {
min-width: 1120px;
border-collapse: separate;
border-spacing: 0 10px;
overflow: hidden;
box-shadow: none;
background: transparent;
}
@@ -193,88 +367,125 @@ a.title:hover {
font-size: 12px;
}
.loading {
position: absolute;
inset: 0;
z-index: 1;
display: grid;
place-items: center;
background: rgba(255, 255, 255, 0.65);
table.is-hidden {
display: none;
}
.empty-state {
padding: 28px;
.table-status {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
min-height: 240px;
padding: 32px;
color: var(--sg-text-muted);
font-size: 14px;
text-align: center;
color: rgba(0, 0, 0, 0.6);
background: transparent;
}
.empty-text {
color: rgba(0, 0, 0, 0.54);
}
.topic-chips {
display: flex;
flex-wrap: wrap;
gap: 6px;
max-width: 320px;
}
.publication-topic-tag,
.publication-topic-more {
.cell-filter-pill {
display: inline-flex;
align-items: center;
max-width: 180px;
min-height: 24px;
padding: 3px 8px;
margin: 0;
padding: 3px 10px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
border-radius: 999px;
background: #fff;
color: var(--sg-text);
font-size: 11px;
font-family: inherit;
font-size: 12px;
line-height: 1.2;
cursor: pointer;
transition: all 0.2s ease;
&:hover,
&:focus-visible {
border-color: var(--sg-primary);
background: var(--sg-surface-soft);
outline: none;
}
&.active {
border-color: var(--sg-primary);
color: var(--sg-primary);
font-weight: 600;
box-shadow:
0 0 0 1px #ffffff,
0 0 0 3px var(--sg-primary);
}
}
.publication-topic-tag {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.type-filter-btn {
display: inline-flex;
margin: 0;
padding: 0;
border: 0;
border-radius: 7px;
background: transparent;
cursor: pointer;
transition: box-shadow 0.2s ease;
.publication-topic-more {
color: var(--sg-text-muted);
&:hover,
&:focus-visible {
outline: none;
box-shadow: 0 0 0 1px var(--sg-primary);
}
&.active {
box-shadow:
0 0 0 1px #ffffff,
0 0 0 3px var(--sg-primary);
}
}
.topic-chips,
.institution-tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.topic-chips {
max-width: 320px;
}
.institution-tags {
align-items: flex-start;
max-width: 280px;
}
.publication-institution-tag,
.publication-institution-more {
.publication-institution-more,
.publication-topic-more {
display: inline-flex;
align-items: center;
max-width: 180px;
min-height: 24px;
padding: 3px 8px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text);
color: var(--sg-text-muted);
font-family: inherit;
font-size: 11px;
line-height: 1.2;
cursor: pointer;
transition: all 0.2s ease;
&:hover,
&:focus-visible {
border-color: var(--sg-primary);
color: var(--sg-primary);
background: var(--sg-surface-soft);
outline: none;
}
}
.publication-institution-tag {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.publication-institution-more {
color: var(--sg-text-muted);
.publication-topic-more {
max-width: 180px;
}
::ng-deep .mat-mdc-header-cell {
@@ -293,6 +504,31 @@ a.title:hover {
font-size: 13px;
}
.table-wrap ::ng-deep {
.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 {
text-align: center;
}
.mat-mdc-cell:not(:last-child),
.mat-mdc-header-cell:not(:last-child) {
border-right: 1px solid var(--sg-border);
}
.mat-column-institutions,
.mat-column-topics {
overflow: visible;
}
}
mat-paginator {
background: transparent;
}
@@ -304,8 +540,6 @@ mat-paginator {
min-height: 66px;
padding: 0 22px 0 28px;
border: 0;
border-top: 0;
border-radius: 0;
color: var(--sg-text-muted);
font-size: 13px;
}
@@ -340,8 +574,7 @@ mat-paginator {
width: 100%;
}
.selected-filter-chips {
justify-content: flex-start;
max-width: none;
.active-filters-row {
align-self: stretch;
}
}
@@ -25,6 +25,7 @@ import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { MatTooltipModule } from '@angular/material/tooltip';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
catchError,
@@ -37,10 +38,12 @@ import {
switchMap,
} from 'rxjs';
import { Work, WorksService } from '../../api';
import { InstitutionsService, Work, WorksService, WorkTopic } from '../../api';
import { PaginationService } from '../../shared/services/pagination.service';
import { createLoadError } from '../../resolvers/utils/errorHandler';
import { ChipComponent } from '../../shared/ui/chip/chip.component';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
interface InstitutionAutocompleteOption {
id?: string | null;
@@ -52,10 +55,6 @@ interface InstitutionAutocompleteOption {
external_id?: string | null;
}
interface InstitutionAutocompleteResponse {
results?: InstitutionAutocompleteOption[] | null;
}
interface TopicAutocompleteOption {
id?: string | null;
display_name?: string | null;
@@ -64,6 +63,10 @@ interface TopicAutocompleteOption {
works_count?: number | null;
entity_type?: string | null;
external_id?: string | null;
field_id?: string | null;
field_name?: string | null;
domain_id?: string | null;
domain_name?: string | null;
}
interface TopicAutocompleteResponse {
@@ -94,8 +97,10 @@ interface PublicationFilterQueryState {
MatSelectModule,
MatSnackBarModule,
MatTableModule,
MatTooltipModule,
ReactiveFormsModule,
RouterLink,
TopicChipComponent,
],
templateUrl: './person-publications.component.html',
styleUrl: './person-publications.component.scss',
@@ -124,6 +129,8 @@ export class PersonPublicationsComponent implements OnInit {
selectedInstitutions: InstitutionAutocompleteOption[] = [];
topicOptions: TopicAutocompleteOption[] = [];
selectedTopics: TopicAutocompleteOption[] = [];
private readonly expandedInstitutions = new Set<string>();
private readonly expandedTopics = new Set<string>();
readonly institutionSearchControl = new FormControl<
string | InstitutionAutocompleteOption
>('', { nonNullable: true });
@@ -132,6 +139,9 @@ export class PersonPublicationsComponent implements OnInit {
>('', {
nonNullable: true,
});
readonly yearSearchControl = new FormControl('', { nonNullable: true });
readonly typeSearchControl = new FormControl('', { nonNullable: true });
readonly languageSearchControl = new FormControl('', { nonNullable: true });
readonly filterForm = new FormGroup({
publicationYears: new FormControl<number[]>([], { nonNullable: true }),
@@ -151,6 +161,8 @@ export class PersonPublicationsComponent implements OnInit {
institutionNames: 'publicationInstitutionName',
topicIds: 'publicationTopicId',
topicNames: 'publicationTopicName',
topicFields: 'publicationTopicField',
topicDomains: 'publicationTopicDomain',
} as const;
readonly typeOptions = [
@@ -187,6 +199,7 @@ export class PersonPublicationsComponent implements OnInit {
private readonly httpClient: HttpClient,
public readonly paginationService: PaginationService,
private readonly snackBar: MatSnackBar,
private readonly institutionsService: InstitutionsService,
) {}
ngOnInit(): void {
@@ -280,6 +293,8 @@ export class PersonPublicationsComponent implements OnInit {
[this.queryParamKeys.institutionNames]: null,
[this.queryParamKeys.topicIds]: null,
[this.queryParamKeys.topicNames]: null,
[this.queryParamKeys.topicFields]: null,
[this.queryParamKeys.topicDomains]: null,
});
}
@@ -305,6 +320,83 @@ export class PersonPublicationsComponent implements OnInit {
this.applyFilters();
}
filterByInstitution(institution: { id: string; name: string }): void {
if (!institution.id) return;
if (this.selectedInstitutions.some((item) => item.id === institution.id)) {
return;
}
this.selectedInstitutions = [
...this.selectedInstitutions,
{ id: institution.id, display_name: institution.name },
];
this.applyFilters();
}
isInstitutionActive(id: string): boolean {
return !!id && this.selectedInstitutions.some((item) => item.id === id);
}
selectedInstitutionCountry(
institution: InstitutionAutocompleteOption,
): string | null {
if (!institution.id) return null;
for (const publication of this.publications) {
for (const authorship of publication.authorships ?? []) {
for (const inst of authorship.institutions ?? []) {
if (inst.id === institution.id && inst.country_code) {
return inst.country_code;
}
}
}
}
return null;
}
toggleYearFilter(year: number): void {
const control = this.filterForm.controls.publicationYears;
const current = control.value;
control.setValue(
current.includes(year)
? current.filter((value) => value !== year)
: [...current, year],
);
this.applyFilters();
}
toggleTypeFilter(type: string): void {
const control = this.filterForm.controls.types;
const current = control.value;
control.setValue(
current.includes(type)
? current.filter((value) => value !== type)
: [...current, type],
);
this.applyFilters();
}
toggleLanguageFilter(language: string): void {
const control = this.filterForm.controls.languages;
const current = control.value;
control.setValue(
current.includes(language)
? current.filter((value) => value !== language)
: [...current, language],
);
this.applyFilters();
}
isYearActive(year: number): boolean {
return this.filterForm.controls.publicationYears.value.includes(year);
}
isTypeActive(type: string): boolean {
return this.filterForm.controls.types.value.includes(type);
}
isLanguageActive(language: string): boolean {
return this.filterForm.controls.languages.value.includes(language);
}
displayTopic(option: string | TopicAutocompleteOption): string {
return typeof option === 'string' ? option : (option.display_name ?? '');
}
@@ -313,13 +405,24 @@ export class PersonPublicationsComponent implements OnInit {
const topic = event.option.value as TopicAutocompleteOption;
if (!topic.id) return;
if (!this.selectedTopics.some((item) => item.id === topic.id)) {
this.selectedTopics = [...this.selectedTopics, topic];
const enrichedTopic: TopicAutocompleteOption = {
...topic,
field_name: topic.field_name ?? this.fieldNameFromHint(topic.hint),
};
this.selectedTopics = [...this.selectedTopics, enrichedTopic];
this.applyFilters();
}
this.topicSearchControl.setValue('', { emitEvent: false });
this.topicOptions = [];
}
private fieldNameFromHint(
hint: string | null | undefined,
): string | undefined {
const fieldName = (hint ?? '').split('·')[0]?.trim();
return fieldName || undefined;
}
removeTopic(topic: TopicAutocompleteOption): void {
this.selectedTopics = this.selectedTopics.filter(
(item) => item.id !== topic.id,
@@ -332,6 +435,31 @@ export class PersonPublicationsComponent implements OnInit {
return doi.startsWith('http') ? doi : `https://doi.org/${doi}`;
}
toggleInstitutions(publication: Work): void {
this.toggleExpanded(this.expandedInstitutions, publication);
}
isInstitutionsExpanded(publication: Work): boolean {
return this.expandedInstitutions.has(this.publicationKey(publication));
}
toggleTopics(publication: Work): void {
this.toggleExpanded(this.expandedTopics, publication);
}
isTopicsExpanded(publication: Work): boolean {
return this.expandedTopics.has(this.publicationKey(publication));
}
private toggleExpanded(set: Set<string>, publication: Work): void {
const key = this.publicationKey(publication);
if (set.has(key)) {
set.delete(key);
} else {
set.add(key);
}
}
publicationKey(publication: Work): string {
const id =
publication.id ?? publication.ids?.openalex ?? publication.doi ?? '';
@@ -346,6 +474,51 @@ export class PersonPublicationsComponent implements OnInit {
return `Zeige 1 bis ${this.publications.length} von ${this.total} Publikationen`;
}
getTopicColor(topic: WorkTopic): string {
return topicHierarchyColor({
id: topic.id,
name: topic.display_name,
field_id: topic.field?.id,
field_name: topic.field?.display_name,
domain_id: topic.domain?.id,
domain_name: topic.domain?.display_name,
});
}
getSelectedTopicColor(topic: TopicAutocompleteOption): string {
return topicHierarchyColor({
id: topic.id,
name: topic.display_name,
field_id: topic.field_id,
field_name: topic.field_name,
domain_id: topic.domain_id,
domain_name: topic.domain_name,
});
}
isTopicActive(topic: WorkTopic): boolean {
return (
!!topic.id && this.selectedTopics.some((item) => item.id === topic.id)
);
}
filterByTopic(topic: WorkTopic): void {
if (!topic.id) return;
if (this.selectedTopics.some((item) => item.id === topic.id)) return;
this.selectedTopics = [
...this.selectedTopics,
{
id: topic.id,
display_name: topic.display_name ?? topic.id,
field_id: topic.field?.id,
field_name: topic.field?.display_name,
domain_id: topic.domain?.id,
domain_name: topic.domain?.display_name,
},
];
this.applyFilters();
}
typeColor(type: string | null | undefined): string {
const normalized = (type ?? '').toLowerCase();
if (normalized.includes('conference')) return 'success';
@@ -353,8 +526,13 @@ export class PersonPublicationsComponent implements OnInit {
return 'info';
}
institutions(publication: Work): Array<{ id: string; name: string }> {
const institutionsById = new Map<string, { id: string; name: string }>();
institutions(
publication: Work,
): Array<{ id: string; name: string; country: string | null }> {
const institutionsById = new Map<
string,
{ id: string; name: string; country: string | null }
>();
for (const authorship of publication.authorships ?? []) {
for (const institution of authorship.institutions ?? []) {
@@ -363,6 +541,7 @@ export class PersonPublicationsComponent implements OnInit {
institutionsById.set(institution.id, {
id: institution.id,
name: institution.display_name,
country: institution.country_code ?? null,
});
}
}
@@ -371,6 +550,68 @@ export class PersonPublicationsComponent implements OnInit {
return Array.from(institutionsById.values());
}
yearSelectionSummary(): string {
return this.summarizeSelection(
this.filterForm.controls.publicationYears.value.map((year) =>
String(year),
),
);
}
typeSelectionSummary(): string {
return this.summarizeSelection(this.filterForm.controls.types.value);
}
languageSelectionSummary(): string {
const labels = this.filterForm.controls.languages.value.map(
(value) =>
this.languageOptions.find((option) => option.value === value)?.label ??
value,
);
return this.summarizeSelection(labels);
}
private summarizeSelection(labels: string[]): string {
if (labels.length === 0) return '';
if (labels.length === 1) return labels[0];
return `+${labels.length}`;
}
languageLabel(value: string): string {
return (
this.languageOptions.find((option) => option.value === value)?.label ??
value
);
}
filteredYearOptions(): number[] {
const term = this.yearSearchControl.value.trim();
if (!term) return this.publicationYearOptions;
return this.publicationYearOptions.filter((year) =>
String(year).includes(term),
);
}
filteredTypeOptions(): { value: string; label: string }[] {
const term = this.typeSearchControl.value.trim().toLowerCase();
if (!term) return this.typeOptions;
return this.typeOptions.filter((type) =>
type.label.toLowerCase().includes(term),
);
}
filteredLanguageOptions(): { value: string; label: string }[] {
const term = this.languageSearchControl.value.trim().toLowerCase();
if (!term) return this.languageOptions;
return this.languageOptions.filter((language) =>
language.label.toLowerCase().includes(term),
);
}
focusSelectSearch(input: HTMLInputElement): void {
setTimeout(() => input.focus());
}
private filters() {
return {
publicationYears: this.filterForm.controls.publicationYears.value,
@@ -438,17 +679,14 @@ export class PersonPublicationsComponent implements OnInit {
}
private searchInstitutions(query: string) {
const params = new HttpParams().set('query', query).set('limit', '10');
const basePath = this.workService.configuration.basePath ?? '';
return this.httpClient
.get<InstitutionAutocompleteResponse>(
`${basePath}/api/institutions/autocomplete`,
{
params,
},
)
.pipe(map((response) => response.results ?? []));
return this.institutionsService
.autocompleteInstitutions(query, undefined, undefined, 10)
.pipe(
map(
(response) =>
(response?.results ?? []) as InstitutionAutocompleteOption[],
),
);
}
private searchTopics(query: string) {
@@ -486,6 +724,12 @@ export class PersonPublicationsComponent implements OnInit {
const topicNames = this.selectedTopics
.map((topic) => topic.display_name)
.filter((name): name is string => !!name);
const topicFields = this.selectedTopics.map(
(topic) => topic.field_name ?? '',
);
const topicDomains = this.selectedTopics.map(
(topic) => topic.domain_name ?? '',
);
void this.router.navigate([], {
relativeTo: this.route,
@@ -507,6 +751,14 @@ export class PersonPublicationsComponent implements OnInit {
: null,
[this.queryParamKeys.topicIds]: topicIds.length ? topicIds : null,
[this.queryParamKeys.topicNames]: topicNames.length ? topicNames : null,
[this.queryParamKeys.topicFields]: topicFields.some((field) => field)
? topicFields
: null,
[this.queryParamKeys.topicDomains]: topicDomains.some(
(domain) => domain,
)
? topicDomains
: null,
...overrides,
},
queryParamsHandling: 'merge',
@@ -524,6 +776,8 @@ export class PersonPublicationsComponent implements OnInit {
);
const topicIds = queryParams.getAll(this.queryParamKeys.topicIds);
const topicNames = queryParams.getAll(this.queryParamKeys.topicNames);
const topicFields = queryParams.getAll(this.queryParamKeys.topicFields);
const topicDomains = queryParams.getAll(this.queryParamKeys.topicDomains);
return {
pageIndex:
@@ -551,6 +805,8 @@ export class PersonPublicationsComponent implements OnInit {
topics: topicIds.filter(Boolean).map((id, index) => ({
id,
display_name: topicNames[index] || id,
field_name: topicFields[index] || undefined,
domain_name: topicDomains[index] || undefined,
})),
};
}
@@ -53,7 +53,9 @@
<div class="metric-item">
<mat-icon>calendar_today</mat-icon>
<div class="metric-content">
<strong>{{ bundProject.funding_start_date | date: 'dd.MM.yyyy' }}</strong>
<strong>{{
bundProject.funding_start_date | date: 'dd.MM.yyyy'
}}</strong>
<span>Förderbeginn</span>
</div>
</div>
@@ -80,7 +82,8 @@
<mat-icon>paid</mat-icon>
<div class="metric-content">
<strong>{{
bundProject.funding_amount | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
bundProject.funding_amount
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}</strong>
<span>Fördersumme</span>
</div>
@@ -387,7 +390,8 @@
<div class="detail-row">
<dt>Laufzeit</dt>
<dd>
von {{ bundProject.funding_start_date | date: 'dd.MM.yyyy' }} bis
von
{{ bundProject.funding_start_date | date: 'dd.MM.yyyy' }} bis
{{ bundProject.funding_end_date | date: 'dd.MM.yyyy' }}
</dd>
</div>
@@ -28,7 +28,7 @@
.status-badge:hover {
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.status-badge mat-icon {
@@ -21,12 +21,14 @@
</p>
}
<div class="hero-actions">
<div
class="status-badge"
[style.background-color]="getStatusColor(getStatusDisplay(dfgProject.funding_end_date))">
<mat-icon>circle</mat-icon>
<span>{{ getStatusDisplay(dfgProject.funding_end_date) }}</span>
</div>
<div
class="status-badge"
[style.background-color]="
getStatusColor(getStatusDisplay(dfgProject.funding_end_date))
">
<mat-icon>circle</mat-icon>
<span>{{ getStatusDisplay(dfgProject.funding_end_date) }}</span>
</div>
@if (dfgProject.link) {
<a [href]="dfgProject.link" target="_blank" class="primary-action">
<mat-icon>open_in_new</mat-icon>
@@ -251,7 +251,7 @@ h1 {
.status-badge:hover {
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.status-badge mat-icon {
@@ -92,10 +92,13 @@ export class DfgDetailsComponent implements OnInit {
}
getDuration(): string {
const start = this.dfgProject?.funding_start_date;
const end = this.dfgProject?.funding_end_date === "2999" ? "Heute" : this.dfgProject?.funding_end_date ;
const end =
this.dfgProject?.funding_end_date === '2999'
? 'Heute'
: this.dfgProject?.funding_end_date;
if (!start || !end) return '';
return `von ${start} bis ${end}`;
}
goBack(): void {
@@ -396,7 +396,9 @@
@if (euProject.ecSignatureDate) {
<div class="detail-row">
<dt>EU-Unterzeichnung</dt>
<dd>{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}</dd>
<dd>
{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}
</dd>
</div>
}
@if (euProject.nature) {
@@ -426,13 +428,17 @@
@if (euProject.ecSignatureDate) {
<div class="detail-row">
<dt>EU-Unterzeichnung</dt>
<dd>{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}</dd>
<dd>
{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}
</dd>
</div>
}
@if (euProject.contentUpdateDate) {
<div class="detail-row">
<dt>Letzte Aktualisierung</dt>
<dd>{{ euProject.contentUpdateDate | date: 'dd.MM.yyyy' }}</dd>
<dd>
{{ euProject.contentUpdateDate | date: 'dd.MM.yyyy' }}
</dd>
</div>
}
@if (euProject.grantDoi) {
@@ -43,9 +43,7 @@
<img
alt=""
class="country-flag"
[src]="
`https://flagcdn.io/${getSvgByCountryCode(org.country)}.svg`
"
[src]="`https://flagcdn.io/${getSvgByCountryCode(org.country)}.svg`"
height="10" />
</span>
} @else {
@@ -28,7 +28,6 @@
}
.organizations-table-wrapper {
table {
width: 100%;
border-radius: 8px;
@@ -263,4 +262,4 @@
}
}
}
}
}
@@ -12,9 +12,7 @@
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef>Titel</th>
<td mat-cell *matCellDef="let pub">
<div
class="pub-title-cell"
(click)="searchForPublication(pub)">
<div class="pub-title-cell" (click)="searchForPublication(pub)">
<span class="pub-title-text">
{{ pub.title || 'Kein Titel' }}
</span>
@@ -34,7 +32,9 @@
<span class="author-wrapper">
<span
class="author-name"
(click)="searchForPersonName(author); $event.stopPropagation()">
(click)="
searchForPersonName(author); $event.stopPropagation()
">
{{ author }}
</span>
@if (!last) {
@@ -57,7 +57,9 @@
<th mat-header-cell *matHeaderCellDef>Zeitschrift</th>
<td mat-cell *matCellDef="let pub">
@if (pub.journalNumber) {
<span class="journal-chip" [matTooltip]="pub.journalNumber">{{ pub.journalNumber }}</span>
<span class="journal-chip" [matTooltip]="pub.journalNumber">{{
pub.journalNumber
}}</span>
} @else {
<span class="empty-value">—</span>
}
@@ -138,4 +140,4 @@
</table>
</div>
</mat-card>
</div>
</div>
@@ -176,11 +176,14 @@
</div>
<div class="tags">
@for (topic of publication.topics ?? []; track topic.id) {
<span
class="topic-tag"
[title]="topic.field?.display_name || ''">
{{ topic.display_name }}
</span>
<app-topic-chip
[label]="topic.display_name || ''"
[description]="topic.description"
[subfieldName]="topic.subfield?.display_name"
[fieldName]="topic.field?.display_name"
[domainName]="topic.domain?.display_name"
[color]="getTopicColor(topic)">
</app-topic-chip>
}
@for (keyword of publication.keywords ?? []; track keyword.id) {
<span>{{ keyword.display_name }}</span>
@@ -268,12 +268,6 @@ aside {
font-size: 11px;
}
.tags .topic-tag {
border-color: #cbd8f1;
background: #f5f8ff;
color: var(--sg-text);
}
.source-list,
.compact-list,
.link-list {
@@ -13,7 +13,10 @@ import {
Location as ApiLocation,
Work,
WorksService,
WorkTopic,
} from '../../api';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
interface DetailLink {
label: string;
@@ -36,6 +39,7 @@ interface InstitutionDetail {
MatIconModule,
MatProgressSpinnerModule,
RouterLink,
TopicChipComponent,
UpperCasePipe,
],
templateUrl: './publication-detail.component.html',
@@ -71,6 +75,17 @@ export class PublicationDetailComponent implements OnInit {
this.location.back();
}
getTopicColor(topic: WorkTopic): string {
return topicHierarchyColor({
id: topic.id,
name: topic.display_name,
field_id: topic.field?.id,
field_name: topic.field?.display_name,
domain_id: topic.domain?.id,
domain_name: topic.domain?.display_name,
});
}
abstractText(): string | null {
const index = this.publication?.abstract_inverted_index;
if (!index || typeof index !== 'object') return null;
@@ -67,6 +67,10 @@
matTooltipPosition="above"
(focusin)="tooltip.show()"
(focusout)="tooltip.hide()">
<span
class="field-dot"
[style.background]="getFieldColor(topic.fieldName)"
aria-hidden="true"></span>
<span class="topic-name">{{ topic.name }}</span>
</mat-checkbox>
<span class="topic-path" [title]="topic.path">{{
@@ -112,7 +116,10 @@
: 'chevron_right'
}}
</mat-icon>
<mat-icon class="folder-icon">folder</mat-icon>
<span
class="field-dot"
[style.background]="getFieldColor(field.name)"
aria-hidden="true"></span>
<span class="node-title field-title">{{
field.name
}}</span>
@@ -93,6 +93,18 @@
flex-direction: column;
}
.field-dot {
flex: 0 0 auto;
display: inline-block;
vertical-align: middle;
width: 9px;
height: 9px;
margin-right: 7px;
border-radius: 50%;
border: 1px solid rgba(255, 255, 255, 0.85);
box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2);
}
.node-header {
display: flex;
align-items: center;
@@ -6,6 +6,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';
import { MatTooltipModule } from '@angular/material/tooltip';
import { TopicsService } from '../../api/api/topics.service';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
import { combineLatest, of } from 'rxjs';
import { toObservable } from '@angular/core/rxjs-interop';
import {
@@ -39,6 +40,7 @@ interface FlatTopic {
id: string;
name: string;
path: string;
fieldName: string;
}
@Component({
@@ -120,6 +122,7 @@ export class TopicHierarchyComponent implements OnInit {
name: topic.display_name || '',
path:
parts.length > 0 ? parts.join(' > ') : topic.description || '',
fieldName: topic.field?.display_name || '',
};
});
}
@@ -151,6 +154,7 @@ export class TopicHierarchyComponent implements OnInit {
id: topic.id,
name: topic.name,
path: `${domain.name} > ${field.name} > ${subfield.name}`,
fieldName: field.name,
});
}
});
@@ -164,6 +168,10 @@ export class TopicHierarchyComponent implements OnInit {
this.searchType.set(type);
}
getFieldColor(fieldName: string | null | undefined): string {
return topicHierarchyColor({ field_name: fieldName });
}
toggleTopic(name: string): void {
const nextSelection = new Set(this.selectedTopics());
if (nextSelection.has(name)) {