@if (article.full_content) { -

+ [content]="article.full_content" + [highlights]="articleHighlights" /> } @else {

Kein Inhalt verfügbar.

} diff --git a/webapp/src/app/modules/news-detail/news-detail.component.scss b/webapp/src/app/modules/news-detail/news-detail.component.scss index 4b091f89..9577c0be 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.scss +++ b/webapp/src/app/modules/news-detail/news-detail.component.scss @@ -598,26 +598,3 @@ main { background: transparent; } } - -:host ::ng-deep .kw-mark { - background: transparent; - color: var(--t); - text-decoration: underline; - text-decoration-color: var(--t); - text-decoration-style: solid; - text-decoration-thickness: 2px; - text-underline-offset: 2px; - font-weight: inherit; - border-radius: 2px; - padding: 0 1px; - cursor: help; - transition: background 0.15s; - - &:hover { - background: color-mix(in srgb, var(--t) 15%, var(--sg-color-mix-base)); - } - - &.kw-flash { - animation: kw-flash 2.4s ease-out forwards; - } -} diff --git a/webapp/src/app/modules/news-detail/news-detail.component.ts b/webapp/src/app/modules/news-detail/news-detail.component.ts index 039c7feb..2c2b86a9 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.ts +++ b/webapp/src/app/modules/news-detail/news-detail.component.ts @@ -12,8 +12,10 @@ import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { MatTooltipModule } from '@angular/material/tooltip'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; - +import { + HighlightedTextComponent, + HighlightTerm, +} from '../../shared/ui/highlighted-text/highlighted-text.component'; import { WorksService } from '../../api'; import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; import { @@ -58,21 +60,21 @@ interface NewsArticleDetail { MatTooltipModule, RouterLink, LoadingComponent, + HighlightedTextComponent, ], templateUrl: './news-detail.component.html', styleUrl: './news-detail.component.scss', }) export class NewsDetailComponent implements OnInit { - @ViewChild('articleBody') articleBodyRef?: ElementRef; + @ViewChild('articleBody', { read: ElementRef }) + articleBodyRef?: ElementRef; private readonly router = inject(Router); private readonly destroyRef = inject(DestroyRef); private readonly route = inject(ActivatedRoute); private readonly httpClient = inject(HttpClient); private readonly worksService = inject(WorksService); - private readonly sanitizer = inject(DomSanitizer); article: NewsArticleDetail | null = null; - highlightedContent: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(''); loading = false; notFound = false; @@ -176,7 +178,6 @@ export class NewsDetailComponent implements OnInit { .subscribe({ next: (article) => { this.article = article; - this.highlightedContent = this.buildHighlightedContent(article); this.expandedTopicId = null; this.personsPage = 0; this.loading = false; @@ -188,15 +189,33 @@ export class NewsDetailComponent implements OnInit { }); } - private buildHighlightedContent(article: NewsArticleDetail): SafeHtml { - const text = article.full_content; - if (!text) return this.sanitizer.bypassSecurityTrustHtml(''); + get articleHighlights(): HighlightTerm[] { + const article = this.article; + if (!article) return []; - return this.sanitizer.bypassSecurityTrustHtml( - highlightKeywords( - text, - topicKeywordColors(article.topics, article.keywords), - ), - ); + const topicByKeyword = new Map(); + for (const topic of article.topics ?? []) { + if (topic.source_keyword) { + topicByKeyword.set(topic.source_keyword.toLowerCase(), topic); + } + } + + const highlights: HighlightTerm[] = []; + for (const keyword of article.keywords ?? []) { + const topic = topicByKeyword.get(keyword.toLowerCase()); + if (!topic) continue; + + highlights.push({ + term: keyword, + topic: { + id: topic.id, + name: topic.display_name, + field_name: topic.field_name, + domain_name: topic.domain_name, + }, + }); + } + + return highlights; } } diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html index 8d6c9db9..19c3c6cc 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html @@ -138,41 +138,10 @@ } @if (getSubjectClassifications().length > 0) { - -
- category -

Fachsystematik

- {{ - getSubjectClassifications().length - }} -
-
- @for (entry of getSubjectClassifications(); track $index) { -
- @for ( - segment of getClassificationParentSegments(entry); - track $index - ) { - {{ segment }} - chevron_right - } -
- @for ( - leaf of getClassificationLeafSegments(entry); - track $index - ) { - - {{ leaf }} - - } -
-
- } -
-
+ } diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss index 68d5ae71..d4a9a328 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss @@ -473,56 +473,6 @@ h1 { color: var(--sg-text-muted); } -.classification-list { - display: flex; - flex-direction: column; - gap: 10px; - padding: 16px 20px 20px; -} - -.classification-path { - display: flex; - align-items: center; - flex-wrap: wrap; - gap: 4px 2px; - padding: 10px 12px; - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - background: var(--sg-surface); -} - -.classification-segment { - font-size: 12px; - line-height: 1.3; - padding: 3px 10px; - border-radius: 10px; - background: var(--sg-surface-soft); - color: var(--sg-text-muted); - white-space: nowrap; - - &--leaf { - background: var(--sg-primary-soft); - color: var(--sg-text); - font-weight: 500; - white-space: normal; - } -} - -.classification-leaf-group { - display: flex; - flex-wrap: wrap; - gap: 4px; -} - -.classification-separator { - width: 16px; - height: 16px; - font-size: 16px; - color: var(--sg-text-muted); - flex-shrink: 0; - opacity: 0.5; -} - .website-html { padding: 16px 20px 20px; font-size: 14px; diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts index 7b72ac75..2c4eda17 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts @@ -10,7 +10,7 @@ import { DfgProjectInstitutionRole } from '../../../api/model/dfgProjectInstitut import { DfgProjectPersonRole } from '../../../api/model/dfgProjectPersonRole'; import { DFGProjectFachgebieteInner } from '../../../api/model/dFGProjectFachgebieteInner'; import { ProjectOaTopicsComponent } from '../../../shared/ui/project-oa-topics/project-oa-topics.component'; - +import { DfgClassificationComponent } from '../../../shared/ui/dfg-classification/dfg-classification.component'; @Component({ selector: 'app-dfg-details', standalone: true, @@ -19,6 +19,7 @@ import { ProjectOaTopicsComponent } from '../../../shared/ui/project-oa-topics/p MatCardModule, MatIconModule, ProjectOaTopicsComponent, + DfgClassificationComponent, ], templateUrl: './dfg-details.component.html', styleUrl: './dfg-details.component.scss', @@ -154,29 +155,9 @@ export class DfgDetailsComponent implements OnInit { this.getInstitutionsList().length ); } - - //(DFG Fachsystematik) - getSubjectClassifications(): DFGProjectFachgebieteInner[] { return this.dfgProject?.subject_classifications ?? []; } - - getClassificationParentSegments(entry: DFGProjectFachgebieteInner): string[] { - return [ - entry.wissenschaftsbereich, - entry.fachkollegium, - entry.fachgebiet, - ].filter((part): part is string => !!part); - } - - getClassificationLeafSegments(entry: DFGProjectFachgebieteInner): string[] { - if (!entry.fach) return []; - return entry.fach - .split(',') - .map((s) => s.trim()) - .filter((s) => !!s); - } - // --- Subprojects & publications --- getSubprojects(): DfgProjectSubprojectSummary[] { diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.html b/webapp/src/app/shared/ui/app-layout/app-layout.component.html index 7be187a0..503abf05 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.html +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.html @@ -58,16 +58,46 @@ icon="group" [size]="200" [diameter]="200" /> - } @else if (resolverState.isResolvingFromOutside('/person/')) { + } @else if (resolverState.isResolvingFromOutside('/person')) { - } @else if (resolverState.isResolvingFromOutside('/projects/')) { + } @else if (resolverState.isResolvingFromOutside('/publications')) { + + } @else if (resolverState.isResolvingFromOutside('/projects')) { + } @else if (resolverState.isResolvingFromOutside('/institutions')) { + + } @else if (resolverState.isResolvingFromOutside('/patents')) { + + } @else if (resolverState.isResolvingFromOutside('/news')) { + + } @else if (resolverState.isResolvingFromOutside('/topics')) { + } @else { 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 51828b4c..cdaae4cd 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 @@ -82,7 +82,7 @@ - @let projectTopics = project.oa_topics ?? []; + @let projectTopics = getProjectTopics(project); @let isTopicsExpanded = isProjectTopicsExpanded(project); @let visibleTopics = isTopicsExpanded ? projectTopics : projectTopics.slice(0, 3); 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 2a89e462..90a62735 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 @@ -102,6 +102,9 @@ export class BundProjectTableComponent implements OnInit { selectedTopicIdsQueryParams = computed(() => { return this.queryParamMap().getAll(this.queryParamKeys.topicId); }); + selectedTopicMatchesQueryParams = computed(() => { + return this.queryParamMap().get('topics')?.split(',') || []; + }); selectedFundingTypesQueryParams = computed(() => { return this.queryParamMap().getAll(this.queryParamKeys.funding_type); }); @@ -225,7 +228,19 @@ export class BundProjectTableComponent implements OnInit { getProjectInstitutions(project: BundProjectSummary): any[] { return project.institution ? [project.institution] : []; } - + getProjectTopics(project: BundProjectSummary): Topic[] { + const topics = (project as any).oa_topics ?? []; + const activeTopics = topics.filter((topic: Topic) => + this.isTopicActive(topic), + ); + return topics.sort((a: Topic, b: Topic) => + activeTopics.includes(a) && !activeTopics.includes(b) + ? -1 + : !activeTopics.includes(a) && activeTopics.includes(b) + ? 1 + : 0, + ); + } isInstitutionActive( institution_name: string | number | null | undefined, ): boolean { @@ -293,8 +308,9 @@ export class BundProjectTableComponent implements OnInit { isTopicActive(topic: Topic): boolean { return ( !!topic.id && - this.authorFilterEnabled() && - this.selectedTopicIdsQueryParams().includes(topic.id) + this.topicFilterEnabled() && + (this.selectedTopicIdsQueryParams().includes(topic.id) || + this.selectedTopicMatchesQueryParams().includes(topic.id)) ); } diff --git a/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.html b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.html new file mode 100644 index 00000000..5d75d007 --- /dev/null +++ b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.html @@ -0,0 +1,29 @@ +@if (classifications().length > 0) { + +
+ category +

Fachsystematik

+ {{ classifications().length }} +
+
+ @for (entry of classifications(); track $index) { +
+ @for ( + segment of getClassificationParentSegments(entry); + track $index + ) { + {{ segment }} + chevron_right + } +
+ @for (leaf of getClassificationLeafSegments(entry); track $index) { + + {{ leaf }} + + } +
+
+ } +
+
+} diff --git a/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.scss b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.scss new file mode 100644 index 00000000..6709220d --- /dev/null +++ b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.scss @@ -0,0 +1,97 @@ +.card { + margin-bottom: 24px; + background: var(--sg-card-bg) !important; + border-color: var(--sg-border) !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 var(--sg-border); +} + +.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: var(--sg-primary-soft); + border-radius: 12px; + color: var(--sg-text-muted); + font-size: 12px; + font-weight: 500; +} + +.classification-list { + display: flex; + flex-direction: column; + gap: 10px; + padding: 16px 20px 20px; +} + +.classification-path { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 4px 2px; + padding: 10px 12px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + background: var(--sg-surface); +} + +.classification-segment { + font-size: 12px; + line-height: 1.3; + padding: 3px 10px; + border-radius: 10px; + background: var(--sg-surface-soft); + color: var(--sg-text-muted); + white-space: nowrap; + + &--leaf { + background: var(--sg-primary-soft); + color: var(--sg-text); + font-weight: 500; + white-space: normal; + } +} + +.classification-leaf-group { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.classification-separator { + width: 16px; + height: 16px; + font-size: 16px; + color: var(--sg-text-muted); + flex-shrink: 0; + opacity: 0.5; +} diff --git a/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.ts b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.ts new file mode 100644 index 00000000..58f04aa2 --- /dev/null +++ b/webapp/src/app/shared/ui/dfg-classification/dfg-classification.component.ts @@ -0,0 +1,29 @@ +import { Component, input } from '@angular/core'; +import { DFGProjectFachgebieteInner } from '../../../api'; +import { MatIconModule } from '@angular/material/icon'; +import { MatCardModule } from '@angular/material/card'; +@Component({ + selector: 'app-dfg-classification', + imports: [MatIconModule, MatCardModule], + templateUrl: './dfg-classification.component.html', + styleUrl: './dfg-classification.component.scss', +}) +export class DfgClassificationComponent { + classifications = input.required>(); + + getClassificationParentSegments(entry: DFGProjectFachgebieteInner): string[] { + return [ + entry.wissenschaftsbereich, + entry.fachkollegium, + entry.fachgebiet, + ].filter((part): part is string => !!part); + } + + getClassificationLeafSegments(entry: DFGProjectFachgebieteInner): string[] { + if (!entry.fach) return []; + return entry.fach + .split(',') + .map((s) => s.trim()) + .filter((s) => !!s); + } +} diff --git a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html index 5f4d2e52..ec8f7600 100644 --- a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html +++ b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html @@ -1,6 +1,7 @@ @@ -9,7 +10,9 @@ queryParamPageKey="page" queryParamSizeKey="size" [pageSizeOptions]="[10, 25, 50]" /> - + + {{ element.title_de }} + {{ @@ -42,12 +45,11 @@ + matTooltipPosition="above"> category - {{ - getClassificationFullChain(classification) - }} + + {{ getClassificationFullChain(classification) }} } @empty { - @@ -60,7 +62,115 @@ }