WIP: Proceed with frontend implementation

This commit is contained in:
Simon Grimme
2022-07-21 21:17:04 +02:00
parent cc1e02a1ca
commit 38028b7e49
17 changed files with 124 additions and 19 deletions
@@ -0,0 +1,12 @@
.fullscreen-overlay {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: rgba(0, 0, 0, 0.15);
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
}
@@ -0,0 +1,14 @@
<div fxFlexFill>
<div class="fullscreen-overlay" *ngIf="this.loading" fxLayout="column" fxLayoutAlign="center center">
<mat-spinner></mat-spinner>
<h2>Loading library...</h2>
</div>
<div fxLayout="row" fxLayoutAlign="center center">
<div *ngIf="!this.loading && this.detectedGames.length === 0">
<h2>Your game library is empty!</h2>
</div>
<div fxLayout="row" fxLayoutGap="12px" [style.margin-top.px]="12" *ngIf="!this.loading && this.detectedGames.length > 0">
<game-cover fxLayout="column" *ngFor="let game of detectedGames" [game]="game"></game-cover>
</div>
</div>
</div>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LibraryOverviewComponent } from './library-overview.component';
describe('LibraryOverviewComponent', () => {
let component: LibraryOverviewComponent;
let fixture: ComponentFixture<LibraryOverviewComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LibraryOverviewComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(LibraryOverviewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,27 @@
import {AfterViewInit, Component} from '@angular/core';
import {GamesService} from "../../services/games.service";
import {DetectedGameDto} from "../../models/dtos/DetectedGameDto";
@Component({
selector: 'app-gameserver-list',
templateUrl: './library-overview.component.html',
styleUrls: ['./library-overview.component.css']
})
export class LibraryOverviewComponent implements AfterViewInit {
detectedGames: DetectedGameDto[] = [];
loading: boolean = true;
constructor(private gameServerService: GamesService) {
}
ngAfterViewInit(): void {
this.gameServerService.getAllGames().subscribe(
(detectedGames: DetectedGameDto[]) => {
this.detectedGames = detectedGames;
this.loading = false;
}
);
}
}