Reformat code
This commit is contained in:
parent
6e27539eca
commit
420cd788c4
1 changed files with 10630 additions and 2646 deletions
40
src/app/components/pages/pages.component.ts
Normal file
40
src/app/components/pages/pages.component.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { Component, ElementRef, ViewChild } from '@angular/core';
|
||||
import { Page } from '../../model/page';
|
||||
import { DataService } from '../../services/data.service';
|
||||
import { ModalService } from '../../services/modal.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pages',
|
||||
templateUrl: './pages.component.html',
|
||||
styleUrls: ['./pages.component.scss']
|
||||
})
|
||||
export class PagesComponent {
|
||||
@ViewChild('top') top: ElementRef;
|
||||
@ViewChild('page') page: ElementRef;
|
||||
@ViewChild('bottom') bottom: ElementRef;
|
||||
|
||||
constructor(public dataService: DataService, private modalService: ModalService) {}
|
||||
|
||||
async selectPage(selected: string) {
|
||||
if (!this.dataService.pageNames.includes(selected)) {
|
||||
const page = new Page({
|
||||
name: selected,
|
||||
towers: [],
|
||||
userData: {}
|
||||
});
|
||||
|
||||
this.dataService.push(page);
|
||||
page.addTower();
|
||||
}
|
||||
|
||||
await this.dataService.changeActiveByName(selected);
|
||||
}
|
||||
|
||||
async openSettings() {
|
||||
try {
|
||||
await this.modalService.showSettings();
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue