mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-15 08:15:37 +00:00
Various styling and small QoL improvements
This commit is contained in:
@@ -3,6 +3,9 @@ import {LibraryService} from "../../services/library.service";
|
||||
import {MatSnackBar} from '@angular/material/snack-bar';
|
||||
import {timeInterval} from "rxjs";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {GamesService} from "../../services/games.service";
|
||||
import {LibraryManagementComponent} from "../library-management/library-management.component";
|
||||
import {LibraryOverviewComponent} from "../library-overview/library-overview.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@@ -12,16 +15,21 @@ import {ActivatedRoute, Router} from "@angular/router";
|
||||
export class HeaderComponent {
|
||||
|
||||
constructor(private libraryService: LibraryService,
|
||||
private gameService: GamesService,
|
||||
private snackBar: MatSnackBar,
|
||||
private router: Router) {
|
||||
}
|
||||
|
||||
reloadLibrary(): void {
|
||||
scanLibrary(): void {
|
||||
this.libraryService.scanLibrary().pipe(timeInterval()).subscribe({
|
||||
next: value => this.snackBar.open(`Library scan completed in ${Math.trunc(value.interval / 1000)} seconds.`, undefined, {duration: 2000}),
|
||||
error: error => this.snackBar.open(`Error while scanning library: ${error.error.message}`, undefined, {duration: 5000})
|
||||
})
|
||||
this.snackBar.open('Library scan started in the background. This could take some time.', undefined, {duration: 5000})
|
||||
this.snackBar.open('Library scan started in the background. This could take some time.\nYou will get another notification once it\'s done', undefined, {duration: 5000})
|
||||
}
|
||||
|
||||
reloadLibrary(): void {
|
||||
this.gameService.getAllGames(true).subscribe(() => this.router.navigate(['/library']));
|
||||
}
|
||||
|
||||
goToLibraryScreen(): void {
|
||||
@@ -32,8 +40,8 @@ export class HeaderComponent {
|
||||
this.router.navigate(['/library-management']);
|
||||
}
|
||||
|
||||
notOnLibraryScreen(): boolean {
|
||||
return !(this.router.url === "/library");
|
||||
onLibraryScreen(): boolean {
|
||||
return this.router.url === "/library";
|
||||
}
|
||||
|
||||
onLibraryManagementScreen(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user