From 85610215b5763366fbcbe01a3878b71d0e5d5f54 Mon Sep 17 00:00:00 2001 From: Farajollahi Date: Sun, 12 Jul 2026 13:23:00 +0200 Subject: [PATCH] fix styles --- .../dashboard/dashboard.component.html | 6 +- .../modules/dashboard/dashboard.component.ts | 69 ++++++++++++++----- 2 files changed, 55 insertions(+), 20 deletions(-) diff --git a/webapp/src/app/modules/dashboard/dashboard.component.html b/webapp/src/app/modules/dashboard/dashboard.component.html index 99bb0009..6ac15fe6 100644 --- a/webapp/src/app/modules/dashboard/dashboard.component.html +++ b/webapp/src/app/modules/dashboard/dashboard.component.html @@ -108,6 +108,7 @@

Die Kennzahlen konnten nicht geladen werden.

} + @if (topicHeatmapLoading || topicHeatmapError || hasTopicHeatmapData()) {
@@ -166,7 +167,9 @@ [loading]="topicHeatmapLoading"> }
+ } + @if (topAuthorsLoading || topAuthorsError || hasTopAuthorData()) {
@@ -195,7 +198,7 @@

} @else {
- @for (dataset of topAuthorDatasets(); track dataset.title) { + @for (dataset of visibleTopAuthorDatasets(); track dataset.title) {

{{ dataset.icon }} }

+ } diff --git a/webapp/src/app/modules/dashboard/dashboard.component.ts b/webapp/src/app/modules/dashboard/dashboard.component.ts index ad236b8e..9a5a9660 100644 --- a/webapp/src/app/modules/dashboard/dashboard.component.ts +++ b/webapp/src/app/modules/dashboard/dashboard.component.ts @@ -19,16 +19,15 @@ type DashboardStatisticKey = | 'eu_projects' | 'bmbf_projects' | 'dfg_projects'; -type TopicTreemapPeriod = 'last_5_years' | 'last_10_years' | 'all_time' | 'custom'; +type TopicTreemapPeriod = + | 'last_5_years' + | 'last_10_years' + | 'all_time' + | 'custom'; @Component({ selector: 'dashboard', - imports: [ - DecimalPipe, - MatIconModule, - RouterLink, - TopicHeatmapComponent, - ], + imports: [DecimalPipe, MatIconModule, RouterLink, TopicHeatmapComponent], templateUrl: './dashboard.component.html', styleUrl: './dashboard.component.scss', }) @@ -77,12 +76,18 @@ export class DashboardComponent implements OnInit { this.statisticsService.getPublicationCount(), ); this.loadStatistic('persons', this.statisticsService.getPersonCount()); - this.loadStatistic('eu_projects', this.statisticsService.getEuProjectCount()); + this.loadStatistic( + 'eu_projects', + this.statisticsService.getEuProjectCount(), + ); this.loadStatistic( 'bmbf_projects', this.statisticsService.getBmbfProjectCount(), ); - this.loadStatistic('dfg_projects', this.statisticsService.getDfgProjectCount()); + this.loadStatistic( + 'dfg_projects', + this.statisticsService.getDfgProjectCount(), + ); } isStatisticLoading(key: DashboardStatisticKey): boolean { @@ -96,19 +101,48 @@ export class DashboardComponent implements OnInit { }> { return [ { - title: - this.topAuthorsWorksPeriod === 'last_5_years' - ? 'Works letzte 5 Jahre' - : 'Works alle Zeiten', + title: 'Publikationen', icon: 'menu_book', entries: this.topAuthors?.works ?? [], }, - { title: 'Projekte', icon: 'work', entries: this.topAuthors?.projects ?? [] }, - { title: 'Patente', icon: 'description', entries: this.topAuthors?.patents ?? [] }, + { + title: 'Projekte', + icon: 'work', + entries: this.topAuthors?.projects ?? [], + }, + { + title: 'Patente', + icon: 'description', + entries: this.topAuthors?.patents ?? [], + }, { title: 'News', icon: 'article', entries: this.topAuthors?.news ?? [] }, ]; } + visibleTopAuthorDatasets(): Array<{ + title: string; + icon: string; + entries: TopAuthor[]; + }> { + const datasets = this.topAuthorDatasets(); + return this.topAuthorsLoading + ? datasets + : datasets.filter((dataset) => dataset.entries.length > 0); + } + + hasTopAuthorData(): boolean { + return this.topAuthorDatasets().some( + (dataset) => dataset.entries.length > 0, + ); + } + + hasTopicHeatmapData(): boolean { + return (this.topicHeatmap?.fields ?? []).some( + (field) => + field.total > 0 || field.values.some((value) => value.count > 0), + ); + } + setTopAuthorsWorksPeriod(period: TopAuthorsWorksPeriod): void { if (period === this.topAuthorsWorksPeriod) return; this.topAuthorsWorksPeriod = period; @@ -150,10 +184,7 @@ export class DashboardComponent implements OnInit { this.loadTopicHeatmap(); } - onTopicTreemapYearChange( - field: 'from' | 'to', - value: string, - ): void { + onTopicTreemapYearChange(field: 'from' | 'to', value: string): void { const year = Number(value); if (!Number.isInteger(year)) return;