add-game.component.ts code cleanup
This commit is contained in:
parent
c6302ad8c0
commit
f69f7f1731
|
@ -16,6 +16,16 @@ export class AddGameComponent implements OnInit {
|
|||
currentPage: number = 0;
|
||||
|
||||
constructor() {
|
||||
this.generateDemoData();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates demo data to test the UI
|
||||
*/
|
||||
generateDemoData() {
|
||||
this.potentialPlayers.push({
|
||||
firebonkId: 1,
|
||||
uuid: 'abc-def-ghi-j',
|
||||
|
@ -42,19 +52,32 @@ export class AddGameComponent implements OnInit {
|
|||
firstName: 'Moritz'
|
||||
});
|
||||
|
||||
this.actualPlayers.push(...this.potentialPlayers.slice(0,4));
|
||||
this.actualPlayers.push(...this.potentialPlayers.slice(0, 4));
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
/**
|
||||
* Switches the entry mask UI to the next page
|
||||
*/
|
||||
switchToNextPage(): void {
|
||||
this.currentPage++;
|
||||
}
|
||||
|
||||
/**
|
||||
* ____ __
|
||||
* / __ \/ /___ ___ _____ __________
|
||||
* / /_/ / / __ `/ / / / _ \/ ___/ ___/
|
||||
* / ____/ / /_/ / /_/ / __/ / (__ )
|
||||
* /_/ /_/\__,_/\__, /\___/_/ /____/
|
||||
* /____/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Toggles if the given player is should be an active player for the current game
|
||||
* @param player The player to toggle the activity for
|
||||
*/
|
||||
togglePlayer(player: Player): void {
|
||||
let index = this.actualPlayers.indexOf(player);
|
||||
if(index !== -1){
|
||||
if (index !== -1) {
|
||||
this.actualPlayers.splice(index, 1);
|
||||
} else {
|
||||
this.actualPlayers.push(player);
|
||||
|
@ -78,11 +101,12 @@ export class AddGameComponent implements OnInit {
|
|||
}
|
||||
|
||||
/**
|
||||
* Switches the entry mask UI to the next page
|
||||
* ___ __
|
||||
* / | ____ ____ ____ __ ______ ________ ____ ___ ___ ____ / /______
|
||||
* / /| | / __ \/ __ \/ __ \/ / / / __ \/ ___/ _ \/ __ `__ \/ _ \/ __ \/ __/ ___/
|
||||
* / ___ |/ / / / / / / /_/ / /_/ / / / / /__/ __/ / / / / / __/ / / / /_(__ )
|
||||
* /_/ |_/_/ /_/_/ /_/\____/\__,_/_/ /_/\___/\___/_/ /_/ /_/\___/_/ /_/\__/____/
|
||||
*/
|
||||
switchToNextPage(): void {
|
||||
this.currentPage++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the activity status for the given announcement
|
||||
|
@ -90,7 +114,7 @@ export class AddGameComponent implements OnInit {
|
|||
*/
|
||||
toggleAnnouncement(announcement: Announcement.Announcement): void {
|
||||
let index = this.selectedAnnouncements.indexOf(announcement);
|
||||
if(index !== -1){
|
||||
if (index !== -1) {
|
||||
this.selectedAnnouncements.splice(index, 1);
|
||||
} else {
|
||||
this.selectedAnnouncements.push(announcement);
|
||||
|
|
Loading…
Reference in New Issue
Block a user