Co-MJ v1 : quêtes de première classe, guidage de préparation, assistant IA,
mode séance, battlemaps multiples et export Foundry ciblé
- Quêtes (Niveau 1) : entité Quest orthogonale à l'arbre, rattachée à un arc HUB
ou libre (migrations V9-V12, V18, V20 ; réconciliation des jumeaux V10).
Fusion quête/conteneur dans la sidebar, progression par partie (statuts
disponible/en cours/terminée), et quêtes libres avec espace de scènes créé
automatiquement (arc technique « Quêtes libres », V21 : levée de la
contrainte arcs.type héritée du baseline).
- Guidage (Pilier B) : bilan de préparation 100 % dérivé (règles arc/chapitre/
scène/quête), panneau « Prochaines étapes » avec boutons « Corriger », et
pastilles détaillées (tooltip des manques) dans l'arbre.
- Assistant IA (Pilier A) : étoffage champ par champ (scène, chapitre, arc) et
brouillons de scènes en propose→applique (brain : narrative-fields,
scene-drafts).
- Horloges & menaces (V15-V17) : clocks à segments avec déclencheurs, fronts.
- Mode séance : préparation de séance (readiness + quêtes dispo), scène
épinglée (V19), récap « précédemment » (brain : session-recap), onglet
« Partie » du panneau de référence, graphe amélioré (pan/zoom, éditeur de
liens).
- Perf : endpoint agrégé GET /api/campaigns/{id}/tree — la sidebar charge en
1 requête au lieu de ~15.
- Battlemaps multiples par scène (variantes jour/nuit, étages…) : liste JSON
étiquetée (V22, reprise automatique de la carte existante), rendu PDF avec
légendes, export/import rétro-compatible.
- Export Foundry ciblé : modale de périmètre (cartes+ennemis / journaux /
tables), bundle filtré côté serveur (zip allégé), module Foundry à jour
(respect du périmètre + une Scene Foundry par variante de carte,
rétro-compatible anciens bundles).
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<div class="node-picker">
|
||||
|
||||
<div class="node-list">
|
||||
@for (n of nodes; track $index) {
|
||||
<div class="node-chip">
|
||||
<lucide-icon class="node-icon" [img]="n.nodeType === 'SCENE' ? MapPin : BookOpen" [size]="15"></lucide-icon>
|
||||
<span class="node-name">{{ nodeName(n) || ('nodePicker.deletedNode' | translate) }}</span>
|
||||
<span class="node-type">{{ (n.nodeType === 'SCENE' ? 'nodePicker.scene' : 'nodePicker.chapter') | translate }}</span>
|
||||
<button type="button" (click)="moveUp($index)" [disabled]="$index === 0" [title]="'nodePicker.moveUp' | translate">
|
||||
<lucide-icon [img]="ChevronUp" [size]="15"></lucide-icon>
|
||||
</button>
|
||||
<button type="button" (click)="moveDown($index)" [disabled]="$index === nodes.length - 1" [title]="'nodePicker.moveDown' | translate">
|
||||
<lucide-icon [img]="ChevronDown" [size]="15"></lucide-icon>
|
||||
</button>
|
||||
<button type="button" (click)="remove($index)" [title]="'nodePicker.remove' | translate">
|
||||
<lucide-icon [img]="X" [size]="15"></lucide-icon>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
@if (nodes.length === 0) {
|
||||
<p class="empty-hint">{{ 'nodePicker.empty' | translate }}</p>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="add-row">
|
||||
<select [(ngModel)]="selectedChapterId" [attr.aria-label]="'nodePicker.selectChapter' | translate">
|
||||
<option value="">{{ 'nodePicker.selectChapter' | translate }}</option>
|
||||
@for (c of availableChapters; track c.id) {
|
||||
<option [value]="c.id">{{ c.name }}</option>
|
||||
}
|
||||
</select>
|
||||
<button type="button" class="btn-secondary" (click)="addChapter()" [disabled]="!selectedChapterId">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
{{ 'nodePicker.addChapter' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="add-row">
|
||||
<select [(ngModel)]="selectedSceneId" [attr.aria-label]="'nodePicker.selectScene' | translate">
|
||||
<option value="">{{ 'nodePicker.selectScene' | translate }}</option>
|
||||
@for (s of availableScenes; track s.id) {
|
||||
<option [value]="s.id">{{ sceneOptionLabel(s) }}</option>
|
||||
}
|
||||
</select>
|
||||
<button type="button" class="btn-secondary" (click)="addScene()" [disabled]="!selectedSceneId">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
{{ 'nodePicker.addScene' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,68 @@
|
||||
.node-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.node-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.node-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
background: #1a1a2e;
|
||||
border: 1px solid #2a2a3d;
|
||||
border-radius: 8px;
|
||||
|
||||
.node-icon { color: #9ca3af; flex: none; }
|
||||
|
||||
.node-name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: #e5e7eb;
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
|
||||
.node-type {
|
||||
font-size: 0.7rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.2rem;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: #9ca3af;
|
||||
cursor: pointer;
|
||||
transition: color 0.15s, background 0.15s;
|
||||
|
||||
&:hover:not(:disabled) { color: #fff; background: #2a2a3d; }
|
||||
&:disabled { opacity: 0.3; cursor: default; }
|
||||
}
|
||||
}
|
||||
|
||||
.empty-hint {
|
||||
margin: 0;
|
||||
font-size: 0.85rem;
|
||||
font-style: italic;
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.add-row {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
|
||||
select { flex: 1; min-width: 0; }
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { LucideAngularModule, Plus, X, ChevronUp, ChevronDown, BookOpen, MapPin } from 'lucide-angular';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { Chapter, Scene, QuestNodeRef, NodeType } from '../../services/campaign.model';
|
||||
|
||||
/**
|
||||
* Sélecteur de nœuds narratifs (Chapitres / Scènes) traversés par une quête.
|
||||
* Émet une liste ORDONNÉE de QuestNodeRef ; l'ordre = position dans la liste
|
||||
* (réindexé à chaque changement). Réutilise les chapitres / scènes déjà chargés
|
||||
* par {@code loadCampaignTreeData} — aucun appel réseau ici.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-node-picker',
|
||||
imports: [FormsModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './node-picker.component.html',
|
||||
styleUrls: ['./node-picker.component.scss']
|
||||
})
|
||||
export class NodePickerComponent {
|
||||
readonly Plus = Plus;
|
||||
readonly X = X;
|
||||
readonly ChevronUp = ChevronUp;
|
||||
readonly ChevronDown = ChevronDown;
|
||||
readonly BookOpen = BookOpen;
|
||||
readonly MapPin = MapPin;
|
||||
|
||||
@Input() nodes: QuestNodeRef[] = [];
|
||||
@Input() chapters: Chapter[] = [];
|
||||
@Input() scenes: Scene[] = [];
|
||||
@Output() nodesChange = new EventEmitter<QuestNodeRef[]>();
|
||||
|
||||
selectedChapterId = '';
|
||||
selectedSceneId = '';
|
||||
|
||||
/** Chapitres pas encore rattachés (un même nœud ne se lie qu'une fois). */
|
||||
get availableChapters(): Chapter[] {
|
||||
return this.chapters.filter(c => !!c.id && !this.isLinked('CHAPTER', c.id));
|
||||
}
|
||||
|
||||
/** Scènes pas encore rattachées. */
|
||||
get availableScenes(): Scene[] {
|
||||
return this.scenes.filter(s => !!s.id && !this.isLinked('SCENE', s.id));
|
||||
}
|
||||
|
||||
private isLinked(type: NodeType, id: string): boolean {
|
||||
return this.nodes.some(n => n.nodeType === type && n.nodeId === id);
|
||||
}
|
||||
|
||||
addChapter(): void {
|
||||
if (!this.selectedChapterId) return;
|
||||
this.emit([...this.nodes, { nodeType: 'CHAPTER', nodeId: this.selectedChapterId, order: this.nodes.length }]);
|
||||
this.selectedChapterId = '';
|
||||
}
|
||||
|
||||
addScene(): void {
|
||||
if (!this.selectedSceneId) return;
|
||||
this.emit([...this.nodes, { nodeType: 'SCENE', nodeId: this.selectedSceneId, order: this.nodes.length }]);
|
||||
this.selectedSceneId = '';
|
||||
}
|
||||
|
||||
remove(index: number): void {
|
||||
this.emit(this.nodes.filter((_, i) => i !== index));
|
||||
}
|
||||
|
||||
moveUp(index: number): void {
|
||||
if (index <= 0) return;
|
||||
const next = [...this.nodes];
|
||||
[next[index - 1], next[index]] = [next[index], next[index - 1]];
|
||||
this.emit(next);
|
||||
}
|
||||
|
||||
moveDown(index: number): void {
|
||||
if (index >= this.nodes.length - 1) return;
|
||||
const next = [...this.nodes];
|
||||
[next[index + 1], next[index]] = [next[index], next[index + 1]];
|
||||
this.emit(next);
|
||||
}
|
||||
|
||||
/** Réindexe {@code order} sur la position courante avant de propager. */
|
||||
private emit(nodes: QuestNodeRef[]): void {
|
||||
this.nodesChange.emit(nodes.map((n, i) => ({ ...n, order: i })));
|
||||
}
|
||||
|
||||
// ── Libellés ──────────────────────────────────────────────────────────────
|
||||
/** Libellé d'un nœud lié ('' si l'entité a été supprimée → géré dans le template). */
|
||||
nodeName(n: QuestNodeRef): string {
|
||||
if (n.nodeType === 'CHAPTER') {
|
||||
return this.chapters.find(c => c.id === n.nodeId)?.name ?? '';
|
||||
}
|
||||
const scene = this.scenes.find(s => s.id === n.nodeId);
|
||||
if (!scene) return '';
|
||||
const chapter = this.chapters.find(c => c.id === scene.chapterId);
|
||||
return chapter ? `${chapter.name} › ${scene.name}` : scene.name;
|
||||
}
|
||||
|
||||
/** Option du menu déroulant des scènes : préfixée du chapitre pour lever l'ambiguïté. */
|
||||
sceneOptionLabel(s: Scene): string {
|
||||
const chapter = this.chapters.find(c => c.id === s.chapterId);
|
||||
return chapter ? `${chapter.name} › ${s.name}` : s.name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user