Skip to content

Commit 2a0baa0

Browse files
chahat99Chahat Jain
andauthored
Privacy Policy opening in new tab (#1769)
* feat(navigation): privacy policy in new tab * feat(navigation): privacy policy in new tab * fix: line removed Co-authored-by: Chahat Jain <[email protected]>
1 parent c31de98 commit 2a0baa0

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

projects/components/src/navigation/navigation-list.component.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { ActivatedRoute } from '@angular/router';
22
import { IconType } from '@hypertrace/assets-library';
3-
import { FeatureState, FeatureStateResolver, MemoizeModule, NavigationService } from '@hypertrace/common';
3+
import {
4+
ExternalNavigationWindowHandling,
5+
FeatureState,
6+
FeatureStateResolver,
7+
MemoizeModule,
8+
NavigationParamsType,
9+
NavigationService
10+
} from '@hypertrace/common';
411
import { createHostFactory, mockProvider, SpectatorHost } from '@ngneat/spectator/jest';
512
import { MockComponent } from 'ng-mocks';
613
import { EMPTY, of } from 'rxjs';
@@ -78,6 +85,11 @@ describe('Navigation List Component', () => {
7885
);
7986
const footerItemsCount = spectator.component.footerItems?.length;
8087
expect(spectator.queryAll('.footer-item').length).toBe(footerItemsCount);
88+
expect(spectator.query(LinkComponent)?.paramsOrUrl).toMatchObject({
89+
navType: NavigationParamsType.External,
90+
url: 'http://test',
91+
windowHandling: ExternalNavigationWindowHandling.NewWindow
92+
});
8193
});
8294

8395
test('should update layout when collapsed input is updated', () => {

projects/components/src/navigation/navigation-list.component.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
22
import { ActivatedRoute } from '@angular/router';
33
import { IconType } from '@hypertrace/assets-library';
4-
import { NavigationService, TypedSimpleChanges } from '@hypertrace/common';
4+
import {
5+
ExternalNavigationParams,
6+
ExternalNavigationWindowHandling,
7+
NavigationParamsType,
8+
NavigationService,
9+
TypedSimpleChanges
10+
} from '@hypertrace/common';
511
import { Observable } from 'rxjs';
612
import { map, startWith } from 'rxjs/operators';
713
import { IconSize } from '../icon/icon-size';
@@ -70,7 +76,7 @@ import {
7076
7177
<hr class="nav-divider" />
7278
<div *ngFor="let footerItem of footerItems" class="footer-item">
73-
<ht-link class="link" [paramsOrUrl]="footerItem.url">
79+
<ht-link class="link" [paramsOrUrl]="this.getFooterItemNavigationParams | htMemoize: footerItem.url">
7480
<ht-icon *ngIf="this.collapsed" [icon]="footerItem.icon" size="${IconSize.Small}"></ht-icon>
7581
<ht-label *ngIf="!this.collapsed" [label]="footerItem.label"></ht-label>
7682
</ht-link>
@@ -112,6 +118,14 @@ export class NavigationListComponent implements OnChanges {
112118
private readonly navListComponentService: NavigationListComponentService
113119
) {}
114120

121+
public getFooterItemNavigationParams(url: string): ExternalNavigationParams {
122+
return {
123+
navType: NavigationParamsType.External,
124+
url: url,
125+
windowHandling: ExternalNavigationWindowHandling.NewWindow
126+
};
127+
}
128+
115129
public ngOnChanges(changes: TypedSimpleChanges<this>): void {
116130
if (changes.navItems) {
117131
this.navItems = this.navListComponentService.resolveFeaturesAndUpdateVisibilityForNavItems(this.navItems);

0 commit comments

Comments
 (0)