diff --git a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.html b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.html index cdaae4cd..e5656409 100644 --- a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.html +++ b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.html @@ -1,6 +1,7 @@ @@ -106,3 +107,60 @@ } + +
+
+ @if (project.highlight?.topic.length > 0) { +
+

Titel

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

Zuwendungsempfänger

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

Verbundprojekt

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

Ausführende Stelle

+ +
+ } +
+
+
diff --git a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.scss b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.scss index 57b73879..63d6ff2d 100644 --- a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.scss +++ b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.scss @@ -205,6 +205,97 @@ } } } +// ------------------------ +// 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; + } +} // ------------------------ // Responsive adjustments diff --git a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.ts b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.ts index 90a62735..33243ad7 100644 --- a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.ts +++ b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.ts @@ -27,6 +27,12 @@ import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors'; import { bundProjectQueryParamKeys } from '../../../resolvers/bund-projects.resolver'; import { SkTextDirective } from '../../../custom-directives/sk-text.directive'; import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overflow-toggle.component'; +import { SearchResultsStateService } from '../../../modules/keywords-search/search-results/search-results-state.service'; +import { + HighlightedTextComponent, + HighlightTerm, +} from '../highlighted-text/highlighted-text.component'; +import { MatDividerModule } from '@angular/material/divider'; @Component({ selector: 'app-bund-project-table', imports: [ @@ -42,6 +48,7 @@ import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overfl ChipComponent, AppTopicChipComponent, SkTextDirective, + HighlightedTextComponent, ], templateUrl: './bund-project-table.component.html', styleUrl: './bund-project-table.component.scss', @@ -49,7 +56,10 @@ import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overfl export class BundProjectTableComponent implements OnInit { private readonly activatedRoute = inject(ActivatedRoute); private readonly router = inject(Router); - + private readonly searchResultsStateService = inject( + SearchResultsStateService, + { optional: true }, + ); page = input.required(); authorFilterEnabled = input(false); institutionFilterEnabled = input(false); @@ -353,4 +363,31 @@ export class BundProjectTableComponent implements OnInit { return this.expandedProjectTopicsId.includes(project.funding_code); } + /** + * 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, + })); + } }