- ng update @angular/core@21 @angular/cli@21 (corrige GHSA-jrmj-c5cx-3cw6, XSS SVG) - Migration automatique des templates vers le control flow natif (@if/@for, 138 fichiers) - Correction des 5 `track` invalides generes par la migration (trackBy a 1 argument -> track $index) + suppression des fonctions trackBy mortes - TypeScript 5.9, zone.js 0.15 ; npm audit : 0 vulnerabilite Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
77 lines
3.0 KiB
TypeScript
77 lines
3.0 KiB
TypeScript
import { Component, OnInit, OnDestroy } from '@angular/core';
|
|
|
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
import { forkJoin } from 'rxjs';
|
|
import { LucideAngularModule, ArrowLeft } from 'lucide-angular';
|
|
import { CampaignService } from '../../../services/campaign.service';
|
|
import { CharacterService } from '../../../services/character.service';
|
|
import { NpcService } from '../../../services/npc.service';
|
|
import { RandomTableService } from '../../../services/random-table.service';
|
|
import { PlaythroughService } from '../../../services/playthrough.service';
|
|
import { LayoutService } from '../../../services/layout.service';
|
|
import { PageTitleService } from '../../../services/page-title.service';
|
|
import { Playthrough } from '../../../services/campaign.model';
|
|
import { loadCampaignTreeData, buildCampaignSidebarConfig } from '../../campaign-tree.helper';
|
|
import { PlaythroughFlagsManagerComponent } from '../../../shared/playthrough-flags-manager/playthrough-flags-manager.component';
|
|
|
|
/**
|
|
* Page dédiée aux "Faits" d'une Partie.
|
|
* Route : /campaigns/:campaignId/playthroughs/:playthroughId/flags
|
|
*/
|
|
@Component({
|
|
selector: 'app-playthrough-flags-page',
|
|
imports: [RouterModule, LucideAngularModule, PlaythroughFlagsManagerComponent],
|
|
templateUrl: './playthrough-flags-page.component.html',
|
|
styleUrls: ['./playthrough-flags-page.component.scss']
|
|
})
|
|
export class PlaythroughFlagsPageComponent implements OnInit, OnDestroy {
|
|
readonly ArrowLeft = ArrowLeft;
|
|
|
|
campaignId = '';
|
|
playthroughId = '';
|
|
playthrough: Playthrough | null = null;
|
|
|
|
constructor(
|
|
private route: ActivatedRoute,
|
|
private router: Router,
|
|
private campaignService: CampaignService,
|
|
private characterService: CharacterService,
|
|
private npcService: NpcService,
|
|
private randomTableService: RandomTableService,
|
|
private playthroughService: PlaythroughService,
|
|
private layoutService: LayoutService,
|
|
private pageTitleService: PageTitleService
|
|
) {}
|
|
|
|
ngOnInit(): void {
|
|
this.route.paramMap.subscribe(pm => {
|
|
const cid = pm.get('campaignId')!;
|
|
const pid = pm.get('playthroughId')!;
|
|
if (cid !== this.campaignId || pid !== this.playthroughId) {
|
|
this.campaignId = cid;
|
|
this.playthroughId = pid;
|
|
this.load();
|
|
}
|
|
});
|
|
}
|
|
|
|
private load(): void {
|
|
forkJoin({
|
|
campaign: this.campaignService.getCampaignById(this.campaignId),
|
|
allCampaigns: this.campaignService.getAllCampaigns(),
|
|
treeData: loadCampaignTreeData(this.campaignService, this.campaignId, this.characterService, this.npcService, this.randomTableService),
|
|
playthrough: this.playthroughService.getById(this.playthroughId)
|
|
}).subscribe(({ campaign, allCampaigns, treeData, playthrough }) => {
|
|
this.playthrough = playthrough;
|
|
this.pageTitleService.set(`${playthrough.name} — Faits`);
|
|
this.layoutService.show(buildCampaignSidebarConfig(campaign, allCampaigns, treeData, this.campaignId));
|
|
});
|
|
}
|
|
|
|
back(): void {
|
|
this.router.navigate(['/campaigns', this.campaignId]);
|
|
}
|
|
|
|
ngOnDestroy(): void {}
|
|
}
|