Files
LoreMind/web/src/app/campaigns/chapter/chapter-edit/chapter-edit.component.html
T
ietm64 c2f162d823
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 13m48s
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 13m16s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 3m3s
Build & Push Images / build (core) (push) Successful in 4m50s
Build & Push Images / build (web) (push) Successful in 3m26s
Build & Push Images / build-switcher (push) Successful in 26s
Build & Push Images / build (brain) (push) Canceled after 1m5s
Mentor d'écriture (M1-M3) : coach dans les champs, relecture d'éditeur, méthode guidée « Donjon en 5 salles »
- M1 coach : bouton ampoule sur 17 champs narratifs (scène, chapitre, arc),
  panneau de conseils (à quoi ça sert, questions, exemple, piège classique).
  Contenu statique i18n fr/en, sans IA ; ampoule aussi dans l'en-tête des
  sections repliables (input coachTopic d'expandable-section).
- M2 relecture d'éditeur : WritingReviewService + GET
  /api/campaigns/{id}/writing-review, 10 règles déterministes WRITE-001 à 010
  (couloir, faux choix, révélation à chemin unique, rythme monotone, enjeux
  absents, narration trop longue ou qui décide à la place des PJ, combat sans
  but, fin unique, scènes non typées). Le back renvoie ruleId + params, les
  textes fr/en sont dans l'i18n. Panneau sur le hub, encart dans les éditeurs,
  liens « Voir » avec ?focus= (nouveaux focus : narration, choices, stakes).
- M3 méthode guidée : POST /api/campaigns/{id}/guided-skeleton (arc existant
  ou nouveau, chapitre, scènes typées, chaînage optionnel, transactionnel)
  + assistant pas à pas générique /campaigns/:id/guided/:method, première
  méthode « Donjon en 5 salles ». Entrées sur le hub de campagne.
- Garde-fous vitest : complétude des textes fr/en du coach, de la relecture
  (règles lues dans le Java) et des méthodes guidées.

Vérifié : core clean verify (1182 tests), web build + 299 tests vitest, lint
sans erreur, parcours testés dans l'appli (back Postgres de dev).
À redéployer : core (2 endpoints, aucune migration) + web.
2026-10-17 11:58:26 +02:00

168 lines
6.6 KiB
HTML

<div class="edit-page">
<div class="page-header">
<div>
<h1>{{ chapter?.name || ('chapterEdit.chapter' | translate) }}</h1>
<p class="subtitle">{{ 'chapterEdit.chapter' | translate }}</p>
</div>
<div class="header-actions">
<button type="button" class="btn-ai"
(click)="toggleChat()"
[class.active]="chatOpen"
[title]="'chapterEdit.aiAssistantTitle' | translate">
<lucide-icon [img]="Sparkles" [size]="14"></lucide-icon>
{{ 'chapterEdit.aiAssistant' | translate }}
</button>
<button type="button" class="btn-secondary" (click)="cancel()">{{ 'common.cancel' | translate }}</button>
<button type="button" class="btn-danger" (click)="delete()">
<lucide-icon [img]="Trash2" [size]="14"></lucide-icon>
{{ 'common.delete' | translate }}
</button>
<button type="button" class="btn-primary" (click)="submit()" [disabled]="form.invalid">
{{ 'common.save' | translate }}
</button>
</div>
</div>
<form [formGroup]="form" (ngSubmit)="submit()" class="edit-form">
<!-- Tout est optionnel sauf le titre : identité visible, le reste replié. -->
<p class="optional-hint">{{ 'chapterEdit.optionalHint' | translate }}</p>
<!-- Mentor d'écriture (M2) : conseils de relecture qui concernent cette entité. -->
<app-writing-review-hints [campaignId]="campaignId" entityType="CHAPTER" [entityId]="chapterId"></app-writing-review-hints>
<!-- Co-création (Pilier A) : le co-MJ propose, validation champ par champ → remplit le formulaire. -->
<app-entity-assist-panel
[entityType]="'chapter'" [entityId]="chapterId" [campaignId]="campaignId"
(applied)="onAssistApplied($event)"></app-entity-assist-panel>
<!-- Co-création (Pilier A, « create ») : peupler ce chapitre en scènes. -->
<app-scene-draft-panel
[chapterId]="chapterId" [campaignId]="campaignId"
[startOpen]="assistParam === 'draft-scenes'"
(created)="onScenesCreated($event)"></app-scene-draft-panel>
<!-- Identité -->
<div class="field">
<label for="chapter-edit-name">{{ 'chapterEdit.nameLabel' | translate }}</label>
<input
id="chapter-edit-name"
type="text"
formControlName="name"
[placeholder]="'chapterEdit.namePlaceholder' | translate"
[class.invalid]="form.get('name')?.invalid && form.get('name')?.touched"
/>
</div>
<div class="field">
<div class="field-label-row">
<label for="chapter-edit-description">{{ 'chapterEdit.synopsisLabel' | translate }}</label>
<app-writing-coach-trigger topic="chapter.synopsis"></app-writing-coach-trigger>
</div>
<textarea
id="chapter-edit-description"
formControlName="description"
[placeholder]="'chapterEdit.synopsisPlaceholder' | translate"
rows="5">
</textarea>
</div>
<div class="field">
<label>{{ 'chapterEdit.icon' | translate }}</label>
<app-icon-picker [options]="campaignIconOptions" [(selected)]="selectedIcon"></app-icon-picker>
</div>
<!-- Illustrations (galerie editable, rendu editorial) -->
<app-expandable-section [title]="'chapterEdit.illustrations' | translate" icon="🖼️" [filled]="illustrationsFilled">
<app-image-gallery
[imageIds]="illustrationImageIds"
[editable]="true"
[layout]="'EDITORIAL'"
(imageIdsChange)="illustrationImageIds = $event">
</app-image-gallery>
<small class="field-hint">{{ 'chapterEdit.illustrationsHint' | translate }}</small>
</app-expandable-section>
<!-- Notes du MJ (privé) -->
<app-expandable-section [title]="'chapterEdit.gmNotesSectionTitle' | translate" icon="🔒" variant="private" [filled]="gmNotesFilled">
<div class="field">
<label for="chapter-edit-gm-notes">{{ 'chapterEdit.gmNotesLabel' | translate }}</label>
<textarea
id="chapter-edit-gm-notes"
formControlName="gmNotes"
[placeholder]="'chapterEdit.gmNotesPlaceholder' | translate"
rows="6">
</textarea>
<small class="field-hint">{{ 'chapterEdit.gmNotesHint' | translate }}</small>
</div>
</app-expandable-section>
<!-- Objectifs et enjeux -->
<app-expandable-section [title]="'chapterEdit.objectivesStakesSectionTitle' | translate" icon="🎯" [initiallyOpen]="focusSection === 'stakes'" [filled]="objectivesStakesFilled">
<div class="field-row">
<div class="field">
<div class="field-label-row">
<label for="chapter-edit-player-objectives">{{ 'chapterEdit.playerObjectivesLabel' | translate }}</label>
<app-writing-coach-trigger topic="chapter.objectives"></app-writing-coach-trigger>
</div>
<textarea
id="chapter-edit-player-objectives"
formControlName="playerObjectives"
[placeholder]="'chapterEdit.playerObjectivesPlaceholder' | translate"
rows="4">
</textarea>
</div>
<div class="field">
<div class="field-label-row">
<label for="chapter-edit-narrative-stakes">{{ 'chapterEdit.narrativeStakesLabel' | translate }}</label>
<app-writing-coach-trigger topic="chapter.stakes"></app-writing-coach-trigger>
</div>
<textarea
id="chapter-edit-narrative-stakes"
formControlName="narrativeStakes"
[placeholder]="'chapterEdit.narrativeStakesPlaceholder' | translate"
rows="4">
</textarea>
</div>
</div>
</app-expandable-section>
<!-- ===== Pages Lore associées (B2 cross-context) ===== -->
@if (loreId) {
<app-expandable-section [title]="'chapterEdit.relatedPages' | translate" icon="🔗" [filled]="loreFilled">
<app-lore-link-picker
[value]="relatedPageIds"
[availablePages]="availablePages"
[loreId]="loreId"
(valueChange)="relatedPageIds = $event">
</app-lore-link-picker>
<small class="field-hint">
{{ 'chapterEdit.relatedPagesHint' | translate }}
</small>
</app-expandable-section>
}
@if (!loreId) {
<div class="field">
<small class="field-hint">
{{ 'chapterEdit.noLoreHint' | translate }}
</small>
</div>
}
</form>
</div>
<!-- Drawer chat IA (hors .edit-page pour couvrir le viewport à droite) -->
<app-ai-chat-drawer
[campaignId]="campaignId"
entityType="chapter"
[entityId]="chapterId"
[isOpen]="chatOpen"
[welcomeMessage]="'chapterEdit.chatWelcome' | translate"
[quickSuggestions]="chatQuickSuggestions"
(closed)="chatOpen = false">
</app-ai-chat-drawer>