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 eab62610..6524e69f 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.html +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.html @@ -127,21 +127,12 @@ - @if (hasPagination()) { - - } + @if (selectedPatent) { diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.scss b/webapp/src/app/modules/institution-patents/institution-patents.component.scss index 2175e457..7cf15235 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.scss +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.scss @@ -26,6 +26,11 @@ gap: 16px; } +app-query-param-paginator { + display: block; + margin-top: 14px; +} + .patents-toolbar-field { width: fit-content; min-width: 180px; @@ -55,14 +60,22 @@ table { width: 100%; - border-collapse: collapse; + border-collapse: separate; + border-spacing: 0; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + overflow: hidden; th { text-align: left; - padding: 10px 12px; - border-bottom: 2px solid var(--sg-border); - font-weight: 600; - color: var(--sg-text); + padding: 12px 16px; + background: var(--sg-surface-muted); + border-bottom: 1px solid var(--sg-border); + font-size: 12px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.02em; + color: var(--sg-text-muted); } tr { @@ -75,572 +88,593 @@ &.selected { background: var(--sg-surface-muted); + transition: background-color 0.15s ease; + + &:hover td { + background: rgba(16, 26, 61, 0.04); + } + + &.selected td { + background: var(--sg-primary-soft); + } + + &:last-child td { + border-bottom: 0; + } + } + + td { + padding: 12px 16px; + border-bottom: 1px solid var(--sg-border); + color: var(--sg-text); + font-size: 13px; + transition: background-color 0.15s ease; + } + + .patent-title { + color: var(--sg-text); + font-weight: 600; + max-width: 280px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .cell-preview { + max-width: 160px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: var(--sg-text-muted); + font-size: 13px; + } + + .cell-authors { + display: flex; + flex-direction: column; + gap: 4px; + min-width: 120px; } } + } - td { - padding: 10px 12px; - border-bottom: 1px solid var(--sg-border); + .match-badge { + display: inline-flex; + align-items: center; + padding: 3px 10px; + border-radius: 999px; + font-size: 0.72rem; + font-weight: 700; + + &--institution { + background: var(--sg-primary-soft); + color: var(--sg-primary); + border: 1px solid var(--sg-border); } - .patent-title { - color: var(--sg-text); - font-weight: 500; - max-width: 280px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + &--name { + background: var(--sg-warning-soft); + color: var(--sg-warning); + border: 1px solid var(--sg-border); } - .cell-preview { - max-width: 160px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + &--both { + background: var(--sg-success-soft); + color: var(--sg-success); + border: 1px solid var(--sg-border); + } + } + + .author-link { + color: var(--sg-blue-highlight); + text-decoration: none; + font-size: 0.82rem; + + &:hover { + text-decoration: underline; + } + } + + .source-badge { + display: inline-flex; + align-items: center; + padding: 3px 10px; + border-radius: 999px; + font-size: 0.75rem; + font-weight: 700; + + &--epo { + background: var(--sg-success-soft); + color: var(--sg-success); + border: 1px solid var(--sg-border); + } + + &--uspto { + background: var(--sg-primary-soft); + color: var(--sg-blue-highlight); + border: 1px solid var(--sg-border); + } + } + + .patent-detail { + width: 440px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + padding: 24px; + background: var(--sg-surface); + box-shadow: var(--sg-shadow-sm); + + &.empty { + display: flex; + align-items: center; + justify-content: center; color: var(--sg-text-muted); - font-size: 13px; + min-height: 200px; } - .cell-authors { + &.overview { display: flex; flex-direction: column; - gap: 4px; - min-width: 120px; - } - } -} + gap: 12px; -.match-badge { - display: inline-flex; - align-items: center; - padding: 3px 10px; - border-radius: 999px; - font-size: 0.72rem; - font-weight: 700; - - &--institution { - background: var(--sg-primary-soft); - color: var(--sg-primary); - border: 1px solid var(--sg-border); - } - - &--name { - background: var(--sg-warning-soft); - color: var(--sg-warning); - border: 1px solid var(--sg-border); - } - - &--both { - background: var(--sg-success-soft); - color: var(--sg-success); - border: 1px solid var(--sg-border); - } -} - -.author-link { - color: var(--sg-blue-highlight); - text-decoration: none; - font-size: 0.82rem; - - &:hover { - text-decoration: underline; - } -} - -.source-badge { - display: inline-flex; - align-items: center; - padding: 3px 10px; - border-radius: 999px; - font-size: 0.75rem; - font-weight: 700; - - &--epo { - background: var(--sg-success-soft); - color: var(--sg-success); - border: 1px solid var(--sg-border); - } - - &--uspto { - background: var(--sg-primary-soft); - color: var(--sg-blue-highlight); - border: 1px solid var(--sg-border); - } -} - -.patent-detail { - width: 440px; - border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 20px; - background: var(--sg-surface-muted); - - &.empty { - display: flex; - align-items: center; - justify-content: center; - color: var(--sg-text-muted); - min-height: 200px; - } - - &.overview { - display: flex; - flex-direction: column; - gap: 12px; - - .overview-title { - font-size: 15px; - font-weight: 600; - color: var(--sg-text); - margin: 0; - } - - .overview-subtitle { - font-size: 13px; - color: var(--sg-text-muted); - margin: 0; - } - - .overview-stats { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 10px; - margin-top: 4px; - } - - .overview-stat { - background: var(--sg-card-bg); - border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 12px 8px; - text-align: center; - - .overview-value { - display: block; - font-size: 22px; + .overview-title { + font-size: 15px; font-weight: 700; color: var(--sg-text); + margin: 0; } - .overview-label { - display: block; - font-size: 12px; + .overview-subtitle { + font-size: 13px; color: var(--sg-text-muted); + margin: 0; + } + + .overview-stats { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 10px; margin-top: 4px; } - &--total { - .overview-value, + .overview-stat { + background: var(--sg-surface); + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + padding: 12px 8px; + text-align: center; + + .overview-value { + display: block; + font-size: 22px; + font-weight: 700; + color: var(--sg-text); + } + .overview-label { - color: var(--sg-blue-highlight); + display: block; + font-size: 12px; + color: var(--sg-text-muted); + margin-top: 4px; + } + + &--total { + + .overview-value, + .overview-label { + color: var(--sg-blue-highlight); + } + } + + &--institution { + + .overview-value, + .overview-label { + color: var(--sg-primary); + } + } + + &--name { + + .overview-value, + .overview-label { + color: var(--sg-warning); + } + } + + &--both { + + .overview-value, + .overview-label { + color: var(--sg-success); + } } } - &--institution { - .overview-value, - .overview-label { - color: var(--sg-primary); - } - } - - &--name { - .overview-value, - .overview-label { - color: var(--sg-warning); - } - } - - &--both { - .overview-value, - .overview-label { - color: var(--sg-success); - } + .overview-hint { + font-size: 12px; + color: var(--sg-text-muted); + margin: 0; } } - .overview-hint { - font-size: 12px; + h3 { + margin: 0 0 16px 0; + font-size: 16px; + font-weight: 700; + color: var(--sg-text); + line-height: 1.4; + } + } + + .detail-stats { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 10px; + + .stat { + background: var(--sg-surface); + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + padding: 10px; + text-align: center; + + .stat-label { + display: block; + font-size: 11px; + color: var(--sg-text-muted); + margin-bottom: 4px; + text-transform: uppercase; + letter-spacing: 0.03em; + } + + .stat-value { + display: block; + font-size: 15px; + font-weight: bold; + color: var(--sg-text); + } + } + } + + .patent-detail-preview { + margin: 14px 0 0; + font-size: 13px; + line-height: 1.55; + color: var(--sg-text-muted); + } + + .patent-detail-action { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + width: 100%; + margin-top: 16px; + padding: 12px 14px; + border: 1px solid var(--sg-border); + border-radius: 10px; + background: var(--sg-surface-soft); + color: var(--sg-blue-highlight); + font-size: 14px; + font-weight: 600; + cursor: pointer; + transition: + border-color 0.15s, + background 0.15s, + box-shadow 0.15s; + + &:hover { + border-color: var(--sg-blue-highlight); + background: var(--sg-primary-soft); + box-shadow: var(--sg-shadow-sm); + } + + .material-icons { + font-size: 20px; + } + } + + .patent-detail-hint { + margin: 8px 0 0; + font-size: 12px; + line-height: 1.4; + color: var(--sg-text-muted); + text-align: center; + } + + .patent-full-detail { + flex: 1; + border: 1px solid var(--sg-border); + border-radius: 8px; + padding: 20px; + background: var(--sg-card-bg); + + h3 { + margin: 0 0 4px 0; + font-size: 16px; + color: var(--sg-text); + line-height: 1.4; + } + + h4 { + margin: 16px 0 8px 0; + font-size: 14px; color: var(--sg-text-muted); + font-weight: 600; + } + + p { + font-size: 13px; + color: var(--sg-text); + line-height: 1.6; margin: 0; } } - h3 { - margin: 0 0 16px 0; - font-size: 16px; - color: var(--sg-text); - line-height: 1.4; - } -} + .back-btn { + display: inline-flex; + align-items: center; + gap: 0.4rem; -.detail-stats { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 10px; + width: auto; + margin-bottom: 1rem; + padding: 0.5rem 0.85rem; - .stat { - background: var(--sg-card-bg); border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 10px; - text-align: center; + border-radius: 999px; - .stat-label { - display: block; - font-size: 11px; + background: var(--sg-surface-soft); + color: var(--sg-blue-highlight); + + font-size: 0.9rem; + font-weight: 600; + + cursor: pointer; + transition: + background-color 0.15s ease, + border-color 0.15s ease, + color 0.15s ease, + box-shadow 0.15s ease; + + &:hover { + background: var(--sg-primary-soft); + border-color: var(--sg-blue-highlight); + color: var(--sg-blue-highlight); + box-shadow: var(--sg-shadow-sm); + } + + &:focus-visible { + outline: 2px solid var(--sg-blue-highlight); + outline-offset: 2px; + } + } + + .detail-section { + margin-top: 12px; + padding-top: 12px; + border-top: 1px solid var(--sg-border); + } + + .patent-meta { + &--inline { + margin: 12px 0 20px; + } + + &__list { + margin: 0; + border: 1px solid var(--sg-border); + border-radius: 12px; + background: var(--sg-card-bg); + box-shadow: var(--sg-shadow-sm); + overflow: hidden; + } + + &__row { + display: grid; + grid-template-columns: minmax(130px, 38%) 1fr; + gap: 12px 16px; + align-items: center; + padding: 11px 16px; + border-top: 1px solid var(--sg-border); + + &:first-child { + border-top: 0; + } + + dt { + margin: 0; + font-size: 12px; + font-weight: 500; + color: var(--sg-text-muted); + line-height: 1.35; + } + + dd { + margin: 0; + font-size: 14px; + font-weight: 600; + color: var(--sg-text); + line-height: 1.35; + word-break: break-word; + } + } + } + + .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: var(--sg-primary-soft); + border: 1px solid var(--sg-border); + color: var(--sg-blue-highlight); + font-size: 0.8rem; + line-height: 1.3; + } + + .classification-section { + &--ipc .classification-card { + background: var(--sg-primary-soft); + border-color: var(--sg-border); + } + + &--ipc .classification-badge--system { + background: var(--sg-surface-muted); + color: var(--sg-blue-highlight); + } + + &--cpc .classification-card { + background: var(--sg-success-soft); + border-color: var(--sg-border); + } + + &--cpc .classification-badge--system { + background: var(--sg-surface-muted); + color: var(--sg-success); + } + } + + .classification-cards { + display: flex; + flex-direction: column; + gap: 10px; + } + + .classification-card { + padding: 12px 14px; + border-radius: 10px; + border: 1px solid var(--sg-border); + } + + .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: var(--sg-text); + } + + .classification-badge { + display: inline-flex; + align-items: center; + padding: 2px 8px; + border-radius: 999px; + font-size: 0.68rem; + font-weight: 700; + letter-spacing: 0.02em; + text-transform: uppercase; + } + + .classification-badge--level { + background: var(--sg-surface-muted); + color: var(--sg-text-muted); + } + + .classification-summary { + margin: 10px 0 0; + font-size: 0.84rem; + line-height: 1.5; + color: var(--sg-text-muted); + } + + .classification-toggle { + margin-top: 6px; + padding: 0; + border: 0; + background: none; + color: var(--sg-blue-highlight); + font-size: 0.78rem; + cursor: pointer; + + &:hover { + text-decoration: underline; + } + } + + .classification-hierarchy { + margin: 10px 0 0; + padding-top: 10px; + border-top: 1px solid var(--sg-border); + } + + .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: var(--sg-text-muted); - margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.03em; } - .stat-value { - display: block; - font-size: 15px; - font-weight: bold; - color: var(--sg-text); - } - } -} - -.patent-detail-preview { - margin: 14px 0 0; - font-size: 13px; - line-height: 1.55; - color: var(--sg-text-muted); -} - -.patent-detail-action { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - width: 100%; - margin-top: 16px; - padding: 12px 14px; - border: 1px solid var(--sg-border); - border-radius: 10px; - background: var(--sg-surface-soft); - color: var(--sg-blue-highlight); - font-size: 14px; - font-weight: 600; - cursor: pointer; - transition: - border-color 0.15s, - background 0.15s, - box-shadow 0.15s; - - &:hover { - border-color: var(--sg-blue-highlight); - background: var(--sg-primary-soft); - box-shadow: var(--sg-shadow-sm); - } - - .material-icons { - font-size: 20px; - } -} - -.patent-detail-hint { - margin: 8px 0 0; - font-size: 12px; - line-height: 1.4; - color: var(--sg-text-muted); - text-align: center; -} - -.patent-full-detail { - flex: 1; - border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 20px; - background: var(--sg-card-bg); - - h3 { - margin: 0 0 4px 0; - font-size: 16px; - color: var(--sg-text); - line-height: 1.4; - } - - h4 { - margin: 16px 0 8px 0; - font-size: 14px; - color: var(--sg-text-muted); - font-weight: 600; - } - - p { - font-size: 13px; - color: var(--sg-text); - line-height: 1.6; - margin: 0; - } -} - -.back-btn { - display: inline-flex; - align-items: center; - gap: 0.4rem; - - width: auto; - margin-bottom: 1rem; - padding: 0.5rem 0.85rem; - - border: 1px solid var(--sg-border); - border-radius: 999px; - - background: var(--sg-surface-soft); - color: var(--sg-blue-highlight); - - font-size: 0.9rem; - font-weight: 600; - - cursor: pointer; - transition: - background-color 0.15s ease, - border-color 0.15s ease, - color 0.15s ease, - box-shadow 0.15s ease; - - &:hover { - background: var(--sg-primary-soft); - border-color: var(--sg-blue-highlight); - color: var(--sg-blue-highlight); - box-shadow: var(--sg-shadow-sm); - } - - &:focus-visible { - outline: 2px solid var(--sg-blue-highlight); - outline-offset: 2px; - } -} - -.detail-section { - margin-top: 12px; - padding-top: 12px; - border-top: 1px solid var(--sg-border); -} - -.patent-meta { - &--inline { - margin: 12px 0 20px; - } - - &__list { - margin: 0; - border: 1px solid var(--sg-border); - border-radius: 12px; - background: var(--sg-card-bg); - box-shadow: var(--sg-shadow-sm); - overflow: hidden; - } - - &__row { - display: grid; - grid-template-columns: minmax(130px, 38%) 1fr; - gap: 12px 16px; - align-items: center; - padding: 11px 16px; - border-top: 1px solid var(--sg-border); - - &:first-child { - border-top: 0; - } - - dt { - margin: 0; - font-size: 12px; - font-weight: 500; - color: var(--sg-text-muted); - line-height: 1.35; - } - dd { margin: 0; - font-size: 14px; - font-weight: 600; + font-size: 0.8rem; + line-height: 1.45; color: var(--sg-text); - line-height: 1.35; - word-break: break-word; - } - } -} - -.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: var(--sg-primary-soft); - border: 1px solid var(--sg-border); - color: var(--sg-blue-highlight); - font-size: 0.8rem; - line-height: 1.3; -} - -.classification-section { - &--ipc .classification-card { - background: var(--sg-primary-soft); - border-color: var(--sg-border); - } - - &--ipc .classification-badge--system { - background: var(--sg-surface-muted); - color: var(--sg-blue-highlight); - } - - &--cpc .classification-card { - background: var(--sg-success-soft); - border-color: var(--sg-border); - } - - &--cpc .classification-badge--system { - background: var(--sg-surface-muted); - color: var(--sg-success); - } -} - -.classification-cards { - display: flex; - flex-direction: column; - gap: 10px; -} - -.classification-card { - padding: 12px 14px; - border-radius: 10px; - border: 1px solid var(--sg-border); -} - -.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: var(--sg-text); -} - -.classification-badge { - display: inline-flex; - align-items: center; - padding: 2px 8px; - border-radius: 999px; - font-size: 0.68rem; - font-weight: 700; - letter-spacing: 0.02em; - text-transform: uppercase; -} - -.classification-badge--level { - background: var(--sg-surface-muted); - color: var(--sg-text-muted); -} - -.classification-summary { - margin: 10px 0 0; - font-size: 0.84rem; - line-height: 1.5; - color: var(--sg-text-muted); -} - -.classification-toggle { - margin-top: 6px; - padding: 0; - border: 0; - background: none; - color: var(--sg-blue-highlight); - font-size: 0.78rem; - cursor: pointer; - - &:hover { - text-decoration: underline; - } -} - -.classification-hierarchy { - margin: 10px 0 0; - padding-top: 10px; - border-top: 1px solid var(--sg-border); -} - -.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: var(--sg-text-muted); - text-transform: uppercase; - letter-spacing: 0.03em; - } - - dd { - margin: 0; - font-size: 0.8rem; - line-height: 1.45; - color: var(--sg-text); - } -} - -.pagination { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - margin-top: 12px; - - button { - padding: 4px 10px; - border: 1px solid var(--sg-border); - border-radius: 6px; - background: var(--sg-surface); - color: var(--sg-text); - cursor: pointer; - font-size: 12px; - - &:disabled { - opacity: 0.5; - cursor: default; } } - span { - font-size: 12px; - color: var(--sg-text-muted); - } -} + .pagination { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-top: 12px; + + button { + padding: 4px 10px; + border: 1px solid var(--sg-border); + border-radius: 6px; + background: var(--sg-surface); + color: var(--sg-text); + cursor: pointer; + font-size: 12px; + + &:disabled { + opacity: 0.5; + cursor: default; + } + } + + span { + font-size: 12px; + color: var(--sg-text-muted); + } + } \ No newline at end of file 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 532fc1d2..196200d0 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.ts +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.ts @@ -11,6 +11,8 @@ import { getPublicationStageLabel, } from '../patent-detail/patent-detail.utils'; 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'; type SortMode = 'date' | 'title'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; @@ -25,6 +27,7 @@ type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both'; MatFormFieldModule, MatSelectModule, MatIconModule, + QueryParamPaginatorComponent, ], templateUrl: './institution-patents.component.html', styleUrl: './institution-patents.component.scss', @@ -47,8 +50,8 @@ export class InstitutionPatentsComponent implements OnInit { activeMatchType: OrgPatentMatchTypeFilter = 'all'; sortMode: SortMode = 'date'; - selectedPage = 1; - readonly pageSize = 20; + pageIndex = 0; + pageSize = 20; totalPatents = 0; ngOnInit(): void { @@ -59,6 +62,12 @@ export class InstitutionPatentsComponent implements OnInit { const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy'); const matchTypeFromUrl = this.route.snapshot.queryParamMap.get('matchType'); + this.pageIndex = this.parsePageIndexParam( + this.route.snapshot.queryParamMap.get('page'), + ); + this.pageSize = this.parsePageSizeParam( + this.route.snapshot.queryParamMap.get('size'), + ); if (this.isValidFilter(filterFromUrl)) { this.activeFilter = filterFromUrl; @@ -79,7 +88,7 @@ export class InstitutionPatentsComponent implements OnInit { setFilter(filter: SourceFilter): void { this.activeFilter = filter; - this.selectedPage = 1; + this.pageIndex = 0; this.selectedPatent = null; this.reloadPatents(); } @@ -87,7 +96,7 @@ export class InstitutionPatentsComponent implements OnInit { setMatchType(matchType: OrgPatentMatchTypeFilter): void { if (this.activeMatchType === matchType) return; this.activeMatchType = matchType; - this.selectedPage = 1; + this.pageIndex = 0; this.selectedPatent = null; this.reloadPatents(); } @@ -108,8 +117,9 @@ export class InstitutionPatentsComponent implements OnInit { this.router.navigate(['/patent', this.selectedPatent.patent_id]); } - setPage(page: number): void { - this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount()); + onPatentPageChange(event: PageEvent): void { + this.pageIndex = event.pageIndex; + this.pageSize = event.pageSize; this.selectedPatent = null; this.reloadPatents(); } @@ -118,14 +128,6 @@ export class InstitutionPatentsComponent implements OnInit { return this.filteredPatents; } - getPageCount(): number { - return Math.max(1, Math.ceil(this.totalPatents / this.pageSize)); - } - - hasPagination(): boolean { - return this.totalPatents > this.pageSize; - } - private reloadPatents(): void { const institutionId = this.institutionId ?? @@ -145,7 +147,7 @@ export class InstitutionPatentsComponent implements OnInit { institutionId, this.activeMatchType !== 'all' ? this.activeMatchType : undefined, - this.selectedPage - 1, + this.pageIndex, this.pageSize, this.activeFilter !== 'all' ? this.activeFilter : undefined, ) @@ -183,13 +185,24 @@ export class InstitutionPatentsComponent implements OnInit { filter: this.activeFilter, sortBy: this.sortMode, matchType: this.activeMatchType, - page: this.selectedPage, + page: this.pageIndex, + size: this.pageSize, }, queryParamsHandling: 'merge', replaceUrl: true, }); } + private parsePageIndexParam(value: string | null): number { + const parsed = Number(value); + return Number.isInteger(parsed) && parsed >= 0 ? parsed : 0; + } + + private parsePageSizeParam(value: string | null): number { + const parsed = Number(value); + return Number.isInteger(parsed) && parsed > 0 ? parsed : 20; + } + private isValidFilter(value: string | null): value is SourceFilter { return value === 'all' || value === 'EPO' || value === 'USPTO'; } diff --git a/webapp/src/app/modules/person-funding/person-funding.component.html b/webapp/src/app/modules/person-funding/person-funding.component.html index 3aecaaa7..dd70703c 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.html +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -1,5 +1,9 @@ @if (loading) { -

Lade Förderungen...

+ } @else if (error) {

Fehler beim Laden der Förderungen.

} @else if (funders.length === 0) { @@ -41,7 +45,10 @@ Förderer - Publikationen + Publikationen + Erstautor + Mitautor + Letztautor @@ -50,29 +57,35 @@ [class.selected]="selectedFunder === funder" (click)="selectFunder(funder)"> {{ funder.funder_name }} - {{ getPublicationCount(funder) }} + {{ getPublicationCount(funder) }} + + {{ funder.author_position_count.first || 0 }} + + + {{ funder.author_position_count.middle || 0 }} + + + {{ funder.author_position_count.last || 0 }} + } - @if (hasFunderListPagination()) { -
- - Seite {{ selectedFunderListPage }} von - {{ getFunderListPageCount() }} - -
- } + @@ -129,26 +142,12 @@ } - @if (hasPublicationPagination()) { -
- - Seite {{ selectedPublicationPage }} von - {{ getSelectedPublicationPageCount() }} - -
- } + } @else {
diff --git a/webapp/src/app/modules/person-funding/person-funding.component.scss b/webapp/src/app/modules/person-funding/person-funding.component.scss index 898f7007..193743bf 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.scss +++ b/webapp/src/app/modules/person-funding/person-funding.component.scss @@ -3,8 +3,12 @@ color: var(--sg-text-muted); } +app-query-param-paginator { + display: block; + margin-top: 14px; +} + .funding-container { - padding: 16px; display: flex; flex-direction: column; gap: 16px; @@ -35,51 +39,107 @@ table { width: 100%; - border-collapse: collapse; + border-collapse: separate; + border-spacing: 0; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + overflow: hidden; th { text-align: left; - padding: 10px 12px; - border-bottom: 2px solid var(--sg-border); - font-weight: 600; - color: var(--sg-text); + padding: 12px 16px; + background: var(--sg-surface-muted); + border-bottom: 1px solid var(--sg-border); + font-size: 12px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.02em; + color: var(--sg-text-muted); } tr { cursor: pointer; - &.selected { + transition: background-color 0.15s ease; + + &:hover td { + background: rgba(16, 26, 61, 0.04); + } + + &.selected td { background: var(--sg-primary-soft); } + + &:last-child td { + border-bottom: 0; + } } td { - padding: 10px 12px; + padding: 12px 16px; border-bottom: 1px solid var(--sg-border); + color: var(--sg-text); + font-size: 13px; + transition: background-color 0.15s ease; } .funder-name { color: var(--sg-text); - font-weight: 500; + font-weight: 600; } + + .text-center { + text-align: center; + } + } +} + +.position-count-badge { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 26px; + padding: 2px 8px; + border-radius: 999px; + font-size: 12px; + font-weight: 700; + + &--first { + background: #effaf3; + color: #24834f; + } + + &--middle { + background: #f6f0ff; + color: #7255d9; + } + + &--last { + background: #fff1f2; + color: #be123c; } } .funding-detail { width: 440px; border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 20px; - background: var(--sg-surface-muted); + border-radius: var(--sg-radius-sm); + padding: 24px; + background: var(--sg-surface); + box-shadow: var(--sg-shadow-sm); h3 { margin: 0 0 16px; font-size: 16px; + font-weight: 700; color: var(--sg-text); } h4 { - margin: 16px 0 8px; - font-size: 14px; + margin: 20px 0 10px; + font-size: 12px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.02em; color: var(--sg-text-muted); } } @@ -95,7 +155,7 @@ text-align: center; background: var(--sg-surface); border: 1px solid var(--sg-border); - border-radius: 8px; + border-radius: var(--sg-radius-sm); padding: 10px; .stat-label { @@ -173,7 +233,7 @@ list-style: none; padding: 0; margin: 0; - max-height: 300px; + max-height: 320px; overflow-y: auto; li { @@ -208,6 +268,9 @@ font-size: 12px; color: var(--sg-text-muted); } + + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); } .empty-overview { @@ -268,7 +331,7 @@ text-align: center; padding: 12px 8px; border: 1px solid var(--sg-border); - border-radius: 8px; + border-radius: var(--sg-radius-sm); background: var(--sg-surface); } @@ -312,19 +375,37 @@ .publication-more-info { display: inline-flex; align-items: center; - border: 0; - background: transparent; - cursor: pointer; gap: 4px; - margin-top: 6px; - padding: 0; + margin-top: 8px; + padding: 4px 10px; + border: 1px solid var(--sg-border); + border-radius: 999px; + background: var(--sg-surface); + cursor: pointer; text-decoration: none; + transition: all 0.15s ease; + + &:hover, + &:focus-visible { + border-color: #1976d2; + background: rgba(16, 26, 61, 0.04); + outline: none; + } } .publication-item { - padding: 8px 0; - border-bottom: 2px solid var(--sg-border); + padding: 10px 14px; + border-bottom: 1px solid var(--sg-border); cursor: pointer; + transition: background-color 0.15s ease; + + &:last-child { + border-bottom: 0; + } + + &:hover { + background: rgba(16, 26, 61, 0.04); + } } .publication-title { @@ -342,7 +423,7 @@ .mehr-infos-label { font-size: 0.8rem; - font-weight: 500; + font-weight: 600; } .publication-link-icon { diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index e86450b8..57684111 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -5,7 +5,10 @@ import { Router } from '@angular/router'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatSelectModule } from '@angular/material/select'; import { MatIconModule } from '@angular/material/icon'; +import { PageEvent } from '@angular/material/paginator'; import { FundingService } from '../../api'; +import { LoadingComponent } from '../../shared/ui/loading/loading.component'; +import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; type SortMode = 'name' | 'top'; type AuthorPosition = 'first' | 'middle' | 'last' | 'unknown'; @@ -26,6 +29,8 @@ type FundingPublicationDetail = { MatFormFieldModule, MatSelectModule, MatIconModule, + LoadingComponent, + QueryParamPaginatorComponent, ], templateUrl: './person-funding.component.html', styleUrl: './person-funding.component.scss', @@ -35,16 +40,18 @@ export class PersonFundingComponent implements OnInit { private router = inject(Router); private fundingApi = inject(FundingService); private initialSelectedFunderKey: string | null = null; - private initialPublicationPage = 1; - private initialFunderListPage = 1; + private initialFunderPageIndex = 0; + private initialFunderPageSize = 10; + private initialPublicationPageIndex = 0; + private initialPublicationPageSize = 10; funders: any[] = []; filteredFunders: any[] = []; selectedFunder: any = null; - selectedFunderListPage = 1; - selectedPublicationPage = 1; - readonly funderListPageSize = 10; - readonly publicationPageSize = 10; + funderPageIndex = 0; + funderPageSize = 10; + publicationPageIndex = 0; + publicationPageSize = 10; activeFilter: 'all' | 'first' | 'middle' | 'last' = 'all'; sortMode: SortMode = 'name'; loading = true; @@ -58,13 +65,18 @@ export class PersonFundingComponent implements OnInit { const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy'); this.initialSelectedFunderKey = this.route.snapshot.queryParamMap.get('funder'); - this.initialPublicationPage = this.parsePageParam( - this.route.snapshot.queryParamMap.get('publicationPage') ?? - this.route.snapshot.queryParamMap.get('page'), - ); - this.initialFunderListPage = this.parsePageParam( + this.initialFunderPageIndex = this.parsePageIndexParam( this.route.snapshot.queryParamMap.get('funderPage'), ); + this.initialFunderPageSize = this.parsePageSizeParam( + this.route.snapshot.queryParamMap.get('funderSize'), + ); + this.initialPublicationPageIndex = this.parsePageIndexParam( + this.route.snapshot.queryParamMap.get('pubPage'), + ); + this.initialPublicationPageSize = this.parsePageSizeParam( + this.route.snapshot.queryParamMap.get('pubSize'), + ); if (this.isValidFilter(filterFromUrl)) { this.activeFilter = filterFromUrl; } @@ -77,9 +89,11 @@ export class PersonFundingComponent implements OnInit { next: (result: any) => { this.funders = result.funders ?? []; this.applyFilter(); - this.selectedFunderListPage = this.clampPage( - this.initialFunderListPage, - this.getFunderListPageCount(), + this.funderPageSize = this.initialFunderPageSize; + this.funderPageIndex = this.clampPageIndex( + this.initialFunderPageIndex, + this.funderPageSize, + this.filteredFunders.length, ); this.restoreSelectedFunderFromUrl(); this.loading = false; @@ -95,7 +109,7 @@ export class PersonFundingComponent implements OnInit { selectFunder(funder: any): void { this.selectedFunder = funder; - this.selectedPublicationPage = 1; + this.publicationPageIndex = 0; this.updateQueryParams(); } @@ -111,10 +125,20 @@ export class PersonFundingComponent implements OnInit { this.updateQueryParams(); } + onFunderPageChange(event: PageEvent): void { + this.funderPageIndex = event.pageIndex; + this.funderPageSize = event.pageSize; + } + + onPublicationPageChange(event: PageEvent): void { + this.publicationPageIndex = event.pageIndex; + this.publicationPageSize = event.pageSize; + } + private applyFilter(): void { this.selectedFunder = null; - this.selectedFunderListPage = 1; - this.selectedPublicationPage = 1; + this.funderPageIndex = 0; + this.publicationPageIndex = 0; let funders: any[]; if (this.activeFilter === 'all') { funders = this.funders; @@ -143,12 +167,13 @@ export class PersonFundingComponent implements OnInit { this.getFunderKey(funder) === this.getFunderKey(matchedFunder), ); if (matchedIndex >= 0) { - this.selectedFunderListPage = - Math.floor(matchedIndex / this.funderListPageSize) + 1; + this.funderPageIndex = Math.floor(matchedIndex / this.funderPageSize); } - this.selectedPublicationPage = this.clampPublicationPage( - this.initialPublicationPage, - this.getPublicationPageCountForFunder(matchedFunder), + this.publicationPageSize = this.initialPublicationPageSize; + this.publicationPageIndex = this.clampPageIndex( + this.initialPublicationPageIndex, + this.publicationPageSize, + this.getPublicationIds(matchedFunder).length, ); this.updateQueryParams(); } else { @@ -165,10 +190,10 @@ export class PersonFundingComponent implements OnInit { funder: this.selectedFunder ? this.getFunderKey(this.selectedFunder) : null, - publicationPage: this.selectedFunder - ? this.selectedPublicationPage - : null, - funderPage: this.selectedFunderListPage, + funderPage: this.funderPageIndex, + funderSize: this.funderPageSize, + pubPage: this.selectedFunder ? this.publicationPageIndex : null, + pubSize: this.selectedFunder ? this.publicationPageSize : null, }, queryParamsHandling: 'merge', replaceUrl: true, @@ -214,61 +239,29 @@ export class PersonFundingComponent implements OnInit { } getPagedFunders(): any[] { - const startIndex = - (this.selectedFunderListPage - 1) * this.funderListPageSize; + const startIndex = this.funderPageIndex * this.funderPageSize; return this.filteredFunders.slice( startIndex, - startIndex + this.funderListPageSize, + startIndex + this.funderPageSize, ); } - hasFunderListPagination(): boolean { - return this.getFunderListPageCount() > 1; - } - - getFunderListPageCount(): number { - return Math.max( - 1, - Math.ceil(this.filteredFunders.length / this.funderListPageSize), - ); - } - - setFunderListPage(page: number): void { - this.selectedFunderListPage = this.clampPage( - page, - this.getFunderListPageCount(), - ); - this.updateQueryParams(); - } - getSelectedPublicationIdsPage(): string[] { if (!this.selectedFunder) { return []; } const allPublicationIds = this.getPublicationIds(this.selectedFunder); - const startIndex = - (this.selectedPublicationPage - 1) * this.publicationPageSize; + const startIndex = this.publicationPageIndex * this.publicationPageSize; return allPublicationIds.slice( startIndex, startIndex + this.publicationPageSize, ); } - hasPublicationPagination(): boolean { - return this.getSelectedPublicationPageCount() > 1; - } - - getSelectedPublicationPageCount(): number { - if (!this.selectedFunder) { - return 1; - } - return this.getPublicationPageCountForFunder(this.selectedFunder); - } - - setPublicationPage(page: number): void { - const totalPages = this.getSelectedPublicationPageCount(); - this.selectedPublicationPage = this.clampPublicationPage(page, totalPages); - this.updateQueryParams(); + getSelectedPublicationTotal(): number { + return this.selectedFunder + ? this.getPublicationIds(this.selectedFunder).length + : 0; } getPositionLabel(position: string): string { @@ -301,11 +294,6 @@ export class PersonFundingComponent implements OnInit { return allIds.size; } - private getPublicationPageCountForFunder(funder: any): number { - const publicationCount = this.getPublicationIds(funder).length; - return Math.max(1, Math.ceil(publicationCount / this.publicationPageSize)); - } - private sortFunders(funders: any[]): any[] { const sortedFunders = [...funders]; return sortedFunders.sort((first, second) => { @@ -329,21 +317,25 @@ export class PersonFundingComponent implements OnInit { return funder.funder_name ?? ''; } - private clampPublicationPage(page: number, totalPages: number): number { - return this.clampPage(page, totalPages); + private clampPageIndex( + pageIndex: number, + pageSize: number, + total: number, + ): number { + const maxIndex = Math.max(0, Math.ceil(total / pageSize) - 1); + return Math.min(Math.max(pageIndex, 0), maxIndex); } - private clampPage(page: number, totalPages: number): number { - return Math.min(Math.max(page, 1), totalPages); - } - - private parsePageParam(value: string | null): number { + private parsePageIndexParam(value: string | null): number { const parsed = Number(value); - if (!Number.isInteger(parsed) || parsed < 1) { - return 1; - } - return parsed; + return Number.isInteger(parsed) && parsed >= 0 ? parsed : 0; } + + private parsePageSizeParam(value: string | null): number { + const parsed = Number(value); + return Number.isInteger(parsed) && parsed > 0 ? parsed : 10; + } + getPublicationTitle(publicationId: string): string { const detailTitle = this.getPublicationDetail(publicationId)?.title; if (detailTitle) return detailTitle; diff --git a/webapp/src/app/modules/person-patents/person-patents.component.html b/webapp/src/app/modules/person-patents/person-patents.component.html index 7ae54317..398004ef 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.html +++ b/webapp/src/app/modules/person-patents/person-patents.component.html @@ -46,6 +46,8 @@ Patent Quelle Jahr + Erfinder + Anmelder @@ -68,26 +70,23 @@ {{ patent.publication_year ?? '-' }} + + {{ getInventorsLabel(patent) }} + + + {{ getAssigneesLabel(patent) }} + } - @if (hasPagination()) { - - } +
@if (selectedPatent) { diff --git a/webapp/src/app/modules/person-patents/person-patents.component.scss b/webapp/src/app/modules/person-patents/person-patents.component.scss index ff872bad..6dcc61f9 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.scss +++ b/webapp/src/app/modules/person-patents/person-patents.component.scss @@ -4,12 +4,16 @@ } .patents-container { - padding: 16px; display: flex; flex-direction: column; gap: 16px; } +app-query-param-paginator { + display: block; + margin-top: 14px; +} + .patents-toolbar-field { width: fit-content; min-width: 180px; @@ -39,18 +43,27 @@ table { width: 100%; - border-collapse: collapse; + border-collapse: separate; + border-spacing: 0; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + overflow: hidden; th { text-align: left; - padding: 10px 12px; - border-bottom: 2px solid var(--sg-border); - font-weight: 600; - color: var(--sg-text); + padding: 12px 16px; + background: var(--sg-surface-muted); + border-bottom: 1px solid var(--sg-border); + font-size: 12px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.02em; + color: var(--sg-text-muted); } tr { cursor: pointer; + transition: background-color 0.15s ease; &:hover { background: var(--sg-surface-soft); @@ -58,542 +71,569 @@ &.selected { background: var(--sg-primary-soft); + + &:hover td { + background: rgba(16, 26, 61, 0.04); + } + + &.selected td { + background: var(--sg-primary-soft); + } + + &:last-child td { + border-bottom: 0; + } + } + + td { + padding: 12px 16px; + border-bottom: 1px solid var(--sg-border); + color: var(--sg-text); + font-size: 13px; + transition: background-color 0.15s ease; + } + + .patent-title { + color: var(--sg-text); + font-weight: 600; + max-width: 400px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .patent-people { + max-width: 220px; + color: var(--sg-text-muted); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } } - - td { - padding: 10px 12px; - border-bottom: 1px solid var(--sg-border); - } - - .patent-title { - color: var(--sg-text); - font-weight: 500; - max-width: 400px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - } -} - -.match-badges { - display: flex; - flex-wrap: wrap; - gap: 4px; - margin-top: 4px; -} - -.match-badge { - display: inline-flex; - align-items: center; - padding: 2px 8px; - border-radius: 999px; - background: var(--sg-surface-muted); - border: 1px solid var(--sg-border); - color: var(--sg-text-muted); - font-size: 0.68rem; - font-weight: 600; - - &--signal { - padding: 4px 10px; - font-size: 0.75rem; - background: var(--sg-success-soft); - border-color: var(--sg-success); - color: var(--sg-success); - } -} - -.match-badges--detail { - margin-top: 14px; - gap: 6px; -} - -.source-badge { - display: inline-flex; - align-items: center; - padding: 3px 10px; - border-radius: 999px; - font-size: 0.75rem; - font-weight: 700; - - &--epo { - background: var(--sg-success-soft); - color: var(--sg-success); - border: 1px solid var(--sg-success); } - &--uspto { - background: var(--sg-primary-soft); - color: var(--sg-blue-highlight); - border: 1px solid var(--sg-border); - } -} - -.patent-detail { - width: 440px; - border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 20px; - background: var(--sg-surface-muted); - - &.empty { + .match-badges { display: flex; + flex-wrap: wrap; + gap: 4px; + margin-top: 4px; + } + + .match-badge { + display: inline-flex; align-items: center; - justify-content: center; - color: var(--sg-text-soft); - min-height: 200px; + padding: 2px 8px; + border-radius: 999px; + background: var(--sg-surface-muted); + border: 1px solid var(--sg-border); + color: var(--sg-text-muted); + font-size: 0.68rem; + font-weight: 600; + + &--signal { + padding: 4px 10px; + font-size: 0.75rem; + background: var(--sg-success-soft); + border-color: var(--sg-success); + color: var(--sg-success); + } } - &.overview { - display: flex; - flex-direction: column; - gap: 12px; + .match-badges--detail { + margin-top: 14px; + gap: 6px; + } - .overview-title { - font-size: 15px; - font-weight: 600; - color: var(--sg-text); - margin: 0; + .source-badge { + display: inline-flex; + align-items: center; + padding: 3px 10px; + border-radius: 999px; + font-size: 0.75rem; + font-weight: 700; + + &--epo { + background: var(--sg-success-soft); + color: var(--sg-success); + border: 1px solid var(--sg-success); } - .overview-subtitle { - font-size: 13px; - color: var(--sg-text-muted); - margin: 0; - } - - .overview-stats { - display: grid; - grid-template-columns: 1fr 1fr 1fr; - gap: 10px; - margin-top: 4px; - } - - .overview-stat { - background: var(--sg-surface); + &--uspto { + background: var(--sg-primary-soft); + color: var(--sg-blue-highlight); border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 12px 8px; - text-align: center; + } + } - .overview-value { - display: block; - font-size: 22px; + .patent-detail { + width: 440px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + padding: 24px; + background: var(--sg-surface); + box-shadow: var(--sg-shadow-sm); + + &.empty { + display: flex; + align-items: center; + justify-content: center; + color: var(--sg-text-muted); + min-height: 200px; + } + + &.overview { + display: flex; + flex-direction: column; + gap: 12px; + + .overview-title { + font-size: 15px; font-weight: 700; color: var(--sg-text); + margin: 0; } - .overview-label { - display: block; - font-size: 12px; + .overview-subtitle { + font-size: 13px; color: var(--sg-text-muted); + margin: 0; + } + + .overview-stats { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: 10px; margin-top: 4px; } - &--total { - .overview-value, + .overview-stat { + background: var(--sg-surface); + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + padding: 12px 8px; + text-align: center; + + .overview-value { + display: block; + font-size: 22px; + font-weight: 700; + color: var(--sg-text); + } + .overview-label { - color: var(--sg-warning); + display: block; + font-size: 12px; + color: var(--sg-text-muted); + margin-top: 4px; + } + + &--total { + + .overview-value, + .overview-label { + color: var(--sg-warning); + } + } + + &--epo { + + .overview-value, + .overview-label { + color: var(--sg-success); + } + } + + &--uspto { + + .overview-value, + .overview-label { + color: var(--sg-blue-highlight); + } } } - &--epo { - .overview-value, - .overview-label { - color: var(--sg-success); - } - } - - &--uspto { - .overview-value, - .overview-label { - color: var(--sg-blue-highlight); - } + .overview-hint { + font-size: 12px; + color: var(--sg-text-muted); + margin: 0; } } - .overview-hint { - font-size: 12px; - color: var(--sg-text-soft); + h3 { + margin: 0 0 16px 0; + font-size: 16px; + font-weight: 700; + color: var(--sg-text); + line-height: 1.4; + } + } + + .detail-stats { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 10px; + + .stat { + background: var(--sg-surface); + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + padding: 10px; + text-align: center; + + .stat-label { + display: block; + font-size: 11px; + color: var(--sg-text-muted); + margin-bottom: 4px; + text-transform: uppercase; + letter-spacing: 0.03em; + } + + .stat-value { + display: block; + font-size: 15px; + font-weight: bold; + color: var(--sg-text); + } + } + } + + .patent-detail-preview { + margin: 14px 0 0; + font-size: 13px; + line-height: 1.55; + color: var(--sg-text-muted); + } + + .patent-detail-action { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + width: 100%; + margin-top: 16px; + padding: 12px 14px; + border: 1px solid var(--sg-border); + border-radius: 10px; + background: var(--sg-primary-soft); + color: var(--sg-blue-highlight); + font-size: 14px; + font-weight: 600; + cursor: pointer; + transition: + border-color 0.15s, + background 0.15s, + box-shadow 0.15s; + + &:hover { + border-color: var(--sg-blue-highlight); + background: var(--sg-surface-soft); + box-shadow: var(--sg-shadow-sm); + } + + mat-icon { + font-size: 20px; + } + } + + .patent-detail-hint { + margin: 8px 0 0; + font-size: 12px; + line-height: 1.4; + color: var(--sg-text-muted); + text-align: center; + } + + .patent-full-detail { + flex: 1; + border: 1px solid var(--sg-border); + border-radius: 8px; + padding: 20px; + background: var(--sg-surface-muted); + + h3 { + margin: 0 0 4px 0; + font-size: 16px; + color: var(--sg-text); + line-height: 1.4; + } + + h4 { + margin: 16px 0 8px 0; + font-size: 14px; + color: var(--sg-text-muted); + font-weight: 600; + } + + p { + font-size: 13px; + color: var(--sg-text); + line-height: 1.6; margin: 0; } } - h3 { - margin: 0 0 16px 0; - font-size: 16px; - color: var(--sg-text); - line-height: 1.4; - } -} + .back-btn { + display: inline-flex; + align-items: center; + gap: 0.4rem; -.detail-stats { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 10px; + width: auto; + margin-bottom: 1rem; + padding: 0.5rem 0.85rem; - .stat { - background: var(--sg-surface); border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 10px; - text-align: center; + border-radius: 999px; - .stat-label { - display: block; - font-size: 11px; + background: var(--sg-surface-soft); + color: var(--sg-blue-highlight); + + font-size: 0.9rem; + font-weight: 600; + + cursor: pointer; + transition: + background-color 0.15s ease, + border-color 0.15s ease, + color 0.15s ease, + box-shadow 0.15s ease; + + &:hover { + background: var(--sg-primary-soft); + border-color: var(--sg-blue-highlight); + box-shadow: var(--sg-shadow-sm); + } + + &:focus-visible { + outline: 2px solid var(--sg-card-hover-border); + outline-offset: 2px; + } + } + + .detail-section { + margin-top: 12px; + padding-top: 12px; + border-top: 1px solid var(--sg-border); + } + + .patent-meta { + &--inline { + margin: 12px 0 20px; + } + + &__list { + margin: 0; + border: 1px solid var(--sg-border); + border-radius: 12px; + background: var(--sg-surface); + box-shadow: var(--sg-shadow-sm); + overflow: hidden; + } + + &__row { + display: grid; + grid-template-columns: minmax(130px, 38%) 1fr; + gap: 12px 16px; + align-items: center; + padding: 11px 16px; + border-top: 1px solid var(--sg-border); + + &:first-child { + border-top: 0; + } + + dt { + margin: 0; + font-size: 12px; + font-weight: 500; + color: var(--sg-text-muted); + line-height: 1.35; + } + + dd { + margin: 0; + font-size: 14px; + font-weight: 600; + color: var(--sg-text); + line-height: 1.35; + word-break: break-word; + } + } + } + + .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: var(--sg-primary-soft); + border: 1px solid var(--sg-border); + color: var(--sg-blue-highlight); + font-size: 0.8rem; + line-height: 1.3; + } + + .classification-section { + &--ipc .classification-card { + background: var(--sg-primary-soft); + border-color: var(--sg-border); + } + + &--ipc .classification-badge--system { + background: var(--sg-primary-soft); + color: var(--sg-blue-highlight); + } + + &--cpc .classification-card { + background: var(--sg-success-soft); + border-color: var(--sg-success); + } + + &--cpc .classification-badge--system { + background: var(--sg-success-soft); + color: var(--sg-success); + } + } + + .classification-cards { + display: flex; + flex-direction: column; + gap: 10px; + } + + .classification-card { + padding: 12px 14px; + border-radius: 10px; + border: 1px solid var(--sg-border); + } + + .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: var(--sg-text); + } + + .classification-badge { + display: inline-flex; + align-items: center; + padding: 2px 8px; + border-radius: 999px; + font-size: 0.68rem; + font-weight: 700; + letter-spacing: 0.02em; + text-transform: uppercase; + } + + .classification-badge--level { + background: var(--sg-surface-soft); + color: var(--sg-text-muted); + } + + .classification-summary { + margin: 10px 0 0; + font-size: 0.84rem; + line-height: 1.5; + color: var(--sg-text-muted); + } + + .classification-toggle { + margin-top: 6px; + padding: 0; + border: 0; + background: none; + color: var(--sg-blue-highlight); + font-size: 0.78rem; + cursor: pointer; + + &:hover { + text-decoration: underline; + } + } + + .classification-hierarchy { + margin: 10px 0 0; + padding-top: 10px; + border-top: 1px solid var(--sg-border); + } + + .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: var(--sg-text-muted); - margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.03em; } - .stat-value { - display: block; - font-size: 15px; - font-weight: bold; - color: var(--sg-text); - } - } -} - -.patent-detail-preview { - margin: 14px 0 0; - font-size: 13px; - line-height: 1.55; - color: var(--sg-text-muted); -} - -.patent-detail-action { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - width: 100%; - margin-top: 16px; - padding: 12px 14px; - border: 1px solid var(--sg-border); - border-radius: 10px; - background: var(--sg-primary-soft); - color: var(--sg-blue-highlight); - font-size: 14px; - font-weight: 600; - cursor: pointer; - transition: - border-color 0.15s, - background 0.15s, - box-shadow 0.15s; - - &:hover { - border-color: var(--sg-blue-highlight); - background: var(--sg-surface-soft); - box-shadow: var(--sg-shadow-sm); - } - - mat-icon { - font-size: 20px; - } -} - -.patent-detail-hint { - margin: 8px 0 0; - font-size: 12px; - line-height: 1.4; - color: var(--sg-text-muted); - text-align: center; -} - -.patent-full-detail { - flex: 1; - border: 1px solid var(--sg-border); - border-radius: 8px; - padding: 20px; - background: var(--sg-surface-muted); - - h3 { - margin: 0 0 4px 0; - font-size: 16px; - color: var(--sg-text); - line-height: 1.4; - } - - h4 { - margin: 16px 0 8px 0; - font-size: 14px; - color: var(--sg-text-muted); - font-weight: 600; - } - - p { - font-size: 13px; - color: var(--sg-text); - line-height: 1.6; - margin: 0; - } -} - -.back-btn { - display: inline-flex; - align-items: center; - gap: 0.4rem; - - width: auto; - margin-bottom: 1rem; - padding: 0.5rem 0.85rem; - - border: 1px solid var(--sg-border); - border-radius: 999px; - - background: var(--sg-surface-soft); - color: var(--sg-blue-highlight); - - font-size: 0.9rem; - font-weight: 600; - - cursor: pointer; - transition: - background-color 0.15s ease, - border-color 0.15s ease, - color 0.15s ease, - box-shadow 0.15s ease; - - &:hover { - background: var(--sg-primary-soft); - border-color: var(--sg-blue-highlight); - box-shadow: var(--sg-shadow-sm); - } - - &:focus-visible { - outline: 2px solid var(--sg-card-hover-border); - outline-offset: 2px; - } -} - -.detail-section { - margin-top: 12px; - padding-top: 12px; - border-top: 1px solid var(--sg-border); -} - -.patent-meta { - &--inline { - margin: 12px 0 20px; - } - - &__list { - margin: 0; - border: 1px solid var(--sg-border); - border-radius: 12px; - background: var(--sg-surface); - box-shadow: var(--sg-shadow-sm); - overflow: hidden; - } - - &__row { - display: grid; - grid-template-columns: minmax(130px, 38%) 1fr; - gap: 12px 16px; - align-items: center; - padding: 11px 16px; - border-top: 1px solid var(--sg-border); - - &:first-child { - border-top: 0; - } - - dt { - margin: 0; - font-size: 12px; - font-weight: 500; - color: var(--sg-text-muted); - line-height: 1.35; - } - dd { margin: 0; - font-size: 14px; - font-weight: 600; + font-size: 0.8rem; + line-height: 1.45; color: var(--sg-text); - line-height: 1.35; - word-break: break-word; - } - } -} - -.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: var(--sg-primary-soft); - border: 1px solid var(--sg-border); - color: var(--sg-blue-highlight); - font-size: 0.8rem; - line-height: 1.3; -} - -.classification-section { - &--ipc .classification-card { - background: var(--sg-primary-soft); - border-color: var(--sg-border); - } - - &--ipc .classification-badge--system { - background: var(--sg-primary-soft); - color: var(--sg-blue-highlight); - } - - &--cpc .classification-card { - background: var(--sg-success-soft); - border-color: var(--sg-success); - } - - &--cpc .classification-badge--system { - background: var(--sg-success-soft); - color: var(--sg-success); - } -} - -.classification-cards { - display: flex; - flex-direction: column; - gap: 10px; -} - -.classification-card { - padding: 12px 14px; - border-radius: 10px; - border: 1px solid var(--sg-border); -} - -.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: var(--sg-text); -} - -.classification-badge { - display: inline-flex; - align-items: center; - padding: 2px 8px; - border-radius: 999px; - font-size: 0.68rem; - font-weight: 700; - letter-spacing: 0.02em; - text-transform: uppercase; -} - -.classification-badge--level { - background: var(--sg-surface-soft); - color: var(--sg-text-muted); -} - -.classification-summary { - margin: 10px 0 0; - font-size: 0.84rem; - line-height: 1.5; - color: var(--sg-text-muted); -} - -.classification-toggle { - margin-top: 6px; - padding: 0; - border: 0; - background: none; - color: var(--sg-blue-highlight); - font-size: 0.78rem; - cursor: pointer; - - &:hover { - text-decoration: underline; - } -} - -.classification-hierarchy { - margin: 10px 0 0; - padding-top: 10px; - border-top: 1px solid var(--sg-border); -} - -.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: var(--sg-text-muted); - text-transform: uppercase; - letter-spacing: 0.03em; - } - - dd { - margin: 0; - font-size: 0.8rem; - line-height: 1.45; - color: var(--sg-text); - } -} - -.pagination { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - margin-top: 12px; - - button { - padding: 4px 10px; - border: 1px solid var(--sg-border); - border-radius: 6px; - background: var(--sg-surface); - cursor: pointer; - font-size: 12px; - - &:disabled { - opacity: 0.5; - cursor: default; } } - span { - font-size: 12px; - color: var(--sg-text-muted); - } -} + .pagination { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-top: 12px; + + button { + padding: 4px 10px; + border: 1px solid var(--sg-border); + border-radius: 6px; + background: var(--sg-surface); + cursor: pointer; + font-size: 12px; + + &:disabled { + opacity: 0.5; + cursor: default; + } + } + + span { + font-size: 12px; + color: var(--sg-text-muted); + } + } \ No newline at end of file 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 9e837060..ece9c4dd 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.ts +++ b/webapp/src/app/modules/person-patents/person-patents.component.ts @@ -13,6 +13,8 @@ import { getPublicationStageLabel, } from '../patent-detail/patent-detail.utils'; 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'; type SortMode = 'date' | 'title'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; @@ -25,6 +27,7 @@ type SourceFilter = 'all' | 'EPO' | 'USPTO'; MatFormFieldModule, MatSelectModule, MatIconModule, + QueryParamPaginatorComponent, ], templateUrl: './person-patents.component.html', styleUrl: './person-patents.component.scss', @@ -45,12 +48,18 @@ export class PersonPatentsComponent { activeFilter: SourceFilter = 'all'; sortMode: SortMode = 'date'; - selectedPage = 1; - readonly pageSize = 10; + pageIndex = 0; + pageSize = 10; constructor() { const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy'); + this.pageIndex = this.parsePageIndexParam( + this.route.snapshot.queryParamMap.get('page'), + ); + this.pageSize = this.parsePageSizeParam( + this.route.snapshot.queryParamMap.get('size'), + ); if (this.isValidFilter(filterFromUrl)) { this.activeFilter = filterFromUrl; @@ -93,12 +102,17 @@ export class PersonPatentsComponent { setFilter(filter: SourceFilter): void { this.activeFilter = filter; - this.selectedPage = 1; + this.pageIndex = 0; this.selectedPatent = null; this.applyFilter(); this.updateQueryParams(); } + onPatentPageChange(event: PageEvent): void { + this.pageIndex = event.pageIndex; + this.pageSize = event.pageSize; + } + setSortMode(sortMode: SortMode): void { this.sortMode = sortMode; this.applyFilter(); @@ -144,12 +158,24 @@ export class PersonPatentsComponent { queryParams: { filter: this.activeFilter, sortBy: this.sortMode, + page: this.pageIndex, + size: this.pageSize, }, queryParamsHandling: 'merge', replaceUrl: true, }); } + private parsePageIndexParam(value: string | null): number { + const parsed = Number(value); + return Number.isInteger(parsed) && parsed >= 0 ? parsed : 0; + } + + private parsePageSizeParam(value: string | null): number { + const parsed = Number(value); + return Number.isInteger(parsed) && parsed > 0 ? parsed : 10; + } + private isValidFilter(value: string | null): value is SourceFilter { return value === 'all' || value === 'EPO' || value === 'USPTO'; } @@ -159,21 +185,16 @@ export class PersonPatentsComponent { } getPagedPatents(): PatentEntry[] { - const start = (this.selectedPage - 1) * this.pageSize; + const start = this.pageIndex * this.pageSize; return this.filteredPatents.slice(start, start + this.pageSize); } - getPageCount(): number { - return Math.max(1, Math.ceil(this.filteredPatents.length / this.pageSize)); + getInventorsLabel(patent: PatentEntry): string { + return patent.inventors?.length ? patent.inventors.join(', ') : '-'; } - hasPagination(): boolean { - return this.getPageCount() > 1; - } - - setPage(page: number): void { - this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount()); - this.updateQueryParams(); + getAssigneesLabel(patent: PatentEntry): string { + return patent.assignees?.length ? patent.assignees.join(', ') : '-'; } formatDate(date: string | null | undefined): string { 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 ddcf6478..637356fa 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 @@ -77,6 +77,20 @@ work Projekte + @if (hasPatents()) { + + verified + Patente + + } diff --git a/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.ts b/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.ts index aaae7e50..8f515049 100644 --- a/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.ts +++ b/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.ts @@ -1,5 +1,13 @@ -import { Component, computed, input } from '@angular/core'; +import { + Component, + computed, + effect, + inject, + input, + signal, +} from '@angular/core'; import { Institution } from '../../../api'; +import { PatentsService } from '../../../api/api/patents.service'; import { MatCardModule } from '@angular/material/card'; import { RouterModule } from '@angular/router'; import { MatDividerModule } from '@angular/material/divider'; @@ -15,12 +23,14 @@ import { DecimalPipe } from '@angular/common'; MatDividerModule, MatIconModule, MatButtonModule, - DecimalPipe + DecimalPipe, ], templateUrl: './app-institution-card.component.html', styleUrl: './app-institution-card.component.scss', }) export class AppInstitutionCardComponent { + private readonly patentsApi = inject(PatentsService); + institution = input.required(); displayName = computed(() => { @@ -33,6 +43,29 @@ export class AppInstitutionCardComponent { return 'Unbekannte Institution'; }); + // The "Patente" action only makes sense once org_patents has been indexed + // for this institution (currently a manual, per-institution process), so + // it's hidden by default and only shown once a cheap count check confirms + // there is actually data behind it. + private readonly hasPatentsSignal = signal(false); + hasPatents = this.hasPatentsSignal.asReadonly(); + + constructor() { + effect(() => { + const id = this.stripOpenAlexId(this.institution().id); + this.hasPatentsSignal.set(false); + if (!id) return; + + this.patentsApi + .getOrgPatentsByInstitution(id, undefined, 0, 0) + .subscribe({ + next: (result) => { + this.hasPatentsSignal.set((result.patent_count ?? 0) > 0); + }, + }); + }); + } + stripOpenAlexId(id: string | null | undefined): string | undefined { if (!id) { return undefined;