import {Component, OnInit} from '@angular/core';
import { CommonModule, DatePipe, ViewportScroller } from '@angular/common';
import { RouterOutlet, NavigationEnd, Router, RouterLink, RouterLinkActive  } from '@angular/router';
import { RequestComponent } from './request/request.component';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule, RouterOutlet, RouterLink, RouterLinkActive, DatePipe, RequestComponent],
  templateUrl: './app.component.html',
  styleUrl: './app.component.scss'
})
export class AppComponent implements OnInit{

  title = 'NIR';
  dateNow?: Date;
  navShow = false;

  ngOnInit(){
    this.dateNow = new Date;
  }

  constructor(
    readonly router: Router,
    readonly viewportScroller: ViewportScroller,
  ) {

    router.events.subscribe((event) => {
        if (event instanceof NavigationEnd) this.viewportScroller.scrollToPosition([0, 0]);
      });

  }
}
