diff --git a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html index 367eda5c..782e5acd 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html +++ b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html @@ -557,8 +557,10 @@ @if (activeTab === 'organizations' && euProject.organizations) { } - - + @if (activeTab === 'publications' && euProject.publications) { + + } + @if (activeTab === 'iprs' && euProject.iprs) { @@ -626,7 +628,7 @@
@for (ipr of euProject.iprs; track ipr.title) { -
+
@if (ipr.type === 'PATENT') { emoji_events diff --git a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.scss b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.scss index 60c230aa..4728e222 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.scss +++ b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.scss @@ -269,13 +269,13 @@ h1 { padding: 0; } -.section-header { - display: flex; - align-items: center; - gap: 10px; - padding: 16px 20px 12px; - border-bottom: 1px solid #f0f2f5; -} + .section-header { + display: flex; + align-items: center; + gap: 12px; + padding: 16px 20px; + border-bottom: 1px solid #e6e9ed; + } .section-header mat-icon { color: var(--sg-text-muted); @@ -286,7 +286,7 @@ h1 { .section-header h2 { margin: 0; - font-size: 16px; + font-size: 18px; font-weight: 600; color: var(--sg-text); } diff --git a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts index a73c2e04..449bae54 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts +++ b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts @@ -16,8 +16,8 @@ import { import { EuProjectData } from '../../../api/model/euProjectData'; import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component'; import { OrganizationsTableComponent } from './organizations-table/organizations-table/organizations-table.component'; -import { HEUPublication } from '../../../api'; - +import { Fp7ProjectIPR } from '../../../api'; +import { PublicationsTableComponent } from './publications-table/publications-table.component'; export type TabType = | 'overview' | 'organizations' @@ -38,6 +38,7 @@ export type TabType = MatTooltipModule, TopicChipComponent, OrganizationsTableComponent, + PublicationsTableComponent ], templateUrl: './eu-details.component.html', styleUrl: './eu-details.component.scss', @@ -49,27 +50,30 @@ export class EuDetailsComponent implements OnInit, OnDestroy { // Data euProject: EuProjectData | undefined; programType: string = ''; - + // UI State activeTab: TabType = 'overview'; isLoading = true; - + // Tab content flags hasOrganizations = false; hasPublications = false; hasIprs = false; hasDeliverables = false; - + // Subscriptions private subscriptions: Subscription = new Subscription(); // Tab configuration - private readonly tabConfig: Record = { + private readonly tabConfig: Record< + TabType, + { label: string; icon: string; order: number } + > = { overview: { label: 'Übersicht', icon: 'info', order: 0 }, organizations: { label: 'Organisationen', icon: 'business', order: 1 }, publications: { label: 'Publikationen', icon: 'article', order: 2 }, iprs: { label: 'IPRs', icon: 'gavel', order: 3 }, - deliverables: { label: 'Ergebnisse', icon: 'assignment', order: 4 } + deliverables: { label: 'Ergebnisse', icon: 'assignment', order: 4 }, }; ngOnInit(): void { @@ -85,7 +89,7 @@ export class EuDetailsComponent implements OnInit, OnDestroy { this.updateTabContentFlags(); this.handleTabFromQueryParams(); } - }) + }), ); // Subscribe to query params changes @@ -95,7 +99,7 @@ export class EuDetailsComponent implements OnInit, OnDestroy { if (this.euProject) { this.handleTabFromQueryParams(params); } - }) + }), ); } @@ -122,14 +126,20 @@ export class EuDetailsComponent implements OnInit, OnDestroy { * Update flags for which tabs have content */ private updateTabContentFlags(): void { - this.hasOrganizations = - (this.euProject?.organizations && this.euProject.organizations.length > 0) || false; - this.hasPublications = - (this.euProject?.publications && this.euProject.publications.length > 0) || false; - this.hasIprs = + this.hasOrganizations = + (this.euProject?.organizations && + this.euProject.organizations.length > 0) || + false; + this.hasPublications = + (this.euProject?.publications && + this.euProject.publications.length > 0) || + false; + this.hasIprs = (this.euProject?.iprs && this.euProject.iprs.length > 0) || false; - this.hasDeliverables = - (this.euProject?.deliverables && this.euProject.deliverables.length > 0) || false; + this.hasDeliverables = + (this.euProject?.deliverables && + this.euProject.deliverables.length > 0) || + false; } /** @@ -138,7 +148,7 @@ export class EuDetailsComponent implements OnInit, OnDestroy { private handleTabFromQueryParams(params?: any): void { const queryParams = params || this.route.snapshot.queryParams; const tabParam = queryParams['tab'] as TabType; - + if (tabParam && this.isValidTab(tabParam)) { if (this.tabHasContent(tabParam)) { this.activeTab = tabParam; @@ -158,7 +168,13 @@ export class EuDetailsComponent implements OnInit, OnDestroy { * Check if a tab value is valid */ private isValidTab(tab: string): tab is TabType { - return ['overview', 'organizations', 'publications', 'iprs', 'deliverables'].includes(tab); + return [ + 'overview', + 'organizations', + 'publications', + 'iprs', + 'deliverables', + ].includes(tab); } /** @@ -189,11 +205,13 @@ export class EuDetailsComponent implements OnInit, OnDestroy { const currentTab = this.route.snapshot.queryParams['tab']; if (currentTab === tab) return; - this.router.navigate([], { - relativeTo: this.route, - queryParams: { tab: tab }, - queryParamsHandling: 'merge', - }).catch(err => console.error('Tab navigation failed:', err)); + this.router + .navigate([], { + relativeTo: this.route, + queryParams: { tab: tab }, + queryParamsHandling: 'merge', + }) + .catch((err) => console.error('Tab navigation failed:', err)); } /** @@ -220,7 +238,7 @@ export class EuDetailsComponent implements OnInit, OnDestroy { */ setTab(tab: TabType): void { if (this.activeTab === tab) return; - + // Check if tab has content if (!this.tabHasContent(tab)) { console.warn(`Tab "${tab}" has no content`); @@ -281,8 +299,16 @@ export class EuDetailsComponent implements OnInit, OnDestroy { * Get sorted tabs that have content */ getVisibleTabs(): TabType[] { - return (['overview', 'organizations', 'publications', 'iprs', 'deliverables'] as TabType[]) - .filter(tab => this.tabHasContent(tab)) + return ( + [ + 'overview', + 'organizations', + 'publications', + 'iprs', + 'deliverables', + ] as TabType[] + ) + .filter((tab) => this.tabHasContent(tab)) .sort((a, b) => this.tabConfig[a].order - this.tabConfig[b].order); } @@ -323,7 +349,10 @@ export class EuDetailsComponent implements OnInit, OnDestroy { const statusUpper = status.toUpperCase(); if (statusUpper.includes('CLOSED') || statusUpper.includes('COMPLETED')) { return '#27ae60'; - } else if (statusUpper.includes('ONGOING') || statusUpper.includes('ACTIVE')) { + } else if ( + statusUpper.includes('ONGOING') || + statusUpper.includes('ACTIVE') + ) { return '#f39c12'; } else if (statusUpper.includes('SIGNED')) { return '#3498db'; @@ -369,13 +398,15 @@ export class EuDetailsComponent implements OnInit, OnDestroy { if (!scheme) return 'N/A'; const schemeMap: { [key: string]: string } = { - 'MSCA-IF-EF-SE': 'MSCA Individual Fellowship - European Fellowship - Standard', + 'MSCA-IF-EF-SE': + 'MSCA Individual Fellowship - European Fellowship - Standard', 'MSCA-IF-EF': 'MSCA Individual Fellowship - European Fellowship', 'MSCA-IF-GF': 'MSCA Individual Fellowship - Global Fellowship', 'MSCA-IF': 'MSCA Individual Fellowship', 'MSCA-ITN': 'MSCA Innovative Training Networks', 'MSCA-RISE': 'MSCA Research and Innovation Staff Exchange', - 'MSCA-COFUND': 'MSCA Co-funding of Regional, National and International Programmes', + 'MSCA-COFUND': + 'MSCA Co-funding of Regional, National and International Programmes', }; return schemeMap[scheme] || scheme; @@ -464,10 +495,12 @@ export class EuDetailsComponent implements OnInit, OnDestroy { console.warn('Cannot search with empty topic'); return; } - - this.router.navigate(['/eu-projects'], { - queryParams: { topic: topic }, - }).catch(err => console.error('Navigation to topic failed:', err)); + + this.router + .navigate(['/eu-projects'], { + queryParams: { topic: topic }, + }) + .catch((err) => console.error('Navigation to topic failed:', err)); } /** @@ -478,10 +511,12 @@ export class EuDetailsComponent implements OnInit, OnDestroy { console.warn('Cannot search with empty keyword'); return; } - - this.router.navigate(['/eu-projects'], { - queryParams: { keyword: keyword }, - }).catch(err => console.error('Navigation to keyword failed:', err)); + + this.router + .navigate(['/eu-projects'], { + queryParams: { keyword: keyword }, + }) + .catch((err) => console.error('Navigation to keyword failed:', err)); } /** @@ -492,10 +527,12 @@ export class EuDetailsComponent implements OnInit, OnDestroy { console.warn('Cannot search with empty framework'); return; } - - this.router.navigate(['/eu-projects'], { - queryParams: { framework: framework }, - }).catch(err => console.error('Navigation to framework failed:', err)); + + this.router + .navigate(['/eu-projects'], { + queryParams: { framework: framework }, + }) + .catch((err) => console.error('Navigation to framework failed:', err)); } /** @@ -506,10 +543,14 @@ export class EuDetailsComponent implements OnInit, OnDestroy { console.warn('Cannot search with empty funding scheme'); return; } - - this.router.navigate(['/eu-projects'], { - queryParams: { fundingScheme: scheme }, - }).catch(err => console.error('Navigation to funding scheme failed:', err)); + + this.router + .navigate(['/eu-projects'], { + queryParams: { fundingScheme: scheme }, + }) + .catch((err) => + console.error('Navigation to funding scheme failed:', err), + ); } /** @@ -520,40 +561,26 @@ export class EuDetailsComponent implements OnInit, OnDestroy { console.warn('Cannot search with empty status'); return; } - - this.router.navigate(['/eu-projects'], { - queryParams: { status: status }, - }).catch(err => console.error('Navigation to status failed:', err)); + + this.router + .navigate(['/eu-projects'], { + queryParams: { status: status }, + }) + .catch((err) => console.error('Navigation to status failed:', err)); } - /** - * Navigate to publication details - */ - searchForPublication(pub: HEUPublication): void { - if (!pub) { - console.warn('Cannot navigate with empty publication'); - return; - } - - const doi = pub.doi?.trim() ?? "unknown"; - - // Encode DOI and navigate - const encodedDoi = encodeURIComponent(doi); - - this.router.navigate(['/publication', encodedDoi], { - queryParams: { - title: pub.title || '' - }, - }).catch(err => console.error('Navigation to publication failed:', err)); + searchForPatent(patent: Fp7ProjectIPR) { + console.log(patent) } - /** * Navigate back to projects list with optional filter */ goBack(filters?: { [key: string]: any }): void { - this.router.navigate(['/eu-projects'], { - queryParams: filters || {}, - queryParamsHandling: 'merge', - }).catch(err => console.error('Navigation back failed:', err)); + this.router + .navigate(['/eu-projects'], { + queryParams: filters || {}, + queryParamsHandling: 'merge', + }) + .catch((err) => console.error('Navigation back failed:', err)); } -} \ No newline at end of file +} diff --git a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.html b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.html new file mode 100644 index 00000000..79cda076 --- /dev/null +++ b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.html @@ -0,0 +1,141 @@ +
+ + @if (showHeader) { +
+ description +

{{ headerTitle }} ({{ getPublicationCount() }})

+
+ } +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Titel +
+ + {{ pub.title || 'Kein Titel' }} + +
+
Autoren + @if (pub.authors) { + @let authorList = parseAuthors(pub.authors); + @if (authorList.length > 0) { +
+ @for (author of authorList; track author; let last = $last) { + + + {{ author }} + + @if (!last) { + , + } + + } +
+ } @else { + — + } + } @else { + — + } +
Zeitschrift + @if (pub.journalTitle) { + {{ pub.journalTitle }} + } @else { + — + } + Jahr + @if (pub.publishedYear) { + {{ pub.publishedYear }} + } @else { + — + } + Verlag + @if (pub.publisher) { + {{ pub.publisher }} + } @else { + — + } + Links + +
+
+
+
\ No newline at end of file diff --git a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.scss b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.scss new file mode 100644 index 00000000..f84c64b4 --- /dev/null +++ b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.scss @@ -0,0 +1,233 @@ +// Publications Table + +.publications-tab { + .card { + margin-bottom: 24px; + } + + .section-header { + display: flex; + align-items: center; + gap: 12px; + padding: 16px 20px; + border-bottom: 1px solid #e6e9ed; + + mat-icon { + color: #6b7a8a; + font-size: 24px; + width: 24px; + height: 24px; + } + + h2 { + margin: 0; + font-size: 18px; + font-weight: 600; + color: #1a1a1a; + } + } + + table { + width: 100%; + border-radius: 8px; + overflow: hidden; + } + + .mat-mdc-header-cell { + font-weight: 600; + color: #6b7a8a; + font-size: 12px; + text-transform: uppercase; + letter-spacing: 0.5px; + background: #f8fafc; + border-bottom: 2px solid #e6e9ed; + padding: 12px 16px; + } + + .mat-mdc-cell { + padding: 12px 16px; + border-bottom: 1px solid #f0f2f5; + font-size: 13px; + } + + .mat-mdc-row { + transition: background 0.2s ease; + cursor: pointer; + } + + .mat-mdc-row:hover { + background: #f8fafc; + } + + .pub-title-cell { + display: flex; + align-items: center; + gap: 8px; + cursor: pointer; + } + + .pub-title-text { + font-weight: 500; + color: #1a1a1a; + line-height: 1.4; + } + + .pub-title-cell:hover .pub-title-text { + color: #005a9c; + text-decoration: underline; + } + + .authors-text { + color: #4a5a6a; + font-size: 13px; + color: #1a1a1a; + line-height: 1.4; + } + .author-name:hover { + color: #005a9c; + text-decoration: underline; + } + + .journal-chip { + display: inline-block; + padding: 2px 10px; + background: #e8edf5; + border-radius: 12px; + font-size: 12px; + color: #6b7a8a; + max-width: 200px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .year-value { + font-weight: 500; + color: #1a1a1a; + } + + .publisher-text { + color: #4a5a6a; + font-size: 13px; + } + + .empty-value { + color: #6b7a8a; + font-size: 13px; + } + + .links-container { + display: flex; + align-items: center; + gap: 8px; + flex-wrap: wrap; + } + + .link-button { + display: inline-flex; + align-items: center; + gap: 4px; + padding: 4px 10px; + background: #f0f3f7; + border-radius: 12px; + color: #4a5a6a; + text-decoration: none; + font-size: 11px; + font-weight: 500; + transition: all 0.2s ease; + + &:hover { + background: #e8edf5; + color: #005a9c; + transform: translateY(-1px); + } + + .link-icon { + font-size: 14px; + width: 14px; + height: 14px; + color: #6b7a8a; + } + + .link-label { + font-size: 10px; + text-transform: uppercase; + letter-spacing: 0.3px; + } + } + + // Responsive styles + @media (max-width: 768px) { + .section-header { + padding: 12px 16px; + + h2 { + font-size: 16px; + } + } + + .mat-mdc-header-cell, + .mat-mdc-cell { + padding: 8px 10px; + font-size: 12px; + } + + .publicationDisplayedColumns { + // Hide less important columns on mobile + .mat-column-publisher { + display: none; + } + } + + .journal-chip { + max-width: 120px; + font-size: 11px; + } + + .link-button { + padding: 2px 8px; + font-size: 10px; + + .link-label { + display: none; + } + } + + .pub-title-text { + font-size: 13px; + } + } + + @media (max-width: 480px) { + .mat-column-journal { + display: none; + } + + .mat-column-publisher { + display: none; + } + + .mat-mdc-cell { + padding: 6px 8px; + font-size: 11px; + } + + .authors-text { + font-size: 11px; + max-width: 100px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: inline-block; + } + + .links-container { + gap: 4px; + } + + .link-button { + padding: 2px 6px; + font-size: 9px; + } + } +} diff --git a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.ts new file mode 100644 index 00000000..44f5af5e --- /dev/null +++ b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.ts @@ -0,0 +1,87 @@ +import { Component, computed, inject, Input } from '@angular/core'; +import { MatTableModule } from '@angular/material/table'; +import { Router } from '@angular/router'; +import { MatIcon } from '@angular/material/icon'; +import { MatCard } from '@angular/material/card'; +import { MatTooltipModule } from '@angular/material/tooltip'; +import { CommonModule } from '@angular/common'; +import { HEUPublication } from '../../../../api'; + +@Component({ + selector: 'app-publications-table', + imports: [CommonModule, MatTableModule, MatIcon, MatCard, MatTooltipModule], + templateUrl: './publications-table.component.html', + styleUrl: './publications-table.component.scss', +}) +export class PublicationsTableComponent { + private router = inject(Router); + + @Input() publications: HEUPublication[] = []; + @Input() showHeader: boolean = true; + @Input() headerTitle: string = 'Publikationen'; + + // Displayed columns for the publications table + publicationDisplayedColumns: string[] = [ + 'title', + 'authors', + 'journal', + 'year', + 'publisher', + 'links', + ]; + author_names = computed(() => 'keka'); + /** + * Navigate to publication details + */ + searchForPublication(pub: HEUPublication): void { + if (!pub) { + console.warn('Cannot navigate with empty publication'); + return; + } + + const doi = pub.doi?.trim() ?? 'unknown'; + + // Encode DOI and navigate + const encodedDoi = encodeURIComponent(doi); + + this.router + .navigate(['/publication', encodedDoi], { + queryParams: { + title: pub.title || '', + }, + }) + .catch((err) => console.error('Navigation to publication failed:', err)); + } + + getPublicationCount(): number { + return this.publications?.length || 0; + } + searchForPersonName(personName: string): void { + this.router.navigate(['/persons'], { + queryParams: { + query: personName, + }, + }); + } + // Parse authors string into array of individual authors + parseAuthors(authorsString: string | undefined): string[] { + if (!authorsString) return []; + + // Common separators: 'and', ',', ';', '&' + // Also handle cases like "Author1, Author2 and Author3" + let authors = authorsString; + + // Replace ' and ' with ', ' for consistent splitting + authors = authors.replace(/\s+and\s+/g, ', '); + + // Split by common separators + let authorList = authors.split(/[,;]\s*/); + + // Clean up each author name + authorList = authorList + .map((author) => author.trim()) + .filter((author) => author.length > 0); + + return authorList; + } +}