You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.4 KiB
82 lines
2.4 KiB
import { Component, Input, OnInit } from '@angular/core';
|
|
import { CommonModule } from '@angular/common';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { MatDividerModule } from '@angular/material/divider';
|
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
|
|
import { RaceDetailsComponent } from '../../components/race-details/race-details.component';
|
|
import { SeasonStandingsComponent } from '../../components/season-standings/season-standings.component';
|
|
import { UploadReplayDialogComponent } from '../../components/upload-replay-dialog/upload-replay-dialog.component';
|
|
|
|
import { SeasonsService } from '../../services/seasons.service';
|
|
import { RacesService } from '../../services/races.service';
|
|
import { AuthService } from '../../services/auth.service';
|
|
import { Season } from '../../models/season.model';
|
|
import { Race } from '../../models/race.model';
|
|
import { NewRaceDialogComponent } from '../../components/new-race-dialog/new-race-dialog.component';
|
|
|
|
@Component({
|
|
selector: 'app-season-details',
|
|
standalone: true,
|
|
imports: [
|
|
CommonModule,
|
|
MatButtonModule,
|
|
MatDividerModule,
|
|
MatTabsModule,
|
|
RaceDetailsComponent,
|
|
SeasonStandingsComponent,
|
|
UploadReplayDialogComponent
|
|
],
|
|
templateUrl: './season-details.component.html',
|
|
styleUrl: './season-details.component.scss'
|
|
})
|
|
export class SeasonDetailsComponent {
|
|
season?: Season;
|
|
races: Race[] = [];
|
|
|
|
seasonId: string = "";
|
|
|
|
constructor(
|
|
private route: ActivatedRoute,
|
|
private seasonsService: SeasonsService,
|
|
private racesService: RacesService,
|
|
private dialog: MatDialog,
|
|
private authService: AuthService,
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
this.seasonId = String(this.route.snapshot.paramMap.get('id'));
|
|
this.seasonsService.getSeason(this.seasonId).subscribe( data => {
|
|
this.season = data;
|
|
console.log(data);
|
|
if (this.season) {
|
|
this.races = this.season?.races;
|
|
}
|
|
});
|
|
}
|
|
|
|
isAuthed() {
|
|
return this.authService.isAuthenticated();
|
|
}
|
|
|
|
openUploadReplayDialog(id: string) {
|
|
this.dialog.open(UploadReplayDialogComponent,
|
|
{
|
|
data: { seasonId: id }
|
|
});
|
|
}
|
|
|
|
openNewRaceDialog(id: string) {
|
|
this.dialog.open(NewRaceDialogComponent,
|
|
{
|
|
data: { seasonId: id }
|
|
});
|
|
}
|
|
|
|
forceUpdate(id: string) {
|
|
this.seasonsService.updateSeason(this.seasonId);
|
|
}
|
|
}
|
|
|