All checks were successful
Corrections fonctionnelles - order initialisé à la création des pages et dossiers de lore (nextOrderFor) : un nouvel élément se place désormais en dernier de sa fratrie au lieu de 0 - storePortrait : type MIME canonique dérivé de l'extension du fichier (un data URL "image/jpg" n'est plus rejeté silencieusement) - takeUntilDestroyed ajouté sur les abonnements paramMap de arc-view, folder-view et campaign-detail (fuites mémoire) Factorisation (suppression de duplication) - shared/folder-grouping.util.ts : groupByFolder + byOrder + byFolderName mutualisés entre npc-list, enemy-list, campaign-detail et la sidebar (folderChildren). Le tri des dossiers est désormais cohérent entre la sidebar et les vues cartes (insensible casse/accents partout) - DataSyncService.onChange()/persist() remplacent le câblage changed$ + reorder recopié dans 5 vues - campaign-detail : loadCampaignBundle()/applyCampaignBundle() éliminent le forkJoin dupliqué entre ngOnInit et reload - ReorderSupport (domain/shared) : squelette générique remplaçant les 8 boucles de réordonnancement copiées dans les services - FoundryExportService : GameSystem résolu une seule fois dans buildBundle - module Foundry : walkScalars mutualise la récursion de flattenStats et flattenStructure (comportements préservés) ; esc() de l'importer aligné sur foundry.utils.escapeHTML Suppression de code mort - characterService/characters retirés de loadCampaignTreeData et de ses 16 appelants (arguments, injections, imports et littéraux CampaignTreeData) - CSS orphelin : .tree-row.cdk-drop-list-receiving et .btn-back - BottomPanel.initiallyOpen (jamais lu) retiré de l'interface et de l'appelant - commentaire trompeur du PDF corrigé Tests - mise à jour de 3 tests obsolètes de campaign-tree.helper.spec qui vérifiaient encore l'ancien comportement (tri alphabétique, non-classés en enfants directs) → alignés sur le modèle actuel (tri par order + pseudo-dossier "Sans dossier")
79 lines
3.2 KiB
TypeScript
79 lines
3.2 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 { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
|
import { CampaignService } from '../../../services/campaign.service';
|
|
import { NpcService } from '../../../services/npc.service';
|
|
import { RandomTableService } from '../../../services/random-table.service';
|
|
import { EnemyService } from '../../../services/enemy.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, TranslatePipe],
|
|
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 npcService: NpcService,
|
|
private randomTableService: RandomTableService,
|
|
private enemyService: EnemyService,
|
|
private playthroughService: PlaythroughService,
|
|
private layoutService: LayoutService,
|
|
private pageTitleService: PageTitleService,
|
|
private translate: TranslateService
|
|
) {}
|
|
|
|
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.npcService, this.randomTableService, this.enemyService),
|
|
playthrough: this.playthroughService.getById(this.playthroughId)
|
|
}).subscribe(({ campaign, allCampaigns, treeData, playthrough }) => {
|
|
this.playthrough = playthrough;
|
|
this.pageTitleService.set(this.translate.instant('playthroughFlagsPage.pageTitle', { name: playthrough.name }));
|
|
this.layoutService.show(buildCampaignSidebarConfig(campaign, allCampaigns, treeData, this.campaignId, this.translate));
|
|
});
|
|
}
|
|
|
|
back(): void {
|
|
this.router.navigate(['/campaigns', this.campaignId]);
|
|
}
|
|
|
|
ngOnDestroy(): void {}
|
|
}
|