diff --git a/workspace/apps/pidp/src/app/shared/components/success-dialog/classes/success-dialog-component.class.ts b/workspace/apps/pidp/src/app/shared/components/success-dialog/classes/success-dialog-component.class.ts new file mode 100644 index 000000000..7a21fb39b --- /dev/null +++ b/workspace/apps/pidp/src/app/shared/components/success-dialog/classes/success-dialog-component.class.ts @@ -0,0 +1,8 @@ +import { DialogBcproviderCreateComponent } from '../components/dialog-bcprovider-create.component'; +import { DialogBcproviderEditComponent } from '../components/dialog-bcprovider-edit.component'; +import { FeedbackSendComponent } from '../components/feedback-send.component'; + +export type SuccessDialogComponentClass = + | DialogBcproviderCreateComponent + | DialogBcproviderEditComponent + | FeedbackSendComponent; diff --git a/workspace/apps/pidp/src/app/shared/components/success-dialog/success-dialog.component.spec.ts b/workspace/apps/pidp/src/app/shared/components/success-dialog/success-dialog.component.spec.ts index fe01e366d..a8bd28682 100644 --- a/workspace/apps/pidp/src/app/shared/components/success-dialog/success-dialog.component.spec.ts +++ b/workspace/apps/pidp/src/app/shared/components/success-dialog/success-dialog.component.spec.ts @@ -1,7 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; -import { NavigationService } from '@pidp/presentation'; import { provideAutoSpy } from 'jest-auto-spies'; import { SuccessDialogComponent } from './success-dialog.component'; @@ -12,11 +11,7 @@ describe('SuccessDialogComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [MatDialogModule], - providers: [ - SuccessDialogComponent, - provideAutoSpy(NavigationService), - provideAutoSpy(MatDialog), - ], + providers: [SuccessDialogComponent, provideAutoSpy(MatDialog)], }).compileComponents(); component = TestBed.inject(SuccessDialogComponent); diff --git a/workspace/apps/pidp/src/app/shared/components/success-dialog/success-dialog.component.ts b/workspace/apps/pidp/src/app/shared/components/success-dialog/success-dialog.component.ts index dcb78d7ad..60f4db86f 100644 --- a/workspace/apps/pidp/src/app/shared/components/success-dialog/success-dialog.component.ts +++ b/workspace/apps/pidp/src/app/shared/components/success-dialog/success-dialog.component.ts @@ -1,3 +1,4 @@ +import { NgClass, NgIf } from '@angular/common'; import { Component, Input, @@ -7,17 +8,15 @@ import { ViewContainerRef, } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { NgClass, NgIf } from '@angular/common'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; import { faCircleCheck, faXmark } from '@fortawesome/free-solid-svg-icons'; -import { NavigationService } from '@pidp/presentation'; import { InjectViewportCssClassDirective } from '@bcgov/shared/ui'; +import { SuccessDialogComponentClass } from './classes/success-dialog-component.class'; import { DialogBcproviderCreateComponent } from './components/dialog-bcprovider-create.component'; import { DialogBcproviderEditComponent } from './components/dialog-bcprovider-edit.component'; -import { FeedbackSendComponent } from './components/feedback-send.component'; @Component({ selector: 'app-success-dialog', @@ -33,17 +32,12 @@ export class SuccessDialogComponent implements OnInit { @Input() public username!: string; @Input() public title!: string; - @Input() public componentType!: Type< - DialogBcproviderCreateComponent | DialogBcproviderEditComponent | FeedbackSendComponent - >; + @Input() public componentType!: Type; @ViewChild('dialogParagraphHost', { static: true, read: ViewContainerRef }) public dialogParagraphHost!: ViewContainerRef; - public constructor( - public dialog: MatDialog, - private navigationService: NavigationService, - ) {} + public constructor(public dialog: MatDialog) {} public onSuccessDialogClose(): void { this.dialog.closeAll(); @@ -51,19 +45,21 @@ export class SuccessDialogComponent implements OnInit { public ngOnInit(): void { this.loadDialogParagraphComponent(this.componentType); - if(this.componentType instanceof DialogBcproviderCreateComponent || this.componentType instanceof DialogBcproviderEditComponent) { + if ( + this.componentType instanceof DialogBcproviderCreateComponent || + this.componentType instanceof DialogBcproviderEditComponent + ) { this.showHeader = true; } } private loadDialogParagraphComponent( - componentType: Type< - DialogBcproviderCreateComponent | DialogBcproviderEditComponent | FeedbackSendComponent - >, + componentType: Type, ): void { - const componentRef = this.dialogParagraphHost.createComponent< - DialogBcproviderCreateComponent | DialogBcproviderEditComponent | FeedbackSendComponent - >(componentType); + const componentRef = + this.dialogParagraphHost.createComponent( + componentType, + ); componentRef.instance.username = this.username; } }