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

96% Statements 48/50
75% Branches 3/4
75% Functions 3/4
96% Lines 48/50

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 511x 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 39x 39x 39x 1x 1x 39x 39x 39x 39x 39x 1x 1x 1x 1x 1x  
import { isPlatformBrowser } from '@angular/common';
import { Component, OnInit, PLATFORM_ID, inject, input, output } from '@angular/core';
import { Router } from '@angular/router';
import { NetworkService } from '@services/network.service';
import Swal from 'sweetalert2';
 
@Component({
	selector: 'grt-progress-bar-mobile',
	templateUrl: './progress-bar-mobile.component.html',
	styleUrls: ['./progress-bar-mobile.component.scss'],
})
export class ProgressBarMobileComponent implements OnInit {
	private router = inject(Router);
	private network = inject(NetworkService);
	readonly moveWizardToStep = output<any>();
 
	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);
	}
}