From fe6f64cc8c833656effdfb3dd564c290bf760ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Thu, 4 Jun 2026 23:42:39 +0200 Subject: [PATCH] Added summary cards for network --- ...erson-network-collaborators.component.scss | 58 +----------- ...erson-network-filter-dialog.component.html | 0 ...erson-network-filter-dialog.component.scss | 0 .../person-network-filter-dialog.component.ts | 25 ++++-- .../person-network-graph.component.html | 7 +- .../person-network-graph.component.scss | 5 +- .../person-network-graph.component.ts | 9 ++ .../person-network-info-card.component.html | 9 ++ .../person-network-info-card.component.scss | 34 +++++++ .../person-network-info-card.component.ts | 15 ++++ ...person-network-publications.component.scss | 55 +----------- .../person-network.component.html | 90 ++++++++++--------- .../person-network.component.scss | 60 ++++++------- .../person-network.component.ts | 53 ++++++++++- webapp/src/styles.scss | 3 + 15 files changed, 232 insertions(+), 191 deletions(-) rename webapp/src/app/{ => modules}/person-network-filter-dialog/person-network-filter-dialog.component.html (100%) rename webapp/src/app/{ => modules}/person-network-filter-dialog/person-network-filter-dialog.component.scss (100%) rename webapp/src/app/{ => modules}/person-network-filter-dialog/person-network-filter-dialog.component.ts (70%) create mode 100644 webapp/src/app/modules/person-network-info-card/person-network-info-card.component.html create mode 100644 webapp/src/app/modules/person-network-info-card/person-network-info-card.component.scss create mode 100644 webapp/src/app/modules/person-network-info-card/person-network-info-card.component.ts diff --git a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss index efec585e..57d2cbf4 100644 --- a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss +++ b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss @@ -1,60 +1,11 @@ -.content { - display: flex; - flex-direction: row; - padding: 40px; - gap: 20px; - max-height: 1000px; -} - -.graph { - width: 75vh; - height: 75vh; -} - .table { overflow: auto; width: 100%; - max-height: 1000px; - height: 1200px; + max-height: 100%; } -.table table { - width: 100%; -} - -.table-area { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; -} - -.scroll-viewport-container { - width: 100%; - height: 100%; -} - -.form-controls { - display: flex; - flex-direction: row; - align-items: flex-start; - gap: 10px; -} - -.form-field-full { - width: 100%; -} - -.right-card { - width: 100%; -} - -.toggle-group { - margin-bottom: 20px; -} - -.toggle-group .mat-button-toggle { - text-transform: none; +.mat-mdc-table { + background-color: var(--sg-background); } .element-row { @@ -75,5 +26,4 @@ .detail-row { width: 100%; - -} \ No newline at end of file +} diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.html b/webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.html similarity index 100% rename from webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.html rename to webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.html diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.scss b/webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.scss similarity index 100% rename from webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.scss rename to webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.scss diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts b/webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.ts similarity index 70% rename from webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts rename to webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.ts index f452c4df..d69c6570 100644 --- a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts +++ b/webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, inject } from '@angular/core'; +import { Component, inject, OnInit } from '@angular/core'; import { FormControl, FormGroup, @@ -11,7 +11,7 @@ import { MatDialogRef, } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; -import { CollaborationNetwork } from '../api'; +import { CollaborationNetwork } from '../../api'; import { MatSelectModule } from '@angular/material/select'; import { MatInputModule } from '@angular/material/input'; import { MatButtonModule } from '@angular/material/button'; @@ -37,12 +37,12 @@ export interface PersonNetworkFilterDialogData { MatSelectModule, MatDialogModule, MatInputModule, - MatButtonModule + MatButtonModule, ], templateUrl: './person-network-filter-dialog.component.html', styleUrl: './person-network-filter-dialog.component.scss', }) -export class PersonNetworkFilterDialogComponent { +export class PersonNetworkFilterDialogComponent implements OnInit { readonly dialogRef = inject(MatDialogRef); readonly data = inject(MAT_DIALOG_DATA); @@ -55,10 +55,23 @@ export class PersonNetworkFilterDialogComponent { maximumCollaborators: new FormControl(10), minimumCollaborations: new FormControl(1), maximumCollaborations: new FormControl(100), - institutions: new FormControl([]), - topics: new FormControl([]), + institutions: new FormControl([]), + topics: new FormControl([]), }); + ngOnInit() { + this.filterForm.patchValue({ + startYear: this.data.startYear, + endYear: this.data.endYear, + minimumCollaborators: this.data.minimumCollaborators, + maximumCollaborators: this.data.maximumCollaborators, + minimumCollaborations: this.data.minimumCollaborations, + maximumCollaborations: this.data.maximumCollaborations, + institutions: this.data.institutions, + topics: this.data.topics, + }); + } + onCancel() { this.dialogRef.close(); } diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.html b/webapp/src/app/modules/person-network-graph/person-network-graph.component.html index a80560d8..ce985536 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.html +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.html @@ -1,6 +1,11 @@ - @if (!isValidGraph()) { + @if (isEmptyGraph()) { +
+ warning +

Das Netzwerk ist leer.

+
+ } @else if (!isValidGraph()) {
warning

Das Netzwerk ist zu groß für eine detaillierte Darstellung.

diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss b/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss index 93a43f1b..f1ae7054 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss @@ -7,13 +7,14 @@ mat-card { display: flex; flex-direction: column; width: 100%; - background: transparent; + background-color: var(--sg-background); } -mat-card-content { +mat-card > mat-card-content { flex: 1 1 auto; min-height: 0; align-items: center; + padding: 0px; } .graph { diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts index 018ee2be..3b7b8d31 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts @@ -24,6 +24,15 @@ export class PersonNetworkGraphComponent { options!: EChartsCoreOption; + readonly isEmptyGraph = computed(() => { + const network = this.collaborationNetwork(); + return ( + network === undefined || + network.nodes.length === 0 || + network.edges.length === 0 + ); + }); + readonly isValidGraph = computed(() => { const network = this.collaborationNetwork(); return ( diff --git a/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.html b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.html new file mode 100644 index 00000000..29c0ea8b --- /dev/null +++ b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.html @@ -0,0 +1,9 @@ + + + {{ icon() }} +
+ {{ value() }} + {{ description() }} +
+
+
diff --git a/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.scss b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.scss new file mode 100644 index 00000000..13a84cc6 --- /dev/null +++ b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.scss @@ -0,0 +1,34 @@ +.info-card { + --info-card-icon-size: 40px; + + background-color: var(--sg-background); + padding: 10px 20px; +} +.info-card mat-card-content { + display: flex; + align-items: start; + gap: 10px; +} + +.info-card mat-icon { + width: var(--info-card-icon-size); + height: var(--info-card-icon-size); + font-size: var(--info-card-icon-size); + color: var(--sg-blue-highlight); +} + +.info-card div { + display: flex; + flex-direction: column; + gap: 4px; +} + +.info-card .number { + font-weight: var(--sg-default-bold-weight); + font-size: 1.5em; +} + +.info-card .description { + color: var(--sg-text-muted); + font-size: 0.9em; +} diff --git a/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.ts b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.ts new file mode 100644 index 00000000..fe5c3913 --- /dev/null +++ b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.ts @@ -0,0 +1,15 @@ +import { Component, input } from '@angular/core'; +import { MatCardModule } from '@angular/material/card'; +import { MatIconModule } from '@angular/material/icon'; + +@Component({ + selector: 'app-person-network-info-card', + imports: [MatIconModule, MatCardModule], + templateUrl: './person-network-info-card.component.html', + styleUrl: './person-network-info-card.component.scss', +}) +export class PersonNetworkInfoCardComponent { + readonly icon = input(); + readonly value = input(); + readonly description = input(); +} diff --git a/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss b/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss index b6462c61..57d2cbf4 100644 --- a/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss +++ b/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss @@ -1,60 +1,11 @@ -.content { - display: flex; - flex-direction: row; - padding: 40px; - gap: 20px; - max-height: 1000px; -} - -.graph { - width: 75vh; - height: 75vh; -} - .table { overflow: auto; width: 100%; - max-height: 1000px; - height: 1200px; + max-height: 100%; } -.table table { - width: 100%; -} - -.table-area { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; -} - -.scroll-viewport-container { - width: 100%; - height: 100%; -} - -.form-controls { - display: flex; - flex-direction: row; - align-items: flex-start; - gap: 10px; -} - -.form-field-full { - width: 100%; -} - -.right-card { - width: 100%; -} - -.toggle-group { - margin-bottom: 20px; -} - -.toggle-group .mat-button-toggle { - text-transform: none; +.mat-mdc-table { + background-color: var(--sg-background); } .element-row { diff --git a/webapp/src/app/modules/person-network/person-network.component.html b/webapp/src/app/modules/person-network/person-network.component.html index d68d7eee..9cd6ab62 100644 --- a/webapp/src/app/modules/person-network/person-network.component.html +++ b/webapp/src/app/modules/person-network/person-network.component.html @@ -1,13 +1,7 @@
-
-
-
Netzwerk
-

Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.

-
- +
+
Netzwerk
+

Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.

@@ -18,21 +12,27 @@
- - - Kollaborierende - - Publikationen + - - + + Kollaborierende + + Publikationen + + +
+ {{ this.displayedTable() === "collaborators" ? "Suche Kollaborierende nach Name oder ID" @@ -48,25 +48,31 @@ -
- - -
- @if (this.displayedTable() === "collaborators") { - - } @else if (this.displayedTable() === "publications") { - - } -
-
-
-
+ + + @if (this.displayedTable() === "collaborators") { + + } @else if (this.displayedTable() === "publications") { + + } + +
+ +
+ @for (summary of this.summaryCards(); track $index) { + + } +
diff --git a/webapp/src/app/modules/person-network/person-network.component.scss b/webapp/src/app/modules/person-network/person-network.component.scss index b51ee5be..36506868 100644 --- a/webapp/src/app/modules/person-network/person-network.component.scss +++ b/webapp/src/app/modules/person-network/person-network.component.scss @@ -1,16 +1,7 @@ .content { display: flex; flex-direction: column; - padding: 40px; - gap: 20px; - align-items: stretch; -} - -.top-row { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: end; + padding: 30px; gap: 20px; } @@ -23,24 +14,26 @@ display: flex; flex-direction: row; gap: 20px; + max-height: 80vh; +} + +form > div { + display: flex; + flex-direction: row; + gap: 20px; +} + +form > div > button, +form > div > mat-button-toggle-group { + margin-top: 20px; + margin-bottom: 20px; + border-radius: var(--sg-radius-sm); + color: var(--sg-text); } .content > app-person-network-graph, .right-card { flex: 1 1 0; - min-width: 0; -} - -.form-field-full { - width: 100%; -} - -.right-card { - width: 100%; -} - -.toggle-group { - margin-bottom: 20px; } .toggle-group .mat-button-toggle { @@ -48,18 +41,21 @@ width: 100%; } -.pair-field { +.summary-container { display: flex; + flex-direction: row; gap: 20px; } -.pair-field > mat-form-field { - width: 100%; +.summary-container app-person-network-info-card { + flex: 1 1 0; } -.top-row button { - height: 42px; - border-color: var(--sg-border); - border-radius: var(--sg-radius-sm); - color: var(--sg-text); -} \ No newline at end of file +.scroll-viewport-container { + height: 50vh; + max-height: 50vh; +} + +mat-card { + background-color: var(--sg-background); +} diff --git a/webapp/src/app/modules/person-network/person-network.component.ts b/webapp/src/app/modules/person-network/person-network.component.ts index 0c192706..f405bad9 100644 --- a/webapp/src/app/modules/person-network/person-network.component.ts +++ b/webapp/src/app/modules/person-network/person-network.component.ts @@ -1,6 +1,6 @@ import { toSignal } from '@angular/core/rxjs-interop'; -import { Component, computed, OnInit } from '@angular/core'; +import { Component, computed, OnInit, signal } from '@angular/core'; import { ActivatedRoute, Router, RouterModule } from '@angular/router'; import { MatCardModule } from '@angular/material/card'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; @@ -30,7 +30,8 @@ import { PersonNetworkGraphComponent } from '../person-network-graph/person-netw import { MatSelectModule } from '@angular/material/select'; import { MatExpansionModule } from '@angular/material/expansion'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; -import { PersonNetworkFilterDialogComponent } from '../../person-network-filter-dialog/person-network-filter-dialog.component'; +import { PersonNetworkFilterDialogComponent } from '../person-network-filter-dialog/person-network-filter-dialog.component'; +import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component'; @Component({ selector: 'app-person-network', @@ -56,6 +57,7 @@ import { PersonNetworkFilterDialogComponent } from '../../person-network-filter- MatSelectModule, MatExpansionModule, MatDialogModule, + PersonNetworkInfoCardComponent, ], templateUrl: './person-network.component.html', styleUrl: './person-network.component.scss', @@ -77,6 +79,34 @@ export class PersonNetworkComponent implements OnInit { displayedTable: new FormControl('collaborators'), }); + persons = signal(0); + institutions = signal(0); + publications = signal(0); + connections = signal(0); + + readonly summaryCards = computed(() => [ + { + icon: 'person', + value: this.persons(), + description: 'Personen', + }, + { + icon: 'apartment', + value: this.institutions(), + description: 'Institutionen', + }, + { + icon: 'menu_book', + value: this.publications(), + description: 'Gemeinsame Publikationen', + }, + { + icon: 'share', + value: this.connections(), + description: 'Verbindungen im Netzwerk', + }, + ]); + readonly formValue = toSignal(this.filterForm.valueChanges); readonly debouncedFormValue = toSignal( this.filterForm.valueChanges.pipe(debounceTime(300)), @@ -137,10 +167,29 @@ export class PersonNetworkComponent implements OnInit { }); } + calculateSummary(collaborationNetwork: CollaborationNetwork) { + this.persons.set( + collaborationNetwork.nodes.filter((node) => node.category === 'author') + .length, + ); + this.institutions.set( + collaborationNetwork.nodes.filter( + (node) => node.category === 'institution', + ).length, + ); + this.publications.set( + collaborationNetwork.nodes.filter((node) => node.category === 'work') + .length, + ); + this.connections.set(collaborationNetwork.edges.length); + } + ngOnInit(): void { this.activatedRoute.data.subscribe(({ collaborationNetwork }) => { this.collaborationNetwork = collaborationNetwork; + this.calculateSummary(collaborationNetwork); + const currentParams = this.activatedRoute.snapshot.queryParams; const initialStartYear = Number(currentParams['start_year']) || diff --git a/webapp/src/styles.scss b/webapp/src/styles.scss index b938fc0f..271f28ac 100644 --- a/webapp/src/styles.scss +++ b/webapp/src/styles.scss @@ -118,6 +118,9 @@ body { --sg-radius-sm: 8px; --sg-radius-md: 12px; --sg-radius-lg: 18px; + + --sg-blue-highlight: #3d7cff; + --sg-default-bold-weight: 900; } * {