import { NgIf } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { AddPinPopupComponent } from '../add-pin-popup/add-pin-popup.component';
import { FriendPageComponent } from "../friend-page/friend-page.component";

@Component({
  selector: 'app-navbar',
  imports: [AddPinPopupComponent, NgIf, FriendPageComponent],
  templateUrl: './navbar.component.html',
})
export class NavbarComponent implements OnInit {
  isHome: boolean = false;
  isModalOpen: boolean = false;

  constructor(private router: Router) {}

  ngOnInit(): void {
    this.isHome = this.router.url === '/';
    this.router.events.subscribe((event) => {
      if (event instanceof NavigationEnd) {
        this.isHome = event.url === '/';
      }
    });
  }
}
