All files / app/pages/career-page career-page.component.ts

87.62% Statements 85/97
100% Branches 5/5
80% Functions 4/5
87.62% Lines 85/97

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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 981x 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x         1x 1x 2x 2x 2x 2x 2x 2x 1x 1x 2x 2x                 2x 2x 2x 1x 1x 2x 2x 1x  
import { isPlatformBrowser, NgClass } from '@angular/common';
import { Component, HostListener, inject, NgZone, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
import { Meta, Title } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { jobCategories } from '@constants/category.constants';
import { FooterElementComponent } from '@elements/footer-element/footer-element.component';
import { HeaderElementComponent } from '@elements/header-element/header-element.component';
import { environment } from '@environments/environment';
import { MetaTagService } from '@services/meta-tag.service';
import { NetworkService } from '@services/network.service';
 
@Component({
	selector: 'grt-career-page',
	templateUrl: './career-page.component.html',
	styleUrl: './career-page.component.scss',
	standalone: true,
	imports: [HeaderElementComponent, FooterElementComponent, NgClass],
})
export class CareerPageComponent implements OnInit, OnDestroy {
	private metaTag = inject(MetaTagService);
	private ngZone = inject(NgZone);
	private meta = inject(Meta);
	private titleService = inject(Title);
	private platformId = inject(PLATFORM_ID);
	network = inject(NetworkService);
	router = inject(Router);
	isBrowser: boolean = false;
	fadeIn = true;
	isMobile = false;
	jobCategories = jobCategories;
 
	careerImages = [
		{
			'mob-img': '/assets/images/career-mob-0.png',
			img: '/assets/images/career-0.png',
			title: 'Empower Discovery. Change How the World Travels.',
		},
		{
			'mob-img': '/assets/images/career-mob-1.png',
			img: '/assets/images/career-1.png',
			title: 'Turn Travel Dreams Into Lifelong Memories.',
		},
		{
			'mob-img': '/assets/images/career-mob-2.png',
			img: '/assets/images/career-2.png',
			title: 'Escape the Ordinary — and Help Others Do the Same.',
		},
	];
	currentImageIndex = 0;
	currentImage = this.careerImages[this.currentImageIndex];
	imageLoopInterval: any;
	constructor() {
		this.isBrowser = isPlatformBrowser(this.platformId);
		this.metaTag.removeMetaTags();
		this.meta.addTags(
			this.metaTag.getMetaTags(
				'Careers at Go Real Travel | Join Our Adventure-Driven Team',
				'Turn your passion for travel into a career! Join Go Real Travel and help create authentic experiences for travelers worldwide. Flexible, fun, and meaningful work.',
				environment.frontendUrl + '/assets/images/career-0.png',
			),
		);
	}
 
	@HostListener('window:resize', ['$event'])
	onResize(): void {
		if (this.isBrowser) {
			this.isMobile = window.innerWidth < 768;
		}
	}
 
	ngOnInit(): void {
		if (this.isBrowser) {
			this.isMobile = window.innerWidth < 768;
		}
		this.titleService.setTitle('Careers at Go Real Travel | Join Our Adventure-Driven Team');
		this.startImageLoop();
	}
 
	startImageLoop() {
		this.ngZone.runOutsideAngular(() => {
			this.imageLoopInterval = setInterval(() => {
				this.ngZone.run(() => {
					this.fadeIn = false;
					setTimeout(() => {
						this.currentImageIndex = (this.currentImageIndex + 1) % this.careerImages.length;
						this.currentImage = this.careerImages[this.currentImageIndex];
						this.fadeIn = true;
					}, 400);
				});
			}, 5000);
		});
	}
 
	ngOnDestroy() {
		clearInterval(this.imageLoopInterval);
	}
}