From 83c809983c447795cebe4d41743c671d2446dbcb Mon Sep 17 00:00:00 2001 From: Khuder Khalti Date: Tue, 18 Aug 2026 10:39:01 +0200 Subject: [PATCH] refactor(patents): share app-card-search/source-filter across patent page. --- .../institution-patents.component.html | 16 +--- .../institution-patents.component.ts | 2 + .../keywords-patents.component.html | 16 +--- .../keywords-patents.component.ts | 2 + .../modules/patents/patents.component.html | 9 +-- .../app/modules/patents/patents.component.ts | 2 - .../person-patents.component.html | 16 +--- .../person-patents.component.ts | 2 + .../app-author-chip.component.ts | 6 +- .../app-institution-card.component.html | 2 +- .../patent-table/patent-table.component.html | 74 ++++++++++--------- .../patent-table/patent-table.component.scss | 27 +++---- .../ui/patent-table/patent-table.component.ts | 15 ++-- .../source-filter.component.html | 11 +++ .../source-filter.component.scss | 4 + .../source-filter/source-filter.component.ts | 17 +++++ 16 files changed, 111 insertions(+), 110 deletions(-) create mode 100644 webapp/src/app/shared/ui/source-filter/source-filter.component.html create mode 100644 webapp/src/app/shared/ui/source-filter/source-filter.component.scss create mode 100644 webapp/src/app/shared/ui/source-filter/source-filter.component.ts diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.html b/webapp/src/app/modules/institution-patents/institution-patents.component.html index e6b144f0..7abb1080 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.html +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.html @@ -36,19 +36,9 @@ Beides - - - - Filter nach Quelle - Alle - EPO - USPTO - - + diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.ts b/webapp/src/app/modules/institution-patents/institution-patents.component.ts index 58fbf82b..4586f7f9 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.ts +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.ts @@ -17,6 +17,7 @@ import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-pagina import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive'; import { AppAuthorTooltipComponent } from '../../shared/ui/app-author-tooltip/app-author-tooltip.component'; import { PatentTableComponent } from '../../shared/ui/patent-table/patent-table.component'; +import { SourceFilterComponent } from '../../shared/ui/source-filter/source-filter.component'; type SortColumn = 'title' | 'publication_year' | 'source' | 'match_type'; type SortDirection = 'asc' | 'desc'; @@ -35,6 +36,7 @@ type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both'; QueryParamPaginatorComponent, ComponentTooltipDirective, PatentTableComponent, + SourceFilterComponent, ], templateUrl: './institution-patents.component.html', styleUrl: './institution-patents.component.scss', diff --git a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html index 3bce037a..2899e79a 100644 --- a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html @@ -13,19 +13,9 @@
- - - - Filter nach Quelle - Alle - EPO - USPTO - - + diff --git a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts index b5907ae6..331de050 100644 --- a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts @@ -16,6 +16,7 @@ import { } from '../../patent-detail/patent-detail.utils'; import { KeywordPatentMappingStatus } from '../../../api'; import { PatentTableComponent } from '../../../shared/ui/patent-table/patent-table.component'; +import { SourceFilterComponent } from '../../../shared/ui/source-filter/source-filter.component'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; type SortColumn = 'title' | 'publication_year' | 'source'; @@ -34,6 +35,7 @@ function isValidSortColumn(value: string | null): value is SortColumn { LoadingComponent, QueryParamPaginatorComponent, PatentTableComponent, + SourceFilterComponent, ], templateUrl: './keywords-patents.component.html', styleUrl: './keywords-patents.component.scss', diff --git a/webapp/src/app/modules/patents/patents.component.html b/webapp/src/app/modules/patents/patents.component.html index a018cef8..82097f4a 100644 --- a/webapp/src/app/modules/patents/patents.component.html +++ b/webapp/src/app/modules/patents/patents.component.html @@ -3,13 +3,7 @@ - @if (loading) { - - } @else if (error) { + @if (error) {

Fehler beim Laden der Patente.

} @else if (showDetail && selectedPatent) {
@@ -260,6 +254,7 @@
} @else {
- - - - Filter nach Quelle - Alle - EPO - USPTO - - + diff --git a/webapp/src/app/modules/person-patents/person-patents.component.ts b/webapp/src/app/modules/person-patents/person-patents.component.ts index f8b31e19..62de6234 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.ts +++ b/webapp/src/app/modules/person-patents/person-patents.component.ts @@ -17,6 +17,7 @@ import { LoadingComponent } from '../../shared/ui/loading/loading.component'; import { PageEvent } from '@angular/material/paginator'; import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; import { PatentTableComponent } from '../../shared/ui/patent-table/patent-table.component'; +import { SourceFilterComponent } from '../../shared/ui/source-filter/source-filter.component'; type SortColumn = 'title' | 'publication_year' | 'source'; type SortDirection = 'asc' | 'desc'; @@ -32,6 +33,7 @@ type SourceFilter = 'all' | 'EPO' | 'USPTO'; MatIconModule, QueryParamPaginatorComponent, PatentTableComponent, + SourceFilterComponent, ], templateUrl: './person-patents.component.html', styleUrl: './person-patents.component.scss', diff --git a/webapp/src/app/shared/ui/app-author-chip/app-author-chip.component.ts b/webapp/src/app/shared/ui/app-author-chip/app-author-chip.component.ts index 60995687..e0220a81 100644 --- a/webapp/src/app/shared/ui/app-author-chip/app-author-chip.component.ts +++ b/webapp/src/app/shared/ui/app-author-chip/app-author-chip.component.ts @@ -39,10 +39,10 @@ export class AppAuthorChipComponent { icon = input('person'); author = input(undefined); - rawOaAuthorId = computed(() => { - return this.stripOpenAlexId(this.author()?.id); - }); authorId = input(undefined); + rawOaAuthorId = computed(() => { + return this.authorId() ?? this.stripOpenAlexId(this.author()?.id); + }); _author = signal(undefined); diff --git a/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.html b/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.html index 49172464..35e492ac 100644 --- a/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.html +++ b/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.html @@ -89,7 +89,7 @@ ]" matButton="outlined" (click)="$event.stopPropagation()"> - verified + workspace_premium Patente } diff --git a/webapp/src/app/shared/ui/patent-table/patent-table.component.html b/webapp/src/app/shared/ui/patent-table/patent-table.component.html index 0a6fcdae..cd86abe3 100644 --- a/webapp/src/app/shared/ui/patent-table/patent-table.component.html +++ b/webapp/src/app/shared/ui/patent-table/patent-table.component.html @@ -39,23 +39,25 @@ @let visibleInventors = expanded ? patent.inventors : (patent.inventors ?? []).slice(0, 3);
- @for (inventor of visibleInventors; track inventor) { - - person - {{ inventor }} + @for (inventor of visibleInventors; track inventor; let last = $last) { + + + person + {{ inventor }} + + @if (last && (patent.inventors ?? []).length > 3) { + + } } @empty { - } - @if ((patent.inventors ?? []).length > 3) { - - }
@@ -64,25 +66,27 @@ @let visibleAssignees = expanded ? patent.assignees : (patent.assignees ?? []).slice(0, 3);
- @for (assignee of visibleAssignees; track assignee) { - - {{ - isAssigneeLikelyPerson(assignee, patent) ? 'person' : 'apartment' - }} - {{ assignee }} + @for (assignee of visibleAssignees; track assignee; let last = $last) { + + + {{ + isAssigneeLikelyPerson(assignee, patent) ? 'person' : 'apartment' + }} + {{ assignee }} + + @if (last && (patent.assignees ?? []).length > 3) { + + } } @empty { - } - @if ((patent.assignees ?? []).length > 3) { - - }
@@ -99,14 +103,12 @@ author of patent.matched_authors.slice(0, 3); track author.openalex_author_id ) { - - {{ author.author_name }} - + } } @else { - diff --git a/webapp/src/app/shared/ui/patent-table/patent-table.component.scss b/webapp/src/app/shared/ui/patent-table/patent-table.component.scss index 76b50023..e711719a 100644 --- a/webapp/src/app/shared/ui/patent-table/patent-table.component.scss +++ b/webapp/src/app/shared/ui/patent-table/patent-table.component.scss @@ -58,15 +58,18 @@ max-width: 240px; } +.person-chip-row { + display: inline-flex; + align-items: center; + gap: 4px; + max-width: 100%; +} + .person-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; - padding: 2px 8px; - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - background: var(--sg-surface-soft); color: var(--sg-text); font-size: 0.75rem; line-height: 1.4; @@ -133,17 +136,9 @@ .cell-authors { display: flex; - flex-direction: column; - gap: 4px; + flex-wrap: wrap; + gap: 0.25rem; + align-items: flex-start; min-width: 120px; -} - -.author-link { - color: var(--sg-blue-highlight); - text-decoration: none; - font-size: 0.82rem; - - &:hover { - text-decoration: underline; - } + max-width: 260px; } diff --git a/webapp/src/app/shared/ui/patent-table/patent-table.component.ts b/webapp/src/app/shared/ui/patent-table/patent-table.component.ts index 44b4d0df..ecc6eeab 100644 --- a/webapp/src/app/shared/ui/patent-table/patent-table.component.ts +++ b/webapp/src/app/shared/ui/patent-table/patent-table.component.ts @@ -1,5 +1,5 @@ -import { Component, TemplateRef, input, output, signal, viewChild } from '@angular/core'; -import { RouterModule } from '@angular/router'; +import { Component, TemplateRef, inject, input, output, signal, viewChild } from '@angular/core'; +import { Router, RouterModule } from '@angular/router'; import { MatIconModule } from '@angular/material/icon'; import { MatButtonModule } from '@angular/material/button'; import { MatTooltipModule } from '@angular/material/tooltip'; @@ -8,8 +8,7 @@ import { PatentEntry } from '../../../api/model/patentEntry'; import { MatchedAuthor } from '../../../api/model/matchedAuthor'; import { DataTableComponent, GenericColumn } from '../data-table/data-table.component'; import { ChipComponent } from '../chip/chip.component'; -import { ComponentTooltipDirective } from '../../../directives/component-tooltip.directive'; -import { AppAuthorTooltipComponent } from '../app-author-tooltip/app-author-tooltip.component'; +import { AppAuthorChipComponent } from '../app-author-chip/app-author-chip.component'; import { isAssigneeLikelyPerson } from '../../../modules/patent-detail/patent-detail.utils'; export interface PatentTableEntry extends PatentEntry { @@ -26,13 +25,13 @@ export interface PatentTableEntry extends PatentEntry { MatTooltipModule, DataTableComponent, ChipComponent, - ComponentTooltipDirective, + AppAuthorChipComponent, ], templateUrl: './patent-table.component.html', styleUrl: './patent-table.component.scss', }) export class PatentTableComponent { - readonly AuthorTooltipComponent = AppAuthorTooltipComponent; + private readonly router = inject(Router); patents = input.required(); selectedPatent = input(null); @@ -144,6 +143,10 @@ export class PatentTableComponent return isAssigneeLikelyPerson(assignee, patent.inventors); } + navigateToPerson(authorId: string): void { + this.router.navigate(['/person', authorId]); + } + getMatchTypeLabel(matchType: string | undefined): string { switch (matchType) { case 'institution': diff --git a/webapp/src/app/shared/ui/source-filter/source-filter.component.html b/webapp/src/app/shared/ui/source-filter/source-filter.component.html new file mode 100644 index 00000000..aa07533c --- /dev/null +++ b/webapp/src/app/shared/ui/source-filter/source-filter.component.html @@ -0,0 +1,11 @@ + + + + Filter nach Quelle + Alle + EPO + USPTO + + diff --git a/webapp/src/app/shared/ui/source-filter/source-filter.component.scss b/webapp/src/app/shared/ui/source-filter/source-filter.component.scss new file mode 100644 index 00000000..212797e5 --- /dev/null +++ b/webapp/src/app/shared/ui/source-filter/source-filter.component.scss @@ -0,0 +1,4 @@ +.source-filter-field { + width: fit-content; + min-width: 180px; +} diff --git a/webapp/src/app/shared/ui/source-filter/source-filter.component.ts b/webapp/src/app/shared/ui/source-filter/source-filter.component.ts new file mode 100644 index 00000000..32dd4ec1 --- /dev/null +++ b/webapp/src/app/shared/ui/source-filter/source-filter.component.ts @@ -0,0 +1,17 @@ +import { Component, input, output } from '@angular/core'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatSelectModule } from '@angular/material/select'; +import { MatIconModule } from '@angular/material/icon'; + +export type SourceFilterValue = 'all' | 'EPO' | 'USPTO'; + +@Component({ + selector: 'app-source-filter', + imports: [MatFormFieldModule, MatSelectModule, MatIconModule], + templateUrl: './source-filter.component.html', + styleUrl: './source-filter.component.scss', +}) +export class SourceFilterComponent { + value = input.required(); + valueChange = output(); +} -- 2.56.1