WIP: Implement frontend

Implemented 1st version of game-detail-view
This commit is contained in:
grimsi
2022-07-24 14:53:24 +02:00
parent e11611bbe6
commit eab1cf629c
21 changed files with 1364 additions and 1162 deletions
@@ -1,29 +1,34 @@
import {Component, OnInit} from '@angular/core';
import {NavMenuItem} from '../../models/objects/NavMenuItem';
import {Component} from '@angular/core';
import {LibraryService} from "../../services/library.service";
import {MatSnackBar} from '@angular/material/snack-bar';
import {timeInterval} from "rxjs";
import {ActivatedRoute, Router} from "@angular/router";
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {
activeItem: NavMenuItem | undefined;
export class HeaderComponent {
constructor(private libraryService: LibraryService,
private snackBar: MatSnackBar) {
private snackBar: MatSnackBar,
private router: Router) {
}
ngOnInit() {
}
reloadLibrary() {
reloadLibrary(): void {
this.libraryService.scanLibrary().pipe(timeInterval()).subscribe({
next: value => this.snackBar.open(`Library scan completed in ${Math.trunc(value.interval/1000)} seconds.`),
next: value => this.snackBar.open(`Library scan completed in ${Math.trunc(value.interval / 1000)} seconds.`),
error: error => this.snackBar.open(`Error while scanning library: ${error}`)
})
}
goToLibraryScreen(): void {
this.router.navigate(['/']);
}
notOnLibraryScreen(): boolean {
return !(this.router.url === "/library");
}
}