Files
front/src/app/app.ts
T

31 lines
958 B
TypeScript

import { Component, computed, inject } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { NavigationEnd, Router, RouterOutlet } from '@angular/router';
import { filter, map, startWith } from 'rxjs';
import { AuthSheet } from './auth/ui/auth-sheet/auth-sheet';
import { BottomNav } from './layout/bottom-nav/bottom-nav';
@Component({
selector: 'app-root',
imports: [RouterOutlet, BottomNav, AuthSheet],
templateUrl: './app.html',
styleUrl: './app.scss',
})
export class App {
private readonly router = inject(Router);
private readonly url = toSignal(
this.router.events.pipe(
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
map(() => this.router.url),
startWith(this.router.url),
),
{ initialValue: this.router.url },
);
protected readonly hideNav = computed(
() => this.url().startsWith('/items') || this.url().startsWith('/objects'),
);
}