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;
});
}
}
@@ -0,0 +1 @@
<div echarts [options]="options"></div>
@@ -0,0 +1,153 @@
import { Component, effect, input } from '@angular/core';
import * as echarts from 'echarts/core';
import { EChartsOption } from 'echarts';
import { GridComponent, LegendComponent } from 'echarts/components';
import { CanvasRenderer } from 'echarts/renderers';
import { NgxEchartsDirective } from 'ngx-echarts';
import { InstitutionFunderSummary } from '../../api';
echarts.use([GridComponent, CanvasRenderer, LegendComponent]);
type FunderData = {
funderName: string;
fundingMap: Record<number, number>;
};
@Component({
selector: 'app-institution-projects-funding-graph',
imports: [NgxEchartsDirective],
templateUrl: './institution-projects-funding-graph.component.html',
styleUrl: './institution-projects-funding-graph.component.scss',
})
export class InstitutionProjectsFundingGraphComponent {
options!: EChartsOption;
fundings = input.required<InstitutionFunderSummary[]>();
constructor() {
effect(() => {
const fundings = this.fundings();
this.generateChartOptions(fundings);
});
}
generateChartOptions(fundings: InstitutionFunderSummary[]): void {
const floorToTwoDecimals = (value: number): string => {
const floored = Math.floor(value * 100) / 100;
return floored.toLocaleString(undefined, {
style: 'currency',
currency: 'EUR',
minimumFractionDigits: 2,
maximumFractionDigits: 2,
});
};
const yearsSet = new Set<string>();
fundings.forEach((series) => {
if (series.funding_per_year) {
Object.keys(series.funding_per_year).forEach((year) =>
yearsSet.add(year),
);
}
});
const xAxisYears = Array.from(yearsSet).sort(
(a, b) => Number(a) - Number(b),
);
const currentYearStr = new Date().getFullYear().toString();
const chartSeries = fundings.map((series, index) => {
const fundingMap = (series.funding_per_year || {}) as Record<
string,
number
>;
const dataPoints = xAxisYears.map((year) => fundingMap[year] ?? 0);
const baseSeries: any = {
name: series.type.toUpperCase(),
type: 'line',
stack: 'TotalInstitutionalFunding',
areaStyle: {},
emphasis: { focus: 'series' },
data: dataPoints,
};
if (index === 0) {
baseSeries.markLine = {
symbol: ['none', 'none'],
silent: true,
label: {
show: true,
position: 'end',
formatter: 'Aktuelles Jahr',
backgroundColor: '#333',
color: '#fff',
padding: [4, 6],
borderRadius: 4,
},
lineStyle: {
color: '#ff4d4f',
type: 'dashed',
width: 2,
},
data: [
{
xAxis: currentYearStr,
},
],
};
}
return baseSeries;
});
this.options = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: { backgroundColor: '#6a7985' },
},
valueFormatter: (value) => {
const numericValue = Array.isArray(value) ? 0 : Number(value ?? 0);
return floorToTwoDecimals(numericValue);
},
},
legend: {
data: fundings.map((series) => series.type.toUpperCase()),
top: '10%',
},
grid: {
left: '4%',
right: '4%',
bottom: '5%',
containLabel: true,
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: xAxisYears,
},
],
yAxis: [
{
type: 'value',
axisLabel: {
formatter: (value: number) =>
value.toLocaleString(undefined, {
style: 'currency',
currency: 'EUR',
maximumFractionDigits: 0,
}),
},
},
],
series: chartSeries,
};
}
}
@@ -1,48 +1,88 @@
<div class="content">
<h3>Projekte</h3>
<mat-card appearance="outlined">
<mat-card-content>
<mat-form-field style="width: 100%">
<mat-label>Suche nach Themen</mat-label>
<input
matInput
type="search"
[debounceTime]="300"
[(debouncedValue)]="urlSearchTerm"
(debouncedValueChange)="handleSearchTermChange($event)" />
<mat-icon matPrefix>search</mat-icon>
<button matIconButton matSuffix (click)="clearSearchTerm()">
<mat-icon>clear</mat-icon>
</button>
</mat-form-field>
<mat-tab-group
[selectedIndex]="tabIndex()"
(selectedTabChange)="selectedTabChange($event)">
<mat-tab label="EU">
<app-data-table
[data]="euProjectData"
[columns]="euProjectColumns"
[activeSortKey]="urlSortKey()"
[sortDirection]="urlSortDirection()"
(sortChange)="handleSortChange($event)" />
</mat-tab>
<mat-tab label="Bund">
<app-data-table
[data]="bundProjectData"
[columns]="bundProjectColumns"
[activeSortKey]="urlSortKey()"
[sortDirection]="urlSortDirection()"
(sortChange)="handleSortChange($event)" />
</mat-tab>
</mat-tab-group>
<mat-paginator
[length]="this.pageTotal()"
[pageSize]="this.pageSize()"
[pageIndex]="this.pageIndex()"
(page)="handlePageChange($event)" />
</mat-card-content>
</mat-card>
<div class="funding-area">
<mat-card appearance="outlined">
<mat-card-content>
<mat-form-field style="width: 100%">
<mat-label>Suche nach Themen</mat-label>
<input
matInput
type="search"
[debounceTime]="300"
[(debouncedValue)]="urlSearchTerm"
(debouncedValueChange)="handleSearchTermChange($event)" />
<mat-icon matPrefix>search</mat-icon>
<button matIconButton matSuffix (click)="clearSearchTerm()">
<mat-icon>clear</mat-icon>
</button>
</mat-form-field>
<mat-tab-group
[selectedIndex]="tabIndex()"
(selectedTabChange)="selectedTabChange($event)">
<mat-tab label="EU">
<app-data-table
[data]="euProjectData"
[columns]="euProjectColumns"
[activeSortKey]="urlSortKey()"
[sortDirection]="urlSortDirection()"
(sortChange)="handleSortChange($event)" />
</mat-tab>
<mat-tab label="Bund">
<app-data-table
[data]="bundProjectData"
[columns]="bundProjectColumns"
[activeSortKey]="urlSortKey()"
[sortDirection]="urlSortDirection()"
(sortChange)="handleSortChange($event)" />
</mat-tab>
</mat-tab-group>
<mat-paginator
[length]="this.pageTotal()"
[pageSize]="this.pageSize()"
[pageIndex]="this.pageIndex()"
(page)="handlePageChange($event)" />
</mat-card-content>
</mat-card>
<div class="funding-info-section">
<mat-card appearance="outlined">
<mat-card-header>
<mat-card-title>Förderung über Zeit</mat-card-title>
</mat-card-header>
<mat-card-content>
<app-institution-projects-funding-graph
[fundings]="[bundProjectsFunding(), cordisEuProjectsFunding()]" />
</mat-card-content>
</mat-card>
<div class="funding-info-cards">
<app-person-network-info-card
[description]="'Gesamte Förderung durch Bund'"
[value]="
(bundTotalFunding()
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
" />
<app-person-network-info-card
[description]="'Durchschnittliche jährliche Förderung durch Bund'"
[value]="
(bundAverageAnnualFunding()
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
" />
<app-person-network-info-card
[description]="'Gesamte Förderung durch die Europäische Union'"
[value]="
(euTotalFunding() | currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ??
undefined
" />
<app-person-network-info-card
[description]="'Durchschnittliche jährliche Förderung durch die Europäische Union'"
[value]="
(euAverageAnnualFunding()
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
" />
</div>
</div>
</div>
</div>
<ng-template #fundingStartTmp let-row>
@@ -51,6 +91,6 @@
<ng-template #fundingEndTmp let-row>
{{ row.funding_end | date: 'dd.MM.yyyy' }}
</ng-template>
<ng-template #grantAmountTmp let-row>
{{ row.grant_amount | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
<ng-template #fundingAmountTmp let-row>
{{ row.funding_amount | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
</ng-template>
@@ -6,3 +6,26 @@ mat-card,
mat-paginator {
background-color: var(--sg-background);
}
.funding-area {
display: flex;
flex-direction: column;
gap: 1rem;
}
.funding-info-section {
display: flex;
flex-direction: column;
gap: 1rem;
}
.funding-info-cards {
display: flex;
flex-direction: row;
gap: 1rem;
app-person-network-info-card {
width: 100%;
height: 100%;
}
}
@@ -12,8 +12,9 @@ import { ActivatedRoute, Router } from '@angular/router';
import {
BundProject,
BundProjectPage,
EuProject,
EuProjectPage,
CordisEuProject,
CordisEuProjectPage,
InstitutionFunderSummary,
} from '../../api';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
@@ -31,12 +32,14 @@ import { Sort, SortDirection } from '@angular/material/sort';
import { DebounceDirective } from '../../directives/debounce.directive';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { InstitutionProjectsFundingGraphComponent } from '../institution-projects-funding-graph/institution-projects-funding-graph.component';
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
type BundProjectRow = {
topic: string;
funding_start: Date;
funding_end: Date;
grant_amount: number;
funding_amount: number;
department: string;
};
@@ -44,7 +47,7 @@ type EuProjectRow = {
topic: string;
funding_start: Date;
funding_end: Date;
grant_amount: number;
funding_amount: number;
};
@Component({
@@ -62,6 +65,8 @@ type EuProjectRow = {
DebounceDirective,
MatIconModule,
MatButtonModule,
InstitutionProjectsFundingGraphComponent,
PersonNetworkInfoCardComponent,
],
templateUrl: './institution-projects.component.html',
styleUrl: './institution-projects.component.scss',
@@ -69,9 +74,9 @@ type EuProjectRow = {
export class InstitutionProjectsComponent implements OnInit {
fundingStartTmp = viewChild.required<TemplateRef<any>>('fundingStartTmp');
fundingEndTmp = viewChild.required<TemplateRef<any>>('fundingEndTmp');
grantAmountTmp = viewChild.required<TemplateRef<any>>('grantAmountTmp');
fundingAmountTmp = viewChild.required<TemplateRef<any>>('fundingAmountTmp');
euProjectPage = input.required<EuProjectPage>();
cordisEuProjectPage = input.required<CordisEuProjectPage>();
euProjectColumns: GenericColumn<EuProjectRow>[] = [];
euProjectData: EuProjectRow[] = [];
@@ -79,6 +84,30 @@ export class InstitutionProjectsComponent implements OnInit {
bundProjectColumns: GenericColumn<BundProjectRow>[] = [];
bundProjectData: BundProjectRow[] = [];
bundProjectsFunding = input.required<InstitutionFunderSummary>();
bundTotalFunding = computed(() => {
const funding = this.bundProjectsFunding();
return Object.values(
funding.funding_per_year as Record<string, number>,
).reduce((sum, yearFunding) => sum + yearFunding, 0);
});
bundAverageAnnualFunding = computed(() => {
const funding = this.bundProjectsFunding();
return funding.annual_average_over_period ?? 0;
});
cordisEuProjectsFunding = input.required<InstitutionFunderSummary>();
euTotalFunding = computed(() => {
const funding = this.cordisEuProjectsFunding();
return Object.values(
funding.funding_per_year as Record<string, number>,
).reduce((sum, yearFunding) => sum + yearFunding, 0);
});
euAverageAnnualFunding = computed(() => {
const funding = this.cordisEuProjectsFunding();
return funding.annual_average_over_period ?? 0;
});
urlSortKey = signal<string>('');
urlSortDirection = signal<SortDirection>('');
urlSearchTerm = signal<string>('');
@@ -98,7 +127,7 @@ export class InstitutionProjectsComponent implements OnInit {
});
effect(() => {
const euPage = this.euProjectPage();
const euPage = this.cordisEuProjectPage();
if (euPage) {
this.euProjectData = euPage.elements
? euPage.elements.map(this.transformEuRow.bind(this))
@@ -118,11 +147,15 @@ export class InstitutionProjectsComponent implements OnInit {
const searchTerm = this.urlSearchTerm();
if (searchTerm) {
this.router.navigate([], {
queryParams: { search: searchTerm },
queryParams: { search: searchTerm, page: 0, size: 10 },
queryParamsHandling: 'merge',
});
}
});
effect(() => {
console.log('Funding over time data:', this.bundProjectsFunding());
});
}
readonly queryParams = toSignal(this.activatedRoute.queryParamMap, {
@@ -141,7 +174,7 @@ export class InstitutionProjectsComponent implements OnInit {
readonly selectedPage = computed(() => {
if (this.displayedProjects() === 'eu') {
return this.euProjectPage();
return this.cordisEuProjectPage();
} else {
return this.bundProjectPage();
}
@@ -162,8 +195,8 @@ export class InstitutionProjectsComponent implements OnInit {
ngOnInit(): void {
this.euProjectColumns = [
{
id: 'topic',
header: 'Thema',
id: 'title',
header: 'Titel',
type: 'accessor',
accessorKey: 'topic',
},
@@ -182,17 +215,17 @@ export class InstitutionProjectsComponent implements OnInit {
cellTemplate: this.fundingEndTmp(),
},
{
id: 'grant_amount',
id: 'funding_amount',
header: 'Fördersumme',
type: 'accessor',
accessorKey: 'grant_amount',
cellTemplate: this.grantAmountTmp(),
accessorKey: 'funding_amount',
cellTemplate: this.fundingAmountTmp(),
},
];
this.bundProjectColumns = [
{
id: 'topic',
header: 'Thema',
header: 'Titel',
type: 'accessor',
accessorKey: 'topic',
},
@@ -211,29 +244,23 @@ export class InstitutionProjectsComponent implements OnInit {
cellTemplate: this.fundingEndTmp(),
},
{
id: 'grant_amount',
id: 'funding_amount',
header: 'Fördersumme',
type: 'accessor',
accessorKey: 'grant_amount',
cellTemplate: this.grantAmountTmp(),
},
{
id: 'department',
header: 'Abteilung',
type: 'accessor',
accessorKey: 'department',
accessorKey: 'funding_amount',
cellTemplate: this.fundingAmountTmp(),
},
];
}
transformEuRow(project: EuProject): EuProjectRow {
transformEuRow(project: CordisEuProject): EuProjectRow {
return {
topic: project.title || '',
funding_start: project.start_date
? new Date(project.start_date)
funding_start: project.startDate
? new Date(project.startDate)
: new Date(0),
funding_end: project.end_date ? new Date(project.end_date) : new Date(0),
grant_amount: Number(project.total_cost) || 0,
funding_end: project.endDate ? new Date(project.endDate) : new Date(0),
funding_amount: Number(project.totalCost) || 0,
};
}
@@ -246,7 +273,7 @@ export class InstitutionProjectsComponent implements OnInit {
funding_end: project.funding_end
? new Date(project.funding_end)
: new Date(0),
grant_amount: project.grant_amount || 0,
funding_amount: project.grant_amount || 0,
department: project.department_fullname || '',
};
}
@@ -265,7 +292,7 @@ export class InstitutionProjectsComponent implements OnInit {
selectedTabChange(event: MatTabChangeEvent): void {
const tab = ['eu', 'bund'][event.index];
this.router.navigate([], {
queryParams: { project_tab: tab, page: 1, size: 10 },
queryParams: { project_tab: tab, page: 0, size: 10 },
queryParamsHandling: 'merge',
});
}
@@ -286,14 +313,14 @@ export class InstitutionProjectsComponent implements OnInit {
handleSearchTermChange(newTerm: string): void {
this.router.navigate([], {
queryParams: { search: newTerm },
queryParams: { search: newTerm, page: 0, size: 10 },
queryParamsHandling: 'merge',
});
}
clearSearchTerm(): void {
this.router.navigate([], {
queryParams: { search: null },
queryParams: { search: null, page: 0, size: 10 },
queryParamsHandling: 'merge',
});
}
@@ -0,0 +1 @@
<p>institution-publications works!</p>
@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-institution-publications',
imports: [],
templateUrl: './institution-publications.component.html',
styleUrl: './institution-publications.component.scss',
})
export class InstitutionPublicationsComponent {}
@@ -26,16 +26,17 @@ export class InstitutionComponent implements OnInit {
links = [
{ label: 'Übersicht', path: 'overview', disabled: false },
{ label: 'Publikationen', path: 'publications', disabled: false },
{
label: 'Projekte',
path: 'projects',
disabled: false,
queryParams: {
project_tab: 'bund',
page: 1,
page: 0,
size: 10,
search: '',
sort_by: 'topic',
sort_by: 'title',
sort_direction: 'asc',
},
},
@@ -0,0 +1,116 @@
<div class="content">
<h1>Passende Institutionen finden</h1>
<mat-divider />
<div class="search-and-sorting">
<mat-form-field style="width: 100%">
<mat-label>Suche nach Namen</mat-label>
<input
matInput
type="search"
[debounceTime]="300"
[(debouncedValue)]="urlSearchTerm"
(debouncedValueChange)="handleSearchTermChange($event)" />
<mat-icon matPrefix>search</mat-icon>
<button matIconButton matSuffix (click)="clearSearchTerm()">
<mat-icon>clear</mat-icon>
</button>
</mat-form-field>
<div class="sorting">
<select (change)="handleSortFieldChange($event)" [value]="urlSortBy()">
<option value="relevance">Relevanz</option>
<option value="name">Name</option>
<option value="works_count">Anzahl Publikationen</option>
<option value="citations_count">Anzahl Zitationen</option>
</select>
<select
(change)="handleSortOrderChange($event)"
[value]="urlSortingOrder()">
<option value="desc">Absteigend</option>
<option value="asc">Aufsteigend</option>
</select>
</div>
</div>
<mat-divider />
@let institutionPageValue = institutionPage();
@if (
institutionPageValue.elements && institutionPageValue.elements.length > 0
) {
<div class="cards">
@for (institution of institutionPageValue.elements; track $index) {
@let institutionId = extractInstitutionId(institution);
<mat-card
class="card"
appearance="outlined"
[routerLink]="
institution.id
? ['/institution', institution.id.split('/').pop() ?? '']
: null
">
<mat-card-header>
<mat-card-title>{{ getDisplayName(institution) }}</mat-card-title>
<mat-card-subtitle
>{{ institution.geo?.city }},
{{ institution.geo?.country }}</mat-card-subtitle
>
</mat-card-header>
<mat-card-content class="card-content">
<mat-divider />
<div class="card-metadata">
<span>Publikationen: {{ institution.works_count }}</span>
<span>Zitationen: {{ institution.cited_by_count }}</span>
</div>
<mat-divider />
</mat-card-content>
<mat-card-footer>
<mat-card-actions>
<a
mat-button
[routerLink]="['/institution', institutionId, 'overview']"
(click)="$event.stopPropagation()">
<mat-icon>info</mat-icon>
Übersicht
</a>
<a
mat-button
[routerLink]="['/institution', institutionId, 'publications']"
(click)="$event.stopPropagation()">
<mat-icon>article</mat-icon>
Publikationen
</a>
<a
mat-button
[routerLink]="['/institution', institutionId, 'projects']"
(click)="$event.stopPropagation()">
<mat-icon>work</mat-icon>
Projekte
</a>
</mat-card-actions>
</mat-card-footer>
</mat-card>
}
</div>
} @else {
<div class="no-results">
<p>Keine passenden Institutionen gefunden.</p>
</div>
}
<mat-divider />
<mat-paginator
[length]="institutionPageValue.total"
[pageSize]="institutionPageValue.size"
[pageSizeOptions]="[10, 20, 50]"
[pageIndex]="institutionPageValue.page"
(page)="handlePageChange($event)">
</mat-paginator>
</div>
@@ -0,0 +1,99 @@
.content {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
}
.sorting {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
}
.sorting select {
padding: 0.75rem;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
font-size: 1rem;
}
.sorting select:hover {
cursor: pointer;
}
.cards {
display: grid;
gap: 1.5rem;
grid-template-columns: repeat(4, 1fr);
padding: 0 1rem;
}
@media (max-width: 900px) {
.cards {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 600px) {
.cards {
grid-template-columns: 1fr;
}
}
mat-paginator {
background-color: var(--sg-background);
}
.card {
padding: 0.5rem;
background-color: var(--sg-background);
transition: transform 0.3s ease;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.card:hover {
cursor: pointer;
transform: scale(1.05);
}
.card-content {
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 0.5rem;
flex: 1;
}
.card-metadata {
display: flex;
flex-direction: column;
gap: 0.2rem;
font-size: 0.9rem;
color: var(--sg-text-secondary);
}
mat-card-actions {
padding-top: 0.5rem;
display: flex;
gap: 0.5rem;
}
mat-card-actions a {
width: 100%;
text-decoration: none;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
}
.no-results {
text-align: center;
padding: 2rem;
color: var(--sg-text-secondary);
}
.search-and-sorting {
padding: 0 1rem;
}
@@ -0,0 +1,108 @@
import { Component, effect, input, signal } from '@angular/core';
import { Institution, InstitutionPage } from '../../api';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatInputModule } from '@angular/material/input';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatIconModule } from '@angular/material/icon';
import { DebounceDirective } from '../../directives/debounce.directive';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatDividerModule } from '@angular/material/divider';
@Component({
selector: 'app-institutions',
imports: [
MatButtonModule,
MatCardModule,
MatInputModule,
MatIconModule,
DebounceDirective,
MatPaginator,
MatDividerModule,
RouterModule,
],
templateUrl: './institutions.component.html',
styleUrl: './institutions.component.scss',
})
export class InstitutionsComponent {
institutionPage = input.required<InstitutionPage>();
urlSearchTerm = signal<string>('');
urlSortBy = signal<string>('relevance');
urlSortingOrder = signal<string>('desc');
constructor(
private readonly activatedRoute: ActivatedRoute,
private readonly router: Router,
) {
this.activatedRoute.queryParams
.pipe(takeUntilDestroyed())
.subscribe((params) => {
this.urlSearchTerm.set(params['search'] || '');
this.urlSortBy.set(params['sort_by'] || 'relevance');
this.urlSortingOrder.set(params['sorting_order'] || 'desc');
});
effect(() => {
const searchTerm = this.urlSearchTerm();
this.router.navigate([], {
queryParams: { search: searchTerm },
queryParamsHandling: 'merge',
});
});
}
handleSearchTermChange(newTerm: string): void {
this.router.navigate([], {
queryParams: { search: newTerm },
queryParamsHandling: 'merge',
});
}
clearSearchTerm(): void {
this.router.navigate([], {
queryParams: { search: null },
queryParamsHandling: 'merge',
});
}
handlePageChange(event: PageEvent): void {
this.router.navigate([], {
queryParams: { page: event.pageIndex, size: event.pageSize },
queryParamsHandling: 'merge',
});
}
extractInstitutionId(institution: Institution): string {
return institution.id?.split('/').pop() ?? '';
}
handleSortFieldChange(event: Event): void {
const selectElement = event.target as HTMLSelectElement;
const sortField = selectElement.value;
this.router.navigate([], {
queryParams: { sort_by: sortField },
queryParamsHandling: 'merge',
});
}
handleSortOrderChange(event: Event): void {
const selectElement = event.target as HTMLSelectElement;
const sortOrder = selectElement.value;
this.router.navigate([], {
queryParams: { sorting_order: sortOrder },
queryParamsHandling: 'merge',
});
}
getDisplayName(institution: Institution): string {
const primary = institution.display_name?.trim();
if (primary && primary.length > 0) return primary;
const alt = institution.display_name_alternatives?.[0]?.trim();
if (alt && alt.length > 0) return alt;
return 'Unbekannte Institution';
}
}
@@ -25,7 +25,7 @@
{{ person.display_name ?? '' }}
</h2>
<p [skText]="loading" class="person-id">
{{ getDistinguishingId(person) ?? '' }}
{{ getDistinguishingId(person) }}
</p>
<p [skText]="loading" class="stats">
{{ getStatsString() }}
@@ -36,11 +36,25 @@ export class PersonCardComponent {
}
institution(person: CustomAuthor): DehydratedInstitution | undefined {
return (
person.last_known_institutions?.[0] ||
person.affiliations?.[person.affiliations.length - 1]?.institution ||
undefined
);
if (person.last_known_institutions?.[0]) {
return person.last_known_institutions[0];
}
const affiliations = person.affiliations ?? [];
let newestInstitution: DehydratedInstitution | undefined =
affiliations[0]?.institution ?? undefined;
let newestYear = -1;
for (const affiliation of affiliations) {
for (const jahr of affiliation.years ?? []) {
if (jahr > newestYear) {
newestYear = jahr;
newestInstitution = affiliation.institution ?? undefined;
}
}
}
return newestInstitution;
}
topics(person: CustomAuthor): WorkTopic[] {
@@ -0,0 +1,269 @@
@if (loading) {
<div class="state state-loading" aria-live="polite">
<mat-spinner diameter="36"></mat-spinner>
<span>Verbindungen zu Unternehmen werden geladen ...</span>
</div>
} @else if (error) {
<div class="state state-error">
Verbindungen zu Unternehmen konnten nicht geladen werden.
</div>
} @else if (data && !data.is_ude_author) {
<section class="empty-state">
<h2>Keine Unternehmenssuche verfügbar</h2>
<p>Für diese Person wird aktuell keine Suche nach Unternehmen angezeigt.</p>
</section>
} @else if (data && connections.length === 0) {
<section class="empty-state">
<h2>Keine Treffer im Handelsregister</h2>
<p>
Für diese Person wurden keine passenden Treffer im Handelsregister
gefunden.
</p>
</section>
} @else if (data) {
<section class="company-connections">
<header class="page-header">
<h2>Mögliche Verbindungen zu Unternehmen</h2>
<p>
{{ getResultCountLabel() }} für
<strong>{{ data.display_name }}</strong>
</p>
</header>
@if (data.common_name_warning) {
<div class="warning-box">
Für diesen Namen gibt es mehrere Treffer im Handelsregister. Die
Ergebnisse sollten besonders vorsichtig interpretiert werden.
</div>
}
<div class="main-layout">
<section class="graph-column">
@if (graphOptions) {
<mat-card appearance="outlined" class="graph-card">
<div class="graph-stage">
<button
mat-icon-button
type="button"
class="graph-related-persons-button"
#relatedPersonsTooltip="matTooltip"
(click)="toggleRelatedPersons(relatedPersonsTooltip)"
[matTooltip]="
showRelatedPersons
? 'Weitere Registerpersonen ausblenden'
: 'Weitere Registerpersonen anzeigen'
"
matTooltipPosition="left"
[attr.aria-label]="
showRelatedPersons
? 'Weitere Registerpersonen ausblenden'
: 'Weitere Registerpersonen anzeigen'
">
<mat-icon class="graph-related-persons-icon">
{{ showRelatedPersons ? 'no_accounts' : 'account_circle' }}
</mat-icon>
</button>
<div
class="graph"
echarts
[options]="graphOptions"
[autoResize]="true"
(wheel)="onGraphWheel($event)"
(chartClick)="onGraphClick($event)"></div>
</div>
@if (roleLegendItems.length > 0) {
<div class="role-legend" aria-label="Legende der Rollen">
@for (item of roleLegendItems; track item.role) {
<span class="role-legend-item">
<span
class="role-legend-line"
[style.background]="item.color"></span>
<span class="role-legend-text">{{ item.role }}</span>
</span>
}
</div>
}
@if (connections.length > 10) {
<p class="graph-note">
Der Graph zeigt die ersten 10 Unternehmen. Die vollständige
Liste ist rechts sichtbar.
</p>
}
</mat-card>
}
<p class="disclaimer">
{{ disclaimer }}
</p>
</section>
<section class="list-column">
<mat-card appearance="outlined" class="connection-list">
<div class="list-header">
<span>Unternehmen</span>
<span>Rolle</span>
</div>
<div class="list-scroll">
@for (connection of connections; track getCompanyKey(connection)) {
@let officer = getPrimaryOfficer(connection);
@let companyKey = getCompanyKey(connection);
@let relatedOfficers = getRelatedOfficers(connection);
<div class="connection-item">
<div
#connectionRow
class="connection-row"
[attr.data-company-key]="companyKey"
[class.selected]="companyKey === selectedCompanyKey"
[class.removed]="connection.company_status === 'removed'"
(click)="selectCompany(connection)">
<span
class="company-name"
[title]="connection.company_name || ''">
{{ connection.company_name || 'Unbekanntes Unternehmen' }}
</span>
<span
class="role-value"
[style.border-color]="getRoleColor(officer?.position)"
[title]="officer?.position || ''">
{{ officer?.position || '—' }}
</span>
</div>
@if (companyKey === selectedCompanyKey) {
<div
class="connection-detail"
(click)="$event.stopPropagation()">
<div class="detail-grid">
<div class="detail-field">
<span class="detail-label">Register</span>
<span class="detail-value">
{{ getCompanyRegisterLabel(connection) }}
</span>
</div>
<div class="detail-field">
<span class="detail-label">Amtsgericht</span>
<span class="detail-value">
{{ getRegistrarLabel(connection) }}
</span>
</div>
<div class="detail-field detail-field--address">
<span class="detail-label">Adresse</span>
<span class="detail-value">
{{ getCompanyAddressLabel(connection) }}
</span>
</div>
<div class="detail-field">
<span class="detail-label">Unternehmensstatus</span>
<span
class="detail-value detail-status"
[class.detail-status--active]="
connection.company_status === 'currently registered'
"
[class.detail-status--removed]="
connection.company_status === 'removed'
">
{{ getCompanyStatusLabel(connection.company_status) }}
</span>
</div>
<div class="detail-field detail-field--wide">
<span class="detail-label">Gegenstand</span>
<span class="detail-value">
{{ getGegenstandLabel() }}
</span>
</div>
</div>
@if (relatedOfficers.length > 0) {
<button
type="button"
class="officers-toggle"
(click)="toggleCompanyOfficers(connection, $event)">
<span>
Weitere Registerpersonen ({{
relatedOfficers.length
}})
</span>
<mat-icon>
{{
isCompanyOfficersExpanded(connection)
? 'expand_less'
: 'expand_more'
}}
</mat-icon>
</button>
@if (isCompanyOfficersExpanded(connection)) {
<div class="related-officers">
@for (
relatedOfficer of relatedOfficers;
track relatedOfficer.name
) {
<div class="related-officer">
<span
class="officer-name"
[title]="relatedOfficer.name || ''">
{{ relatedOfficer.name }}
</span>
<span
class="officer-role"
[style.border-color]="
getRoleColor(relatedOfficer.position)
"
[title]="relatedOfficer.position || ''">
{{ relatedOfficer.position || '—' }}
</span>
@if (relatedOfficer.name) {
<a
mat-icon-button
color="primary"
class="officer-open-link"
[routerLink]="['/persons']"
[queryParams]="
getPersonSearchQueryParams(
relatedOfficer.name
)
"
target="_blank"
rel="noopener noreferrer"
[attr.aria-label]="
'Suche nach ' +
relatedOfficer.name +
' öffnen'
"
[title]="
'Suche nach ' +
relatedOfficer.name +
' öffnen'
">
<mat-icon>open_in_new</mat-icon>
</a>
} @else {
<span class="officer-open-placeholder"></span>
}
</div>
}
</div>
}
}
</div>
}
</div>
}
</div>
</mat-card>
</section>
</div>
</section>
}
@@ -0,0 +1,505 @@
$marked-color: #5470c6;
$related-person-color: #4f8df5;
$timeline-purple: #7255d9;
$timeline-purple-bg: #f6f0ff;
$timeline-orange-bg: #fff7e8;
$timeline-orange-border: #ffd796;
$timeline-orange-text: #c67500;
$card-border: #dbe5f6;
$text-main: #07163d;
$text-muted: #64718f;
:host {
display: block;
}
.company-connections {
display: flex;
flex-direction: column;
gap: 16px;
padding: 20px 28px 32px;
}
.page-header {
h2 {
margin: 0 0 6px;
color: $text-main;
font-size: 20px;
font-weight: 700;
line-height: 1.25;
}
p {
margin: 0;
color: $text-muted;
font-size: 14px;
line-height: 1.4;
}
}
.state {
display: flex;
align-items: center;
justify-content: center;
gap: 14px;
min-height: 220px;
color: $text-muted;
font-size: 14px;
}
.state-error {
color: #b42318;
}
.empty-state {
margin: 14px 28px;
padding: 18px 22px;
border: 1px solid $card-border;
border-radius: 16px;
background: #ffffff;
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
h2 {
margin: 0 0 6px;
color: $text-main;
font-size: 18px;
font-weight: 700;
line-height: 1.3;
}
p {
margin: 0;
color: $text-muted;
font-size: 14px;
line-height: 1.4;
}
}
.warning-box {
padding: 12px 14px;
border: 1px solid $timeline-orange-border;
border-radius: 12px;
background: $timeline-orange-bg;
color: $timeline-orange-text;
font-size: 14px;
line-height: 1.45;
}
.main-layout {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 18px;
height: 680px;
align-items: stretch;
}
.graph-column,
.list-column {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
.graph-card,
.connection-list {
border-radius: 16px;
background: #ffffff;
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
overflow: hidden;
}
.graph-card {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.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%;
min-height: 0;
overscroll-behavior: contain;
touch-action: none;
user-select: none;
cursor: grab;
}
.graph:active {
cursor: grabbing;
}
.role-legend {
flex: 0 0 auto;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 10px 18px;
padding: 10px 18px 6px;
}
.role-legend-item {
display: inline-flex;
align-items: center;
gap: 8px;
min-width: 0;
color: $text-muted;
font-size: 12px;
font-weight: 600;
}
.role-legend-line {
flex: 0 0 auto;
display: inline-block;
width: 24px;
height: 3px;
border-radius: 999px;
}
.role-legend-text {
min-width: 0;
max-width: 260px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.graph-note {
flex: 0 0 auto;
margin: 0;
padding: 4px 18px 16px;
color: $text-muted;
font-size: 13px;
line-height: 1.35;
text-align: left;
}
.disclaimer {
flex: 0 0 auto;
margin: 14px 0 0;
padding: 12px 14px;
border-left: 3px solid $timeline-purple;
border-radius: 8px;
background: $timeline-purple-bg;
color: $text-muted;
font-size: 13px;
line-height: 1.45;
}
.connection-list {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.list-header,
.connection-row {
display: grid;
grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
gap: clamp(10px, 1vw, 18px);
align-items: center;
}
.list-header {
flex: 0 0 auto;
padding: 12px 16px;
border-bottom: 1px solid $card-border;
background: #fbfdff;
color: $text-muted;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
line-height: 1.3;
}
.list-header span,
.connection-row span {
min-width: 0;
justify-self: start;
text-align: left;
}
.list-scroll {
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
}
.connection-item {
border-bottom: 1px solid #edf2fb;
}
.connection-row {
padding: 14px 16px;
color: $text-main;
font-size: 14px;
cursor: pointer;
&:hover {
background: #f8fbff;
}
&.selected {
background: #f0f6ff;
box-shadow: inset 3px 0 0 $marked-color;
}
&.removed {
color: $text-muted;
}
}
.company-name,
.role-value,
.detail-value,
.officer-name,
.officer-role {
display: block;
max-width: 100%;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.company-name {
font-weight: 700;
}
.role-value {
width: auto;
padding-left: 8px;
border-left: 3px solid;
color: $text-main;
}
.connection-detail {
padding: 0 16px 16px;
background: #f8fbff;
}
.detail-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px 18px;
padding: 14px 0 4px;
border-top: 1px solid #e5edf8;
}
.detail-field {
min-width: 0;
}
.detail-field--wide {
grid-column: 1 / -1;
}
.detail-field--address .detail-value,
.detail-field--wide .detail-value {
overflow: visible;
text-overflow: unset;
white-space: normal;
}
.detail-label {
display: block;
margin-bottom: 3px;
color: $text-muted;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
}
.detail-value {
color: $text-main;
font-size: 13px;
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;
align-items: center;
width: 100%;
margin-top: 14px;
padding: 12px 0 0;
border: 0;
border-top: 1px solid #e5edf8;
background: transparent;
color: $text-muted;
font-size: 11px;
font-weight: 700;
text-align: left;
text-transform: uppercase;
letter-spacing: 0.02em;
cursor: pointer;
}
.officers-toggle mat-icon {
color: $text-muted;
}
.related-officers {
display: flex;
flex-direction: column;
gap: 6px;
margin: 8px 0 0;
padding: 0;
}
.related-officer {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) 40px;
gap: 12px;
align-items: center;
color: $text-main;
font-size: 13px;
}
.officer-name {
color: $text-main;
font-weight: 400;
}
.officer-role {
padding-left: 10px;
border-left: 4px solid #8a95b3;
color: $text-main;
font-weight: 600;
}
.officer-open-link {
justify-self: center;
color: $marked-color;
}
.officer-open-placeholder {
display: block;
width: 40px;
height: 40px;
}
@media (max-width: 1450px) {
.main-layout {
grid-template-columns: 1fr;
height: auto;
}
.graph-card {
height: 520px;
}
.connection-list {
height: 520px;
}
}
@media (max-width: 760px) {
.company-connections {
padding: 18px 16px 28px;
}
.empty-state {
margin: 14px 16px;
}
.graph-card {
height: 420px;
}
.list-header {
display: none;
}
.connection-row {
grid-template-columns: 1fr;
gap: 8px;
}
.detail-grid {
grid-template-columns: 1fr;
}
.related-officer {
grid-template-columns: minmax(0, 1fr) 40px;
gap: 6px 10px;
}
.officer-role {
grid-column: 1 / 2;
}
.officer-open-link,
.officer-open-placeholder {
grid-column: 2 / 3;
grid-row: 1 / 3;
align-self: center;
justify-self: center;
}
}
@@ -0,0 +1,702 @@
import { CommonModule, LocationStrategy } from '@angular/common';
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';
import { NgxEchartsDirective } from 'ngx-echarts';
import {
CompanyConnection,
CompanyConnectionsResponse,
CompanyConnectionsService,
MatchedOfficer,
} from '../../api';
interface RoleLegendItem {
role: string;
color: string;
}
@Component({
selector: 'app-person-company-connections',
imports: [
CommonModule,
MatProgressSpinnerModule,
NgxEchartsDirective,
MatButtonModule,
MatCardModule,
MatIconModule,
MatTooltipModule,
MatTooltip,
RouterModule,
],
templateUrl: './person-company-connections.component.html',
styleUrl: './person-company-connections.component.scss',
})
export class PersonCompanyConnectionsComponent implements OnInit {
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly locationStrategy = inject(LocationStrategy);
private readonly companyConnectionsApi = inject(CompanyConnectionsService);
private readonly graphCompanyLimit = 10;
private readonly personCategoryIndex = 0;
private readonly activeCompanyCategoryIndex = 1;
private readonly removedCompanyCategoryIndex = 2;
private readonly registerPersonCategoryIndex = 3;
private readonly personCategoryName = 'Person';
private readonly activeCompanyCategoryName = 'Aktives Unternehmen';
private readonly removedCompanyCategoryName = 'Gelöschtes Unternehmen';
private readonly registerPersonCategoryName = 'Registerperson';
private readonly authorColor = '#7255d9';
private readonly companyActiveColor = '#39a96b';
private readonly companyRemovedColor = '#8a95b3';
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<string, string> = {
Geschäftsführer: '#2678e8',
Prokurist: '#39a96b',
'Persönlich haftender Gesellschafter': '#7255d9',
Liquidator: '#f59e0b',
Inhaber: '#e0527c',
Vorstand: '#0f766e',
};
readonly disclaimer =
'Die angezeigten Verbindungen basieren nur auf einem Namensabgleich und können gleichnamige Personen enthalten.';
loading = true;
error = false;
data: CompanyConnectionsResponse | null = null;
graphOptions: EChartsOption | null = null;
roleLegendItems: RoleLegendItem[] = [];
selectedCompanyKey: string | null = null;
expandedOfficersCompanyKey: string | null = null;
showRelatedPersons = false;
@ViewChildren('connectionRow', { read: ElementRef })
private connectionRows!: QueryList<ElementRef<HTMLElement>>;
get connections(): CompanyConnection[] {
return this.data?.connections ?? [];
}
ngOnInit(): void {
this.route.parent?.paramMap.subscribe((params) => {
const authorId = params.get('id');
if (!authorId) {
this.loading = false;
this.error = true;
return;
}
this.loadCompanyConnections(authorId);
});
}
getPrimaryOfficer(connection: CompanyConnection): MatchedOfficer | null {
return connection.matched_officers?.[0] ?? null;
}
getRelatedOfficers(connection: CompanyConnection): MatchedOfficer[] {
const displayName = this.data?.display_name?.trim();
return (connection.officers ?? []).filter((officer) => {
const officerName = officer.name?.trim();
if (!officerName) {
return false;
}
if (officer.is_matched_person) {
return false;
}
return officerName !== displayName;
});
}
getCompanyStatusLabel(status?: string | null): string {
if (status === 'currently registered') {
return 'Aktiv';
}
if (status === 'removed') {
return 'Gelöscht';
}
return status || 'Unbekannt';
}
getCompanyKey(connection: CompanyConnection): string {
return (
connection.company_number ||
`${connection.company_name}-${connection.register_art}-${connection.register_nummer}`
);
}
getCompanyRegisterLabel(connection: CompanyConnection): string {
const parts = [connection.register_art, connection.register_nummer].filter(
Boolean,
);
return parts.length > 0 ? parts.join(' ') : '—';
}
getRegistrarLabel(connection: CompanyConnection): string {
return connection.registrar || '—';
}
getCompanyAddressLabel(connection: CompanyConnection): string {
return connection.registered_address || connection.registered_office || '—';
}
getGegenstandLabel(): string {
return 'Noch nicht verfügbar.';
}
getResultCountLabel(): string {
if (!this.data) {
return '';
}
const companyCount = this.data.company_count ?? this.connections.length;
if (companyCount === 1) {
return '1 Treffer';
}
return `${companyCount} Treffer`;
}
getRoleColor(role?: string | null): string {
if (!role) {
return this.fallbackRoleColor;
}
return this.roleColors[role] ?? this.fallbackRoleColor;
}
isCompanySelected(connection: CompanyConnection): boolean {
return this.selectedCompanyKey === this.getCompanyKey(connection);
}
isCompanyOfficersExpanded(connection: CompanyConnection): boolean {
return this.expandedOfficersCompanyKey === this.getCompanyKey(connection);
}
selectCompany(connection: CompanyConnection): void {
const companyKey = this.getCompanyKey(connection);
if (this.selectedCompanyKey === companyKey) {
this.selectedCompanyKey = null;
this.expandedOfficersCompanyKey = null;
return;
}
this.selectedCompanyKey = companyKey;
this.expandedOfficersCompanyKey = null;
}
toggleCompanyOfficers(connection: CompanyConnection, event: Event): void {
event.stopPropagation();
const companyKey = this.getCompanyKey(connection);
if (this.expandedOfficersCompanyKey === companyKey) {
this.expandedOfficersCompanyKey = null;
return;
}
this.expandedOfficersCompanyKey = companyKey;
}
onGraphClick(event: any): void {
if (event.dataType !== 'node') {
return;
}
if (event.data?.category === this.personCategoryIndex) {
return;
}
if (this.isCompanyNodeCategory(event.data?.category)) {
this.selectedCompanyKey = event.data.id;
this.expandedOfficersCompanyKey = null;
this.scrollSelectedCompanyIntoView();
return;
}
if (event.data?.category === this.registerPersonCategoryIndex) {
this.openPersonSearchInNewTab(event.data.searchName || event.data.name);
}
}
onGraphWheel(event: WheelEvent): void {
event.preventDefault();
}
private isCompanyNodeCategory(category: unknown): boolean {
return (
category === this.activeCompanyCategoryIndex ||
category === this.removedCompanyCategoryIndex
);
}
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;
this.data = null;
this.graphOptions = null;
this.roleLegendItems = [];
this.selectedCompanyKey = null;
this.expandedOfficersCompanyKey = null;
this.showRelatedPersons = false;
this.companyConnectionsApi
.getCompanyConnectionsByAuthor(authorId)
.subscribe({
next: (response) => {
this.data = response;
this.graphOptions = this.createGraphOptions(response);
this.loading = false;
},
error: (error) => {
console.error('Failed to load company connections:', error);
this.error = true;
this.loading = false;
},
});
}
private refreshGraph(): void {
if (!this.data) {
this.graphOptions = null;
this.roleLegendItems = [];
return;
}
this.graphOptions = this.createGraphOptions(this.data);
}
private createGraphOptions(
response: CompanyConnectionsResponse,
): EChartsOption | null {
const connections = response.connections ?? [];
if (!response.is_ude_author || connections.length === 0) {
return null;
}
const graphConnections = connections.slice(0, this.graphCompanyLimit);
this.roleLegendItems = this.createRoleLegendItems(graphConnections);
const personNodeId = `author-${response.author_id}`;
const nodes: any[] = [
{
id: personNodeId,
name: response.display_name || 'Person',
category: this.personCategoryIndex,
symbol: this.personIconSymbol,
symbolSize: 42,
symbolKeepAspect: true,
itemStyle: {
color: this.authorColor,
},
label: {
show: true,
position: 'bottom',
fontWeight: 700,
color: '#07163d',
},
},
];
const links: any[] = [];
for (const connection of graphConnections) {
const companyKey = this.getCompanyKey(connection);
const isRemoved = connection.company_status === 'removed';
nodes.push({
id: companyKey,
name: connection.company_name || 'Unbekanntes Unternehmen',
category: isRemoved
? this.removedCompanyCategoryIndex
: this.activeCompanyCategoryIndex,
symbol: isRemoved
? this.removedCompanyIconSymbol
: this.activeCompanyIconSymbol,
symbolSize: 44,
symbolKeepAspect: true,
itemStyle: {
color: isRemoved ? this.companyRemovedColor : this.companyActiveColor,
},
label: {
show: true,
position: 'bottom',
color: '#07163d',
width: 125,
overflow: 'truncate',
},
});
const officer = this.getPrimaryOfficer(connection);
const role = officer?.position || 'Unbekannte Rolle';
const color = this.getRoleColor(officer?.position);
links.push({
source: personNodeId,
target: companyKey,
value: role,
lineStyle: {
color,
width: 2.4,
opacity: 1,
},
});
if (this.showRelatedPersons) {
const relatedOfficers = this.getRelatedOfficers(connection);
relatedOfficers.forEach((relatedOfficer, index) => {
const relatedOfficerId = `officer-${companyKey}-${index}`;
const relatedRole = relatedOfficer.position || 'Unbekannte Rolle';
nodes.push({
id: relatedOfficerId,
name: relatedOfficer.name || 'Registerperson',
searchName: relatedOfficer.name,
role: relatedRole,
category: this.registerPersonCategoryIndex,
symbol: this.registerPersonIconSymbol,
symbolSize: 30,
symbolKeepAspect: true,
itemStyle: {
color: this.relatedPersonColor,
},
label: {
show: true,
position: 'bottom',
color: '#07163d',
width: 110,
overflow: 'truncate',
fontSize: 11,
},
});
links.push({
source: companyKey,
target: relatedOfficerId,
value: relatedRole,
lineStyle: {
color: this.getRoleColor(relatedOfficer.position),
width: 1.8,
opacity: 1,
},
});
});
}
}
const graphSeries: any = {
type: 'graph',
layout: 'force',
roam: true,
roamTrigger: 'global',
animation: false,
top: 34,
left: 20,
right: 20,
bottom: 64,
data: nodes,
links,
categories: this.createGraphCategories(),
force: {
repulsion: this.showRelatedPersons ? 760 : 620,
edgeLength: this.showRelatedPersons ? 145 : 170,
gravity: 0.08,
},
lineStyle: {
curveness: 0.05,
opacity: 1,
},
edgeSymbol: ['none', 'none'],
emphasis: {
focus: 'adjacency',
lineStyle: {
width: 3.5,
},
},
};
return {
legend: {
data: this.createNodeLegendData(graphConnections),
bottom: 8,
left: 'center',
orient: 'horizontal',
itemGap: 18,
itemWidth: 20,
itemHeight: 20,
selectedMode: false,
textStyle: {
color: '#3f4659',
fontSize: 13,
fontWeight: 500,
},
},
tooltip: {
trigger: 'item',
formatter: (params: any) => {
if (params.dataType === 'node') {
if (params.data?.category === this.registerPersonCategoryIndex) {
return params.data?.role
? `${params.data.name}<br/>Rolle: ${params.data.role}`
: params.data?.name;
}
return params.data?.name ?? '';
}
if (params.dataType === 'edge') {
return params.data?.value
? `Rolle: ${params.data.value}`
: 'Verbindung';
}
return '';
},
},
series: [graphSeries],
} as EChartsOption;
}
private createGraphCategories(): any[] {
return [
{
name: this.personCategoryName,
symbol: this.personIconSymbol,
},
{
name: this.activeCompanyCategoryName,
symbol: this.activeCompanyIconSymbol,
},
{
name: this.removedCompanyCategoryName,
symbol: this.removedCompanyIconSymbol,
},
{
name: this.registerPersonCategoryName,
symbol: this.registerPersonIconSymbol,
},
];
}
private createNodeLegendData(connections: CompanyConnection[]): any[] {
const hasActiveCompany = connections.some(
(connection) => connection.company_status !== 'removed',
);
const hasRemovedCompany = connections.some(
(connection) => connection.company_status === 'removed',
);
const legendData = [
{
name: this.personCategoryName,
icon: this.personIconSymbol,
},
];
if (hasActiveCompany) {
legendData.push({
name: this.activeCompanyCategoryName,
icon: this.activeCompanyIconSymbol,
});
}
if (hasRemovedCompany) {
legendData.push({
name: this.removedCompanyCategoryName,
icon: this.removedCompanyIconSymbol,
});
}
if (this.showRelatedPersons) {
legendData.push({
name: this.registerPersonCategoryName,
icon: this.registerPersonIconSymbol,
});
}
return legendData;
}
private createRoleLegendItems(
connections: CompanyConnection[],
): RoleLegendItem[] {
const usedRoles = new Set<string>();
for (const connection of connections) {
const role = this.getPrimaryOfficer(connection)?.position;
if (role) {
usedRoles.add(role);
}
if (this.showRelatedPersons) {
for (const officer of this.getRelatedOfficers(connection)) {
if (officer.position) {
usedRoles.add(officer.position);
}
}
}
}
return [...usedRoles]
.sort((a, b) => a.localeCompare(b))
.map((role) => ({
role,
color: this.getRoleColor(role),
}));
}
openPersonSearchInNewTab(name?: string | null): void {
const url = this.createPersonSearchUrl(name);
if (!url) {
return;
}
window.open(url, '_blank', 'noopener,noreferrer');
}
private createPersonSearchUrl(name?: string | null): string | null {
const query = name?.trim();
if (!query) {
return null;
}
const urlTree = this.router.createUrlTree(['/persons'], {
queryParams: this.getPersonSearchQueryParams(query),
});
const internalUrl = this.router.serializeUrl(urlTree);
return this.locationStrategy.prepareExternalUrl(internalUrl);
}
getPersonSearchQueryParams(name?: string | null): {
query: string;
page: number;
} {
return {
query: name?.trim() ?? '',
page: 1,
};
}
private scrollSelectedCompanyIntoView(): void {
window.setTimeout(() => {
if (!this.selectedCompanyKey) {
return;
}
const selectedRow = this.connectionRows.find((row) => {
return (
row.nativeElement.dataset['companyKey'] === this.selectedCompanyKey
);
});
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 = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="${backgroundPath}" fill="#fff"/>
<path d="${foregroundPath}" fill="${color}"/>
</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 = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="${backgroundPath}" fill="#fff"/>
<path d="${foregroundPath}" fill="${color}"/>
</svg>
`;
return this.toSvgImageSymbol(svg);
}
private toSvgImageSymbol(svg: string): string {
return `image://data:image/svg+xml;utf8,${encodeURIComponent(svg.trim())}`;
}
}
@@ -59,7 +59,7 @@
</div>
<div
*ngIf="timelineViewMode !== 'wordcloud' && hasYearRange"
*ngIf="hasYearRange"
class="year-filter"
aria-label="Zeitraum eingrenzen">
<div class="year-filter-top">
@@ -110,13 +110,6 @@
<span>{{ maxYear }}</span>
</div>
</div>
<div
*ngIf="timelineViewMode === 'wordcloud'"
class="year-filter"
aria-label="Anzahl angezeigter Themen">
<ng-content select="[timeline-wordcloud-controls]"></ng-content>
</div>
</div>
<ng-container *ngIf="timelineViewMode === 'wordcloud'; else timelineViews">
@@ -38,7 +38,7 @@
.timeline-header {
display: grid;
grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
align-items: flex-start;
gap: 24px;
margin-bottom: 28px;
@@ -103,6 +103,7 @@
border: 1px solid #dbe5f6;
border-radius: 10px;
background: #fbfdff;
box-sizing: border-box;
}
.year-filter-top,
@@ -14,26 +14,6 @@
(topicSelect)="onTimelineTopicSelect($event)"
(yearSelect)="onTimelineYearSelect($event)"
(loadEarlierYears)="onTimelineLoadEarlierYears()">
<div timeline-wordcloud-controls class="word-cloud-slider-wrapper">
@if (loadingWordCloud) {
<span class="slider-label">Themen laden ...</span>
} @else if (wordCloudOptions && sliderMax > 5) {
<span class="slider-label">{{ topN }} Themen</span>
<div class="word-cloud-slider" [style.--range-value]="sliderPercent">
<div class="range-track"></div>
<input
type="range"
[min]="5"
[max]="sliderMax"
[value]="topN"
(input)="onTopNChange($event)"
aria-label="Anzahl der angezeigten Themen" />
</div>
} @else {
<span class="slider-label">Themen</span>
}
</div>
<div timeline-wordcloud-content class="word-cloud-view">
@if (loadingWordCloud) {
<div class="word-cloud-state">Forschungsthemen werden geladen ...</div>
@@ -5,91 +5,6 @@
box-sizing: border-box;
}
.word-cloud-slider-wrapper {
display: flex;
align-items: center;
justify-content: center;
gap: 0.75rem;
min-height: 86px;
}
.slider-label {
font-size: 13px;
color: var(--sg-text-muted);
white-space: nowrap;
min-width: 4.5rem;
text-align: right;
}
.word-cloud-slider {
--accent: #0057ff;
--range-value: 50%;
position: relative;
width: 160px;
height: 22px;
.range-track {
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 5px;
transform: translateY(-50%);
border-radius: 999px;
background: linear-gradient(
to right,
var(--accent) 0%,
var(--accent) var(--range-value),
#d8e2f4 var(--range-value),
#d8e2f4 100%
);
}
input[type='range'] {
position: absolute;
inset: 0;
width: 100%;
height: 22px;
margin: 0;
appearance: none;
background: transparent;
&::-webkit-slider-runnable-track,
&::-moz-range-track {
height: 5px;
background: transparent;
border: none;
}
&::-webkit-slider-thumb {
appearance: none;
width: 15px;
height: 15px;
margin-top: -5px;
border: 2px solid #ffffff;
border-radius: 50%;
background: var(--accent);
box-shadow:
0 0 0 1px #9ab7ff,
0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
}
&::-moz-range-thumb {
width: 15px;
height: 15px;
border: 2px solid #ffffff;
border-radius: 50%;
background: var(--accent);
box-shadow:
0 0 0 1px #9ab7ff,
0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
}
}
}
.word-cloud-view {
min-height: 420px;
}
@@ -54,32 +54,10 @@ export class PersonOverviewComponent implements OnInit {
loadingWordCloud = false;
wordCloudEmpty = false;
topN = 30;
sliderMax = 50;
get sliderPercent(): string {
if (this.sliderMax <= 5) return '100%';
return `${(((this.topN - 5) / (this.sliderMax - 5)) * 100).toFixed(1)}%`;
}
onTopNChange(event: Event): void {
this.topN = Number((event.target as HTMLInputElement).value);
this.rebuildWordCloud();
}
private allTopicData: Array<{
private rawTopicOccurrences: Array<{
name: string;
value: number;
topicId: string | undefined;
textStyle: { color: string; fontSize: number };
emphasis: {
textStyle: {
fontSize: number;
color: string;
shadowBlur: number;
shadowColor: string;
};
};
topicId: string;
year: number | undefined;
}> = [];
ngOnInit(): void {
@@ -123,6 +101,7 @@ export class PersonOverviewComponent implements OnInit {
onTimelineYearRangeChange(range: TimelineYearRange): void {
this.timelineStartYear = range.startYear;
this.timelineEndYear = range.endYear;
this.rebuildWordCloud();
this.updateTimelineQueryParams(
{
@@ -308,30 +287,20 @@ export class PersonOverviewComponent implements OnInit {
this.timelineEarlierYearsLoadFailed = false;
}
private readonly blueShades = [
'#0057ff',
'#1a6fff',
'#2952d9',
'#3d7cff',
'#1240cc',
'#5a90ff',
'#0044cc',
'#4d85ff',
'#0b4fe0',
'#2563eb',
private readonly timelineColors = [
'#7255d9',
'#2678e8',
'#39a96b',
'#f59e0b',
'#e0527c',
];
private topicColor(name: string): string {
const hash = name.split('').reduce((acc, c) => acc + c.charCodeAt(0), 0);
return this.blueShades[hash % this.blueShades.length];
}
private loadWordCloud(authorId: string): void {
if (!authorId || authorId === '0') {
this.wordCloudOptions = null;
this.wordCloudEmpty = false;
this.loadingWordCloud = false;
this.allTopicData = [];
this.rawTopicOccurrences = [];
return;
}
@@ -344,64 +313,28 @@ export class PersonOverviewComponent implements OnInit {
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe({
next: (page) => {
const counts = new Map<string, number>();
const nameToId = new Map<string, string>();
this.rawTopicOccurrences = [];
page.elements?.forEach((work) => {
const year = work.publication_year ?? undefined;
work.topics?.forEach((topic) => {
if (topic.display_name && topic.id) {
counts.set(
topic.display_name,
(counts.get(topic.display_name) ?? 0) + 1,
);
if (!nameToId.has(topic.display_name)) {
nameToId.set(topic.display_name, topic.id);
}
this.rawTopicOccurrences.push({
name: topic.display_name,
topicId: topic.id,
year,
});
}
});
});
const allValues = Array.from(counts.values());
const minVal = Math.min(...allValues);
const maxVal = Math.max(...allValues);
const computeSize = (v: number): number =>
maxVal === minVal
? 22
: Math.round(12 + ((v - minVal) / (maxVal - minVal)) * (32 - 12));
this.allTopicData = Array.from(counts.entries())
.sort((a, b) => b[1] - a[1])
.map(([name, value]) => {
const fontSize = computeSize(value);
return {
name,
value,
topicId: nameToId.get(name),
textStyle: { color: this.topicColor(name), fontSize },
emphasis: {
textStyle: {
fontSize: Math.round(fontSize * 1.1),
color: '#101a3d',
shadowBlur: 16,
shadowColor: 'rgba(0, 87, 255, 0.35)',
},
},
};
});
this.loadingWordCloud = false;
if (this.allTopicData.length === 0) {
if (this.rawTopicOccurrences.length === 0) {
this.wordCloudEmpty = true;
return;
}
this.sliderMax = Math.min(50, this.allTopicData.length);
this.topN = Math.min(30, this.sliderMax);
setTimeout(() => {
this.rebuildWordCloud();
});
setTimeout(() => this.rebuildWordCloud());
},
error: (error) => {
console.error('Word cloud could not be loaded.', error);
@@ -412,8 +345,57 @@ export class PersonOverviewComponent implements OnInit {
}
private rebuildWordCloud(): void {
const data = this.allTopicData.slice(0, this.topN);
if (data.length === 0) return;
const start = this.timelineStartYear;
const end = this.timelineEndYear;
const counts = new Map<string, number>();
const nameToId = new Map<string, string>();
for (const occ of this.rawTopicOccurrences) {
if (start !== undefined && (occ.year === undefined || occ.year < start))
continue;
if (end !== undefined && (occ.year === undefined || occ.year > end))
continue;
counts.set(occ.name, (counts.get(occ.name) ?? 0) + 1);
if (!nameToId.has(occ.name)) nameToId.set(occ.name, occ.topicId);
}
if (counts.size === 0) {
this.wordCloudOptions = null;
this.wordCloudEmpty = true;
return;
}
this.wordCloudEmpty = false;
const allValues = Array.from(counts.values());
const minVal = Math.min(...allValues);
const maxVal = Math.max(...allValues);
const computeSize = (v: number): number =>
maxVal === minVal
? 22
: Math.round(12 + ((v - minVal) / (maxVal - minVal)) * (32 - 12));
const sorted = Array.from(counts.entries()).sort((a, b) => b[1] - a[1]);
const data = sorted.slice(0, 30).map(([name, value], i) => {
const fontSize = computeSize(value);
const color = this.timelineColors[i % this.timelineColors.length];
return {
name,
value,
topicId: nameToId.get(name),
textStyle: { color, fontSize },
emphasis: {
textStyle: {
fontSize: Math.round(fontSize * 1.1),
color,
shadowBlur: 16,
shadowColor: 'rgba(0, 87, 255, 0.35)',
},
},
};
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.wordCloudOptions = {
series: [
@@ -0,0 +1,179 @@
@if (loading) {
<p class="message">Lade Patente...</p>
} @else if (error) {
<p class="message">Fehler beim Laden der Patente.</p>
} @else if (patents.length === 0) {
<p class="message">Keine Patente gefunden.</p>
} @else {
<div class="patents-container">
<div class="patents-summary">
<p class="summary-line">
<span class="summary-value">{{ filteredPatents.length }}</span>
<span class="summary-label"> Patente</span>
</p>
<p class="summary-line">
<span class="summary-value">{{ getEpoCount() }}</span>
<span class="summary-label"> EPO</span>
</p>
<p class="summary-line">
<span class="summary-value">{{ getUsptoCount() }}</span>
<span class="summary-label"> USPTO</span>
</p>
</div>
@if (showDetail && selectedPatent) {
<button class="back-btn" (click)="showDetail = false">
← Zurück zu den Patenten
</button>
}
<div class="patents-content">
@if (showDetail && selectedPatent) {
<div class="patent-full-detail">
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
@if (selectedPatent.abstract) {
<div class="detail-section">
<h4>Abstract</h4>
<p>{{ selectedPatent.abstract }}</p>
</div>
}
<div class="detail-section">
<h4>Erfinder</h4>
<ul class="tag-list">
@for (inventor of selectedPatent.inventors; track inventor) {
<li class="tag">{{ inventor }}</li>
}
</ul>
</div>
@if (selectedPatent.assignees.length > 0) {
<div class="detail-section">
<h4>Anmelder</h4>
<ul class="tag-list">
@for (assignee of selectedPatent.assignees; track assignee) {
<li class="tag">{{ assignee }}</li>
}
</ul>
</div>
}
@if (selectedPatent.ipc.length > 0) {
<div class="detail-section">
<h4>Klassifikation (IPC)</h4>
<ul class="tag-list tag-list--compact">
@for (ipc of selectedPatent.ipc; track ipc) {
<li class="tag">{{ ipc }}</li>
}
</ul>
</div>
}
</div>
}
<div class="patents-list" [class.hidden]="showDetail">
<div class="patents-list-toolbar">
<label class="sort-control">
<span>Filter nach Quelle:</span>
<select
[value]="activeFilter"
(change)="setFilter($any($event.target).value)">
<option value="all">Alle</option>
<option value="EPO">EPO</option>
<option value="USPTO">USPTO</option>
</select>
</label>
<label class="sort-control">
<span>Sortieren nach:</span>
<select
[value]="sortMode"
(change)="setSortMode($any($event.target).value)">
<option value="date">Datum</option>
<option value="title">Titel</option>
</select>
</label>
</div>
<table>
<thead>
<tr>
<th>Patent</th>
<th>Quelle</th>
<th>Jahr</th>
</tr>
</thead>
<tbody>
@for (patent of getPagedPatents(); track patent.patent_id) {
<tr
[class.selected]="selectedPatent === patent"
(click)="selectPatent(patent)">
<td class="patent-title">
{{ patent.title ?? patent.patent_id }}
</td>
<td>
<span
class="source-badge source-badge--{{
patent.source.toLowerCase()
}}">
{{ patent.source }}
</span>
</td>
<td>{{ patent.publication_year ?? '-' }}</td>
</tr>
}
</tbody>
</table>
@if (hasPagination()) {
<div class="pagination">
<button
[disabled]="selectedPage === 1"
(click)="setPage(selectedPage - 1)">
Zurück
</button>
<span>Seite {{ selectedPage }} von {{ getPageCount() }}</span>
<button
[disabled]="selectedPage === getPageCount()"
(click)="setPage(selectedPage + 1)">
Weiter
</button>
</div>
}
</div>
@if (selectedPatent) {
<div class="patent-detail">
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
<div class="detail-stats">
<div class="stat stat--clickable" (click)="openDetail()">
<span class="stat-label">Quelle</span>
<span class="stat-value">
<span
class="source-badge source-badge--{{
selectedPatent.source.toLowerCase()
}}">
{{ selectedPatent.source }}
</span>
</span>
</div>
<div class="stat">
<span class="stat-label">Patent-Nr.</span>
<span class="stat-value">{{ selectedPatent.patent_id }}</span>
</div>
<div class="stat">
<span class="stat-label">Datum</span>
<span class="stat-value">{{
formatDate(selectedPatent.publication_date)
}}</span>
</div>
</div>
</div>
} @else {
<div class="patent-detail empty">
<p>Klicke auf ein Patent für Details.</p>
</div>
}
</div>
</div>
}
@@ -0,0 +1,306 @@
.message {
padding: 16px;
color: #666;
}
.patents-container {
padding: 16px;
display: flex;
flex-direction: column;
gap: 16px;
}
.patents-summary {
margin-bottom: 8px;
display: flex;
gap: 24px;
.summary-line {
margin: 0;
font-size: 14px;
color: #333;
}
.summary-label {
color: #333;
}
.summary-value {
font-weight: 600;
color: #333;
}
}
.sort-control {
display: inline-flex;
align-items: center;
gap: 6px;
width: fit-content;
padding: 10px 14px;
border-radius: 20px;
background: #f2f2f2;
color: #333;
font-size: 14px;
span {
color: #555;
}
select {
border: 0;
background: transparent;
color: #111827;
font: inherit;
cursor: pointer;
outline: none;
}
}
.patents-content {
display: flex;
gap: 24px;
align-items: flex-start;
}
.patents-list {
flex: 1;
&.hidden {
display: none;
}
.patents-list-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
flex-wrap: wrap;
}
table {
width: 100%;
border-collapse: collapse;
th {
text-align: left;
padding: 10px 12px;
border-bottom: 2px solid #e0e0e0;
font-weight: 600;
color: #333;
}
tr {
cursor: pointer;
&:hover {
background: #f5f5f5;
}
&.selected {
background: #f0f0f0;
}
}
td {
padding: 10px 12px;
border-bottom: 1px solid #f0f0f0;
}
.patent-title {
color: #333;
font-weight: 500;
max-width: 400px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.source-badge {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 700;
&--epo {
background: #effaf3;
color: #24834f;
border: 1px solid #bdebcf;
}
&--uspto {
background: #f0f6ff;
color: #0b63ce;
border: 1px solid #bdd4ff;
}
}
.patent-detail {
width: 440px;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 20px;
background: #fafafa;
&.empty {
display: flex;
align-items: center;
justify-content: center;
color: #999;
min-height: 200px;
}
h3 {
margin: 0 0 16px 0;
font-size: 16px;
color: #333;
line-height: 1.4;
}
}
.detail-stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
.stat {
background: white;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 10px;
text-align: center;
.stat-label {
display: block;
font-size: 11px;
color: #666;
margin-bottom: 4px;
text-transform: uppercase;
letter-spacing: 0.03em;
}
.stat-value {
display: block;
font-size: 15px;
font-weight: bold;
color: #333;
}
}
}
.stat--clickable {
cursor: pointer;
transition:
border-color 0.15s,
background 0.15s;
&:hover {
border-color: #0b63ce;
background: #f0f6ff;
}
}
.patent-full-detail {
flex: 1;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 20px;
background: #fafafa;
h3 {
margin: 0 0 16px 0;
font-size: 16px;
color: #333;
line-height: 1.4;
}
h4 {
margin: 16px 0 8px 0;
font-size: 14px;
color: #555;
font-weight: 600;
}
p {
font-size: 13px;
color: #444;
line-height: 1.6;
margin: 0;
}
}
.back-btn {
border: none;
background: none;
color: #333;
cursor: pointer;
font-size: 14px;
font-weight: 400;
padding: 0;
align-self: flex-start; // NEU
&:hover {
text-decoration: underline;
}
}
.detail-section {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #eee;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 0;
padding: 0;
list-style: none;
&--compact .tag {
font-size: 0.75rem;
padding: 3px 8px;
}
}
.tag {
padding: 4px 10px;
border-radius: 999px;
background: #f0f6ff;
border: 1px solid #dbeafe;
color: #1e40af;
font-size: 0.8rem;
line-height: 1.3;
}
.pagination {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-top: 12px;
button {
padding: 4px 10px;
border: 1px solid #d0d0d0;
border-radius: 6px;
background: white;
cursor: pointer;
font-size: 12px;
&:disabled {
opacity: 0.5;
cursor: default;
}
}
span {
font-size: 12px;
color: #666;
}
}
@@ -0,0 +1,165 @@
import { Component, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
import { PatentsService, PatentEntry } from '../../api/api/patents.service';
type SortMode = 'date' | 'title';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
@Component({
selector: 'app-person-patents',
imports: [CommonModule],
templateUrl: './person-patents.component.html',
styleUrl: './person-patents.component.scss',
})
export class PersonPatentsComponent implements OnInit {
private route = inject(ActivatedRoute);
private router = inject(Router);
private patentsApi = inject(PatentsService);
patents: PatentEntry[] = [];
filteredPatents: PatentEntry[] = [];
authorName: string | null = null;
selectedPatent: PatentEntry | null = null;
showDetail = false;
loading = true;
error = false;
activeFilter: SourceFilter = 'all';
sortMode: SortMode = 'date';
selectedPage = 1;
readonly pageSize = 10;
ngOnInit(): void {
this.route.parent?.paramMap.subscribe((params) => {
const authorId = params.get('id') ?? '';
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
if (this.isValidFilter(filterFromUrl)) {
this.activeFilter = filterFromUrl;
}
if (this.isValidSortMode(sortFromUrl)) {
this.sortMode = sortFromUrl;
}
if (authorId) {
this.patentsApi.getPatentsByAuthor(authorId, 'body').subscribe({
next: (result) => {
this.patents = result.patents ?? [];
this.authorName = result.author_name ?? null;
this.applyFilter();
this.loading = false;
},
error: () => {
this.error = true;
this.loading = false;
},
});
}
});
}
setFilter(filter: SourceFilter): void {
this.activeFilter = filter;
this.selectedPage = 1;
this.selectedPatent = null;
this.showDetail = false;
this.applyFilter();
this.updateQueryParams();
}
setSortMode(sortMode: SortMode): void {
this.sortMode = sortMode;
this.applyFilter();
this.updateQueryParams();
}
selectPatent(patent: PatentEntry): void {
this.selectedPatent = patent;
this.showDetail = false;
this.updateQueryParams();
}
openDetail(): void {
this.showDetail = true;
}
private applyFilter(): void {
let patents = this.patents;
if (this.activeFilter !== 'all') {
patents = patents.filter((p) => p.source === this.activeFilter);
}
this.filteredPatents = this.sortPatents(patents);
}
private sortPatents(patents: PatentEntry[]): PatentEntry[] {
return [...patents].sort((a, b) => {
if (this.sortMode === 'date') {
return (b.publication_date ?? '').localeCompare(
a.publication_date ?? '',
);
}
return (a.title ?? '').localeCompare(b.title ?? '', 'de', {
sensitivity: 'base',
});
});
}
private updateQueryParams(): void {
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
filter: this.activeFilter,
sortBy: this.sortMode,
},
queryParamsHandling: 'merge',
replaceUrl: true,
});
}
private isValidFilter(value: string | null): value is SourceFilter {
return value === 'all' || value === 'EPO' || value === 'USPTO';
}
private isValidSortMode(value: string | null): value is SortMode {
return value === 'date' || value === 'title';
}
getPagedPatents(): PatentEntry[] {
const start = (this.selectedPage - 1) * this.pageSize;
return this.filteredPatents.slice(start, start + this.pageSize);
}
getPageCount(): number {
return Math.max(1, Math.ceil(this.filteredPatents.length / this.pageSize));
}
hasPagination(): boolean {
return this.getPageCount() > 1;
}
setPage(page: number): void {
this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount());
this.updateQueryParams();
}
formatDate(date: string | null): string {
if (!date) return '-';
const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
return new Intl.DateTimeFormat('de-DE').format(new Date(d));
}
getEpoCount(): number {
return this.patents.filter((p) => p.source === 'EPO').length;
}
getUsptoCount(): number {
return this.patents.filter((p) => p.source === 'USPTO').length;
}
}
@@ -0,0 +1,385 @@
<div class="detail-page">
<div class="page-header">
<div class="breadcrumb">
<span>Bund Projekte</span>
<mat-icon>chevron_right</mat-icon>
<span>Projektdetails</span>
</div>
</div>
@if (bundProject) {
<div class="project-hero">
<div class="hero-content">
<div class="eyebrow">
<span class="project-badge">Bund Projekt</span>
<span class="project-id"
>ID: {{ bundProject.funding_reference }}</span
>
<!-- @if (isNewProject()) {
<span class="new-badge">Neu</span>
} -->
</div>
<h1>{{ bundProject.title || 'Ohne Titel' }}</h1>
@if (bundProject.funding_reference) {
<p class="project-reference">
<strong>{{ bundProject.funding_type }}</strong>
</p>
}
<div class="hero-actions">
<!-- @if (bundProject.project_agency) {
<div class="agency-info" (click)="searchForAgency(bundProject.project_agency)">
<mat-icon>account_balance</mat-icon>
<span>{{ bundProject.project_agency_fullname || bundProject.project_agency }}</span>
</div>
} -->
<!-- @if (bundProject.funding_type) {
<div class="funding-type-info" (click)="searchForFundingType(bundProject.funding_type)">
<mat-icon>category</mat-icon>
<span>{{ bundProject.funding_type }}</span>
</div>
} -->
</div>
</div>
<div class="metrics-grid">
<div class="metric-item">
<mat-icon>calendar_today</mat-icon>
<div class="metric-content">
<strong>{{ getStartDate() || 'N/A' }}</strong>
<span>Startdatum</span>
</div>
</div>
<div class="metric-item">
<mat-icon>event_busy</mat-icon>
<div class="metric-content">
<strong>{{ getFundingStatus(getEndDate()) }}</strong>
<span>Enddatum</span>
</div>
</div>
@if (bundProject.funding_amount) {
<div class="metric-item">
<mat-icon>paid</mat-icon>
<div class="metric-content">
<strong>{{ getFundingAmountDisplay() }}</strong>
<span>Fördersumme</span>
</div>
</div>
}
@if (bundProject.funding_profile) {
<div class="metric-item">
<mat-icon>assignment</mat-icon>
<div class="metric-content">
<strong>{{ bundProject.funding_profile }}</strong>
<span>Förderprofil</span>
</div>
</div>
}
</div>
</div>
@if (bundProject.description) {
<mat-card appearance="outlined" class="card description-card">
<div class="section-header">
<mat-icon>description</mat-icon>
<h2>Beschreibung</h2>
</div>
<p class="description-text">{{ bundProject.description }}</p>
</mat-card>
}
<div class="content-grid">
<main class="main-content">
<!-- Beteiligte Personen -->
@if (getAssociatedPersons().length > 0) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>people</mat-icon>
<h2>Beteiligte Personen</h2>
<span class="count-badge">{{
getAssociatedPersons().length
}}</span>
</div>
<div class="person-grid">
@for (person of getAssociatedPersons(); track person) {
<div class="person-item" (click)="searchForPersonName(person)">
<div class="avatar">{{ getInitials(person) }}</div>
<div class="person-name">{{ person }}</div>
</div>
}
</div>
</mat-card>
}
<!-- Beteiligte Institutionen -->
@if (getInstitutions().length > 0) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>business</mat-icon>
<h2>Beteiligte Institutionen</h2>
<span class="count-badge">{{ getInstitutions().length }}</span>
</div>
<div class="institution-grid">
@for (institution of getInstitutions(); track institution) {
<div
class="institution-item"
(click)="searchForInstitutionName(institution)">
<mat-icon>apartment</mat-icon>
<span>{{ institution }}</span>
</div>
}
</div>
</mat-card>
}
<!-- Joint Project Information
@if (bundProject.joint_project) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>groups</mat-icon>
<h2>Gemeinschaftsprojekt</h2>
</div>
<div class="joint-project-content">
<mat-icon>link</mat-icon>
<span>{{ bundProject.joint_project }}</span>
</div>
</mat-card>
} -->
<!-- Organisatorische Details -->
@if (
bundProject.executing_agency ||
bundProject.funding_recipient ||
bundProject.project_agency ||
bundProject.department ||
bundProject.division
) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>organization</mat-icon>
<h2>Organisation</h2>
</div>
<dl class="details-list">
@if (bundProject.executing_agency) {
<div class="detail-row">
<dt>Ausführende Stelle</dt>
<dd>
{{ bundProject.executing_agency }}
</dd>
</div>
}
@if (bundProject.funding_recipient) {
<div class="detail-row">
<dt>Förderempfänger</dt>
<dd>{{ bundProject.funding_recipient }}</dd>
</div>
}
@if (bundProject.project_agency) {
<div class="detail-row">
<dt>Projektagentur</dt>
<dd>
{{
bundProject.project_agency_fullname ||
bundProject.project_agency
}}
</dd>
</div>
}
@if (bundProject.department) {
<div class="detail-row">
<dt>Abteilung</dt>
<dd>
{{
bundProject.department_fullname || bundProject.department
}}
</dd>
</div>
}
@if (bundProject.division) {
<div class="detail-row">
<dt>Division</dt>
<dd>{{ bundProject.division }}</dd>
</div>
}
</dl>
</mat-card>
}
<!-- Standort -->
@if (
bundProject.location ||
bundProject.municipality ||
bundProject.state ||
bundProject.country
) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>location_on</mat-icon>
<h2>Standort</h2>
</div>
<dl class="details-list">
@if (bundProject.location) {
<div class="detail-row">
<dt>Standort</dt>
<dd>
{{ bundProject.location }}
</dd>
</div>
}
@if (bundProject.municipality) {
<div class="detail-row">
<dt>Gemeinde</dt>
<dd>{{ bundProject.municipality }}</dd>
</div>
}
@if (bundProject.state) {
<div class="detail-row">
<dt>Bundesland</dt>
<dd>
{{ bundProject.state }}
</dd>
</div>
}
@if (bundProject.country) {
<div class="detail-row">
<dt>Land</dt>
<dd>{{ bundProject.country }}</dd>
</div>
}
@if (bundProject.municipality_code) {
<div class="detail-row">
<dt>Gemeindeschlüssel</dt>
<dd>{{ bundProject.municipality_code }}</dd>
</div>
}
</dl>
</mat-card>
}
<!-- Zusätzliche Informationen -->
@if (
bundProject.performance_plan_code ||
bundProject.performance_plan_fullname ||
bundProject.publication_date ||
bundProject.record_date
) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>more_info</mat-icon>
<h2>Weitere Informationen</h2>
</div>
<dl class="details-list">
@if (bundProject.performance_plan_code) {
<div class="detail-row">
<dt>Leistungsplancode</dt>
<dd>{{ bundProject.performance_plan_code }}</dd>
</div>
}
@if (bundProject.performance_plan_fullname) {
<div class="detail-row">
<dt>Leistungsplan</dt>
<dd>{{ bundProject.performance_plan_fullname }}</dd>
</div>
}
@if (bundProject.publication_date) {
<div class="detail-row">
<dt>Veröffentlichungsdatum</dt>
<dd>{{ bundProject.publication_date }}</dd>
</div>
}
@if (bundProject.record_date) {
<div class="detail-row">
<dt>Datensatzdatum</dt>
<dd>{{ bundProject.record_date }}</dd>
</div>
}
</dl>
</mat-card>
}
</main>
<aside class="sidebar">
<!-- Projektdetails -->
<mat-card appearance="outlined" class="card details-card">
<div class="section-header">
<mat-icon>info</mat-icon>
<h2>Projektdetails</h2>
</div>
<dl class="details-list">
<div class="detail-row">
<dt>Projekt ID</dt>
<dd>{{ bundProject.funding_reference || 'N/A' }}</dd>
</div>
<!-- <div class="detail-row">
<dt>Titel</dt>
<dd>{{ bundProject.title || 'N/A' }}</dd>
</div> -->
<!-- @if (bundProject.funding_reference) {
<div class="detail-row">
<dt>Förderreferenz</dt>
<dd>{{ bundProject.funding_reference }}</dd>
</div>
} -->
@if (bundProject.funding_type) {
<div class="detail-row">
<dt>Förderart</dt>
<dd>
{{ bundProject.funding_type }}
</dd>
</div>
}
@if (bundProject.funding_profile) {
<div class="detail-row">
<dt>Förderprofil</dt>
<dd>{{ bundProject.funding_profile }}</dd>
</div>
}
@if (bundProject.funding_amount) {
<div class="detail-row">
<dt>Fördersumme</dt>
<dd>{{ getFundingAmountDisplay() }}</dd>
</div>
}
@if (bundProject.funding_amount) {
<div class="detail-row">
<dt>Agency</dt>
<dd>
{{
bundProject.project_agency_fullname ||
bundProject.project_agency
}}
</dd>
</div>
}
<!-- <div class="detail-row">
<dt>Startdatum</dt>
<dd>{{ getStartDate() || 'N/A' }}</dd>
</div>
<div class="detail-row">
<dt>Enddatum</dt>
<dd>{{ getFundingStatus(getEndDate()) }}</dd>
</div> -->
@if (getDuration()) {
<div class="detail-row">
<dt>Laufzeit</dt>
<dd>{{ getDuration() }}</dd>
</div>
}
@if (bundProject.joint_project) {
<div class="detail-row">
<dt>Gemeinschaftsprojekt</dt>
<dd>{{ bundProject.joint_project }}</dd>
</div>
}
</dl>
</mat-card>
</aside>
</div>
} @else {
<div class="error-container">
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<p>Bund Projekt nicht gefunden.</p>
</div>
</div>
}
</div>
@@ -0,0 +1,527 @@
// Complete SCSS with all styles including clickable elements
.detail-page {
padding: 28px 32px 42px;
max-width: 100%;
margin: 0 auto;
}
.page-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
margin-bottom: 24px;
}
.back-link {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 16px;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text);
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
}
.back-link:hover {
background: #f5f7fa;
border-color: #b8c5d6;
}
.back-link mat-icon {
width: 20px;
height: 20px;
font-size: 20px;
}
.breadcrumb {
display: flex;
align-items: center;
gap: 6px;
color: var(--sg-text-muted);
font-size: 13px;
}
.breadcrumb mat-icon {
width: 18px;
height: 18px;
font-size: 18px;
}
.breadcrumb span:last-child {
color: var(--sg-text);
font-weight: 500;
}
.project-hero {
background: #f8fafc;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-md);
padding: 28px 32px;
margin-bottom: 28px;
}
.hero-content {
margin-bottom: 24px;
}
.eyebrow {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
flex-wrap: wrap;
}
.project-badge {
display: inline-block;
padding: 4px 12px;
background: #e8edf5;
color: var(--sg-text);
border-radius: var(--sg-radius-sm);
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.project-id {
color: var(--sg-text-muted);
font-size: 13px;
}
.new-badge {
display: inline-block;
padding: 2px 10px;
background: #27ae60;
color: #fff;
border-radius: var(--sg-radius-sm);
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
h1 {
margin: 0 0 8px;
font-size: 26px;
line-height: 1.3;
font-weight: 700;
color: var(--sg-text);
}
.project-reference {
margin: 0 0 16px;
color: var(--sg-text-muted);
font-size: 14px;
}
.hero-actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.agency-info,
.funding-type-info {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 16px;
background: #fff;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
color: var(--sg-text);
font-size: 14px;
cursor: pointer;
transition: all 0.2s;
}
.agency-info:hover,
.funding-type-info:hover {
background: #f5f7fa;
border-color: #b8c5d6;
}
.agency-info mat-icon,
.funding-type-info mat-icon {
color: var(--sg-text-muted);
width: 20px;
height: 20px;
font-size: 20px;
}
.metrics-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
padding-top: 20px;
border-top: 1px solid #d9e2f0;
}
.metric-item {
display: flex;
align-items: center;
gap: 12px;
}
.metric-item mat-icon {
color: var(--sg-text-muted);
width: 24px;
height: 24px;
font-size: 24px;
}
.metric-content {
display: flex;
flex-direction: column;
}
.metric-content strong {
font-size: 15px;
color: var(--sg-text);
line-height: 1.3;
}
.metric-content span {
font-size: 12px;
color: var(--sg-text-muted);
}
.card {
margin-bottom: 24px;
border-color: #d9e2f0 !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 #f0f2f5;
}
.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: #e8edf5;
border-radius: 12px;
color: var(--sg-text-muted);
font-size: 12px;
font-weight: 500;
}
.description-text {
padding: 16px 20px 20px;
margin: 0;
color: var(--sg-text);
font-size: 14px;
line-height: 1.6;
}
.content-grid {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 24px;
}
.main-content {
display: flex;
flex-direction: column;
gap: 24px;
}
.sidebar {
display: flex;
flex-direction: column;
gap: 24px;
}
.person-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 12px;
padding: 16px 20px 20px;
}
.person-item {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
background: #fff;
cursor: pointer;
transition: all 0.2s;
}
.person-item:hover {
background: #f8fafc;
border-color: #b8c5d6;
transform: translateY(-1px);
}
.avatar {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: 50%;
background: #e8edf5;
color: var(--sg-text);
font-size: 13px;
font-weight: 600;
flex-shrink: 0;
}
.person-name {
font-size: 13px;
font-weight: 500;
color: var(--sg-text);
}
.institution-grid {
display: grid;
grid-template-columns: 1fr;
gap: 8px;
padding: 16px 20px 20px;
}
.institution-item {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
background: #fff;
font-size: 13px;
color: var(--sg-text);
cursor: pointer;
transition: all 0.2s;
}
.institution-item:hover {
background: #f8fafc;
border-color: #b8c5d6;
}
.institution-item mat-icon {
color: var(--sg-text-muted);
width: 20px;
height: 20px;
font-size: 20px;
flex-shrink: 0;
}
.joint-project-content {
display: flex;
align-items: center;
gap: 12px;
padding: 16px 20px 20px;
color: var(--sg-text);
font-size: 14px;
}
.joint-project-content mat-icon {
color: var(--sg-text-muted);
width: 24px;
height: 24px;
font-size: 24px;
flex-shrink: 0;
}
.details-list {
margin: 0;
padding: 16px 20px 20px;
}
.detail-row {
display: grid;
grid-template-columns: 140px 1fr;
gap: 24px;
padding: 8px 0;
border-bottom: 1px solid #f0f2f5;
}
.detail-row:last-child {
border-bottom: none;
}
.detail-row dt {
color: var(--sg-text-muted);
font-size: 13px;
font-weight: 500;
}
.detail-row dd {
margin: 0;
color: var(--sg-text);
font-size: 13px;
word-break: break-word;
display: flex;
align-items: center;
gap: 6px;
}
.detail-row dd.clickable {
cursor: pointer;
transition: color 0.2s;
}
.detail-row dd.clickable:hover {
color: var(--sg-primary, #0066cc);
}
.detail-row dd.clickable:hover .search-icon {
opacity: 1;
}
.search-icon {
width: 16px;
height: 16px;
font-size: 16px;
opacity: 0;
transition: opacity 0.2s;
color: var(--sg-text-muted);
}
.detail-row dd:hover .search-icon {
opacity: 1;
}
.empty-state {
padding: 20px;
text-align: center;
color: var(--sg-text-muted);
font-size: 14px;
}
.error-container {
display: flex;
align-items: center;
justify-content: center;
min-height: 400px;
}
.error-state {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
color: var(--sg-text-muted);
}
.error-state mat-icon {
width: 48px;
height: 48px;
font-size: 48px;
color: #e74c3c;
}
.error-state p {
margin: 0;
font-size: 16px;
}
// Clickable external link styling
.external-link {
color: var(--sg-primary, #0066cc);
text-decoration: none;
}
.external-link:hover {
text-decoration: underline;
}
@media (max-width: 992px) {
.content-grid {
grid-template-columns: 1fr;
gap: 20px;
}
}
@media (max-width: 768px) {
.detail-page {
padding: 16px;
}
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 12px;
}
.project-hero {
padding: 20px;
}
.metrics-grid {
grid-template-columns: 1fr 1fr;
gap: 12px;
}
h1 {
font-size: 22px;
}
.detail-row {
grid-template-columns: 1fr;
gap: 4px;
}
.person-grid {
grid-template-columns: 1fr;
}
.eyebrow {
gap: 8px;
}
}
@media (max-width: 480px) {
.metrics-grid {
grid-template-columns: 1fr;
}
.hero-actions {
flex-direction: column;
}
.agency-info,
.funding-type-info {
width: 100%;
justify-content: center;
}
}
@@ -0,0 +1,163 @@
import { Component, OnInit, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { BundProjectDetails } from '../../../api/model/bundProjectDetails';
import { Router } from '@angular/router';
@Component({
selector: 'app-bund-details',
standalone: true,
imports: [CommonModule, MatCardModule, MatIconModule],
templateUrl: './bund-details.component.html',
styleUrl: './bund-details.component.scss',
})
export class BundDetailsComponent implements OnInit {
private route = inject(ActivatedRoute);
bundProject: BundProjectDetails | undefined;
constructor(private router: Router) {}
ngOnInit(): void {
this.route.data.subscribe(({ bundSingleProject }) => {
console.log('Bund Project:', bundSingleProject);
this.bundProject = bundSingleProject;
});
}
getInitials(name: string | null | undefined): string {
if (!name) return '';
const parts = name.trim().split(/\s+/);
if (parts.length > 1) {
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
}
return parts[0][0].toUpperCase();
}
getFundingStatus(fundingEndDate: string | null | undefined): string {
if (!fundingEndDate) return 'N/A';
if (fundingEndDate === '2999') return 'laufend';
const year = parseInt(fundingEndDate, 10);
if (isNaN(year)) return fundingEndDate;
return year >= new Date().getFullYear()
? `${fundingEndDate} (laufend)`
: `${fundingEndDate} (abgeschlossen)`;
}
formatCurrency(amount: number | null | undefined): string {
if (amount === null || amount === undefined) return 'N/A';
// Format as Euro with thousands separators
return new Intl.NumberFormat('de-DE', {
style: 'currency',
currency: 'EUR',
minimumFractionDigits: 0,
maximumFractionDigits: 0,
}).format(amount);
}
searchForPersonName(personName: string): void {
this.router.navigate(['/persons'], {
queryParams: {
query: personName,
},
});
}
searchForInstitutionName(institutionName: string): void {
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
}
// searchForLocation(location: string): void {
// this.router.navigate(['/bund-projects'], {
// queryParams: {
// location: location
// }
// });
// }
// searchForState(state: string): void {
// this.router.navigate(['/bund-projects'], {
// queryParams: {
// state: state
// }
// });
// }
// searchForFundingType(fundingType: string): void {
// this.router.navigate(['/bund-projects'], {
// queryParams: {
// fundingType: fundingType
// }
// });
// }
// searchForAgency(agency: string): void {
// this.router.navigate(['/bund-projects'], {
// queryParams: {
// agency: agency
// }
// });
// }
private formatGermanDate(dateString: string): string {
if (!dateString) return '';
return new Intl.DateTimeFormat('de-DE', {
day: 'numeric',
month: 'long',
year: 'numeric',
}).format(new Date(dateString));
}
/**
* All associated persons as a simple list.
*/
getAssociatedPersons(): string[] {
return this.bundProject?.associated_persons || [];
}
getStartDate(): string {
return this.formatGermanDate(this.bundProject?.funding_start_date ?? '');
}
getEndDate(): string {
return this.formatGermanDate(this.bundProject?.funding_end_date ?? '');
}
getDuration(): string {
const start = this.bundProject?.funding_start_date;
const end = this.bundProject?.funding_end_date;
if (!start || !end) return '';
return `von ${this.formatGermanDate(start)} bis ${this.formatGermanDate(end)}`;
}
/**
* All institutions as a simple list.
*/
getInstitutions(): string[] {
return this.bundProject?.institutions || [];
}
/**
* Check if project is new
*/
isNewProject(): boolean {
return this.bundProject?.is_new === true;
}
/**
* Get display name for funding amount
*/
getFundingAmountDisplay(): string {
if (!this.bundProject?.funding_amount) return 'N/A';
return this.formatCurrency(this.bundProject.funding_amount);
}
goBack(): void {
window.history.back();
}
}
@@ -0,0 +1,245 @@
<div class="detail-page">
<div class="page-header">
<div class="breadcrumb">
<span>DFG Projekte</span>
<mat-icon>chevron_right</mat-icon>
<span>Projektdetails</span>
</div>
</div>
@if (dfgProject) {
<div class="project-hero">
<div class="hero-content">
<div class="eyebrow">
<span class="project-badge">DFG Projekt</span>
<span class="project-id">ID: {{ dfgProject.id }}</span>
</div>
<h1>{{ dfgProject.title }}</h1>
@if (dfgProject.project_identifier) {
<p class="project-identifier">
<strong>{{ dfgProject.project_identifier.split('-')[0] }}</strong>
</p>
}
<div class="hero-actions">
@if (dfgProject.link) {
<a [href]="dfgProject.link" target="_blank" class="primary-action">
<mat-icon>open_in_new</mat-icon>
<span>Zum Projekt</span>
</a>
}
@if (dfgProject.website) {
<a
[href]="dfgProject.website"
target="_blank"
class="secondary-action">
<mat-icon>language</mat-icon>
<span>Webseite</span>
</a>
}
</div>
</div>
<div class="metrics-grid">
<div class="metric-item">
<mat-icon>calendar_today</mat-icon>
<div class="metric-content">
<strong>{{ dfgProject.funding_start_date || 'N/A' }}</strong>
<span>Fördersbeginn</span>
</div>
</div>
<div class="metric-item">
<mat-icon>event_busy</mat-icon>
<div class="metric-content">
<strong>{{ getFundingStatus(dfgProject.funding_end_date) }}</strong>
<span>Fördersende</span>
</div>
</div>
<!-- @if (dfgProject.subject_area) {
<div class="metric-item">
<mat-icon>category</mat-icon>
<div class="metric-content">
<strong>{{ dfgProject.subject_area }}</strong>
<span>Fachliche Zuordnung</span>
</div>
</div>
} -->
@if (dfgProject.dfg_procedure) {
<div class="metric-item">
<mat-icon>gavel</mat-icon>
<div class="metric-content">
<strong>{{ dfgProject.dfg_procedure }}</strong>
<span>DFG Verfahren</span>
</div>
</div>
}
<!-- @if (dfgProject.funding_type) {
<div class="metric-item">
<mat-icon>paid</mat-icon>
<div class="metric-content">
<strong>{{ dfgProject.funding_type }}</strong>
<span>Förderung</span>
</div>
</div>
} -->
@if (dfgProject.international_reference) {
<div class="metric-item">
<mat-icon>public</mat-icon>
<div class="metric-content">
<strong>{{ dfgProject.international_reference }}</strong>
<span>Internationaler Bezug</span>
</div>
</div>
}
</div>
</div>
@if (dfgProject.description) {
<mat-card appearance="outlined" class="card description-card">
<div class="section-header">
<mat-icon>description</mat-icon>
<h2>Beschreibung</h2>
</div>
<p class="description-text">{{ dfgProject.description }}</p>
</mat-card>
}
<div class="content-grid">
<main class="main-content">
<!-- Beteiligte Personen -->
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>people</mat-icon>
<h2>Beteiligte Personen</h2>
<span class="count-badge">{{ getAssociatedPersons().length }}</span>
</div>
@if (getAssociatedPersons().length > 0) {
<div class="person-grid">
@for (person of getAssociatedPersons(); track person) {
<div (click)="searchForPersonName(person)" class="person-item">
<div class="avatar">{{ getInitials(person) }}</div>
<div class="person-name">{{ person }}</div>
</div>
}
</div>
} @else {
<div class="empty-state">Keine Personen gefunden.</div>
}
</mat-card>
<!-- Beteiligte Institutionen -->
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>business</mat-icon>
<h2>Beteiligte Institutionen</h2>
<span class="count-badge">{{ getInstitutions().length }}</span>
</div>
@if (getInstitutions().length > 0) {
<div class="institution-grid">
@for (institution of getInstitutions(); track institution) {
<div
(click)="searchForInstitutionName(institution)"
class="institution-item">
<mat-icon>apartment</mat-icon>
<span>{{ institution }}</span>
</div>
}
</div>
} @else {
<div class="empty-state">Keine Institutionen gefunden.</div>
}
</mat-card>
<!-- Teilprojekt -->
<!-- @if (dfgProject.subproject_of) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>account_tree</mat-icon>
<h2>Teilprojekt</h2>
</div>
<dl class="details-list">
<div class="detail-row">
<dt>Teilprojekt zu</dt>
<dd>{{ dfgProject.subproject_of }}</dd>
</div>
</dl>
</mat-card>
} -->
</main>
<aside class="sidebar">
<!-- Projektdetails -->
<mat-card appearance="outlined" class="card details-card">
<div class="section-header">
<mat-icon>info</mat-icon>
<h2>Projektdetails</h2>
</div>
<dl class="details-list">
<div class="detail-row">
<dt>Projekt ID</dt>
<dd>{{ dfgProject.id || 'N/A' }}</dd>
</div>
<div class="detail-row">
<dt>Titel</dt>
<dd>{{ dfgProject.title || 'N/A' }}</dd>
</div>
<div class="detail-row">
<dt>Projektkennung</dt>
<dd>{{ dfgProject.project_identifier || 'N/A' }}</dd>
</div>
<div class="detail-row">
<dt>Fachliche Zuordnung</dt>
<dd>{{ dfgProject.subject_area || 'N/A' }}</dd>
</div>
<div class="detail-row">
<dt>DFG-Verfahren</dt>
<dd>{{ dfgProject.dfg_procedure || 'N/A' }}</dd>
</div>
<!-- <div class="detail-row">
<dt>Förderung</dt>
<dd>{{ dfgProject.funding_type || 'N/A' }}</dd>
</div> -->
<div class="detail-row">
<dt>Fördersbeginn</dt>
<dd>{{ dfgProject.funding_start_date || 'N/A' }}</dd>
</div>
<div class="detail-row">
<dt>Fördersende</dt>
<dd>{{ getFundingStatus(dfgProject.funding_end_date) }}</dd>
</div>
@if (dfgProject.subproject_of) {
<div class="detail-row">
<dt>Teilprojekt von</dt>
<dd>{{ dfgProject.subproject_of }}</dd>
</div>
}
@if (dfgProject.international_reference) {
<div class="detail-row">
<dt>Internationaler Bezug</dt>
<dd>{{ dfgProject.international_reference }}</dd>
</div>
}
@if (dfgProject.website) {
<div class="detail-row">
<dt>Webseite</dt>
<dd>
<a
[href]="dfgProject.website"
target="_blank"
class="external-link"
>{{ dfgProject.website }}</a
>
</dd>
</div>
}
</dl>
</mat-card>
</aside>
</div>
} @else {
<div class="error-container">
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<p>DFG Projekt nicht gefunden.</p>
</div>
</div>
}
</div>
@@ -0,0 +1,467 @@
.detail-page {
padding: 28px 32px 42px;
max-width: 100%;
margin: 0 auto;
}
.page-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
margin-bottom: 24px;
}
.back-link {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 16px;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text);
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
}
.back-link:hover {
background: #f5f7fa;
border-color: #b8c5d6;
}
.back-link mat-icon {
width: 20px;
height: 20px;
font-size: 20px;
}
.breadcrumb {
display: flex;
align-items: center;
gap: 6px;
color: var(--sg-text-muted);
font-size: 13px;
}
.breadcrumb mat-icon {
width: 18px;
height: 18px;
font-size: 18px;
}
.breadcrumb span:last-child {
color: var(--sg-text);
font-weight: 500;
}
.project-hero {
background: #f8fafc;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-md);
padding: 28px 32px;
margin-bottom: 28px;
}
.hero-content {
margin-bottom: 24px;
}
.eyebrow {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
}
.project-badge {
display: inline-block;
padding: 4px 12px;
background: #e8edf5;
color: var(--sg-text);
border-radius: var(--sg-radius-sm);
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.project-id {
color: var(--sg-text-muted);
font-size: 13px;
}
h1 {
margin: 0 0 8px;
font-size: 26px;
line-height: 1.3;
font-weight: 700;
color: var(--sg-text);
}
.project-identifier {
margin: 0 0 16px;
color: var(--sg-text-muted);
font-size: 14px;
}
.hero-actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.primary-action,
.secondary-action {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 20px;
border-radius: var(--sg-radius-sm);
text-decoration: none;
font-size: 14px;
font-weight: 500;
transition: all 0.2s;
}
.primary-action {
background: var(--sg-primary, #0066cc);
color: #fff;
border: none;
}
.primary-action:hover {
background: var(--sg-primary-dark, #0052a3);
}
.secondary-action {
background: #fff;
color: var(--sg-text);
border: 1px solid #d9e2f0;
}
.secondary-action:hover {
background: #f5f7fa;
border-color: #b8c5d6;
}
.primary-action mat-icon,
.secondary-action mat-icon {
width: 20px;
height: 20px;
font-size: 20px;
}
.metrics-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
padding-top: 20px;
border-top: 1px solid #d9e2f0;
}
.metric-item {
display: flex;
align-items: center;
gap: 12px;
}
.metric-item mat-icon {
color: var(--sg-text-muted);
width: 24px;
height: 24px;
font-size: 24px;
}
.metric-content {
display: flex;
flex-direction: column;
}
.metric-content strong {
font-size: 15px;
color: var(--sg-text);
line-height: 1.3;
}
.metric-content span {
font-size: 12px;
color: var(--sg-text-muted);
}
.card {
margin-bottom: 24px;
border-color: #d9e2f0 !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 #f0f2f5;
}
.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: #e8edf5;
border-radius: 12px;
color: var(--sg-text-muted);
font-size: 12px;
font-weight: 500;
}
.description-text {
padding: 16px 20px 20px;
margin: 0;
color: var(--sg-text);
font-size: 14px;
line-height: 1.6;
}
.content-grid {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 24px;
}
.main-content {
display: flex;
flex-direction: column;
gap: 24px;
}
.sidebar {
display: flex;
flex-direction: column;
gap: 24px;
}
.person-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 12px;
padding: 16px 20px 20px;
}
.person-item {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
background: #fff;
transition: all 0.2s;
}
.person-item:hover {
cursor: pointer;
background: #f8fafc;
border-color: #b8c5d6;
}
.avatar {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: 50%;
background: #e8edf5;
color: var(--sg-text);
font-size: 13px;
font-weight: 600;
flex-shrink: 0;
}
.person-name {
cursor: pointer;
font-size: 13px;
font-weight: 500;
color: var(--sg-text);
}
.institution-grid {
cursor: pointer;
display: grid;
grid-template-columns: 1fr;
gap: 8px;
padding: 16px 20px 20px;
}
.institution-item {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
border: 1px solid #d9e2f0;
border-radius: var(--sg-radius-sm);
background: #fff;
font-size: 13px;
color: var(--sg-text);
}
.institution-item mat-icon {
color: var(--sg-text-muted);
width: 20px;
height: 20px;
font-size: 20px;
flex-shrink: 0;
}
.details-list {
margin: 0;
padding: 16px 20px 20px;
}
.detail-row {
display: grid;
grid-template-columns: 140px 1fr;
gap: 12px;
padding: 8px 0;
border-bottom: 1px solid #f0f2f5;
}
.detail-row:last-child {
border-bottom: none;
}
.detail-row dt {
color: var(--sg-text-muted);
font-size: 13px;
font-weight: 500;
}
.detail-row dd {
margin: 0;
color: var(--sg-text);
font-size: 13px;
word-break: break-word;
}
.external-link {
color: var(--sg-primary, #0066cc);
text-decoration: none;
}
.external-link:hover {
text-decoration: underline;
}
.empty-state {
padding: 20px;
text-align: center;
color: var(--sg-text-muted);
font-size: 14px;
}
.error-container {
display: flex;
align-items: center;
justify-content: center;
min-height: 400px;
}
.error-state {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
color: var(--sg-text-muted);
}
.error-state mat-icon {
width: 48px;
height: 48px;
font-size: 48px;
color: #e74c3c;
}
.error-state p {
margin: 0;
font-size: 16px;
}
@media (max-width: 992px) {
.content-grid {
grid-template-columns: 1fr;
gap: 20px;
}
}
@media (max-width: 768px) {
.detail-page {
padding: 16px;
}
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 12px;
}
.project-hero {
padding: 20px;
}
.metrics-grid {
grid-template-columns: 1fr 1fr;
gap: 12px;
}
h1 {
font-size: 22px;
}
.detail-row {
grid-template-columns: 1fr;
gap: 4px;
}
.person-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 480px) {
.metrics-grid {
grid-template-columns: 1fr;
}
.hero-actions {
flex-direction: column;
}
.primary-action,
.secondary-action {
width: 100%;
justify-content: center;
}
}
@@ -0,0 +1,77 @@
import { Component, OnInit, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { DfgProjectDetails } from '../../../api';
import { Router } from '@angular/router';
@Component({
selector: 'app-dfg-details',
standalone: true,
imports: [CommonModule, MatCardModule, MatIconModule],
templateUrl: './dfg-details.component.html',
styleUrl: './dfg-details.component.scss',
})
export class DfgDetailsComponent implements OnInit {
private route = inject(ActivatedRoute);
dfgProject: DfgProjectDetails | undefined;
constructor(private router: Router) {}
ngOnInit(): void {
this.route.data.subscribe(({ dfgSingleProject }) => {
console.log('DFG Project:', dfgSingleProject);
this.dfgProject = dfgSingleProject;
});
}
getInitials(name: string | null | undefined): string {
if (!name) return '';
const parts = name.trim().split(/\s+/);
if (parts.length > 1) {
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
}
return parts[0][0].toUpperCase();
}
getFundingStatus(fundingEndDate: string | null | undefined): string {
if (!fundingEndDate) return 'N/A';
if (fundingEndDate === '2999') return 'laufend';
const year = parseInt(fundingEndDate, 10);
if (isNaN(year)) return fundingEndDate;
return year >= new Date().getFullYear()
? `${fundingEndDate} (laufend)`
: `${fundingEndDate} (abgeschlossen)`;
}
searchForPersonName(personName: string): void {
this.router.navigate(['/persons'], {
queryParams: {
query: personName,
},
});
}
searchForInstitutionName(institutionName: string): void {
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
}
/**
* All associated persons as a simple list (no role grouping).
*/
getAssociatedPersons(): string[] {
return this.dfgProject?.associated_persons || [];
}
/**
* All institutions as a simple list.
*/
getInstitutions(): string[] {
return this.dfgProject?.institutions || [];
}
goBack(): void {
window.history.back();
}
}
@@ -39,7 +39,11 @@
</div>
<ng-template #dfgProjectActionsTmp let-element>
<a href="{{ element.link }}" target="_blank" mat-icon-button color="primary">
<a
[routerLink]="['/projects/dfg', element.id]"
target="_blank"
mat-icon-button
color="primary">
<mat-icon>open_in_new</mat-icon>
</a>
</ng-template>
@@ -20,7 +20,7 @@ import { MatTabsModule } from '@angular/material/tabs';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { DebounceDirective } from '../../directives/debounce.directive';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { Sort, SortDirection } from '@angular/material/sort';
@@ -37,6 +37,7 @@ import { Sort, SortDirection } from '@angular/material/sort';
MatInputModule,
DebounceDirective,
MatPaginatorModule,
RouterModule,
],
templateUrl: './person-projects.component.html',
styleUrl: './person-projects.component.scss',
@@ -119,15 +119,20 @@ export class PersonComponent {
() => this.person()?.affiliations?.[0] ?? null,
);
readonly lastAffiliation = computed(() => {
let lastAffiliation: number | undefined = 0;
if (this.person()?.affiliations?.length != undefined) {
lastAffiliation = this.person()?.affiliations?.length;
const affiliations = this.person()?.affiliations ?? [];
let newestAffiliation = affiliations[0] ?? null;
let newestYear = -1;
for (const affiliation of affiliations) {
for (const jahr of affiliation.years ?? []) {
if (jahr > newestYear) {
newestYear = jahr;
newestAffiliation = affiliation;
}
}
}
return (
(lastAffiliation
? this.person()?.affiliations?.[lastAffiliation - 1]
: this.person()?.affiliations?.[0]) ?? null
);
return newestAffiliation;
});
readonly institution = computed(
() =>
@@ -184,9 +189,10 @@ export class PersonComponent {
},
{ label: 'Publikationen', path: 'publications', disabled: false },
{ label: 'Netzwerk', path: 'network', disabled: false },
{ label: 'Gründungen', path: 'foundings', disabled: true },
{ label: 'Unternehmen', path: 'company-connections', disabled: false },
{ label: 'Förderungen', path: 'funding', disabled: false },
{ label: 'Nachrichten', path: 'news', disabled: false },
{ label: 'Patente', path: 'patents', disabled: false },
];
onInterestingTagClick(selection: { id: string; name: string }): void {
@@ -0,0 +1,112 @@
<div class="content">
<h1>Passende Projekte finden</h1>
<mat-divider />
<div style="padding: 0 1rem">
<mat-form-field style="width: 100%">
<mat-label>Suche nach Namen</mat-label>
<input
matInput
type="search"
[debounceTime]="300"
[(debouncedValue)]="urlSearchTerm"
(debouncedValueChange)="handleSearchTermChange($event)" />
<mat-icon matPrefix>search</mat-icon>
<button matIconButton matSuffix (click)="clearSearchTerm()">
<mat-icon>clear</mat-icon>
</button>
</mat-form-field>
<div
style="
display: flex;
justify-content: space-between;
align-items: center;
">
<mat-chip-listbox
[value]="urlChips()"
(change)="handleChipBoxChange($event)"
multiple>
<mat-chip-option value="eu">EU</mat-chip-option>
<mat-chip-option value="bund">BUND</mat-chip-option>
<mat-chip-option value="dfg">DFG</mat-chip-option>
</mat-chip-listbox>
<div class="sorting">
<select (change)="handleSortFieldChange($event)" [value]="urlSortBy()">
<option value="title">Name</option>
</select>
<select
(change)="handleSortOrderChange($event)"
[value]="urlSortingOrder()">
<option value="desc">Absteigend</option>
<option value="asc">Aufsteigend</option>
</select>
</div>
</div>
</div>
<mat-divider />
@let fundingProjectPageValue = fundingProjectPage();
@if (
fundingProjectPageValue.elements &&
fundingProjectPageValue.elements.length > 0
) {
<div class="cards">
@for (fundingProject of fundingProjectPageValue.elements; track $index) {
<mat-card
class="card"
appearance="outlined"
[routerLink]="getDetaiLink(fundingProject)">
<mat-card-header>
<mat-card-title>{{ fundingProject.title }}</mat-card-title>
<mat-card-subtitle>{{
fundingProject.type | uppercase
}}</mat-card-subtitle>
</mat-card-header>
<mat-card-content class="card-content">
<mat-divider />
<div class="card-metadata">
<span
>Von {{ fundingProject.start_date | date }} bis
{{ fundingProject.end_date | date }}</span
>
</div>
<mat-divider />
</mat-card-content>
<mat-card-footer>
<mat-card-actions>
<a
mat-button
[routerLink]="getDetaiLink(fundingProject)"
(click)="$event.stopPropagation()">
<mat-icon>info</mat-icon>
Übersicht
</a>
</mat-card-actions>
</mat-card-footer>
</mat-card>
}
</div>
} @else {
<div class="no-results">
<p>Keine passenden Projekte gefunden.</p>
</div>
}
<mat-divider />
<mat-paginator
[length]="fundingProjectPageValue.total"
[pageSize]="fundingProjectPageValue.size"
[pageSizeOptions]="[10, 20, 50]"
[pageIndex]="fundingProjectPageValue.page"
(page)="handlePageChange($event)">
</mat-paginator>
</div>
@@ -0,0 +1,99 @@
.content {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
}
.sorting {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
}
.sorting select {
padding: 0.75rem;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
font-size: 1rem;
}
.sorting select:hover {
cursor: pointer;
}
.cards {
display: grid;
gap: 1.5rem;
grid-template-columns: repeat(4, 1fr);
padding: 0 1rem;
}
@media (max-width: 900px) {
.cards {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 600px) {
.cards {
grid-template-columns: 1fr;
}
}
mat-paginator {
background-color: var(--sg-background);
}
.card {
padding: 0.5rem;
background-color: var(--sg-background);
transition: transform 0.3s ease;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.card:hover {
cursor: pointer;
transform: scale(1.05);
}
.card-content {
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 0.5rem;
flex: 1;
}
.card-metadata {
display: flex;
flex-direction: column;
gap: 0.2rem;
font-size: 0.9rem;
color: var(--sg-text-secondary);
}
mat-card-actions {
padding-top: 0.5rem;
display: flex;
gap: 0.5rem;
}
mat-card-actions a {
width: 100%;
text-decoration: none;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
}
.no-results {
text-align: center;
padding: 2rem;
color: var(--sg-text-secondary);
}
.mat-mdc-standard-chip {
border-radius: var(--sg-radius-sm);
}
@@ -0,0 +1,128 @@
import { Component, effect, input, signal } from '@angular/core';
import { FundingProject, FundingProjectPage, ProjectType } from '../../api';
import { MatDividerModule } from '@angular/material/divider';
import { MatFormFieldModule } from '@angular/material/form-field';
import { DebounceDirective } from '../../directives/debounce.directive';
import { MatIconModule } from '@angular/material/icon';
import { MatCardModule } from '@angular/material/card';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { DatePipe, UpperCasePipe } from '@angular/common';
import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips';
@Component({
selector: 'app-projects',
imports: [
MatDividerModule,
MatFormFieldModule,
DebounceDirective,
MatIconModule,
MatCardModule,
RouterModule,
MatPaginator,
MatInputModule,
MatButtonModule,
UpperCasePipe,
DatePipe,
MatChipsModule,
],
templateUrl: './projects.component.html',
styleUrl: './projects.component.scss',
})
export class ProjectsComponent {
fundingProjectPage = input.required<FundingProjectPage>();
urlSearchTerm = signal<string>('');
urlSortBy = signal<string>('relevance');
urlSortingOrder = signal<string>('desc');
urlChips = signal<ProjectType[]>(['eu', 'bund', 'dfg']);
constructor(
private readonly activatedRoute: ActivatedRoute,
private readonly router: Router,
) {
this.activatedRoute.queryParams
.pipe(takeUntilDestroyed())
.subscribe((params) => {
this.urlSearchTerm.set(params['search'] || '');
this.urlSortBy.set(params['sort_by'] || 'relevance');
this.urlSortingOrder.set(params['sorting_order'] || 'desc');
this.urlChips.set(
(params['selected_project_types'] || 'eu,bund,dfg').split(','),
);
});
effect(() => {
const searchTerm = this.urlSearchTerm();
this.router.navigate([], {
queryParams: { search: searchTerm },
queryParamsHandling: 'merge',
});
});
}
handleSearchTermChange(newTerm: string): void {
this.router.navigate([], {
queryParams: { search: newTerm },
queryParamsHandling: 'merge',
});
}
clearSearchTerm(): void {
this.router.navigate([], {
queryParams: { search: null },
queryParamsHandling: 'merge',
});
}
handlePageChange(event: PageEvent): void {
this.router.navigate([], {
queryParams: { page: event.pageIndex, size: event.pageSize },
queryParamsHandling: 'merge',
});
}
handleSortFieldChange(event: Event): void {
const selectElement = event.target as HTMLSelectElement;
const sortField = selectElement.value;
this.router.navigate([], {
queryParams: { sort_by: sortField },
queryParamsHandling: 'merge',
});
}
handleSortOrderChange(event: Event): void {
const selectElement = event.target as HTMLSelectElement;
const sortOrder = selectElement.value;
this.router.navigate([], {
queryParams: { sorting_order: sortOrder },
queryParamsHandling: 'merge',
});
}
handleChipBoxChange(change: MatChipListboxChange): void {
const selectedValues = change.value as string[];
this.router.navigate([], {
queryParams: {
selected_project_types: selectedValues.length
? selectedValues.join(',')
: null,
},
queryParamsHandling: 'merge',
});
}
getDetaiLink(fundingProject: FundingProject): string | null {
if (fundingProject.type === 'bund') {
return '/projects/bund/' + fundingProject.id;
} else if (fundingProject.type === 'dfg') {
return '/projects/dfg/' + fundingProject.id;
} else {
return null;
}
}
}
@@ -0,0 +1,29 @@
// src/app/modules/university-ranking/services/university-data.service.ts
import { inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { InstitutionsService, RankingResponse } from '../../../api';
export type ResearchTopic =
| 'Artificial Intelligence'
| 'Quantum Computing'
| 'Renewable Energy'
| 'Biotechnology';
export type DashboardMetric = 'publications' | 'citations';
@Injectable({ providedIn: 'root' })
export class UniversityRankingService {
private apiService = inject(InstitutionsService);
/**
* Fetches ranking and timeseries data directly from the backend.
* Calculations for growth and trends are now handled server-side.
*/
getRankingData(
topic: ResearchTopic,
metric: DashboardMetric,
): Observable<RankingResponse> {
return this.apiService.getRankingsApiInseServiceUniversityRankingsGet(
topic,
metric,
);
}
}
@@ -0,0 +1,5 @@
<div
echarts
[options]="chartOption"
[merge]="mergeOption"
class="chart-container"></div>
@@ -0,0 +1,4 @@
.chart-container {
height: 500px;
width: 100%;
}
@@ -0,0 +1,64 @@
// src/app/modules/university-ranking/components/line-chart/university-line-chart.component.ts
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { EChartsOption } from 'echarts';
import { NgxEchartsDirective } from 'ngx-echarts';
import { UniversityTopicData, YearlyData } from '../../../api';
export type ResearchTopic =
| 'Artificial Intelligence'
| 'Quantum Computing'
| 'Renewable Energy'
| 'Biotechnology';
export type DashboardMetric = 'publications' | 'citations';
@Component({
selector: 'app-university-line-chart',
templateUrl: './uni-line-chart.component.html',
styleUrl: './uni-line-chart.component.scss',
imports: [NgxEchartsDirective],
standalone: true,
})
export class UniversityLineChartComponent implements OnChanges {
@Input() data: UniversityTopicData[] = [];
@Input() metric: DashboardMetric = 'publications';
chartOption: EChartsOption = {
title: {
text: 'Research Output Over Time',
left: 'center',
textStyle: { fontWeight: 'lighter' },
},
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
legend: { bottom: 0 },
grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
xAxis: { type: 'category', boundaryGap: false, data: [] },
yAxis: { type: 'value', name: 'Volume' },
dataZoom: [{ type: 'slider', show: true, bottom: 40 }],
series: [],
};
mergeOption: EChartsOption = {};
ngOnChanges(changes: SimpleChanges): void {
if (this.data.length > 0) {
this.updateChart();
console.log('CHANGES!');
}
}
private updateChart() {
const years = this.data[0].yearly_data.map((d) => d.year);
const series = this.data.map((uni) => ({
name: uni.university,
type: 'line',
smooth: true,
emphasis: { focus: 'series' },
animationDuration: 2000,
data: uni.yearly_data.map((d) => d[this.metric]),
}));
this.mergeOption = {
xAxis: { data: years.map(String) },
series: series as any,
};
}
}
@@ -0,0 +1,42 @@
<div class="ranking-card">
<h4>Topic Rankings</h4>
@if (loading) {
<div class="skeleton-loader">Loading rankings...</div>
} @else {
<table class="ranking-table">
<thead>
<tr>
<th>Rank</th>
<th>University</th>
<th>Latest</th>
<th>5Y Growth</th>
<th>Trend</th>
</tr>
</thead>
<tbody>
@for (row of rankings; track $index) {
<tr [class.top-tier]="row.rank <= 3">
<td>#{{ row.rank }}</td>
<td>
{{ row.university }}
@if (row.is_top_mover) {
<span class="mover-badge" title="Top mover last 3 years"
>🔥</span
>
}
</td>
<td>{{ row.publications | number }}</td>
<td
[class.positive]="row.growth_rate > 0"
[class.negative]="row.growth_rate < 0">
{{ row.growth_rate | number: '1.0-1' }}%
</td>
<td class="trend-col" [attr.data-trend]="row.trend">
{{ getTrendIcon(row.trend) }}
</td>
</tr>
}
</tbody>
</table>
}
</div>
@@ -0,0 +1,21 @@
// src/app/modules/university-ranking/components/ranking-table/university-ranking-table.component.ts
import { Component, Input } from '@angular/core';
import { UniversityRanking } from '../../../api';
import { DecimalPipe } from '@angular/common';
@Component({
selector: 'app-university-ranking-table',
templateUrl: './uni-ranking-table.component.html',
styleUrls: ['./uni-ranking-table.component.scss'],
imports: [DecimalPipe],
})
export class UniversityRankingTableComponent {
@Input() rankings: UniversityRanking[] = [];
@Input() loading: boolean = false;
getTrendIcon(trend: string): string {
if (trend === 'up') return '↑';
if (trend === 'down') return '↓';
return '→';
}
}