From ae2230ff0e82d9665e6da52dcfb6eea1d87ecdc9 Mon Sep 17 00:00:00 2001 From: genja Date: Sat, 15 Aug 2026 22:19:42 +0200 Subject: [PATCH] moved dfg classification hierarchy to separated component --- .../dfg-details/dfg-details.component.html | 39 +------- .../dfg-details/dfg-details.component.scss | 50 ---------- .../dfg-details/dfg-details.component.ts | 23 +---- .../dfg-classification.component.html | 29 ++++++ .../dfg-classification.component.scss | 97 +++++++++++++++++++ .../dfg-classification.component.ts | 29 ++++++ 6 files changed, 161 insertions(+), 106 deletions(-) create mode 100644 webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.html create mode 100644 webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.scss create mode 100644 webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.ts diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html index 8d6c9db9..19c3c6cc 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html @@ -138,41 +138,10 @@ } @if (getSubjectClassifications().length > 0) { - -
- category -

Fachsystematik

- {{ - getSubjectClassifications().length - }} -
-
- @for (entry of getSubjectClassifications(); track $index) { -
- @for ( - segment of getClassificationParentSegments(entry); - track $index - ) { - {{ segment }} - chevron_right - } -
- @for ( - leaf of getClassificationLeafSegments(entry); - track $index - ) { - - {{ leaf }} - - } -
-
- } -
-
+ } diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss index 68d5ae71..d4a9a328 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss @@ -473,56 +473,6 @@ h1 { color: var(--sg-text-muted); } -.classification-list { - display: flex; - flex-direction: column; - gap: 10px; - padding: 16px 20px 20px; -} - -.classification-path { - display: flex; - align-items: center; - flex-wrap: wrap; - gap: 4px 2px; - padding: 10px 12px; - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - background: var(--sg-surface); -} - -.classification-segment { - font-size: 12px; - line-height: 1.3; - padding: 3px 10px; - border-radius: 10px; - background: var(--sg-surface-soft); - color: var(--sg-text-muted); - white-space: nowrap; - - &--leaf { - background: var(--sg-primary-soft); - color: var(--sg-text); - font-weight: 500; - white-space: normal; - } -} - -.classification-leaf-group { - display: flex; - flex-wrap: wrap; - gap: 4px; -} - -.classification-separator { - width: 16px; - height: 16px; - font-size: 16px; - color: var(--sg-text-muted); - flex-shrink: 0; - opacity: 0.5; -} - .website-html { padding: 16px 20px 20px; font-size: 14px; diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts index 7b72ac75..2c4eda17 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts @@ -10,7 +10,7 @@ import { DfgProjectInstitutionRole } from '../../../api/model/dfgProjectInstitut import { DfgProjectPersonRole } from '../../../api/model/dfgProjectPersonRole'; import { DFGProjectFachgebieteInner } from '../../../api/model/dFGProjectFachgebieteInner'; import { ProjectOaTopicsComponent } from '../../../shared/ui/project-oa-topics/project-oa-topics.component'; - +import { DfgClassificationComponent } from '../../../shared/ui/dfg-classification/dfg-classification.component'; @Component({ selector: 'app-dfg-details', standalone: true, @@ -19,6 +19,7 @@ import { ProjectOaTopicsComponent } from '../../../shared/ui/project-oa-topics/p MatCardModule, MatIconModule, ProjectOaTopicsComponent, + DfgClassificationComponent, ], templateUrl: './dfg-details.component.html', styleUrl: './dfg-details.component.scss', @@ -154,29 +155,9 @@ export class DfgDetailsComponent implements OnInit { this.getInstitutionsList().length ); } - - //(DFG Fachsystematik) - getSubjectClassifications(): DFGProjectFachgebieteInner[] { return this.dfgProject?.subject_classifications ?? []; } - - getClassificationParentSegments(entry: DFGProjectFachgebieteInner): string[] { - return [ - entry.wissenschaftsbereich, - entry.fachkollegium, - entry.fachgebiet, - ].filter((part): part is string => !!part); - } - - getClassificationLeafSegments(entry: DFGProjectFachgebieteInner): string[] { - if (!entry.fach) return []; - return entry.fach - .split(',') - .map((s) => s.trim()) - .filter((s) => !!s); - } - // --- Subprojects & publications --- getSubprojects(): DfgProjectSubprojectSummary[] { diff --git a/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.html b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.html new file mode 100644 index 00000000..5d75d007 --- /dev/null +++ b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.html @@ -0,0 +1,29 @@ +@if (classifications().length > 0) { + +
+ category +

Fachsystematik

+ {{ classifications().length }} +
+
+ @for (entry of classifications(); track $index) { +
+ @for ( + segment of getClassificationParentSegments(entry); + track $index + ) { + {{ segment }} + chevron_right + } +
+ @for (leaf of getClassificationLeafSegments(entry); track $index) { + + {{ leaf }} + + } +
+
+ } +
+
+} diff --git a/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.scss b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.scss new file mode 100644 index 00000000..6709220d --- /dev/null +++ b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.scss @@ -0,0 +1,97 @@ +.card { + margin-bottom: 24px; + background: var(--sg-card-bg) !important; + border-color: var(--sg-border) !important; + border-radius: var(--sg-radius-md) !important; +} + +.card ::ng-deep .mat-mdc-card-content { + padding: 0; +} + +.section-header { + display: flex; + align-items: center; + gap: 10px; + padding: 16px 20px 12px; + border-bottom: 1px solid var(--sg-border); +} + +.section-header mat-icon { + color: var(--sg-text-muted); + width: 22px; + height: 22px; + font-size: 22px; +} + +.section-header h2 { + margin: 0; + font-size: 16px; + font-weight: 600; + color: var(--sg-text); +} + +.count-badge { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 24px; + height: 24px; + padding: 0 8px; + margin-left: auto; + background: var(--sg-primary-soft); + border-radius: 12px; + color: var(--sg-text-muted); + font-size: 12px; + font-weight: 500; +} + +.classification-list { + display: flex; + flex-direction: column; + gap: 10px; + padding: 16px 20px 20px; +} + +.classification-path { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 4px 2px; + padding: 10px 12px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + background: var(--sg-surface); +} + +.classification-segment { + font-size: 12px; + line-height: 1.3; + padding: 3px 10px; + border-radius: 10px; + background: var(--sg-surface-soft); + color: var(--sg-text-muted); + white-space: nowrap; + + &--leaf { + background: var(--sg-primary-soft); + color: var(--sg-text); + font-weight: 500; + white-space: normal; + } +} + +.classification-leaf-group { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.classification-separator { + width: 16px; + height: 16px; + font-size: 16px; + color: var(--sg-text-muted); + flex-shrink: 0; + opacity: 0.5; +} diff --git a/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.ts b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.ts new file mode 100644 index 00000000..58f04aa2 --- /dev/null +++ b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.ts @@ -0,0 +1,29 @@ +import { Component, input } from '@angular/core'; +import { DFGProjectFachgebieteInner } from '../../../api'; +import { MatIconModule } from '@angular/material/icon'; +import { MatCardModule } from '@angular/material/card'; +@Component({ + selector: 'app-dfg-classification', + imports: [MatIconModule, MatCardModule], + templateUrl: './dfg-classification.component.html', + styleUrl: './dfg-classification.component.scss', +}) +export class DfgClassificationComponent { + classifications = input.required>(); + + getClassificationParentSegments(entry: DFGProjectFachgebieteInner): string[] { + return [ + entry.wissenschaftsbereich, + entry.fachkollegium, + entry.fachgebiet, + ].filter((part): part is string => !!part); + } + + getClassificationLeafSegments(entry: DFGProjectFachgebieteInner): string[] { + if (!entry.fach) return []; + return entry.fach + .split(',') + .map((s) => s.trim()) + .filter((s) => !!s); + } +}