From 42bcac251bded6f734e2c9f8e6ec3a2bd2ef1dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Tue, 4 Aug 2026 15:03:50 +0200 Subject: [PATCH 1/2] feat(person): moved link tab nav bar to dedicated component --- .../app/modules/person/person.component.html | 20 ++--- .../app/modules/person/person.component.ts | 74 ++++++++++++------- .../shared/ui/app-menu/app-menu.component.ts | 41 ++++++---- webapp/src/app/shared/ui/icons.ts | 18 +++++ .../link-tab-nav-bar.component.html | 19 +++++ .../link-tab-nav-bar.component.scss | 5 ++ .../link-tab-nav-bar.component.ts | 50 +++++++++++++ webapp/src/styles.scss | 3 +- 8 files changed, 174 insertions(+), 56 deletions(-) create mode 100644 webapp/src/app/shared/ui/icons.ts create mode 100644 webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.html create mode 100644 webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.scss create mode 100644 webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.ts diff --git a/webapp/src/app/modules/person/person.component.html b/webapp/src/app/modules/person/person.component.html index 362af283..1fd0a34b 100644 --- a/webapp/src/app/modules/person/person.component.html +++ b/webapp/src/app/modules/person/person.component.html @@ -132,20 +132,12 @@ [loading]="isTopicsLoading()" (tagClick)="onInterestingTagClick($event)"> - + @if (this.links()) { + + } } @else { ; - disabled: boolean; -}; +import { + LinkTabNavBarComponent, + LinkTabNavBarItem, +} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component'; +import { + COMPANY_CONNECTION_ICON, + FUNDING_ICON, + NETWORK_ICON, + NEWS_ICON, + OVERVIEW_ICON, + PATENT_ICON, + PROJECT_ICON, + PUBLICATION_ICON, +} from '../../shared/ui/icons'; @Component({ selector: 'app-person', @@ -55,6 +62,7 @@ type PersonLink = { LoadingComponent, CountryFlagComponent, CareerStageChipComponent, + LinkTabNavBarComponent, ], templateUrl: './person.component.html', styleUrl: './person.component.scss', @@ -69,6 +77,11 @@ export class PersonComponent { canFetchGdprRelevantData = input.required(); + protected readonly navBar = viewChild('navBar'); + protected readonly activeLink = computed( + () => this.navBar()?.activeLink() ?? null, + ); + constructor() { this.bookmarkService .load() @@ -236,11 +249,12 @@ export class PersonComponent { { initialValue: [] }, ); - readonly links = computed(() => { + readonly links = computed(() => { const links = [ { label: 'Übersicht', description: 'Übersicht über die Person', + icon: OVERVIEW_ICON, path: 'overview', disabled: false, }, @@ -249,6 +263,7 @@ export class PersonComponent { { label: 'Projekte', description: 'Übersicht der durchgeführten Projekte der Person', + icon: PROJECT_ICON, path: 'projects', queryParams: { page: 0, @@ -264,12 +279,13 @@ export class PersonComponent { { label: 'Publikationen', description: 'Übersicht der Publikationen der Person', + icon: PUBLICATION_ICON, path: 'publications', - disabled: false, }, { label: 'Netzwerk', description: 'Kooperationsnetzwerk der Person', + icon: NETWORK_ICON, path: 'network', disabled: false, queryParams: { @@ -284,6 +300,7 @@ export class PersonComponent { { label: 'Unternehmen', description: 'Unternehmen, mit denen die Person verbunden ist', + icon: COMPANY_CONNECTION_ICON, path: 'company-connections', disabled: false, }, @@ -292,18 +309,21 @@ export class PersonComponent { { label: 'Förderungen', description: 'Übersicht der Förderungen der Person', + icon: FUNDING_ICON, path: 'funding', disabled: false, }, { label: 'Nachrichten', description: 'Nachrichten über die Person', + icon: NEWS_ICON, path: 'news', disabled: false, }, { label: 'Patente', description: 'Patente der Person', + icon: PATENT_ICON, path: 'patents', disabled: false, }, @@ -311,25 +331,25 @@ export class PersonComponent { return links; }); - readonly activeLink = computed(() => { - const currentUrl = this.currentUrl(); - if (!currentUrl) { - return null; - } + // readonly activeLink = computed(() => { + // const currentUrl = this.currentUrl(); + // if (!currentUrl) { + // return null; + // } - for (const link of this.links()) { - const linkUrl = this.router - .createUrlTree([link.path], { - relativeTo: this.activatedRoute, - }) - .toString(); + // for (const link of this.links()) { + // const linkUrl = this.router + // .createUrlTree([link.path], { + // relativeTo: this.activatedRoute, + // }) + // .toString(); - if (linkUrl.startsWith(currentUrl) || currentUrl.startsWith(linkUrl)) { - return link; - } - } - return null; - }); + // if (linkUrl.startsWith(currentUrl) || currentUrl.startsWith(linkUrl)) { + // return link; + // } + // } + // return null; + // }); onInterestingTagClick(selection: { id: string; diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts index fa0072f3..52d86a73 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts @@ -17,6 +17,21 @@ import { topicQueryParamKeys } from '../../../resolvers/topic-page.resolver'; import { SortDirection, TopicSortBy, WorkSortBy } from '../../../api'; import { workQueryParamKeys } from '../../../resolvers/work-page.resolver'; import { MatMenuModule } from '@angular/material/menu'; +import { + BOOKMARKS_ICON, + DASHBOARD_ICON, + INSTITUTION_ICON, + JOBS_ICON, + KEYWORDS_ICON, + MANAGE_ACCOUNTS_ICON, + NEWS_ICON, + ORGANIZATIONS_ICON, + PATENT_ICON, + PERSONS_ICON, + PROJECT_ICON, + PUBLICATION_ICON, + TOPIC_ICON, +} from '../icons'; type NavItem = { label: string; @@ -71,13 +86,13 @@ export class AppMenuComponent { const items: NavItem[] = [ { label: 'Dashboard', - icon: 'dashboard', + icon: DASHBOARD_ICON, route: '/dashboard', disabled: false, }, { label: 'Personen', - icon: 'groups', + icon: PERSONS_ICON, route: '/persons', queryParams: activeInstitutionPersonListQueryParams( this.credentialService.effectiveInstitutionId(), @@ -87,19 +102,19 @@ export class AppMenuComponent { }, { label: 'Bookmarks', - icon: 'bookmarks', + icon: BOOKMARKS_ICON, route: '/bookmarks', disabled: false, }, { label: 'News', - icon: 'newspaper', + icon: NEWS_ICON, route: '/news', disabled: false, }, { label: 'Institutionen', - icon: 'apartment', + icon: INSTITUTION_ICON, route: '/institutions', disabled: false, queryParams: { @@ -112,7 +127,7 @@ export class AppMenuComponent { }, { label: 'Publikationen', - icon: 'menu_book', + icon: PUBLICATION_ICON, route: '/publications', disabled: false, queryParams: { @@ -125,7 +140,7 @@ export class AppMenuComponent { }, { label: 'Themen', - icon: 'topic', + icon: TOPIC_ICON, route: '/topics', disabled: false, queryParams: { @@ -138,7 +153,7 @@ export class AppMenuComponent { }, { label: 'Projekte', - icon: 'work', + icon: PROJECT_ICON, route: '/projects', disabled: false, queryParams: { @@ -152,13 +167,13 @@ export class AppMenuComponent { }, { label: 'Patente', - icon: 'workspace_premium', + icon: PATENT_ICON, route: '/patents', disabled: false, }, { label: 'Keywords', - icon: 'join_left', + icon: KEYWORDS_ICON, route: '/keywords', disabled: false, queryParams: { @@ -167,21 +182,21 @@ export class AppMenuComponent { }, { label: 'Accounts', - icon: 'manage_accounts', + icon: MANAGE_ACCOUNTS_ICON, route: '/accounts', disabled: false, managerOrAdminOnly: true, }, { label: 'Organisationen', - icon: 'domain', + icon: ORGANIZATIONS_ICON, route: '/organizations', disabled: false, superAdminOnly: true, }, { label: 'Jobs', - icon: 'sync', + icon: JOBS_ICON, route: '/jobs', disabled: false, superAdminOnly: true, diff --git a/webapp/src/app/shared/ui/icons.ts b/webapp/src/app/shared/ui/icons.ts new file mode 100644 index 00000000..ed81f570 --- /dev/null +++ b/webapp/src/app/shared/ui/icons.ts @@ -0,0 +1,18 @@ +export const BOOKMARKS_ICON = "bookmarks" as const; +export const COMPANY_CONNECTION_ICON = 'business' as const; +export const DASHBOARD_ICON = 'dashboard' as const; +export const FUNDING_ICON = 'account_balance' as const; +export const INSTITUTION_ICON = 'school' as const; +export const JOBS_ICON = "sync" as const; +export const KEYWORDS_ICON = 'join_left' as const; +export const MANAGE_ACCOUNTS_ICON = 'manage_accounts' as const; +export const NETWORK_ICON = 'share' as const; +export const NEWS_ICON = 'newspaper' as const; +export const ORGANIZATIONS_ICON = 'domain' as const; +export const OVERVIEW_ICON = 'visibility' as const; +export const PATENT_ICON = 'workspace_premium' as const; +export const PERSONS_ICON = 'groups' as const; +export const PERSON_ICON = 'person' as const; +export const PROJECT_ICON = 'work' as const; +export const PUBLICATION_ICON = 'menu_book' as const; +export const TOPIC_ICON = 'topic' as const; \ No newline at end of file diff --git a/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.html b/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.html new file mode 100644 index 00000000..fa54da5b --- /dev/null +++ b/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.html @@ -0,0 +1,19 @@ + diff --git a/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.scss b/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.scss new file mode 100644 index 00000000..aaa131c5 --- /dev/null +++ b/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.scss @@ -0,0 +1,5 @@ +.link-tab-nav-bar-item { + display: flex; + align-items: center; + gap: 0.25rem; +} \ No newline at end of file diff --git a/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.ts b/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.ts new file mode 100644 index 00000000..3f87669d --- /dev/null +++ b/webapp/src/app/shared/ui/link-tab-nav-bar/link-tab-nav-bar.component.ts @@ -0,0 +1,50 @@ +import { Component, computed, inject, input } from '@angular/core'; +import { MatTabNavPanel, MatTabsModule } from '@angular/material/tabs'; +import { + ActivatedRoute, + isActive, + Router, + RouterModule, +} from '@angular/router'; +import { MatIconModule } from '@angular/material/icon'; + +export type LinkTabNavBarItem = { + label: string; + path: string; + icon?: string; + description?: string; + queryParams?: Record; + disabled?: boolean; +}; + +@Component({ + selector: 'app-link-tab-nav-bar', + imports: [MatTabsModule, RouterModule, MatIconModule], + templateUrl: './link-tab-nav-bar.component.html', + styleUrl: './link-tab-nav-bar.component.scss', +}) +export class LinkTabNavBarComponent { + private readonly router = inject(Router); + private readonly activatedRoute = inject(ActivatedRoute); + + links = input.required(); + tabPanel = input(); + + activeLink = computed(() => { + for (const link of this.links()) { + const linkUrlTree = this.router.createUrlTree([link.path], { + relativeTo: this.activatedRoute, + }); + + if ( + isActive(linkUrlTree, this.router, { + paths: 'subset', + queryParams: 'ignored', + })() + ) { + return link; + } + } + return null; + }); +} diff --git a/webapp/src/styles.scss b/webapp/src/styles.scss index fdcaec2f..95a45697 100644 --- a/webapp/src/styles.scss +++ b/webapp/src/styles.scss @@ -2,12 +2,11 @@ // For more information: https://material.angular.io/guide/theming @use '@angular/material' as mat; @use 'm3-theme' as m3; +@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,200..700,0..1,-50..200'); @include mat.elevation-classes(); @include mat.app-background(); -@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,200..700,0..1,-50..200'); - @font-face { font-display: swap; font-family: 'Montserrat'; From 6c55493acb9c382f4869cc597f62889883dd4fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Tue, 4 Aug 2026 15:30:34 +0200 Subject: [PATCH 2/2] feat(topic, institution): reused generic link tab nav bar --- .../institution/institution.component.html | 36 +++++---------- .../institution/institution.component.scss | 12 +++-- .../institution/institution.component.ts | 45 +++++++++++-------- .../app/modules/topic/topic.component.html | 15 +------ .../src/app/modules/topic/topic.component.ts | 9 +++- 5 files changed, 56 insertions(+), 61 deletions(-) diff --git a/webapp/src/app/modules/institution/institution.component.html b/webapp/src/app/modules/institution/institution.component.html index ef072421..4b53e760 100644 --- a/webapp/src/app/modules/institution/institution.component.html +++ b/webapp/src/app/modules/institution/institution.component.html @@ -1,27 +1,15 @@ -
-

{{ institution().display_name }}

- - -

{{ institution().homepage_url }}

-

{{ institution().display_name_alternatives }}

-

And many more useful details...

-
-
- - +
+
+

{{ institution().display_name }}

+ + +

{{ institution().homepage_url }}

+

{{ institution().display_name_alternatives }}

+

And many more useful details...

+
+
+
+
diff --git a/webapp/src/app/modules/institution/institution.component.scss b/webapp/src/app/modules/institution/institution.component.scss index 2521fee5..0aae5047 100644 --- a/webapp/src/app/modules/institution/institution.component.scss +++ b/webapp/src/app/modules/institution/institution.component.scss @@ -1,6 +1,12 @@ -.content { - padding: 16px; +.container { display: flex; flex-direction: column; - gap: 16px; + gap: 1rem; +} + +.content { + display: flex; + flex-direction: column; + gap: 1rem; + margin: 0 1rem; } diff --git a/webapp/src/app/modules/institution/institution.component.ts b/webapp/src/app/modules/institution/institution.component.ts index 124b4f13..0edce91b 100644 --- a/webapp/src/app/modules/institution/institution.component.ts +++ b/webapp/src/app/modules/institution/institution.component.ts @@ -1,25 +1,21 @@ import { Component, computed, input } from '@angular/core'; -import { RouterLink, RouterOutlet, RouterLinkActive } from '@angular/router'; +import { RouterModule } from '@angular/router'; import { Institution } from '../../api'; import { MatCardModule } from '@angular/material/card'; import { MatTabsModule } from '@angular/material/tabs'; - -type TabLink = { - label: string; - path: string; - disabled: boolean; - queryParams?: Record; -}; +import { + LinkTabNavBarComponent, + LinkTabNavBarItem, +} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component'; +import { + PATENT_ICON, + PROJECT_ICON, + PUBLICATION_ICON, +} from '../../shared/ui/icons'; @Component({ selector: 'app-institution', - imports: [ - MatCardModule, - MatTabsModule, - RouterLink, - RouterOutlet, - RouterLinkActive, - ], + imports: [MatCardModule, MatTabsModule, RouterModule, LinkTabNavBarComponent], templateUrl: './institution.component.html', styleUrl: './institution.component.scss', }) @@ -27,14 +23,20 @@ export class InstitutionComponent { institution = input.required(); canFetchGdprRelevantData = input.required(); - _links = computed(() => { - const links: TabLink[] = [ - { label: 'Publikationen', path: 'publications', disabled: false }, + _links = computed(() => { + const links: LinkTabNavBarItem[] = [ + { + label: 'Publikationen', + icon: PUBLICATION_ICON, + path: 'publications', + disabled: false, + }, ]; if (this.canFetchGdprRelevantData()) { links.push( { label: 'Projekte', + icon: PROJECT_ICON, path: 'projects', disabled: false, queryParams: { @@ -46,7 +48,12 @@ export class InstitutionComponent { sort_direction: 'asc', }, }, - { label: 'Patente', path: 'patents', disabled: false }, + { + label: 'Patente', + icon: PATENT_ICON, + path: 'patents', + disabled: false, + }, ); } return links; diff --git a/webapp/src/app/modules/topic/topic.component.html b/webapp/src/app/modules/topic/topic.component.html index fb4bc779..d75b8c70 100644 --- a/webapp/src/app/modules/topic/topic.component.html +++ b/webapp/src/app/modules/topic/topic.component.html @@ -31,21 +31,8 @@
+ -
diff --git a/webapp/src/app/modules/topic/topic.component.ts b/webapp/src/app/modules/topic/topic.component.ts index 38c102f6..306cbcb8 100644 --- a/webapp/src/app/modules/topic/topic.component.ts +++ b/webapp/src/app/modules/topic/topic.component.ts @@ -6,6 +6,11 @@ import { MatDividerModule } from '@angular/material/divider'; import { MatIconModule } from '@angular/material/icon'; import { DecimalPipe } from '@angular/common'; import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; +import { PUBLICATION_ICON } from '../../shared/ui/icons'; +import { + LinkTabNavBarComponent, + LinkTabNavBarItem, +} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component'; @Component({ host: { @@ -18,6 +23,7 @@ import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; MatDividerModule, MatIconModule, DecimalPipe, + LinkTabNavBarComponent, ], templateUrl: './topic.component.html', styleUrl: './topic.component.scss', @@ -25,9 +31,10 @@ import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; export class TopicComponent { topic = input.required(); - links = [ + links: LinkTabNavBarItem[] = [ { label: 'Publikationen', + icon: PUBLICATION_ICON, path: 'publications', disabled: false, queryParams: {