moved dfg classification hierarchy to separated component

This commit is contained in:
2026-08-15 22:19:42 +02:00
parent 12914208cd
commit ae2230ff0e
6 changed files with 161 additions and 106 deletions
@@ -138,41 +138,10 @@
}
<!-- Fachsystematik -->
@if (getSubjectClassifications().length > 0) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>category</mat-icon>
<h2>Fachsystematik</h2>
<span class="count-badge">{{
getSubjectClassifications().length
}}</span>
</div>
<div class="classification-list">
@for (entry of getSubjectClassifications(); track $index) {
<div class="classification-path">
@for (
segment of getClassificationParentSegments(entry);
track $index
) {
<span class="classification-segment">{{ segment }}</span>
<mat-icon class="classification-separator"
>chevron_right</mat-icon
>
}
<div class="classification-leaf-group">
@for (
leaf of getClassificationLeafSegments(entry);
track $index
) {
<span
class="classification-segment classification-segment--leaf">
{{ leaf }}
</span>
}
</div>
</div>
}
</div>
</mat-card>
<app-dfg-classification
[classifications]="
getSubjectClassifications()
"></app-dfg-classification>
}
<!-- Beteiligte Personen -->
<mat-card appearance="outlined" class="card">
@@ -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;
@@ -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[] {
@@ -0,0 +1,29 @@
@if (classifications().length > 0) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>category</mat-icon>
<h2>Fachsystematik</h2>
<span class="count-badge">{{ classifications().length }}</span>
</div>
<div class="classification-list">
@for (entry of classifications(); track $index) {
<div class="classification-path">
@for (
segment of getClassificationParentSegments(entry);
track $index
) {
<span class="classification-segment">{{ segment }}</span>
<mat-icon class="classification-separator">chevron_right</mat-icon>
}
<div class="classification-leaf-group">
@for (leaf of getClassificationLeafSegments(entry); track $index) {
<span class="classification-segment classification-segment--leaf">
{{ leaf }}
</span>
}
</div>
</div>
}
</div>
</mat-card>
}
@@ -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;
}
@@ -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<Array<DFGProjectFachgebieteInner>>();
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);
}
}