feat(person): moved link tab nav bar to dedicated component
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -132,20 +132,12 @@
|
||||
[loading]="isTopicsLoading()"
|
||||
(tagClick)="onInterestingTagClick($event)"></app-person-interesting>
|
||||
</section>
|
||||
<nav class="person-tabs sg-tab-nav" mat-tab-nav-bar [tabPanel]="tabPanel">
|
||||
@for (link of links(); track link.path) {
|
||||
<a
|
||||
mat-tab-link
|
||||
[routerLink]="link.path"
|
||||
[queryParams]="link.queryParams"
|
||||
routerLinkActive
|
||||
#rla="routerLinkActive"
|
||||
[active]="rla.isActive"
|
||||
[disabled]="link.disabled">
|
||||
{{ link.label }}
|
||||
</a>
|
||||
}
|
||||
</nav>
|
||||
@if (this.links()) {
|
||||
<app-link-tab-nav-bar
|
||||
#navBar
|
||||
[links]="links()"
|
||||
[tabPanel]="tabPanel"></app-link-tab-nav-bar>
|
||||
}
|
||||
} @else {
|
||||
<app-loading
|
||||
text="Person wird geladen..."
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
signal,
|
||||
DestroyRef,
|
||||
input,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
toSignal,
|
||||
@@ -33,14 +34,20 @@ import { PersonDataResolved } from '../../resolvers/person.resolver';
|
||||
import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||
import { collaborationGraphQueryParamKeys } from '../../resolvers/collaboration-graph.resolver';
|
||||
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
||||
|
||||
type PersonLink = {
|
||||
label: string;
|
||||
description?: string;
|
||||
path: string;
|
||||
queryParams?: Record<string, any>;
|
||||
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<boolean>();
|
||||
|
||||
protected readonly navBar = viewChild<LinkTabNavBarComponent>('navBar');
|
||||
protected readonly activeLink = computed(
|
||||
() => this.navBar()?.activeLink() ?? null,
|
||||
);
|
||||
|
||||
constructor() {
|
||||
this.bookmarkService
|
||||
.load()
|
||||
@@ -236,11 +249,12 @@ export class PersonComponent {
|
||||
{ initialValue: [] },
|
||||
);
|
||||
|
||||
readonly links = computed<PersonLink[]>(() => {
|
||||
readonly links = computed<LinkTabNavBarItem[]>(() => {
|
||||
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<PersonLink | null>(() => {
|
||||
const currentUrl = this.currentUrl();
|
||||
if (!currentUrl) {
|
||||
return null;
|
||||
}
|
||||
// readonly activeLink = computed<LinkTabNavBarItem | null>(() => {
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user