Co-MJ v1 : quêtes de première classe, guidage de préparation, assistant IA,
Build & Push Images / build (brain) (push) Successful in 1m38s
Build & Push Images / build (web) (push) Successful in 1m53s
Build & Push Images / build (core) (push) Successful in 3m40s
Build & Push Images / build-switcher (push) Successful in 16s

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:
2026-07-03 15:29:23 +02:00
parent 268f4721ce
commit b2c3800bf8
278 changed files with 15570 additions and 1451 deletions
@@ -62,6 +62,70 @@
<div class="play-grid">
<!-- Colonne gauche : journal -->
<div class="play-main">
<!-- Scène courante épinglée (mode cockpit) -->
@if (pinnedScene) {
<section class="pinned-scene">
<div class="pinned-head">
<lucide-icon [img]="Pin" [size]="14" class="pinned-icon"></lucide-icon>
<span class="pinned-label">{{ 'sessionDetail.pinned.label' | translate }}</span>
<strong class="pinned-name">{{ pinnedScene.name }}</strong>
<span class="pinned-actions">
<button type="button" class="btn-icon" (click)="openPinnedScene()" [disabled]="!pinnedArcId"
[title]="'sessionDetail.pinned.open' | translate">
<lucide-icon [img]="ExternalLink" [size]="13"></lucide-icon>
</button>
<button type="button" class="btn-icon" (click)="unpinScene()"
[title]="'sessionDetail.pinned.unpin' | translate">
<lucide-icon [img]="PinOff" [size]="13"></lucide-icon>
</button>
</span>
</div>
@if (pinnedScene.location || pinnedScene.timing) {
<p class="pinned-meta">
@if (pinnedScene.location) { <span>📍 {{ pinnedScene.location }}</span> }
@if (pinnedScene.timing) { <span>🕒 {{ pinnedScene.timing }}</span> }
</p>
}
@if (pinnedScene.playerNarration) {
<button type="button" class="pinned-narration-toggle" (click)="narrationOpen = !narrationOpen">
{{ (narrationOpen ? 'sessionDetail.pinned.hideNarration' : 'sessionDetail.pinned.showNarration') | translate }}
</button>
@if (narrationOpen) {
<p class="pinned-narration">{{ pinnedScene.playerNarration }}</p>
}
}
</section>
}
<!-- Récap « précédemment… » -->
<section class="recap-bar">
@if (!recapText) {
<button type="button" class="btn-secondary recap-btn" (click)="generateRecap()" [disabled]="recapLoading">
<lucide-icon [img]="recapLoading ? RefreshCw : ScrollText" [size]="14" [class.spin]="recapLoading"></lucide-icon>
{{ (recapLoading ? 'sessionDetail.recap.loading' : 'sessionDetail.recap.button') | translate }}
</button>
@if (recapError) { <span class="recap-error">{{ recapError }}</span> }
}
@if (recapText) {
<div class="recap-box">
<div class="recap-head">
<lucide-icon [img]="ScrollText" [size]="14"></lucide-icon>
<span>{{ 'sessionDetail.recap.title' | translate:{ name: recapFrom } }}</span>
<button type="button" class="btn-icon" (click)="closeRecap()" [title]="'common.cancel' | translate">
<lucide-icon [img]="X" [size]="13"></lucide-icon>
</button>
</div>
<p class="recap-text">{{ recapText }}</p>
@if (session.active) {
<button type="button" class="btn-secondary recap-add" (click)="addRecapToJournal()">
<lucide-icon [img]="Plus" [size]="13"></lucide-icon>
{{ 'sessionDetail.recap.addToJournal' | translate }}
</button>
}
</div>
}
</section>
<!-- Ajouter une entrée -->
@if (session.active) {
<section class="detail-section add-entry-section">
@@ -185,7 +249,8 @@
[canAddToJournal]="session.active"
(rolled)="onDiceRolled($event)"
(aiReplyToJournal)="onAiReplyToJournal($event)"
(noteToJournal)="onItemNoteToJournal($event)">
(noteToJournal)="onItemNoteToJournal($event)"
(pinScene)="onPinScene($event)">
</app-session-reference-panel>
</aside>
</div>
@@ -344,3 +344,92 @@
word-break: break-word;
margin: 0;
}
// ─────────────── Mode cockpit : scène courante épinglée ───────────────
.pinned-scene {
margin-bottom: 1rem;
padding: 0.7rem 0.9rem;
background: #14141f;
border: 1px solid #3a3658;
border-left: 3px solid #6c63ff;
border-radius: 10px;
.pinned-head {
display: flex;
align-items: center;
gap: 0.45rem;
.pinned-icon { color: #8b80ff; flex-shrink: 0; }
.pinned-label { color: #9ca3af; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.pinned-name { flex: 1; min-width: 0; color: #f3f4f6; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-actions { display: inline-flex; gap: 0.25rem; flex-shrink: 0; }
}
.pinned-meta {
display: flex;
gap: 0.9rem;
margin: 0.4rem 0 0;
color: #9ca3af;
font-size: 0.82rem;
}
.pinned-narration-toggle {
margin-top: 0.45rem;
background: none;
border: none;
padding: 0;
color: #8b80ff;
font-size: 0.8rem;
cursor: pointer;
&:hover { color: #b9a8ff; text-decoration: underline; }
}
.pinned-narration {
margin: 0.45rem 0 0;
color: #d1d5db;
font-size: 0.88rem;
line-height: 1.5;
white-space: pre-wrap;
font-style: italic;
}
}
// ─────────────── Récap « précédemment… » ───────────────
.recap-bar { margin-bottom: 1rem; }
.recap-btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.recap-error { margin-left: 0.6rem; color: #fca5a5; font-size: 0.82rem; }
.spin { animation: session-spin 0.9s linear infinite; }
@keyframes session-spin { to { transform: rotate(360deg); } }
.recap-box {
padding: 0.7rem 0.9rem;
background: #17131f;
border: 1px solid #4a3a68;
border-left: 3px solid #8b5fb4;
border-radius: 10px;
.recap-head {
display: flex;
align-items: center;
gap: 0.45rem;
color: #cbb9ff;
font-size: 0.85rem;
font-weight: 600;
span { flex: 1; min-width: 0; }
}
.recap-text {
margin: 0.5rem 0;
color: #e5e7eb;
font-size: 0.9rem;
line-height: 1.55;
white-space: pre-wrap;
font-style: italic;
}
.recap-add { display: inline-flex; align-items: center; gap: 0.35rem; }
}
@@ -6,13 +6,16 @@ import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import {
LucideAngularModule, LucideIconData,
Dices, ArrowLeft, Square, Trash2, Pencil, Check,
StickyNote, Sparkles, UserCheck, Plus, X
StickyNote, Sparkles, UserCheck, Plus, X,
Pin, PinOff, ExternalLink, ScrollText, RefreshCw
} from 'lucide-angular';
import { catchError, switchMap, filter, map } from 'rxjs/operators';
import { of } from 'rxjs';
import { SessionService } from '../../services/session.service';
import { Session } from '../../services/session.model';
import { PlaythroughService } from '../../services/playthrough.service';
import { CampaignService } from '../../services/campaign.service';
import { Scene } from '../../services/campaign.model';
import {
SessionEntry, SessionEntryInput, EntryType, ENTRY_TYPE_META
} from '../../services/session-entry.model';
@@ -43,6 +46,11 @@ export class SessionDetailComponent implements OnInit, OnDestroy {
readonly Check = Check;
readonly Plus = Plus;
readonly X = X;
readonly Pin = Pin;
readonly PinOff = PinOff;
readonly ExternalLink = ExternalLink;
readonly ScrollText = ScrollText;
readonly RefreshCw = RefreshCw;
/** Mapping enum → composant Lucide pour le rendu des icônes par type. */
readonly typeIcons: Record<EntryType, LucideIconData> = {
@@ -73,11 +81,25 @@ export class SessionDetailComponent implements OnInit, OnDestroy {
editEntryType: EntryType = 'NOTE';
editEntryContent = '';
// ─────────────── Mode cockpit : scène courante épinglée ───────────────
pinnedScene: Scene | null = null;
/** Arc parent de la scène épinglée (résolu via son chapitre) — pour le lien d'ouverture. */
pinnedArcId: string | null = null;
/** Narration joueur dépliée dans le bandeau. */
narrationOpen = false;
// ─────────────── Récap « précédemment… » ───────────────
recapLoading = false;
recapText: string | null = null;
recapFrom: string | null = null;
recapError: string | null = null;
constructor(
private route: ActivatedRoute,
private router: Router,
private sessionService: SessionService,
private playthroughService: PlaythroughService,
private campaignService: CampaignService,
private entryService: SessionEntryService,
private layoutService: LayoutService,
private pageTitleService: PageTitleService,
@@ -110,6 +132,7 @@ export class SessionDetailComponent implements OnInit, OnDestroy {
if (session) {
this.pageTitleService.set(session.name);
this.loadEntries(session.id);
this.loadPinnedScene(session.currentSceneId ?? null);
if (session.playthroughId) {
this.playthroughService.getById(session.playthroughId).pipe(
catchError(() => of(null))
@@ -127,6 +150,88 @@ export class SessionDetailComponent implements OnInit, OnDestroy {
});
}
// ─────────────── Mode cockpit : scène courante ───────────────
/** Charge (ou vide) le bandeau de scène épinglée. Épingle caduque (scène supprimée) → ignorée. */
private loadPinnedScene(sceneId: string | null): void {
if (!sceneId) { this.pinnedScene = null; this.pinnedArcId = null; return; }
this.campaignService.getSceneById(sceneId).pipe(catchError(() => of(null))).subscribe(scene => {
this.pinnedScene = scene;
this.narrationOpen = false;
this.pinnedArcId = null;
if (scene?.chapterId) {
this.campaignService.getChapterById(scene.chapterId).pipe(catchError(() => of(null)))
.subscribe(ch => this.pinnedArcId = ch?.arcId ?? null);
}
});
}
/** Épingle une scène depuis le panneau de référence (onglet Scènes). */
onPinScene(sceneId: string): void {
if (!this.session) return;
this.sessionService.setCurrentScene(this.session.id, sceneId).subscribe({
next: updated => { this.session = updated; this.loadPinnedScene(updated.currentSceneId ?? null); },
error: () => console.error('Erreur lors de l\'épinglage de la scène')
});
}
unpinScene(): void {
if (!this.session) return;
this.sessionService.setCurrentScene(this.session.id, null).subscribe({
next: updated => { this.session = updated; this.pinnedScene = null; this.pinnedArcId = null; },
error: () => console.error('Erreur lors du retrait de l\'épingle')
});
}
/** Ouvre la scène épinglée dans un nouvel onglet (préserve l'écran de session). */
openPinnedScene(): void {
if (!this.pinnedScene || !this.campaignId || !this.pinnedArcId) return;
const url = ['/campaigns', this.campaignId, 'arcs', this.pinnedArcId,
'chapters', this.pinnedScene.chapterId, 'scenes', this.pinnedScene.id].join('/');
window.open(url, '_blank', 'noopener');
}
// ─────────────── Récap « précédemment… » ───────────────
generateRecap(): void {
if (!this.session || this.recapLoading) return;
this.recapLoading = true;
this.recapError = null;
this.sessionService.recap(this.session.id).subscribe({
next: r => {
this.recapLoading = false;
this.recapText = r.recap;
this.recapFrom = r.previousSessionName;
},
error: err => {
this.recapLoading = false;
// Message backend (pas de séance précédente, journal vide, Brain KO…) si disponible.
this.recapError = err?.error?.error
?? this.translate.instant('sessionDetail.recap.error');
}
});
}
/** Consigne le récap au journal (entrée NOTE 📜) puis referme l'encart. */
addRecapToJournal(): void {
if (!this.session || !this.recapText) return;
const input: SessionEntryInput = { type: 'NOTE', content: '📜 ' + this.recapText };
this.entryService.createEntry(this.session.id, input).subscribe({
next: created => {
this.entries = [created, ...this.entries];
this.recapText = null;
this.recapFrom = null;
},
error: () => console.error('Erreur lors de l\'ajout du récap au journal')
});
}
closeRecap(): void {
this.recapText = null;
this.recapFrom = null;
this.recapError = null;
}
// ─────────────── Renommage de la Session ───────────────
startRename(): void {
@@ -1,6 +1,13 @@
<div class="reference-panel">
<nav class="ref-tabs">
<button type="button"
class="ref-tab"
[class.ref-tab--active]="activeTab === 'play'"
(click)="selectTab('play')">
<lucide-icon [img]="Timer" [size]="14"></lucide-icon>
{{ 'sessionReferencePanel.tabPlay' | translate }}
</button>
<button type="button"
class="ref-tab"
[class.ref-tab--active]="activeTab === 'ai'"
@@ -47,6 +54,24 @@
<div class="ref-content" [class.ref-content--fill]="activeTab === 'ai'">
<!-- ====== Partie (état de jeu : horloges + faits) ====== -->
@if (activeTab === 'play') {
<div class="ref-list">
@if (playthroughId) {
<div class="ref-play-section">
<h4 class="ref-play-title">{{ 'sessionReferencePanel.playClocks' | translate }}</h4>
<app-clocks-manager [playthroughId]="playthroughId" [campaignId]="campaignId"></app-clocks-manager>
</div>
<div class="ref-play-section">
<h4 class="ref-play-title">{{ 'sessionReferencePanel.playFacts' | translate }}</h4>
<app-playthrough-flags-manager [campaignId]="campaignId" [playthroughId]="playthroughId"></app-playthrough-flags-manager>
</div>
} @else {
<p class="empty-hint">{{ 'sessionReferencePanel.playNoPlaythrough' | translate }}</p>
}
</div>
}
<!-- ====== IA ====== -->
@if (activeTab === 'ai') {
<app-session-ai-chat-panel
@@ -178,13 +203,21 @@
<div class="ref-subgroup">
<span class="ref-subgroup-title">{{ chapter.name }}</span>
@for (scene of scenesOf(chapter); track scene) {
<button
type="button"
class="ref-item ref-item--nested"
(click)="openInNewTab(['campaigns', campaignId, 'arcs', arc.id!, 'chapters', chapter.id!, 'scenes', scene.id!])">
<span class="ref-item-name">{{ scene.name }}</span>
<lucide-icon [img]="ExternalLink" [size]="12" class="ref-item-icon"></lucide-icon>
</button>
<div class="ref-item-row">
<button
type="button"
class="ref-item ref-item--nested"
(click)="openInNewTab(['campaigns', campaignId, 'arcs', arc.id!, 'chapters', chapter.id!, 'scenes', scene.id!])">
<span class="ref-item-name">{{ scene.name }}</span>
<lucide-icon [img]="ExternalLink" [size]="12" class="ref-item-icon"></lucide-icon>
</button>
<!-- Épingler comme scène courante (mode cockpit). -->
<button type="button" class="ref-pin"
[title]="'sessionReferencePanel.pinScene' | translate"
(click)="pinScene.emit(scene.id!)">
<lucide-icon [img]="Pin" [size]="12"></lucide-icon>
</button>
</div>
}
</div>
}
@@ -196,3 +196,44 @@
text-align: center;
margin: 0.5rem 0;
}
// ─────────────── Onglet « Partie » (état de jeu : horloges + faits) ───────────────
.ref-play-section {
margin-bottom: 1rem;
.ref-play-title {
margin: 0 0 0.5rem;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
color: #9ca3af;
}
}
// Ligne scène + épingle : le bouton d'ouverture garde toute la largeur restante.
.ref-item-row {
display: flex;
align-items: center;
gap: 0.25rem;
.ref-item { flex: 1; min-width: 0; }
}
.ref-pin {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
flex-shrink: 0;
padding: 0;
background: transparent;
border: 1px solid #2a2a3d;
border-radius: 6px;
color: #6b7280;
cursor: pointer;
transition: color 0.15s, border-color 0.15s, background 0.15s;
&:hover { color: #c7d2fe; border-color: #6c63ff; background: rgba(108, 99, 255, 0.1); }
}
@@ -1,7 +1,7 @@
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { TranslatePipe } from '@ngx-translate/core';
import { LucideAngularModule, User, Drama, Swords, Dices, ExternalLink, Sparkles, Table2, Package, ChevronDown, ChevronRight } from 'lucide-angular';
import { LucideAngularModule, User, Drama, Swords, Dices, ExternalLink, Sparkles, Table2, Package, ChevronDown, ChevronRight, Timer, Pin } from 'lucide-angular';
import { catchError, of } from 'rxjs';
import { CampaignService } from '../../services/campaign.service';
import { CharacterService } from '../../services/character.service';
@@ -18,8 +18,10 @@ import {
import { SessionAiChatPanelComponent } from '../session-ai-chat-panel/session-ai-chat-panel.component';
import { SessionRandomTablesPanelComponent } from '../session-random-tables-panel/session-random-tables-panel.component';
import { SessionItemCatalogsPanelComponent } from '../session-item-catalogs-panel/session-item-catalogs-panel.component';
import { ClocksManagerComponent } from '../../shared/clocks-manager/clocks-manager.component';
import { PlaythroughFlagsManagerComponent } from '../../shared/playthrough-flags-manager/playthrough-flags-manager.component';
type TabId = 'dice' | 'tables' | 'objects' | 'characters' | 'scenes' | 'ai';
type TabId = 'play' | 'dice' | 'tables' | 'objects' | 'characters' | 'scenes' | 'ai';
/**
* Panneau latéral du mode jeu : référence rapide en lecture seule.
@@ -33,7 +35,7 @@ type TabId = 'dice' | 'tables' | 'objects' | 'characters' | 'scenes' | 'ai';
*/
@Component({
selector: 'app-session-reference-panel',
imports: [LucideAngularModule, TranslatePipe, SessionDicePanelComponent, SessionAiChatPanelComponent, SessionRandomTablesPanelComponent, SessionItemCatalogsPanelComponent],
imports: [LucideAngularModule, TranslatePipe, SessionDicePanelComponent, SessionAiChatPanelComponent, SessionRandomTablesPanelComponent, SessionItemCatalogsPanelComponent, ClocksManagerComponent, PlaythroughFlagsManagerComponent],
templateUrl: './session-reference-panel.component.html',
styleUrls: ['./session-reference-panel.component.scss']
})
@@ -48,6 +50,8 @@ export class SessionReferencePanelComponent implements OnChanges {
readonly Package = Package;
readonly ChevronDown = ChevronDown;
readonly ChevronRight = ChevronRight;
readonly Timer = Timer;
readonly Pin = Pin;
@Input() campaignId!: string;
/** Partie active — nécessaire pour charger les PJ (refonte Playthrough). */
@@ -59,8 +63,11 @@ export class SessionReferencePanelComponent implements OnChanges {
@Output() aiReplyToJournal = new EventEmitter<string>();
/** Émis pour consigner un objet de catalogue au journal (entrée NOTE). */
@Output() noteToJournal = new EventEmitter<string>();
/** Émis quand le MJ épingle une scène comme « scène courante » (mode cockpit). */
@Output() pinScene = new EventEmitter<string>();
activeTab: TabId = 'dice';
// « Partie » par défaut : l'état de jeu (horloges + faits) est le réflexe à la table.
activeTab: TabId = 'play';
characters: Character[] = [];
npcs: Npc[] = [];