All files / app app.component.ts

68.75% Statements 11/16
0% Branches 0/1
50% Functions 3/6
71.42% Lines 10/14

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                    1x 3x 3x 3x   3x                             3x   3x   3x         3x       3x                                  
import {Component, HostListener} from '@angular/core';
import {MatDialog} from "@angular/material/dialog";
import {Router} from "@angular/router";
import {SocialComponent} from "./modals/social/social.component";
 
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  opened_start: boolean = false;
  opened_end: boolean = false;
  screenWidth : number = 1024;
 
  navLinks: {
    label: string;
    link: string;
    index: number;
  }[] = [
    {
      label: 'Home',
      link: '/home',
      index: 0
    }, {
      label: 'My Reservation',
      link: '/room',
      index: 1
    }
  ];
  activeLinkIndex = -1;
 
  constructor(private router: Router, public dialog: MatDialog) {
    // this.navLinks =
    this.getScreenSize();
 
  }
  @HostListener('window:resize', ['$event'])
  getScreenSize() {
    this.screenWidth = window.innerWidth;
  }
 
  ngOnInit(): void {
    this.router.events.subscribe(() => {
      const navLinkEntry = this.navLinks.find(tab => tab.link === '.' + this.router.url)
      Iif (navLinkEntry !== undefined) {
        this.activeLinkIndex = this.navLinks.indexOf(navLinkEntry);
      }
      // else{
      //   this.activeLinkIndex = 3;
      // }
    });
  }
 
  openNotifications(): void {
    const dialogRef = this.dialog.open(SocialComponent, {
      // data: {name: this.name, animal: this.animal},
    });
  }
}