95 lines
3.4 KiB
TypeScript
95 lines
3.4 KiB
TypeScript
import { DatePipe } from '@angular/common';
|
|
import { Title } from '@angular/platform-browser';
|
|
import { trigger, state, style, animate, transition } from '@angular/animations';
|
|
import { Component, DestroyRef, Injectable, inject, OnInit } from '@angular/core';
|
|
import { FormsModule } from '@angular/forms';
|
|
import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper';
|
|
import { MatCardModule } from '@angular/material/card';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { MatDividerModule } from '@angular/material/divider';
|
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
import { MatIconModule } from '@angular/material/icon';
|
|
import { MatInputModule } from '@angular/material/input';
|
|
import { MatStepperIntl, MatStepperModule } from '@angular/material/stepper';
|
|
|
|
import { ListErrorsComponent } from '@components/shared';
|
|
import { Errors } from '@models';
|
|
import { HWGuildRaid, HWGuildRaidAttacker, HWGuildRaidAttackers, HWGuildRaidStage, HWMember } from '@models/herowars';
|
|
|
|
import guildRaids from 'src/files-data/hw-guild-raids.json'; // page Asgard -> Guild Raid -> Log
|
|
|
|
@Injectable()
|
|
export class GuildRaidStepperIntl extends MatStepperIntl {
|
|
// the default optional label text, if unspecified is "Optional"
|
|
override optionalLabel = 'Optional Label';
|
|
}
|
|
@Component({
|
|
selector: 'app-herowars-guildraid',
|
|
standalone: true,
|
|
providers: [
|
|
{
|
|
provide: STEPPER_GLOBAL_OPTIONS,
|
|
useValue: { displayDefaultIndicatorType: false },
|
|
},
|
|
],
|
|
imports: [
|
|
DatePipe, FormsModule, ListErrorsComponent,
|
|
MatButtonModule, MatCardModule, MatDividerModule, MatFormFieldModule,
|
|
MatIconModule, MatInputModule, MatStepperModule
|
|
],
|
|
templateUrl: './herowars-guildraid.component.html',
|
|
styleUrl: './herowars-guildraid.component.scss',
|
|
animations: [
|
|
trigger('flyInOut', [
|
|
state('in', style({ transform: 'translateY(0)' })),
|
|
transition('void => *', [
|
|
style({ transform: 'translateY(-100%)' }),
|
|
animate(200)
|
|
]),
|
|
transition('* => void', [
|
|
style({ transform: 'translateY(100%)' }),
|
|
animate(200)
|
|
])
|
|
])
|
|
]
|
|
})
|
|
export class HerowarsGuildraidComponent implements OnInit {
|
|
public title = 'Guild Raids';
|
|
public subtitle = 'Log';
|
|
public description = 'Tools in working progress.';
|
|
public errors: Errors = { errors: {} };
|
|
public destroyRef = inject(DestroyRef);
|
|
public minVarPct = 3;
|
|
public minValue = 0;
|
|
public now = new Date();
|
|
private _guildMembers: HWMember[] = [];
|
|
private _matStepperIntl = inject(MatStepperIntl);
|
|
private _guildRaids: HWGuildRaid[] = [];
|
|
private _raidStages: HWGuildRaidStage[] = [
|
|
{ num: 1, name: 'Stage 1', maxPower: 320000, duration: 8, startTime: 0, endTime: 0 },
|
|
{ num: 2, name: 'Stage 2', maxPower: 500000, duration: 8, startTime: 0, endTime: 0 },
|
|
{ num: 3, name: 'Stage 3', maxPower: 0, duration: 0, startTime: 0, endTime: 0 }
|
|
];
|
|
|
|
constructor(
|
|
private _titleService: Title
|
|
) { }
|
|
|
|
ngOnInit() {
|
|
this._titleService.setTitle(this.title);
|
|
this._guildMembers.map((data) => {
|
|
data.raids = [];
|
|
data.raidsInfo = {
|
|
variationAvg: 0,
|
|
variationSum: 0
|
|
};
|
|
return data;
|
|
});
|
|
}
|
|
|
|
getMembers(): HWMember[] {
|
|
return this._guildMembers;
|
|
}
|
|
|
|
}
|