diff --git a/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.html b/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.html index 4e4a2b50..c7921e71 100644 --- a/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.html +++ b/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.html @@ -1,6 +1,7 @@ @@ -146,3 +147,73 @@ open_in_new + +
+
+ @if (project.highlight?.title.length > 0) { +
+

Titel

+ +
+ } + + @if (project.highlight?.objective.length > 0) { +
+

Zusammenfassung

+ +
+ } + @if (project.highlight?.acronym.length > 0) { +
+

Akronym

+ +
+ } + @if (project.highlight?.cordis_topic_text.length > 0) { +
+

Cordis-Thema

+ +
+ } + @if (project.highlight?.keywords.length > 0) { +
+

Schlüsselwörter

+ +
+ } +
+
+
diff --git a/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.scss b/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.scss index 39334f9f..abe02090 100644 --- a/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.scss +++ b/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.scss @@ -142,7 +142,97 @@ .classification-container { max-width: 200px; } +// ------------------------ +// Expanded project panel +// ------------------------ +.project-panel { + width: 100%; + padding: 12px 16px 14px; + color: var(--sg-text); + background: var(--sg-background); + border-top: 1px solid var(--sg-border); +} + +.project-panel__header { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; + margin-bottom: 10px; +} + +.project-panel__heading { + display: flex; + align-items: flex-start; + gap: 8px; + + > mat-icon { + flex: 0 0 auto; + width: 19px; + height: 19px; + color: var(--sg-primary); + font-size: 19px; + } + + h3 { + margin: 0; + font-size: 13px; + font-weight: 700; + line-height: 1.2; + } + + p { + margin: 1px 0 0; + color: var(--sg-text-muted); + font-size: 11px; + line-height: 1.3; + } +} + +.project-panel__content { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); + gap: 10px; +} + +.panel-field { + min-width: 0; + + &--full { + grid-column: 1 / -1; + } +} + +.panel-field__label { + color: var(--sg-text-muted); + font-size: 10px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.02em; +} + +.panel-field__text { + margin: 0; + font-size: 12px; + line-height: 1.5; + overflow-wrap: anywhere; +} + +.project-panel__empty { + display: flex; + align-items: center; + gap: 6px; + grid-column: 1 / -1; + color: var(--sg-text-muted); + font-size: 12px; + + mat-icon { + width: 16px; + height: 16px; + font-size: 16px; + } +} // ------------------------ // Data table overrides (applied via ::ng-deep) // ------------------------ diff --git a/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.ts b/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.ts index 3ce72773..9641bdd8 100644 --- a/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.ts +++ b/webapp/src/app/shared/ui/eu-project-table/eu-project-table.component.ts @@ -33,6 +33,12 @@ import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors'; import { ChipComponent } from '../chip/chip.component'; import { AppAuthorChipComponent } from '../app-author-chip/app-author-chip.component'; import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overflow-toggle.component'; +import { + HighlightedTextComponent, + HighlightTerm, +} from '../highlighted-text/highlighted-text.component'; +import { MatDividerModule } from '@angular/material/divider'; +import { SearchResultsStateService } from '../../../modules/keywords-search/search-results/search-results-state.service'; @Component({ selector: 'app-eu-project-table', imports: [ @@ -49,6 +55,8 @@ import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overfl ChipComponent, AppAuthorChipComponent, SkTextDirective, + MatDividerModule, + HighlightedTextComponent, ], templateUrl: './eu-project-table.component.html', styleUrl: './eu-project-table.component.scss', @@ -56,7 +64,10 @@ import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overfl export class EuProjectTableComponent { private readonly activatedRoute = inject(ActivatedRoute); private readonly router = inject(Router); - + private readonly searchResultsStateService = inject( + SearchResultsStateService, + { optional: true }, + ); queryParamKeys = euProjectQueryParamKeys; page = input(); @@ -94,7 +105,12 @@ export class EuProjectTableComponent { selectedTypesQueryParams = computed(() => { return this.queryParamMap().getAll(this.queryParamKeys.projectType); }); - + keywordTopicMap = computed(() => { + return ( + this.searchResultsStateService?.keywordTopicMap() ?? + new Map() + ); + }); projectTypeTmp = viewChild.required>('projectTypeTmp'); fundingStartTmp = viewChild.required>('fundingStartTmp'); fundingEndTmp = viewChild.required>('fundingEndTmp'); @@ -507,4 +523,33 @@ export class EuProjectTableComponent { ? this.expandedProjectTopicsIds.filter((id) => id !== projectId) : [...this.expandedProjectTopicsIds, projectId]; } + // Highlighted Text + /** + * Extracts the distinct matched terms out of Elasticsearch-style + * highlight fragments (terms wrapped in ...). + */ + extractHighlightTerms(fragments: string[] | null | undefined): string[] { + const terms = new Set(); + + for (const fragment of fragments ?? []) { + if (typeof fragment !== 'string') continue; + + const matches = fragment.matchAll(/(.*?)<\/em>/gi); + for (const match of matches) { + const term = match[1]?.trim(); + if (term) { + terms.add(term); + } + } + } + + return Array.from(terms); + } + + getHighlightTerms(terms: string[] | null | undefined): HighlightTerm[] { + return (terms ?? []).map((term) => ({ + term, + topic: this.searchResultsStateService?.resolveTopicForTerm(term) ?? null, + })); + } }