All files / app/elements/progress-bar progress-bar.component.ts

96.36% Statements 53/55
75% Branches 3/4
75% Functions 3/4
96.36% Lines 53/55

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 561x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 35x 35x 35x 1x 1x 35x 35x 35x 35x 35x 1x 1x 1x 1x 1x  
import { NgStyle, isPlatformBrowser } from '@angular/common';
import { Component, OnInit, PLATFORM_ID, inject, input, output } from '@angular/core';
import { Router } from '@angular/router';
import { BrandService } from '@services/brand.service';
import { NetworkService } from '@services/network.service';
import Swal from 'sweetalert2';
 
@Component({
	selector: 'grt-progress-bar',
	templateUrl: './progress-bar.component.html',
	styleUrls: ['./progress-bar.component.scss'],
	standalone: true,
	imports: [NgStyle],
})
export class ProgressBarComponent implements OnInit {
	private router = inject(Router);
	private network = inject(NetworkService);
	readonly moveWizardToStep = output<any>();
	brand = inject(BrandService);
	branding = this.brand.getBrand();
 
	Toast = Swal.mixin({
		toast: true,
		position: 'top-end',
		showCloseButton: true,
		showConfirmButton: false,
		timerProgressBar: true,
		didOpen: (toast) => {
			toast.onmouseenter = Swal.stopTimer;
			toast.onmouseleave = Swal.resumeTimer;
		},
	});
 
	readonly stage = input.required<number>();
	stepCompleted: string | null = '';
	continent!: string;
	isBrowser: boolean;
	wizardData!: any;
 
	constructor() {
		const platformId = inject(PLATFORM_ID);
		this.isBrowser = isPlatformBrowser(platformId);
	}
 
	ngOnInit() {
		if (this.isBrowser) {
			this.stepCompleted = localStorage.getItem('step-completion');
		}
		this.continent = this.network.isEuropeSelectedAsB() ? 'europe' : 'asia';
	}
 
	moveToStep(stepNumber: number) {
		this.moveWizardToStep.emit(stepNumber);
	}
}