From 5396b453144173c1fb5895242957bc908a84fd35 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 19 Jun 2026 05:26:25 +0200 Subject: [PATCH 1/3] add sidebar collapse and refine company connections --- .../person-company-connections.component.html | 63 +++--- .../person-company-connections.component.scss | 197 ++++++------------ .../person-company-connections.component.ts | 174 ++++++++++------ .../ui/app-layout/app-layout.component.html | 11 +- .../ui/app-layout/app-layout.component.scss | 4 + .../ui/app-layout/app-layout.component.ts | 28 +++ .../ui/app-menu/app-menu.component.html | 147 +++++++++---- .../ui/app-menu/app-menu.component.scss | 68 +++++- .../shared/ui/app-menu/app-menu.component.ts | 9 +- 9 files changed, 437 insertions(+), 264 deletions(-) diff --git a/webapp/src/app/modules/person-company-connections/person-company-connections.component.html b/webapp/src/app/modules/person-company-connections/person-company-connections.component.html index 7cb40edc..f4e9453b 100644 --- a/webapp/src/app/modules/person-company-connections/person-company-connections.component.html +++ b/webapp/src/app/modules/person-company-connections/person-company-connections.component.html @@ -40,24 +40,30 @@
@if (graphOptions) { -
-
- -
- +
+ +
} -
+ }

@@ -95,7 +101,7 @@

-
+
Unternehmen Rolle @@ -109,6 +115,7 @@
- + {{ - isCompanyOfficersExpanded(connection) ? '▲' : '▼' + isCompanyOfficersExpanded(connection) + ? 'expand_less' + : 'expand_more' }} - + @if (isCompanyOfficersExpanded(connection)) { - +
} }
@@ -253,7 +262,7 @@
}
-
+ diff --git a/webapp/src/app/modules/person-company-connections/person-company-connections.component.scss b/webapp/src/app/modules/person-company-connections/person-company-connections.component.scss index b051e2a2..91824dd7 100644 --- a/webapp/src/app/modules/person-company-connections/person-company-connections.component.scss +++ b/webapp/src/app/modules/person-company-connections/person-company-connections.component.scss @@ -1,10 +1,8 @@ -$author-color: #5470c6; +$marked-color: #5470c6; +$related-person-color: #4f8df5; $timeline-purple: #7255d9; $timeline-purple-bg: #f6f0ff; -$timeline-green-bg: #effaf3; -$timeline-green-border: #bdebcf; - $timeline-orange-bg: #fff7e8; $timeline-orange-border: #ffd796; $timeline-orange-text: #c67500; @@ -107,7 +105,6 @@ $text-muted: #64718f; .graph-card, .connection-list { - border: 1px solid $card-border; border-radius: 16px; background: #ffffff; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04); @@ -121,70 +118,45 @@ $text-muted: #64718f; flex-direction: column; } -.graph-toolbar { - flex: 0 0 auto; - padding: 12px 18px 8px; - border-bottom: 1px solid #edf2fb; -} - -.related-toggle { - display: inline-flex; - align-items: center; - gap: 10px; - max-width: 100%; - padding: 0; - border: 0; - background: transparent; - color: $text-main; - cursor: pointer; -} - -.toggle-switch { - position: relative; - flex: 0 0 auto; - width: 44px; - height: 24px; - border-radius: 999px; - background: #dbe5f6; - transition: background 160ms ease; -} - -.toggle-knob { - position: absolute; - top: 3px; - left: 3px; - width: 18px; - height: 18px; - border-radius: 999px; - background: #ffffff; - box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24); - transition: transform 160ms ease; -} - -.related-toggle.active .toggle-switch { - background: #e95590; -} - -.related-toggle.active .toggle-knob { - transform: translateX(20px); -} - -.toggle-text { - min-width: 0; - color: $text-main; - font-size: 13px; - font-weight: 600; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - .graph-stage { + position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; } +.graph-related-persons-button { + position: absolute; + top: 12px; + right: 12px; + z-index: 2; + + width: 50px; + height: 50px; + padding: 0; + + background: transparent; + color: $related-person-color; + box-shadow: none; +} + +.graph-related-persons-button:hover { + background: rgba(84, 112, 198, 0.08); +} + +.graph-related-persons-icon { + width: 51px; + height: 51px; + + font-size: 51px; + line-height: 51px; + font-variation-settings: + 'FILL' 1, + 'wght' 400, + 'GRAD' 0, + 'opsz' 48; +} + .graph { width: 100%; height: 100%; @@ -288,14 +260,6 @@ $text-muted: #64718f; .list-header span, .connection-row span { min-width: 0; -} - -.list-header span { - white-space: normal; -} - -.list-header span, -.connection-row span { justify-self: start; text-align: left; } @@ -322,7 +286,7 @@ $text-muted: #64718f; &.selected { background: #f0f6ff; - box-shadow: inset 3px 0 0 $author-color; + box-shadow: inset 3px 0 0 $marked-color; } &.removed { @@ -343,34 +307,10 @@ $text-muted: #64718f; white-space: nowrap; } -.company-name { - min-width: 0; -} - .company-name { font-weight: 700; } -.detail-value.detail-status { - display: block; - margin: 0; - padding: 0; - border: 0; - border-radius: 0; - background: transparent; - font-size: 13px; - font-weight: 700; - line-height: 1.35; -} - -.detail-value.detail-status--active { - color: #218354; -} - -.detail-value.detail-status--removed { - color: #6b7280; -} - .role-value { width: auto; padding-left: 8px; @@ -422,6 +362,26 @@ $text-muted: #64718f; line-height: 1.35; } +.detail-value.detail-status { + display: block; + margin: 0; + padding: 0; + border: 0; + border-radius: 0; + background: transparent; + font-size: 13px; + font-weight: 700; + line-height: 1.35; +} + +.detail-value.detail-status--active { + color: #218354; +} + +.detail-value.detail-status--removed { + color: #6b7280; +} + .officers-toggle { display: flex; justify-content: space-between; @@ -441,21 +401,23 @@ $text-muted: #64718f; cursor: pointer; } +.officers-toggle mat-icon { + color: $text-muted; +} + .related-officers { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; padding: 0; - list-style: none; } .related-officer { display: grid; - grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) 28px; + grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) 40px; gap: 12px; align-items: center; - padding-right: 34px; color: $text-main; font-size: 13px; } @@ -466,49 +428,21 @@ $text-muted: #64718f; } .officer-role { - display: block; - max-width: 100%; - min-width: 0; padding-left: 10px; border-left: 4px solid #8a95b3; color: $text-main; font-weight: 600; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } .officer-open-link { - --mdc-icon-button-state-layer-size: 28px; - --mat-icon-button-state-layer-size: 28px; - justify-self: center; - display: inline-flex; - align-items: center; - justify-content: center; - width: 28px; - height: 28px; - padding: 0; - border-radius: 6px; - color: $author-color; - line-height: 1; -} - -.officer-open-link:hover { - background: rgba(47, 76, 190, 0.08); -} - -.officer-open-link .mat-icon { - width: 20px; - height: 20px; - font-size: 20px; - line-height: 20px; + color: $marked-color; } .officer-open-placeholder { display: block; - width: 28px; - height: 28px; + width: 40px; + height: 40px; } @media (max-width: 1450px) { @@ -553,9 +487,8 @@ $text-muted: #64718f; } .related-officer { - grid-template-columns: minmax(0, 1fr) 28px; + grid-template-columns: minmax(0, 1fr) 40px; gap: 6px 10px; - padding-right: 0; } .officer-role { diff --git a/webapp/src/app/modules/person-company-connections/person-company-connections.component.ts b/webapp/src/app/modules/person-company-connections/person-company-connections.component.ts index 8e7b1c03..742349e8 100644 --- a/webapp/src/app/modules/person-company-connections/person-company-connections.component.ts +++ b/webapp/src/app/modules/person-company-connections/person-company-connections.component.ts @@ -1,7 +1,16 @@ import { CommonModule, LocationStrategy } from '@angular/common'; -import { Component, ElementRef, OnInit, inject } from '@angular/core'; +import { + Component, + ElementRef, + OnInit, + QueryList, + ViewChildren, + inject, +} from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; +import { MatCardModule } from '@angular/material/card'; import { MatIconModule } from '@angular/material/icon'; +import { MatTooltip, MatTooltipModule } from '@angular/material/tooltip'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { ActivatedRoute, Router, RouterModule } from '@angular/router'; import { EChartsOption } from 'echarts'; @@ -26,7 +35,10 @@ interface RoleLegendItem { MatProgressSpinnerModule, NgxEchartsDirective, MatButtonModule, + MatCardModule, MatIconModule, + MatTooltipModule, + MatTooltip, RouterModule, ], templateUrl: './person-company-connections.component.html', @@ -36,11 +48,9 @@ export class PersonCompanyConnectionsComponent implements OnInit { private readonly route = inject(ActivatedRoute); private readonly router = inject(Router); private readonly locationStrategy = inject(LocationStrategy); - private readonly host = inject(ElementRef); private readonly companyConnectionsApi = inject(CompanyConnectionsService); private readonly graphCompanyLimit = 10; - private readonly searchInstitutionName = 'University of Duisburg-Essen'; private readonly personCategoryIndex = 0; private readonly activeCompanyCategoryIndex = 1; @@ -58,6 +68,22 @@ export class PersonCompanyConnectionsComponent implements OnInit { private readonly relatedPersonColor = '#4f8df5'; private readonly fallbackRoleColor = '#8a95b3'; + private readonly personIconSymbol = this.createAccountCircleSymbol( + this.authorColor, + ); + + private readonly registerPersonIconSymbol = this.createAccountCircleSymbol( + this.relatedPersonColor, + ); + + private readonly activeCompanyIconSymbol = this.createApartmentSymbol( + this.companyActiveColor, + ); + + private readonly removedCompanyIconSymbol = this.createApartmentSymbol( + this.companyRemovedColor, + ); + private readonly roleColors: Record = { Geschäftsführer: '#2678e8', Prokurist: '#39a96b', @@ -81,6 +107,9 @@ export class PersonCompanyConnectionsComponent implements OnInit { expandedOfficersCompanyKey: string | null = null; showRelatedPersons = false; + @ViewChildren('connectionRow', { read: ElementRef }) + private connectionRows!: QueryList>; + get connections(): CompanyConnection[] { return this.data?.connections ?? []; } @@ -216,11 +245,6 @@ export class PersonCompanyConnectionsComponent implements OnInit { this.expandedOfficersCompanyKey = companyKey; } - toggleRelatedPersons(): void { - this.showRelatedPersons = !this.showRelatedPersons; - this.refreshGraph(); - } - onGraphClick(event: any): void { if (event.dataType !== 'node') { return; @@ -253,6 +277,17 @@ export class PersonCompanyConnectionsComponent implements OnInit { ); } + toggleRelatedPersons(tooltip?: MatTooltip): void { + this.showRelatedPersons = !this.showRelatedPersons; + this.refreshGraph(); + + tooltip?.hide(0); + + window.setTimeout(() => { + tooltip?.show(0); + }); + } + private loadCompanyConnections(authorId: string): void { this.loading = true; this.error = false; @@ -309,8 +344,9 @@ export class PersonCompanyConnectionsComponent implements OnInit { id: personNodeId, name: response.display_name || 'Person', category: this.personCategoryIndex, - symbol: 'circle', - symbolSize: 44, + symbol: this.personIconSymbol, + symbolSize: 42, + symbolKeepAspect: true, itemStyle: { color: this.authorColor, }, @@ -335,8 +371,11 @@ export class PersonCompanyConnectionsComponent implements OnInit { category: isRemoved ? this.removedCompanyCategoryIndex : this.activeCompanyCategoryIndex, - symbol: 'roundRect', - symbolSize: [48, 34], + symbol: isRemoved + ? this.removedCompanyIconSymbol + : this.activeCompanyIconSymbol, + symbolSize: 44, + symbolKeepAspect: true, itemStyle: { color: isRemoved ? this.companyRemovedColor : this.companyActiveColor, }, @@ -377,8 +416,9 @@ export class PersonCompanyConnectionsComponent implements OnInit { searchName: relatedOfficer.name, role: relatedRole, category: this.registerPersonCategoryIndex, - symbol: 'circle', - symbolSize: 28, + symbol: this.registerPersonIconSymbol, + symbolSize: 30, + symbolKeepAspect: true, itemStyle: { color: this.relatedPersonColor, }, @@ -412,7 +452,7 @@ export class PersonCompanyConnectionsComponent implements OnInit { roam: true, roamTrigger: 'global', animation: false, - top: 24, + top: 34, left: 20, right: 20, bottom: 64, @@ -444,8 +484,8 @@ export class PersonCompanyConnectionsComponent implements OnInit { left: 'center', orient: 'horizontal', itemGap: 18, - itemWidth: 18, - itemHeight: 14, + itemWidth: 20, + itemHeight: 20, selectedMode: false, textStyle: { color: '#3f4659', @@ -483,31 +523,19 @@ export class PersonCompanyConnectionsComponent implements OnInit { return [ { name: this.personCategoryName, - symbol: 'circle', - itemStyle: { - color: this.authorColor, - }, + symbol: this.personIconSymbol, }, { name: this.activeCompanyCategoryName, - symbol: 'roundRect', - itemStyle: { - color: this.companyActiveColor, - }, + symbol: this.activeCompanyIconSymbol, }, { name: this.removedCompanyCategoryName, - symbol: 'roundRect', - itemStyle: { - color: this.companyRemovedColor, - }, + symbol: this.removedCompanyIconSymbol, }, { name: this.registerPersonCategoryName, - symbol: 'circle', - itemStyle: { - color: this.relatedPersonColor, - }, + symbol: this.registerPersonIconSymbol, }, ]; } @@ -523,40 +551,28 @@ export class PersonCompanyConnectionsComponent implements OnInit { const legendData = [ { name: this.personCategoryName, - icon: 'circle', - itemStyle: { - color: this.authorColor, - }, + icon: this.personIconSymbol, }, ]; if (hasActiveCompany) { legendData.push({ name: this.activeCompanyCategoryName, - icon: 'roundRect', - itemStyle: { - color: this.companyActiveColor, - }, + icon: this.activeCompanyIconSymbol, }); } if (hasRemovedCompany) { legendData.push({ name: this.removedCompanyCategoryName, - icon: 'roundRect', - itemStyle: { - color: this.companyRemovedColor, - }, + icon: this.removedCompanyIconSymbol, }); } if (this.showRelatedPersons) { legendData.push({ name: this.registerPersonCategoryName, - icon: 'circle', - itemStyle: { - color: this.relatedPersonColor, - }, + icon: this.registerPersonIconSymbol, }); } @@ -619,12 +635,10 @@ export class PersonCompanyConnectionsComponent implements OnInit { } getPersonSearchQueryParams(name?: string | null): { - institutionName: string; query: string; page: number; } { return { - institutionName: this.searchInstitutionName, query: name?.trim() ?? '', page: 1, }; @@ -636,19 +650,53 @@ export class PersonCompanyConnectionsComponent implements OnInit { return; } - const rows = Array.from( - this.host.nativeElement.querySelectorAll('.connection-row'), - ) as HTMLElement[]; + const selectedRow = this.connectionRows.find((row) => { + return ( + row.nativeElement.dataset['companyKey'] === this.selectedCompanyKey + ); + }); - for (const row of rows) { - if (row.dataset['companyKey'] === this.selectedCompanyKey) { - row.scrollIntoView({ - block: 'nearest', - behavior: 'smooth', - }); - return; - } - } + selectedRow?.nativeElement.scrollIntoView({ + block: 'nearest', + behavior: 'smooth', + }); }); } + + private createAccountCircleSymbol(color: string): string { + const backgroundPath = + 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z'; + + const foregroundPath = + 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z'; + + const svg = ` + + + + + `; + + return this.toSvgImageSymbol(svg); + } + + private createApartmentSymbol(color: string): string { + const backgroundPath = 'M17 11V3H7v4H3v14h18V11h-4z'; + + const foregroundPath = + 'M17 11V3H7v4H3v14h18V11h-4zM7 19H5v-2h2v2zm0-4H5v-2h2v2zm0-4H5V9h2v2zm4 8H9v-2h2v2zm0-4H9v-2h2v2zm0-4H9V9h2v2zm0-4H9V5h2v2zm4 12h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V9h2v2zm0-4h-2V5h2v2zm4 12h-2v-2h2v2zm0-4h-2v-2h2v2z'; + + const svg = ` + + + + + `; + + return this.toSvgImageSymbol(svg); + } + + private toSvgImageSymbol(svg: string): string { + return `image://data:image/svg+xml;utf8,${encodeURIComponent(svg.trim())}`; + } } diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.html b/webapp/src/app/shared/ui/app-layout/app-layout.component.html index 6de5f1f4..20fcd511 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.html +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.html @@ -1,6 +1,8 @@
- + @if ( (credentialService.authenticated | async) && ((credentialService.superadmin | async) || @@ -8,10 +10,15 @@ ) { - + + } diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.scss b/webapp/src/app/shared/ui/app-layout/app-layout.component.scss index 5afa1f9c..adba06a1 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.scss +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.scss @@ -84,6 +84,10 @@ mat-toolbar.main { box-shadow: none; } +.drawer--collapsed { + width: 76px; +} + .content { display: flex; flex-direction: column; diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts index 7ac7e077..f0a1e6c1 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts @@ -45,7 +45,10 @@ export class AppLayoutComponent implements OnInit, OnDestroy { protected resolverState = inject(ResolverStateService); mediaQueryListener: () => void; + private readonly sidebarCollapsedStorageKey = 'inse.sidebar.collapsed'; sideNavOpen = false; + sideNavCollapsed = this.readSidebarCollapsedState(); + constructor( public credentialService: CredentialService, public router: Router, @@ -56,6 +59,11 @@ export class AppLayoutComponent implements OnInit, OnDestroy { this.mediaQuery = media.matchMedia('(max-width: 600px)'); this.mediaQueryListener = () => { this.sideNavOpen = !this.mediaQuery.matches; + + if (this.mediaQuery.matches) { + this.sideNavCollapsed = false; + } + changeDetector.detectChanges(); }; } @@ -66,6 +74,26 @@ export class AppLayoutComponent implements OnInit, OnDestroy { } } + private readSidebarCollapsedState(): boolean { + return localStorage.getItem(this.sidebarCollapsedStorageKey) === 'true'; + } + + isSidebarCollapsed(): boolean { + return this.sideNavCollapsed && !this.mediaQuery.matches; + } + + toggleSidebarCollapsed(): void { + if (this.mediaQuery.matches) { + return; + } + + this.sideNavCollapsed = !this.sideNavCollapsed; + localStorage.setItem( + this.sidebarCollapsedStorageKey, + String(this.sideNavCollapsed), + ); + } + ngOnInit() { this.sideNavOpen = !this.mediaQuery.matches; this.mediaQuery.addEventListener('change', this.mediaQueryListener); diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.html b/webapp/src/app/shared/ui/app-menu/app-menu.component.html index 5c43bd85..f20b8878 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.html +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.html @@ -1,30 +1,71 @@ -
-
diff --git a/webapp/src/app/modules/institution-projects/institution-projects.component.ts b/webapp/src/app/modules/institution-projects/institution-projects.component.ts index debef76a..4f547c61 100644 --- a/webapp/src/app/modules/institution-projects/institution-projects.component.ts +++ b/webapp/src/app/modules/institution-projects/institution-projects.component.ts @@ -85,19 +85,29 @@ export class InstitutionProjectsComponent implements OnInit { bundProjectData: BundProjectRow[] = []; bundProjectsFunding = input.required(); - bundTotalFunding = computed(() => { const funding = this.bundProjectsFunding(); return Object.values( funding.funding_per_year as Record, ).reduce((sum, yearFunding) => sum + yearFunding, 0); }); - bundAverageAnnualFunding = computed(() => { const funding = this.bundProjectsFunding(); return funding.annual_average_over_period ?? 0; }); + cordisEuProjectsFunding = input.required(); + euTotalFunding = computed(() => { + const funding = this.cordisEuProjectsFunding(); + return Object.values( + funding.funding_per_year as Record, + ).reduce((sum, yearFunding) => sum + yearFunding, 0); + }); + euAverageAnnualFunding = computed(() => { + const funding = this.cordisEuProjectsFunding(); + return funding.annual_average_over_period ?? 0; + }); + urlSortKey = signal(''); urlSortDirection = signal(''); urlSearchTerm = signal(''); @@ -239,7 +249,7 @@ export class InstitutionProjectsComponent implements OnInit { type: 'accessor', accessorKey: 'funding_amount', cellTemplate: this.fundingAmountTmp(), - } + }, ]; } diff --git a/webapp/src/app/resolvers/bund-projects-funding.resolver.ts b/webapp/src/app/resolvers/bund-projects-funding.resolver.ts index 61591e66..27f188c5 100644 --- a/webapp/src/app/resolvers/bund-projects-funding.resolver.ts +++ b/webapp/src/app/resolvers/bund-projects-funding.resolver.ts @@ -5,9 +5,11 @@ import { inject } from '@angular/core'; export const bundProjectsFundingResolver: ResolveFn< InstitutionFunderSummary > = (route, state) => { - let institutionId = route.paramMap.get('institutionId'); + let institutionId = route.parent?.paramMap.get('institutionId') ?? null; if (!institutionId) { institutionId = route.parent?.paramMap.get('institutionId') ?? null; } - return inject(ProjectsService).getBundFundingOverTime(institutionId || ''); + return inject(ProjectsService).getInstitutionBundProjectsFundingOverTime( + institutionId!, + ); }; diff --git a/webapp/src/app/resolvers/cordis-eu-projects-funding.resolver.ts b/webapp/src/app/resolvers/cordis-eu-projects-funding.resolver.ts new file mode 100644 index 00000000..4b1e5385 --- /dev/null +++ b/webapp/src/app/resolvers/cordis-eu-projects-funding.resolver.ts @@ -0,0 +1,17 @@ +import { ResolveFn } from '@angular/router'; +import { InstitutionFunderSummary, ProjectsService } from '../api'; +import { inject } from '@angular/core'; + +export const cordisEuProjectsFundingResolver: ResolveFn< + InstitutionFunderSummary +> = (route, state) => { + let institutionId = route.parent?.paramMap.get('institutionId') ?? null; + if (!institutionId) { + throw new Error( + 'Institution ID is required to resolve Cordis EU projects funding', + ); + } + return inject(ProjectsService).getInstitutionCordisEuProjectsFundingOverTime( + institutionId, + ); +};