Skip to content

Commit

Permalink
GB3-1684: Add KoPla Link
Browse files Browse the repository at this point in the history
  • Loading branch information
TIL-EBP committed Dec 9, 2024
1 parent f9b3775 commit c75d20d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@
<mat-icon>launch</mat-icon>
Geodatenshop</a
>
@if (isIntranetHost) {
<a
class="navbar__item"
href="https://gdi.zh.ch/portal/home/"
mat-button
target="_blank"
rel="noopener noreferrer"
matTooltip="Kollaborationsplattform"
>
<mat-icon>launch</mat-icon>
KoPla</a
>
}
</div>
</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Subscription, tap} from 'rxjs';
import {MainPage} from 'src/app/shared/enums/main-page.enum';
import {selectIsAuthenticated, selectUserName} from 'src/app/state/auth/reducers/auth-status.reducer';
import {AuthStatusActions} from '../../../../state/auth/actions/auth-status.actions';
import {ConfigService} from '../../../services/config.service';

@Component({
selector: 'navbar-mobile-dialog',
Expand All @@ -15,6 +16,7 @@ export class NavbarMobileDialogComponent implements OnInit, OnDestroy {
protected readonly mainPageEnum = MainPage;
public isAuthenticated: boolean = false;
public userName?: string;
public isIntranetHost: boolean = false;

private readonly subscriptions = new Subscription();
private readonly userName$ = this.store.select(selectUserName);
Expand All @@ -23,7 +25,10 @@ export class NavbarMobileDialogComponent implements OnInit, OnDestroy {
constructor(
private readonly dialogRef: MatDialogRef<NavbarMobileDialogComponent>,
private readonly store: Store,
) {}
private readonly configService: ConfigService,
) {
this.isIntranetHost = this.configService.isIntranetHost();
}

public ngOnInit() {
this.initSubscriptions();
Expand Down
13 changes: 13 additions & 0 deletions src/app/shared/components/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@
<mat-icon>launch</mat-icon>
Geodatenshop
</a>
@if (isIntranetHost) {
<a
class="navbar__item"
href="https://gdi.zh.ch/portal/home/"
mat-button
target="_blank"
rel="noopener noreferrer"
matTooltip="Kollaborationsplattform"
>
<mat-icon>launch</mat-icon>
KoPla
</a>
}
<mat-divider class="navbar__divider" vertical></mat-divider>
@if (!isAuthenticated) {
<button (click)="startLogin()" class="navbar__item navbar__item--button" mat-button>
Expand Down
7 changes: 6 additions & 1 deletion src/app/shared/components/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {ScreenMode} from '../../types/screen-size.type';
import {NavbarMobileDialogComponent} from '../navbar-mobile/navbar-mobile-dialog/navbar-mobile-dialog.component';
import {PanelClass} from '../../enums/panel-class.enum';
import {MatDialog} from '@angular/material/dialog';
import {ConfigService} from '../../services/config.service';

@Component({
selector: 'navbar',
Expand All @@ -22,6 +23,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
public userName?: string;
public scrollbarWidth: number = 0;
public screenMode: ScreenMode = 'regular';
public isIntranetHost: boolean = false;

protected readonly mainPageEnum = MainPage;

Expand All @@ -34,7 +36,10 @@ export class NavbarComponent implements OnInit, OnDestroy {
constructor(
private readonly store: Store,
private readonly dialog: MatDialog,
) {}
private readonly configService: ConfigService,
) {
this.isIntranetHost = this.configService.isIntranetHost();
}

public ngOnInit() {
this.initSubscriptions();
Expand Down
4 changes: 4 additions & 0 deletions src/app/shared/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ export class ConfigService {
return this.searchIndexConfig.filter((searchIndex) => searchIndexTypes.includes(searchIndex.indexType));
}

public isIntranetHost(): boolean {
return this.document.location.host.includes('ktzh');
}

/**
* Extracts the hostname from Document.location, also removing any port mappings.
*
Expand Down

0 comments on commit c75d20d

Please sign in to comment.