Merge branch 'dev' into feat/add_site_news

This commit is contained in:
Steven Tischer
2026-06-20 21:06:29 +02:00
142 changed files with 13636 additions and 1143 deletions
@@ -0,0 +1,39 @@
<div class="dashboard-wrapper">
<header class="dashboard-header">
<h2>University Performance Dashboard</h2>
<div class="controls">
<select (change)="onTopicChange($any($event.target).value)">
@for (t of topics; track t) {
<option [value]="t">{{ t }}</option>
}
</select>
<div class="toggle-group">
<button
[class.active]="metric === 'publications'"
(click)="setMetric('publications')">
Publications
</button>
<button
[class.active]="metric === 'citations'"
(click)="setMetric('citations')">
Citations
</button>
</div>
</div>
</header>
<div class="content-grid">
<section class="chart-section">
<app-university-line-chart
[data]="rawDataSource"
[metric]="metric"></app-university-line-chart>
</section>
<aside class="table-section">
<app-university-ranking-table
[rankings]="computedRankings"
[loading]="isLoading"></app-university-ranking-table>
</aside>
</div>
</div>
@@ -0,0 +1,95 @@
// src/app/modules/university-ranking/dashboard.component.scss
.dashboard-wrapper {
padding: 2rem;
font-family: 'Inter', sans-serif;
color: #333;
.dashboard-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
border-bottom: 1px solid #eee;
padding-bottom: 1rem;
}
.content-grid {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 2rem;
@media (max-width: 1024px) {
grid-template-columns: 1fr;
}
}
.controls {
display: flex;
gap: 1rem;
select {
padding: 0.5rem;
border-radius: 4px;
border: 1px solid #ccc;
}
.toggle-group {
button {
padding: 0.5rem 1rem;
border: 1px solid #0056b3;
background: white;
color: #0056b3;
cursor: pointer;
&:first-child {
border-radius: 4px 0 0 4px;
}
&:last-child {
border-radius: 0 4px 4px 0;
}
&.active {
background: #0056b3;
color: white;
}
}
}
}
}
// Table styling
.ranking-table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
th,
td {
padding: 0.75rem;
text-align: left;
border-bottom: 1px solid #f0f0f0;
}
.top-tier {
background-color: #f8fbff;
font-weight: 600;
}
.positive {
color: #28a745;
}
.negative {
color: #dc3545;
}
.mover-badge {
margin-left: 4px;
font-size: 0.8rem;
}
.trend-col {
font-weight: bold;
&[data-trend='up'] {
color: #28a745;
}
&[data-trend='down'] {
color: #dc3545;
}
}
}
@@ -1,10 +1,62 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { UniversityRankingService } from '../university-ranking/services/uni-ranking-service';
import { UniversityLineChartComponent } from '../university-ranking/uni-line-chart/uni-line-chart.component';
import { UniversityRankingTableComponent } from '../university-ranking/uni-ranking-table/uni-ranking-table.component';
import { UniversityTopicData, UniversityRanking } from '../../api';
export type ResearchTopic =
| 'Artificial Intelligence'
| 'Quantum Computing'
| 'Renewable Energy'
| 'Biotechnology';
export type DashboardMetric = 'publications' | 'citations';
@Component({
selector: 'app-dashboard',
imports: [],
selector: 'dashboard',
imports: [UniversityLineChartComponent, UniversityRankingTableComponent],
templateUrl: './dashboard.component.html',
styleUrl: './dashboard.component.scss',
standalone: true,
})
export class DashboardComponent {}
export class DashboardComponent implements OnInit {
topics: ResearchTopic[] = [
'Artificial Intelligence',
'Quantum Computing',
'Renewable Energy',
'Biotechnology',
];
selectedTopic: ResearchTopic = 'Artificial Intelligence';
metric: DashboardMetric = 'publications';
rawDataSource: UniversityTopicData[] = [];
computedRankings: UniversityRanking[] = [];
isLoading = false;
constructor(private dataService: UniversityRankingService) {}
ngOnInit() {
this.loadData();
}
onTopicChange(topic: ResearchTopic) {
this.selectedTopic = topic;
this.loadData(); // Re-fetch as rankings depend on the topic
}
setMetric(metric: DashboardMetric) {
this.metric = metric;
this.loadData(); // Re-fetch as ranking order changes based on metric
}
private loadData() {
this.isLoading = true;
this.dataService
.getRankingData(this.selectedTopic, this.metric)
.subscribe((response) => {
// Map backend snake_case properties to frontend camelCase if necessary,
// though OpenAPI Generator usually handles this.
console.log(response);
this.rawDataSource = (response.timeseries as any) || [];
this.computedRankings = (response.rankings as any) || [];
this.isLoading = false;
});
}
}