Skip to content

Commit

Permalink
Merge pull request #1032 from bcgov/feature/ALCS-1046-2
Browse files Browse the repository at this point in the history
Add business name to inbox
  • Loading branch information
dhaselhan authored Oct 4, 2023
2 parents 17d5170 + 126f0ac commit 6a1d96d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
3 changes: 3 additions & 0 deletions portal-frontend/src/app/features/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<div>
<div class="header-row">
<div *ngIf="profile && (profile.government || profile.businessName)">
<h6>{{ profile.government || profile.businessName }}</h6>
</div>
<diV class="title">
<h3>Portal Inbox</h3>
<div>
Expand Down
9 changes: 8 additions & 1 deletion portal-frontend/src/app/features/home/home.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogModule } from '@angular/material/dialog';
import { RouterTestingModule } from '@angular/router/testing';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { BehaviorSubject } from 'rxjs';
import { ApplicationSubmissionService } from '../../services/application-submission/application-submission.service';
import { UserDto } from '../../services/authentication/authentication.dto';
import { AuthenticationService } from '../../services/authentication/authentication.service';

import { HomeComponent } from './home.component';

describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
let mockAuthService: DeepMocked<AuthenticationService>;

beforeEach(async () => {
mockAuthService = createMock();
mockAuthService.$currentProfile = new BehaviorSubject<UserDto | undefined>(undefined);

await TestBed.configureTestingModule({
imports: [RouterTestingModule, MatDialogModule],
declarations: [HomeComponent],
providers: [
{
provide: AuthenticationService,
useValue: {},
useValue: mockAuthService,
},
{
provide: ApplicationSubmissionService,
Expand Down
28 changes: 15 additions & 13 deletions portal-frontend/src/app/features/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Subject, takeUntil } from 'rxjs';
import { UserDto } from '../../services/authentication/authentication.dto';
import { AuthenticationService } from '../../services/authentication/authentication.service';
import { OverlaySpinnerService } from '../../shared/overlay-spinner/overlay-spinner.service';
import { CreateSubmissionDialogComponent } from '../create-submission-dialog/create-submission-dialog.component';

@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
export class HomeComponent implements OnInit {
public name = '';
export class HomeComponent implements OnInit, OnDestroy {
$destroy = new Subject<void>();
public isLearnMoreOpen = false;
profile: UserDto | undefined;

constructor(
private authenticationService: AuthenticationService,
private dialog: MatDialog,
private spinnerService: OverlaySpinnerService
) {}
constructor(private authenticationService: AuthenticationService, private dialog: MatDialog) {}

ngOnInit(): void {
const user = this.authenticationService.currentUser;
if (user) {
this.name = user.name;
}
this.authenticationService.$currentProfile.pipe(takeUntil(this.$destroy)).subscribe((profile) => {
this.profile = profile;
});
}

ngOnDestroy(): void {
this.$destroy.next();
this.$destroy.complete();
}

async onCreateApplication() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h5 class="center">
</button>
<mat-menu class="user-menu" #userMenu="matMenu">
<div class="item">User ID: {{ user?.bceidUserName }}</div>
<div class="item">Business: {{ user?.businessName }}</div>
<div class="item">Business: {{ user?.government || user?.businessName }}</div>
<div class="item">Type: {{ user?.businessName ? 'BCeID Business' : 'BCeID Basic' }}</div>
</mat-menu>
<button class="inbox-btn" routerLink="/home" mat-flat-button color="primary">Portal Inbox</button>
Expand Down

0 comments on commit 6a1d96d

Please sign in to comment.