Mise en place de l'anglais comme deuxième langue pour l'application
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
@if (node) {
|
||||
<div class="folder-view">
|
||||
<!-- Fil d'Ariane : Lore → ancêtres → dossier courant -->
|
||||
<nav class="breadcrumb" aria-label="Fil d'Ariane">
|
||||
<nav class="breadcrumb" [attr.aria-label]="'folderView.breadcrumb' | translate">
|
||||
@if (lore) {
|
||||
<button type="button" class="crumb" (click)="navigateToLoreRoot()">
|
||||
{{ lore.name }}
|
||||
@@ -24,27 +24,27 @@
|
||||
{{ node.name }}
|
||||
</h1>
|
||||
<p class="description">
|
||||
{{ subfolders.length }} sous-dossier(s) · {{ pages.length }} page(s)
|
||||
{{ 'folderView.summary' | translate:{ folders: subfolders.length, pages: pages.length } }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button type="button" class="btn-secondary" (click)="navigateToEdit()" title="Modifier le dossier">
|
||||
<button type="button" class="btn-secondary" (click)="navigateToEdit()" [title]="'folderView.editTitle' | translate">
|
||||
<lucide-icon [img]="Pencil" [size]="14"></lucide-icon>
|
||||
Modifier
|
||||
{{ 'common.edit' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn-danger" (click)="delete()" title="Supprimer le dossier et tout son contenu">
|
||||
<button type="button" class="btn-danger" (click)="delete()" [title]="'folderView.deleteTitle' | translate">
|
||||
<lucide-icon [img]="Trash2" [size]="14"></lucide-icon>
|
||||
Supprimer
|
||||
{{ 'common.delete' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Sous-dossiers -->
|
||||
<section class="detail-section">
|
||||
<div class="section-header">
|
||||
<h2>Sous-dossiers</h2>
|
||||
<h2>{{ 'folderView.subfolders' | translate }}</h2>
|
||||
<button class="btn-add" (click)="navigateToCreateSubfolder()">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
Nouveau sous-dossier
|
||||
{{ 'folderView.newSubfolder' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
@if (subfolders.length > 0) {
|
||||
@@ -59,17 +59,17 @@
|
||||
}
|
||||
@if (subfolders.length === 0) {
|
||||
<div class="empty-state">
|
||||
<p>Aucun sous-dossier.</p>
|
||||
<p>{{ 'folderView.noSubfolders' | translate }}</p>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
<!-- Pages -->
|
||||
<section class="detail-section">
|
||||
<div class="section-header">
|
||||
<h2>Pages</h2>
|
||||
<h2>{{ 'folderView.pages' | translate }}</h2>
|
||||
<button class="btn-add" (click)="navigateToCreatePage()">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
Nouvelle page
|
||||
{{ 'folderView.newPage' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
@if (pages.length > 0) {
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
@if (pages.length === 0) {
|
||||
<div class="empty-state">
|
||||
<p>Aucune page dans ce dossier.</p>
|
||||
<p>{{ 'folderView.noPages' | translate }}</p>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { forkJoin } from 'rxjs';
|
||||
import { LucideAngularModule, LucideIconData, Folder, FileText, Pencil, Trash2, Plus, ChevronRight } from 'lucide-angular';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -24,7 +25,7 @@ import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-folder-view',
|
||||
imports: [LucideAngularModule],
|
||||
imports: [LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './folder-view.component.html',
|
||||
styleUrls: ['./folder-view.component.scss']
|
||||
})
|
||||
@@ -53,7 +54,8 @@ export class FolderViewComponent implements OnInit, OnDestroy {
|
||||
private pageService: PageService,
|
||||
private layoutService: LayoutService,
|
||||
private pageTitleService: PageTitleService,
|
||||
private confirmDialog: ConfirmDialogService
|
||||
private confirmDialog: ConfirmDialogService,
|
||||
private translate: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -146,20 +148,24 @@ export class FolderViewComponent implements OnInit, OnDestroy {
|
||||
this.loreService.getLoreNodeDeletionImpact(this.folderId).subscribe({
|
||||
next: impact => {
|
||||
const parts: string[] = [];
|
||||
if (impact.folders > 0) parts.push(`${impact.folders} sous-dossier${impact.folders > 1 ? 's' : ''}`);
|
||||
if (impact.pages > 0) parts.push(`${impact.pages} page${impact.pages > 1 ? 's' : ''}`);
|
||||
if (impact.folders > 0) parts.push(this.translate.instant(
|
||||
impact.folders > 1 ? 'folderView.impact.subfoldersPlural' : 'folderView.impact.subfolders',
|
||||
{ n: impact.folders }));
|
||||
if (impact.pages > 0) parts.push(this.translate.instant(
|
||||
impact.pages > 1 ? 'folderView.impact.pagesPlural' : 'folderView.impact.pages',
|
||||
{ n: impact.pages }));
|
||||
|
||||
const details: string[] = [];
|
||||
if (parts.length) {
|
||||
details.push(`Cette action supprimera aussi : ${parts.join(', ')}.`);
|
||||
details.push(this.translate.instant('folderView.impact.alsoDeletes', { items: parts.join(', ') }));
|
||||
}
|
||||
details.push('Cette action est irréversible.');
|
||||
details.push(this.translate.instant('folderView.impact.irreversible'));
|
||||
|
||||
this.confirmDialog.confirm({
|
||||
title: 'Supprimer le dossier',
|
||||
message: `Supprimer le dossier "${node.name}" ?`,
|
||||
title: this.translate.instant('folderView.deleteConfirmTitle'),
|
||||
message: this.translate.instant('folderView.deleteConfirmMessage', { name: node.name }),
|
||||
details,
|
||||
confirmLabel: 'Supprimer',
|
||||
confirmLabel: this.translate.instant('common.delete'),
|
||||
variant: 'danger'
|
||||
}).then(ok => {
|
||||
if (!ok) return;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="modal" (click)="$event.stopPropagation()">
|
||||
|
||||
<div class="modal-header">
|
||||
<h2>Créer un nouveau Lore</h2>
|
||||
<h2>{{ 'loreCreate.title' | translate }}</h2>
|
||||
<button class="btn-close" (click)="onCancel()">
|
||||
<lucide-icon [img]="X" [size]="18"></lucide-icon>
|
||||
</button>
|
||||
@@ -11,43 +11,43 @@
|
||||
<form [formGroup]="form" (ngSubmit)="submit()">
|
||||
|
||||
<div class="field">
|
||||
<label for="lore-name">Nom de l'univers *</label>
|
||||
<label for="lore-name">{{ 'loreCreate.nameLabel' | translate }}</label>
|
||||
<input
|
||||
id="lore-name"
|
||||
type="text"
|
||||
formControlName="name"
|
||||
placeholder="Ex: Royaume des Ombres, Cyberpunk 2157..."
|
||||
[placeholder]="'loreCreate.namePlaceholder' | translate"
|
||||
[class.invalid]="form.get('name')?.invalid && form.get('name')?.touched"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="lore-description">Description</label>
|
||||
<label for="lore-description">{{ 'common.description' | translate }}</label>
|
||||
<textarea
|
||||
id="lore-description"
|
||||
formControlName="description"
|
||||
placeholder="Décrivez brièvement votre univers, son ambiance, son genre..."
|
||||
[placeholder]="'loreCreate.descriptionPlaceholder' | translate"
|
||||
rows="5"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<p><strong>💡 Astuce :</strong> Votre lore sera créé avec quelques templates par défaut :</p>
|
||||
<p [innerHTML]="'loreCreate.infoIntro' | translate"></p>
|
||||
<ul>
|
||||
<li>PNJ - Pour vos personnages</li>
|
||||
<li>Lieu - Pour vos villes et régions</li>
|
||||
<li>Faction - Pour vos organisations</li>
|
||||
<li>Objet - Pour vos artefacts</li>
|
||||
<li>{{ 'loreCreate.infoNpc' | translate }}</li>
|
||||
<li>{{ 'loreCreate.infoPlace' | translate }}</li>
|
||||
<li>{{ 'loreCreate.infoFaction' | translate }}</li>
|
||||
<li>{{ 'loreCreate.infoItem' | translate }}</li>
|
||||
</ul>
|
||||
<p class="info-footer">Vous pourrez créer vos propres templates ensuite !</p>
|
||||
<p class="info-footer">{{ 'loreCreate.infoFooter' | translate }}</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-actions">
|
||||
<button type="submit" class="btn-primary" [disabled]="form.invalid">
|
||||
<lucide-icon [img]="BookCopy" [size]="16"></lucide-icon>
|
||||
Créer le lore
|
||||
{{ 'loreCreate.submit' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary" (click)="onCancel()">Annuler</button>
|
||||
<button type="button" class="btn-secondary" (click)="onCancel()">{{ 'common.cancel' | translate }}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -2,10 +2,11 @@ import { Component, EventEmitter, Output } from '@angular/core';
|
||||
|
||||
import { ReactiveFormsModule, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { LucideAngularModule, BookCopy, X } from 'lucide-angular';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-lore-create',
|
||||
imports: [ReactiveFormsModule, LucideAngularModule],
|
||||
imports: [ReactiveFormsModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './lore-create.component.html',
|
||||
styleUrls: ['./lore-create.component.scss']
|
||||
})
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button type="button" class="btn-secondary" (click)="openGraph()"
|
||||
title="Visualiser le graphe des pages et de leurs liens (PNJ inclus)">
|
||||
[title]="'loreDetail.graphTitle' | translate">
|
||||
<lucide-icon [img]="Network" [size]="14"></lucide-icon>
|
||||
Graphe
|
||||
{{ 'loreDetail.graph' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary" (click)="startEdit()" title="Modifier le Lore">
|
||||
<button type="button" class="btn-secondary" (click)="startEdit()" [title]="'loreDetail.editTitle' | translate">
|
||||
<lucide-icon [img]="Pencil" [size]="14"></lucide-icon>
|
||||
Modifier
|
||||
{{ 'common.edit' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn-danger" (click)="deleteLore()" title="Supprimer le Lore">
|
||||
<button type="button" class="btn-danger" (click)="deleteLore()" [title]="'loreDetail.deleteTitle' | translate">
|
||||
<lucide-icon [img]="Trash2" [size]="14"></lucide-icon>
|
||||
Supprimer
|
||||
{{ 'common.delete' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,19 +28,19 @@
|
||||
@if (editing) {
|
||||
<div class="detail-header edit-mode">
|
||||
<div class="field">
|
||||
<label for="lore-detail-edit-name">Nom</label>
|
||||
<label for="lore-detail-edit-name">{{ 'common.name' | translate }}</label>
|
||||
<input id="lore-detail-edit-name" type="text" [(ngModel)]="editName" name="editName" required />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="lore-detail-edit-description">Description</label>
|
||||
<label for="lore-detail-edit-description">{{ 'common.description' | translate }}</label>
|
||||
<textarea id="lore-detail-edit-description" [(ngModel)]="editDescription" name="editDescription" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button type="button" class="btn-primary" (click)="saveEdit()" [disabled]="!editName.trim()">
|
||||
Sauvegarder
|
||||
{{ 'common.save' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary" (click)="cancelEdit()">
|
||||
Annuler
|
||||
{{ 'common.cancel' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,10 +49,10 @@
|
||||
@if (!editing) {
|
||||
<section class="detail-section nodes-section">
|
||||
<div class="section-header">
|
||||
<h2>Dossiers</h2>
|
||||
<h2>{{ 'loreDetail.folders' | translate }}</h2>
|
||||
<button class="btn-add" (click)="navigateToCreateNode()">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
Nouveau dossier
|
||||
{{ 'loreDetail.newFolder' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
<!-- rootNodes : uniquement les dossiers racine (pas les sous-dossiers,
|
||||
@@ -70,10 +70,10 @@
|
||||
@if (rootNodes.length === 0) {
|
||||
<div class="empty-state">
|
||||
<lucide-icon [img]="Folder" [size]="40" class="empty-icon"></lucide-icon>
|
||||
<p>Aucun dossier pour le moment.</p>
|
||||
<p>{{ 'loreDetail.noFolders' | translate }}</p>
|
||||
<button class="btn-add-first" (click)="navigateToCreateNode()">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
Créer votre premier dossier
|
||||
{{ 'loreDetail.createFirstFolder' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { LucideAngularModule, Folder, Plus, Pencil, Trash2, Network } from 'lucide-angular';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -14,7 +15,7 @@ import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog
|
||||
|
||||
@Component({
|
||||
selector: 'app-lore-detail',
|
||||
imports: [FormsModule, LucideAngularModule],
|
||||
imports: [FormsModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './lore-detail.component.html',
|
||||
styleUrls: ['./lore-detail.component.scss']
|
||||
})
|
||||
@@ -44,7 +45,8 @@ export class LoreDetailComponent implements OnInit, OnDestroy {
|
||||
private pageService: PageService,
|
||||
private layoutService: LayoutService,
|
||||
private pageTitleService: PageTitleService,
|
||||
private confirmDialog: ConfirmDialogService
|
||||
private confirmDialog: ConfirmDialogService,
|
||||
private translate: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -130,27 +132,32 @@ export class LoreDetailComponent implements OnInit, OnDestroy {
|
||||
this.loreService.getLoreDeletionImpact(lore.id!).subscribe({
|
||||
next: impact => {
|
||||
const deleted: string[] = [];
|
||||
if (impact.folders > 0) deleted.push(`${impact.folders} dossier${impact.folders > 1 ? 's' : ''}`);
|
||||
if (impact.pages > 0) deleted.push(`${impact.pages} page${impact.pages > 1 ? 's' : ''}`);
|
||||
if (impact.templates > 0) deleted.push(`${impact.templates} template${impact.templates > 1 ? 's' : ''}`);
|
||||
if (impact.folders > 0) deleted.push(this.translate.instant(
|
||||
impact.folders > 1 ? 'loreDetail.impact.foldersPlural' : 'loreDetail.impact.folders',
|
||||
{ n: impact.folders }));
|
||||
if (impact.pages > 0) deleted.push(this.translate.instant(
|
||||
impact.pages > 1 ? 'loreDetail.impact.pagesPlural' : 'loreDetail.impact.pages',
|
||||
{ n: impact.pages }));
|
||||
if (impact.templates > 0) deleted.push(this.translate.instant(
|
||||
impact.templates > 1 ? 'loreDetail.impact.templatesPlural' : 'loreDetail.impact.templates',
|
||||
{ n: impact.templates }));
|
||||
|
||||
const details: string[] = [];
|
||||
if (deleted.length) {
|
||||
details.push(`Cette action supprimera aussi : ${deleted.join(', ')}.`);
|
||||
details.push(this.translate.instant('loreDetail.impact.alsoDeletes', { items: deleted.join(', ') }));
|
||||
}
|
||||
if (impact.detachedCampaigns > 0) {
|
||||
details.push(
|
||||
`${impact.detachedCampaigns} campagne${impact.detachedCampaigns > 1 ? 's' : ''} ${impact.detachedCampaigns > 1 ? 'seront conservées' : 'sera conservée'} ` +
|
||||
`mais ${impact.detachedCampaigns > 1 ? 'perdront' : 'perdra'} leur lien vers cet univers.`
|
||||
);
|
||||
details.push(this.translate.instant(
|
||||
impact.detachedCampaigns > 1 ? 'loreDetail.impact.detachedCampaignsPlural' : 'loreDetail.impact.detachedCampaigns',
|
||||
{ n: impact.detachedCampaigns }));
|
||||
}
|
||||
details.push('Cette action est irréversible.');
|
||||
details.push(this.translate.instant('loreDetail.impact.irreversible'));
|
||||
|
||||
this.confirmDialog.confirm({
|
||||
title: 'Supprimer le Lore',
|
||||
message: `Supprimer définitivement le Lore "${lore.name}" ?`,
|
||||
title: this.translate.instant('loreDetail.deleteConfirmTitle'),
|
||||
message: this.translate.instant('loreDetail.deleteConfirmMessage', { name: lore.name }),
|
||||
details,
|
||||
confirmLabel: 'Supprimer',
|
||||
confirmLabel: this.translate.instant('common.delete'),
|
||||
variant: 'danger'
|
||||
}).then(ok => {
|
||||
if (!ok) return;
|
||||
|
||||
@@ -3,28 +3,27 @@
|
||||
<header class="graph-header">
|
||||
<button type="button" class="btn-back" (click)="back()">
|
||||
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon>
|
||||
Retour au Lore
|
||||
{{ 'loreGraph.back' | translate }}
|
||||
</button>
|
||||
<div class="graph-title">
|
||||
<h1>
|
||||
<lucide-icon [img]="Network" [size]="20"></lucide-icon>
|
||||
{{ lore.name }} — Graphe
|
||||
{{ 'loreGraph.title' | translate:{ name: lore.name } }}
|
||||
</h1>
|
||||
<p class="graph-subtitle">
|
||||
{{ nodes.length - npcCount }} page(s) · {{ npcCount }} PNJ · {{ edgeCount }} lien(s).
|
||||
Cliquez sur un nœud pour l'ouvrir, glissez-le pour réarranger.
|
||||
{{ 'loreGraph.subtitle' | translate:{ pages: (nodes.length - npcCount), npcs: npcCount, edges: edgeCount } }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="graph-legend">
|
||||
<span class="legend-item"><span class="legend-dot legend-dot--page"></span> Page de Lore</span>
|
||||
<span class="legend-item"><span class="legend-dot legend-dot--npc"></span> PNJ</span>
|
||||
<span class="legend-item"><span class="legend-line legend-line--npc"></span> Lien PNJ → page</span>
|
||||
<span class="legend-item"><span class="legend-dot legend-dot--page"></span> {{ 'loreGraph.legendPage' | translate }}</span>
|
||||
<span class="legend-item"><span class="legend-dot legend-dot--npc"></span> {{ 'loreGraph.legendNpc' | translate }}</span>
|
||||
<span class="legend-item"><span class="legend-line legend-line--npc"></span> {{ 'loreGraph.legendLink' | translate }}</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@if (nodes.length === 0) {
|
||||
<div class="graph-empty">
|
||||
Aucune page dans ce Lore pour l'instant — le graphe se remplira au fur et à mesure.
|
||||
{{ 'loreGraph.empty' | translate }}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="graph-scroll">
|
||||
@@ -62,8 +61,7 @@
|
||||
</div>
|
||||
@if (edgeCount === 0) {
|
||||
<p class="graph-hint">
|
||||
Aucun lien pour l'instant : liez des pages entre elles (« Pages liées » d'une page)
|
||||
ou rattachez un PNJ à des pages de Lore depuis sa fiche.
|
||||
{{ 'loreGraph.hint' | translate }}
|
||||
</p>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild } from '@angular/co
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
import { forkJoin } from 'rxjs';
|
||||
import { LucideAngularModule, ArrowLeft, Network } from 'lucide-angular';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -45,7 +46,7 @@ interface GraphEdge {
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-lore-graph',
|
||||
imports: [RouterModule, LucideAngularModule],
|
||||
imports: [RouterModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './lore-graph.component.html',
|
||||
styleUrls: ['./lore-graph.component.scss']
|
||||
})
|
||||
@@ -86,7 +87,8 @@ export class LoreGraphComponent implements OnInit, OnDestroy {
|
||||
private pageService: PageService,
|
||||
private npcService: NpcService,
|
||||
private layoutService: LayoutService,
|
||||
private pageTitleService: PageTitleService
|
||||
private pageTitleService: PageTitleService,
|
||||
private translate: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -97,7 +99,7 @@ export class LoreGraphComponent implements OnInit, OnDestroy {
|
||||
}).subscribe(({ sidebar, npcs }) => {
|
||||
this.lore = sidebar.lore;
|
||||
this.layoutService.show(buildLoreSidebarConfig(sidebar));
|
||||
this.pageTitleService.set(`${sidebar.lore.name} — Graphe`);
|
||||
this.pageTitleService.set(this.translate.instant('loreGraph.title', { name: sidebar.lore.name }));
|
||||
this.buildGraph(sidebar.pages, npcs);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
<div class="node-create-page">
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Créer un nouveau dossier</h1>
|
||||
<p class="subtitle">Les dossiers permettent d'organiser vos pages par catégorie</p>
|
||||
<h1>{{ 'loreNodeCreate.title' | translate }}</h1>
|
||||
<p class="subtitle">{{ 'loreNodeCreate.subtitle' | translate }}</p>
|
||||
</div>
|
||||
|
||||
<form [formGroup]="form" (ngSubmit)="submit()" class="node-form">
|
||||
|
||||
<div class="field">
|
||||
<label>Nom du dossier *</label>
|
||||
<label>{{ 'loreNodeCreate.nameLabel' | translate }}</label>
|
||||
<input
|
||||
type="text"
|
||||
formControlName="name"
|
||||
placeholder="Ex: Personnages, Créatures..."
|
||||
[placeholder]="'loreNodeCreate.namePlaceholder' | translate"
|
||||
[class.invalid]="form.get('name')?.invalid && form.get('name')?.touched"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>Dossier parent <span class="optional">(optionnel)</span></label>
|
||||
<label>{{ 'loreNodeCreate.parentLabel' | translate }} <span class="optional">{{ 'common.optional' | translate }}</span></label>
|
||||
<select formControlName="parentId">
|
||||
<option value="">— Racine du Lore —</option>
|
||||
<option value="">{{ 'loreNodeCreate.rootOption' | translate }}</option>
|
||||
@for (parent of availableParents; track parent) {
|
||||
<option [value]="parent.id">{{ parent.name }}</option>
|
||||
}
|
||||
</select>
|
||||
<p class="hint">Laissez vide pour créer un dossier à la racine du lore</p>
|
||||
<p class="hint">{{ 'loreNodeCreate.parentHint' | translate }}</p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>Icône</label>
|
||||
<label>{{ 'loreNodeCreate.iconLabel' | translate }}</label>
|
||||
<div class="icon-grid">
|
||||
@for (option of iconOptions; track option) {
|
||||
<button
|
||||
@@ -44,10 +44,10 @@
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>Description <span class="optional">(optionnel)</span></label>
|
||||
<label>{{ 'common.description' | translate }} <span class="optional">{{ 'common.optional' | translate }}</span></label>
|
||||
<textarea
|
||||
formControlName="description"
|
||||
placeholder="Décrivez le type de contenu que ce dossier contiendra..."
|
||||
[placeholder]="'loreNodeCreate.descriptionPlaceholder' | translate"
|
||||
rows="4">
|
||||
</textarea>
|
||||
</div>
|
||||
@@ -55,9 +55,9 @@
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn-primary" [disabled]="form.invalid">
|
||||
<lucide-icon [img]="getIcon(selectedIcon)" [size]="16"></lucide-icon>
|
||||
Créer le dossier
|
||||
{{ 'loreNodeCreate.submit' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary" (click)="cancel()">Annuler</button>
|
||||
<button type="button" class="btn-secondary" (click)="cancel()">{{ 'common.cancel' | translate }}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { ReactiveFormsModule, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { LucideAngularModule, LucideIconData } from 'lucide-angular';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -14,7 +15,7 @@ import { LORE_ICON_OPTIONS, IconOption, resolveIcon } from '../lore-icons';
|
||||
|
||||
@Component({
|
||||
selector: 'app-lore-node-create',
|
||||
imports: [ReactiveFormsModule, LucideAngularModule],
|
||||
imports: [ReactiveFormsModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './lore-node-create.component.html',
|
||||
styleUrls: ['./lore-node-create.component.scss']
|
||||
})
|
||||
|
||||
@@ -2,39 +2,39 @@
|
||||
<div class="page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1>Éditer le dossier</h1>
|
||||
<h1>{{ 'loreNodeEdit.title' | translate }}</h1>
|
||||
<p class="subtitle">
|
||||
{{ childFolderCount }} sous-dossier(s) · {{ pageCount }} page(s)
|
||||
{{ 'loreNodeEdit.summary' | translate:{ folders: childFolderCount, pages: pageCount } }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button type="button" class="btn-secondary" (click)="cancel()">Annuler</button>
|
||||
<button type="button" class="btn-secondary" (click)="cancel()">{{ 'common.cancel' | translate }}</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn-primary"
|
||||
[disabled]="form.invalid"
|
||||
(click)="save()">
|
||||
Sauvegarder
|
||||
{{ 'common.save' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
<form [formGroup]="form" class="edit-form">
|
||||
<div class="field">
|
||||
<label>Nom du dossier *</label>
|
||||
<label>{{ 'loreNodeEdit.nameLabel' | translate }}</label>
|
||||
<input type="text" formControlName="name" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Dossier parent <span class="optional">(optionnel)</span></label>
|
||||
<label>{{ 'loreNodeEdit.parentLabel' | translate }} <span class="optional">{{ 'common.optional' | translate }}</span></label>
|
||||
<select formControlName="parentId">
|
||||
<option value="">— Racine du Lore —</option>
|
||||
<option value="">{{ 'loreNodeEdit.rootOption' | translate }}</option>
|
||||
@for (parent of availableParents; track parent) {
|
||||
<option [value]="parent.id">{{ parent.name }}</option>
|
||||
}
|
||||
</select>
|
||||
<p class="hint">Vous ne pouvez pas choisir un sous-dossier du dossier courant (cycle interdit)</p>
|
||||
<p class="hint">{{ 'loreNodeEdit.parentHint' | translate }}</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Icône</label>
|
||||
<label>{{ 'loreNodeEdit.iconLabel' | translate }}</label>
|
||||
<div class="icon-grid">
|
||||
@for (option of iconOptions; track option) {
|
||||
<button
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ReactiveFormsModule, FormBuilder, FormGroup, Validators } from '@angula
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { forkJoin } from 'rxjs';
|
||||
import { LucideAngularModule, LucideIconData } from 'lucide-angular';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -32,7 +33,7 @@ import { LORE_ICON_OPTIONS, IconOption } from '../lore-icons';
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-lore-node-edit',
|
||||
imports: [ReactiveFormsModule, LucideAngularModule],
|
||||
imports: [ReactiveFormsModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './lore-node-edit.component.html',
|
||||
styleUrls: ['./lore-node-edit.component.scss']
|
||||
})
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
<div class="lore-hero">
|
||||
<lucide-icon [img]="BookOpen" [size]="56" class="hero-icon"></lucide-icon>
|
||||
<h1>Vos Univers</h1>
|
||||
<p class="hero-subtitle">Sélectionnez un lore existant ou créez un nouvel univers</p>
|
||||
<h1>{{ 'lore.heroTitle' | translate }}</h1>
|
||||
<p class="hero-subtitle">{{ 'lore.heroSubtitle' | translate }}</p>
|
||||
</div>
|
||||
|
||||
<div class="lore-grid">
|
||||
@@ -12,13 +12,13 @@
|
||||
<div class="lore-card" (click)="navigateToDetail(lore.id!)">
|
||||
<div class="card-header">
|
||||
<lucide-icon [img]="Folder" [size]="20" class="card-icon"></lucide-icon>
|
||||
<span class="card-date">Il y a 2h</span>
|
||||
<span class="card-date">{{ 'lore.cardDate' | translate }}</span>
|
||||
</div>
|
||||
<h2>{{ lore.name }}</h2>
|
||||
<p class="card-description">{{ lore.description }}</p>
|
||||
<div class="card-stats">
|
||||
<span>📄 {{ lore.pageCount || 0 }} pages</span>
|
||||
<span>🌳 {{ lore.nodeCount || 0 }} dossiers</span>
|
||||
<span>📄 {{ 'lore.statPages' | translate:{ n: (lore.pageCount || 0) } }}</span>
|
||||
<span>🌳 {{ 'lore.statFolders' | translate:{ n: (lore.nodeCount || 0) } }}</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -27,13 +27,13 @@
|
||||
<div class="new-icon">
|
||||
<lucide-icon [img]="Plus" [size]="20"></lucide-icon>
|
||||
</div>
|
||||
<h2>Nouveau Lore</h2>
|
||||
<p class="card-description">Créez un nouvel univers</p>
|
||||
<h2>{{ 'lore.newLore' | translate }}</h2>
|
||||
<p class="card-description">{{ 'lore.newLoreSubtitle' | translate }}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<p class="tip">💡 Astuce : Utilisez les templates pour structurer votre univers de manière cohérente</p>
|
||||
<p class="tip">{{ 'lore.tip' | translate }}</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { Router } from '@angular/router';
|
||||
import { LucideAngularModule, BookOpen, Folder, Plus } from 'lucide-angular';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { LoreService } from '../services/lore.service';
|
||||
import { LayoutService } from '../services/layout.service';
|
||||
import { Lore } from '../services/lore.model';
|
||||
@@ -9,7 +10,7 @@ import { LoreCreateComponent } from './lore-create/lore-create.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-lore',
|
||||
imports: [LucideAngularModule, LoreCreateComponent],
|
||||
imports: [LucideAngularModule, TranslatePipe, LoreCreateComponent],
|
||||
templateUrl: './lore.component.html',
|
||||
styleUrls: ['./lore.component.scss']
|
||||
})
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<div class="page">
|
||||
|
||||
<header class="page-header">
|
||||
<h1>Créer une nouvelle Page</h1>
|
||||
<p class="subtitle">Créez une page à partir d'un template existant</p>
|
||||
<h1>{{ 'pageCreate.title' | translate }}</h1>
|
||||
<p class="subtitle">{{ 'pageCreate.subtitle' | translate }}</p>
|
||||
</header>
|
||||
|
||||
<form [formGroup]="form" (ngSubmit)="submit()" class="page-form">
|
||||
|
||||
<!-- Titre -->
|
||||
<div class="field">
|
||||
<label for="page-title">Titre de la page *</label>
|
||||
<input id="page-title" type="text" formControlName="title" placeholder="Ex: Maître Eldrin, La Cité d'Argent..." />
|
||||
<label for="page-title">{{ 'pageCreate.pageTitleLabel' | translate }}</label>
|
||||
<input id="page-title" type="text" formControlName="title" [placeholder]="'pageCreate.pageTitlePlaceholder' | translate" />
|
||||
</div>
|
||||
|
||||
<!-- Template -->
|
||||
<div class="field">
|
||||
<label>Template *</label>
|
||||
<label>{{ 'pageCreate.templateLabel' | translate }}</label>
|
||||
|
||||
@if (templates.length) {
|
||||
<div class="templates-grid">
|
||||
@@ -39,20 +39,20 @@
|
||||
[routerLink]="['/lore', loreId, 'templates', 'create']"
|
||||
[queryParams]="{ returnTo: 'page-create' }"
|
||||
(click)="saveDraft()"
|
||||
title="Créer un nouveau template pour ce Lore">
|
||||
[title]="'pageCreate.createTemplateTitle' | translate">
|
||||
<div class="template-card-head">
|
||||
<lucide-icon [img]="Plus" [size]="16"></lucide-icon>
|
||||
<span class="template-name">Créer un template</span>
|
||||
<span class="template-name">{{ 'pageCreate.createTemplate' | translate }}</span>
|
||||
</div>
|
||||
<p class="template-description">
|
||||
Vous reviendrez ici automatiquement, votre saisie sera conservée.
|
||||
{{ 'pageCreate.createTemplateHint' | translate }}
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
} @else {
|
||||
<p class="empty-hint">
|
||||
Aucun template défini pour ce Lore.
|
||||
<a [routerLink]="['/lore', loreId, 'templates', 'create']" [queryParams]="{ returnTo: 'page-create' }" (click)="saveDraft()">Créer un template</a> d'abord.
|
||||
{{ 'pageCreate.noTemplates' | translate }}
|
||||
<a [routerLink]="['/lore', loreId, 'templates', 'create']" [queryParams]="{ returnTo: 'page-create' }" (click)="saveDraft()">{{ 'pageCreate.createTemplate' | translate }}</a> {{ 'pageCreate.firstSuffix' | translate }}
|
||||
</p>
|
||||
}
|
||||
|
||||
@@ -60,30 +60,27 @@
|
||||
|
||||
<!-- Dossier de destination -->
|
||||
<div class="field">
|
||||
<label for="page-node">Dossier de destination *</label>
|
||||
<label for="page-node">{{ 'pageCreate.nodeLabel' | translate }}</label>
|
||||
|
||||
@if (nodes.length) {
|
||||
<select id="page-node" formControlName="nodeId">
|
||||
<option value="" disabled>Sélectionnez un dossier</option>
|
||||
<option value="" disabled>{{ 'pageCreate.nodePlaceholder' | translate }}</option>
|
||||
@for (node of nodes; track node) {
|
||||
<option [value]="node.id">{{ node.name }}</option>
|
||||
}
|
||||
</select>
|
||||
<p class="hint">La page sera créée dans ce dossier</p>
|
||||
<p class="hint">{{ 'pageCreate.nodeHint' | translate }}</p>
|
||||
} @else {
|
||||
<p class="empty-hint">
|
||||
Aucun dossier dans ce Lore.
|
||||
<a [routerLink]="['/lore', loreId, 'nodes', 'create']" [queryParams]="{ returnTo: 'page-create' }" (click)="saveDraft()">Créer un dossier</a> d'abord.
|
||||
{{ 'pageCreate.noNodes' | translate }}
|
||||
<a [routerLink]="['/lore', loreId, 'nodes', 'create']" [queryParams]="{ returnTo: 'page-create' }" (click)="saveDraft()">{{ 'pageCreate.createNode' | translate }}</a> {{ 'pageCreate.firstSuffix' | translate }}
|
||||
</p>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Aide contextuelle -->
|
||||
<div class="info-box">
|
||||
💡 Option 1 : <strong>Créer la page</strong> vide, puis remplir les champs manuellement.<br>
|
||||
💡 Option 2 : <strong>Créer avec l'IA</strong> pour dialoguer avec un assistant qui pré-remplira les champs.
|
||||
</div>
|
||||
<div class="info-box" [innerHTML]="'pageCreate.infoBox' | translate"></div>
|
||||
|
||||
<!-- Erreur wizard (parsing <values> ou échec HTTP) -->
|
||||
@if (wizardError) {
|
||||
@@ -92,13 +89,13 @@
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="actions-row">
|
||||
<button type="button" class="btn-secondary" (click)="cancel()">Annuler</button>
|
||||
<button type="button" class="btn-secondary" (click)="cancel()">{{ 'common.cancel' | translate }}</button>
|
||||
<button type="button" class="btn-ai" (click)="openWizard()" [disabled]="!canSubmit"
|
||||
title="Ouvrir l'assistant IA pour pré-remplir les champs">
|
||||
[title]="'pageCreate.aiTitle' | translate">
|
||||
<lucide-icon [img]="Sparkles" [size]="14"></lucide-icon>
|
||||
Créer avec l'IA
|
||||
{{ 'pageCreate.createWithAi' | translate }}
|
||||
</button>
|
||||
<button type="submit" class="btn-primary" [disabled]="!canSubmit">Créer la page</button>
|
||||
<button type="submit" class="btn-primary" [disabled]="!canSubmit">{{ 'pageCreate.createPage' | translate }}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { ReactiveFormsModule, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
import { LucideAngularModule, FileText, Sparkles, Plus } from 'lucide-angular';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -26,7 +27,7 @@ import { AiChatDrawerComponent, ChatPrimaryAction } from '../../shared/ai-chat-d
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-page-create',
|
||||
imports: [ReactiveFormsModule, RouterModule, LucideAngularModule, AiChatDrawerComponent],
|
||||
imports: [ReactiveFormsModule, RouterModule, LucideAngularModule, TranslatePipe, AiChatDrawerComponent],
|
||||
templateUrl: './page-create.component.html',
|
||||
styleUrls: ['./page-create.component.scss']
|
||||
})
|
||||
@@ -53,13 +54,9 @@ export class PageCreateComponent implements OnInit, OnDestroy {
|
||||
/** Erreur de parsing du bloc <values> — affichée sous le drawer. */
|
||||
wizardError: string | null = null;
|
||||
/** Action primaire du wizard : applique les valeurs extraites et crée la page. */
|
||||
readonly wizardPrimaryAction: ChatPrimaryAction = { label: 'Appliquer et créer la page' };
|
||||
readonly wizardPrimaryAction: ChatPrimaryAction;
|
||||
/** Suggestions rapides orientées "affiner le résultat" (mode wizard). */
|
||||
readonly wizardSuggestions: string[] = [
|
||||
'Rends la description plus courte',
|
||||
'Ajoute un trait distinctif marquant',
|
||||
'Donne un ton plus sombre'
|
||||
];
|
||||
readonly wizardSuggestions: string[];
|
||||
|
||||
constructor(
|
||||
private fb: FormBuilder,
|
||||
@@ -69,16 +66,23 @@ export class PageCreateComponent implements OnInit, OnDestroy {
|
||||
private templateService: TemplateService,
|
||||
private pageService: PageService,
|
||||
private layoutService: LayoutService,
|
||||
private pageTitleService: PageTitleService
|
||||
private pageTitleService: PageTitleService,
|
||||
private translate: TranslateService
|
||||
) {
|
||||
this.form = this.fb.group({
|
||||
title: ['', Validators.required],
|
||||
nodeId: ['', Validators.required]
|
||||
});
|
||||
this.wizardPrimaryAction = { label: this.translate.instant('pageCreate.wizardPrimaryAction') };
|
||||
this.wizardSuggestions = [
|
||||
this.translate.instant('pageCreate.wizardSuggestion1'),
|
||||
this.translate.instant('pageCreate.wizardSuggestion2'),
|
||||
this.translate.instant('pageCreate.wizardSuggestion3')
|
||||
];
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.pageTitleService.set('Nouvelle page');
|
||||
this.pageTitleService.set(this.translate.instant('pageCreate.pageTitle'));
|
||||
this.loreId = this.route.snapshot.paramMap.get('loreId')!;
|
||||
this.preselectedNodeId = this.route.snapshot.paramMap.get('nodeId');
|
||||
|
||||
@@ -248,12 +252,12 @@ export class PageCreateComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
applyWizardAndCreate(): void {
|
||||
if (!this.canSubmit || !this.lastWizardReply) {
|
||||
this.wizardError = "L'assistant n'a pas encore répondu. Décrivez d'abord votre idée.";
|
||||
this.wizardError = this.translate.instant('pageCreate.errorNoReply');
|
||||
return;
|
||||
}
|
||||
const values = this.extractValuesBlock(this.lastWizardReply);
|
||||
if (!values) {
|
||||
this.wizardError = "Impossible d'extraire les valeurs. Demandez à l'assistant de proposer à nouveau.";
|
||||
this.wizardError = this.translate.instant('pageCreate.errorNoValues');
|
||||
return;
|
||||
}
|
||||
this.wizardError = null;
|
||||
@@ -271,10 +275,10 @@ export class PageCreateComponent implements OnInit, OnDestroy {
|
||||
const updated = { ...created, values };
|
||||
this.pageService.update(created.id!, updated).subscribe({
|
||||
next: () => this.router.navigate(['/lore', this.loreId, 'pages', created.id, 'edit']),
|
||||
error: () => this.wizardError = 'Page créée, mais impossible d\'appliquer les valeurs.'
|
||||
error: () => this.wizardError = this.translate.instant('pageCreate.errorApplyValues')
|
||||
});
|
||||
},
|
||||
error: () => this.wizardError = 'Erreur lors de la création de la page.'
|
||||
error: () => this.wizardError = this.translate.instant('pageCreate.errorCreate')
|
||||
});
|
||||
}
|
||||
|
||||
@@ -313,8 +317,8 @@ Les clés du JSON doivent correspondre EXACTEMENT aux noms de champs indiqués.
|
||||
/** Welcome message contextualisé au template choisi. */
|
||||
get wizardWelcome(): string {
|
||||
const tpl = this.selectedTemplate;
|
||||
if (!tpl) return 'Décrivez ce que vous souhaitez créer.';
|
||||
return `Super, on va créer une page "${tpl.name}" ! Décrivez-la-moi en quelques mots — contexte, rôle, traits marquants — et je proposerai des valeurs pour chaque champ.`;
|
||||
if (!tpl) return this.translate.instant('pageCreate.wizardWelcomeEmpty');
|
||||
return this.translate.instant('pageCreate.wizardWelcome', { name: tpl.name });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,48 +4,48 @@
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1>{{ page.title }}</h1>
|
||||
<p class="subtitle">{{ template?.name || 'Page' }}</p>
|
||||
<p class="subtitle">{{ template?.name || ('pageEdit.pageFallback' | translate) }}</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button type="button" class="btn-ai"
|
||||
(click)="toggleChat()"
|
||||
[disabled]="aiLoading"
|
||||
[class.active]="chatOpen"
|
||||
title="Ouvrir l'Assistant IA (chat ou remplissage automatique)">
|
||||
[title]="'pageEdit.aiTitle' | translate">
|
||||
<lucide-icon [img]="Sparkles" [size]="14"></lucide-icon>
|
||||
{{ aiLoading ? 'Génération…' : 'Assistant IA' }}
|
||||
{{ (aiLoading ? 'pageEdit.generating' : 'pageEdit.aiAssistant') | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary" [routerLink]="['/lore', loreId, 'pages', pageId]">Annuler</button>
|
||||
<button type="button" class="btn-danger" (click)="delete()">Supprimer</button>
|
||||
<button type="button" class="btn-secondary" [routerLink]="['/lore', loreId, 'pages', pageId]">{{ 'common.cancel' | translate }}</button>
|
||||
<button type="button" class="btn-danger" (click)="delete()">{{ 'common.delete' | translate }}</button>
|
||||
<button type="button" class="btn-primary" (click)="save()" [disabled]="!title.trim()">
|
||||
Sauvegarder
|
||||
{{ 'common.save' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
@if (aiError) {
|
||||
<div class="ai-error-banner" role="alert">
|
||||
<span>{{ aiError }}</span>
|
||||
<button type="button" class="ai-error-dismiss" (click)="aiError = null" aria-label="Fermer">×</button>
|
||||
<button type="button" class="ai-error-dismiss" (click)="aiError = null" [attr.aria-label]="'common.close' | translate">×</button>
|
||||
</div>
|
||||
}
|
||||
<form class="edit-form">
|
||||
<!-- Identité ----------------------------------------------------- -->
|
||||
<div class="field">
|
||||
<label>Nom</label>
|
||||
<label>{{ 'common.name' | translate }}</label>
|
||||
<input type="text" [(ngModel)]="title" name="title" required />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Dossier</label>
|
||||
<label>{{ 'pageEdit.folder' | translate }}</label>
|
||||
<select [(ngModel)]="nodeId" name="nodeId">
|
||||
@for (node of nodes; track node) {
|
||||
<option [value]="node.id">{{ node.name }}</option>
|
||||
}
|
||||
</select>
|
||||
<p class="hint">Déplacez cette page dans un autre dossier</p>
|
||||
<p class="hint">{{ 'pageEdit.folderHint' | translate }}</p>
|
||||
</div>
|
||||
<!-- Champs dynamiques du template -------------------------------- -->
|
||||
@if (template?.fields?.length) {
|
||||
<h2 class="section-title">Champs</h2>
|
||||
<h2 class="section-title">{{ 'pageEdit.fields' | translate }}</h2>
|
||||
@for (field of template!.fields; track field) {
|
||||
<!-- Champ TEXT : textarea editable -->
|
||||
@if (field.type === 'TEXT') {
|
||||
@@ -55,7 +55,7 @@
|
||||
[(ngModel)]="values[field.name]"
|
||||
[name]="'value_' + field.name"
|
||||
rows="4"
|
||||
[placeholder]="'Valeur pour ' + field.name + '...'">
|
||||
[placeholder]="'pageEdit.valuePlaceholder' | translate:{ field: field.name }">
|
||||
</textarea>
|
||||
</div>
|
||||
}
|
||||
@@ -87,7 +87,7 @@
|
||||
</div>
|
||||
}
|
||||
@if (!(field.labels ?? []).length) {
|
||||
<p class="kv-empty">Aucun libellé défini dans le template pour ce champ.</p>
|
||||
<p class="kv-empty">{{ 'pageEdit.noLabels' | translate }}</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -122,7 +122,7 @@
|
||||
<td class="table-edit-actions-col">
|
||||
<button type="button" class="btn-row-delete"
|
||||
(click)="removeTableRow(field.name, ri)"
|
||||
[attr.aria-label]="'Supprimer la ligne ' + (ri + 1)" title="Supprimer la ligne">
|
||||
[attr.aria-label]="'pageEdit.deleteRowN' | translate:{ n: (ri + 1) }" [title]="'pageEdit.deleteRow' | translate">
|
||||
<lucide-icon [img]="Trash2" [size]="13"></lucide-icon>
|
||||
</button>
|
||||
</td>
|
||||
@@ -132,28 +132,28 @@
|
||||
</table>
|
||||
<button type="button" class="btn-row-add" (click)="addTableRow(field.name, field.labels)">
|
||||
<lucide-icon [img]="Plus" [size]="13"></lucide-icon>
|
||||
Ajouter une ligne
|
||||
{{ 'pageEdit.addRow' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
} @else {
|
||||
<p class="kv-empty">Aucune colonne définie dans le template pour ce tableau.</p>
|
||||
<p class="kv-empty">{{ 'pageEdit.noColumns' | translate }}</p>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
<!-- Tags --------------------------------------------------------- -->
|
||||
<h2 class="section-title">Tags</h2>
|
||||
<h2 class="section-title">{{ 'pageEdit.tags' | translate }}</h2>
|
||||
<div class="field">
|
||||
<app-chips-input
|
||||
[value]="tags"
|
||||
(valueChange)="tags = $event"
|
||||
placeholder="Ajouter un tag (Entrée pour valider)...">
|
||||
[placeholder]="'pageEdit.tagsPlaceholder' | translate">
|
||||
</app-chips-input>
|
||||
<p class="hint">Mots-clés libres pour classer et retrouver cette page</p>
|
||||
<p class="hint">{{ 'pageEdit.tagsHint' | translate }}</p>
|
||||
</div>
|
||||
<!-- Liens vers d'autres pages ----------------------------------- -->
|
||||
<h2 class="section-title">Pages liées</h2>
|
||||
<h2 class="section-title">{{ 'pageEdit.relatedPages' | translate }}</h2>
|
||||
<div class="field">
|
||||
<app-lore-link-picker
|
||||
[value]="relatedPageIds"
|
||||
@@ -162,18 +162,18 @@
|
||||
[loreId]="loreId"
|
||||
(valueChange)="relatedPageIds = $event">
|
||||
</app-lore-link-picker>
|
||||
<p class="hint">Cliquez sur un lien pour ouvrir la page associée</p>
|
||||
<p class="hint">{{ 'pageEdit.relatedPagesHint' | translate }}</p>
|
||||
</div>
|
||||
<!-- Notes privées ----------------------------------------------- -->
|
||||
<h2 class="section-title">Notes privées</h2>
|
||||
<h2 class="section-title">{{ 'pageEdit.privateNotes' | translate }}</h2>
|
||||
<div class="field">
|
||||
<textarea
|
||||
[(ngModel)]="notes"
|
||||
name="notes"
|
||||
rows="4"
|
||||
placeholder="Notes personnelles (non exportées vers FoundryVTT)">
|
||||
[placeholder]="'pageEdit.privateNotesPlaceholder' | translate">
|
||||
</textarea>
|
||||
<p class="hint">Visibles uniquement par vous. Utiles pour préparer vos sessions.</p>
|
||||
<p class="hint">{{ 'pageEdit.privateNotesHint' | translate }}</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { FormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { forkJoin } from 'rxjs';
|
||||
import { LucideAngularModule, Sparkles, Plus, Trash2 } from 'lucide-angular';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -36,7 +37,7 @@ import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-page-edit',
|
||||
imports: [FormsModule, RouterLink, LucideAngularModule, ChipsInputComponent, LoreLinkPickerComponent, BreadcrumbComponent, AiChatDrawerComponent, ImageGalleryComponent],
|
||||
imports: [FormsModule, RouterLink, LucideAngularModule, TranslatePipe, ChipsInputComponent, LoreLinkPickerComponent, BreadcrumbComponent, AiChatDrawerComponent, ImageGalleryComponent],
|
||||
templateUrl: './page-edit.component.html',
|
||||
styleUrls: ['./page-edit.component.scss']
|
||||
})
|
||||
@@ -81,13 +82,9 @@ export class PageEditComponent implements OnInit, OnDestroy {
|
||||
/** Phase b5 — drawer chat IA (conversationnel). */
|
||||
chatOpen = false;
|
||||
/** Action primaire dans le chat : déclenche le one-shot b4 (remplissage automatique). */
|
||||
readonly chatPrimaryAction: ChatPrimaryAction = { label: 'Remplir automatiquement tous les champs' };
|
||||
readonly chatPrimaryAction: ChatPrimaryAction;
|
||||
/** Suggestions rapides hardcodées (MVP). */
|
||||
readonly chatQuickSuggestions: string[] = [
|
||||
"Étoffe l'histoire de cette page",
|
||||
'Suggère des liens avec d\'autres pages du Lore',
|
||||
'Propose une intrigue secondaire'
|
||||
];
|
||||
readonly chatQuickSuggestions: string[];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
@@ -97,8 +94,16 @@ export class PageEditComponent implements OnInit, OnDestroy {
|
||||
private pageService: PageService,
|
||||
private layoutService: LayoutService,
|
||||
private pageTitleService: PageTitleService,
|
||||
private confirmDialog: ConfirmDialogService
|
||||
) {}
|
||||
private confirmDialog: ConfirmDialogService,
|
||||
private translate: TranslateService
|
||||
) {
|
||||
this.chatPrimaryAction = { label: this.translate.instant('pageEdit.chatPrimaryAction') };
|
||||
this.chatQuickSuggestions = [
|
||||
this.translate.instant('pageEdit.chatSuggestion1'),
|
||||
this.translate.instant('pageEdit.chatSuggestion2'),
|
||||
this.translate.instant('pageEdit.chatSuggestion3')
|
||||
];
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loreId = this.route.snapshot.paramMap.get('loreId')!;
|
||||
@@ -267,8 +272,8 @@ export class PageEditComponent implements OnInit, OnDestroy {
|
||||
error: (err) => {
|
||||
this.aiLoading = false;
|
||||
this.aiError = err?.status === 502
|
||||
? "L'assistant IA est injoignable. V\u00e9rifiez que le service Brain tourne."
|
||||
: "\u00c9chec de la g\u00e9n\u00e9ration IA. R\u00e9essayez dans un instant.";
|
||||
? this.translate.instant('pageEdit.aiUnreachable')
|
||||
: this.translate.instant('pageEdit.aiFailed');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -293,9 +298,9 @@ export class PageEditComponent implements OnInit, OnDestroy {
|
||||
delete(): void {
|
||||
if (!this.page) return;
|
||||
this.confirmDialog.confirm({
|
||||
title: 'Supprimer la page',
|
||||
message: `Supprimer la page "${this.page.title}" ?`,
|
||||
confirmLabel: 'Supprimer',
|
||||
title: this.translate.instant('pageEdit.deleteTitle'),
|
||||
message: this.translate.instant('pageEdit.deleteMessage', { title: this.page.title }),
|
||||
confirmLabel: this.translate.instant('common.delete'),
|
||||
variant: 'danger'
|
||||
}).then(ok => {
|
||||
if (!ok || !this.page) return;
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
<header class="view-header">
|
||||
<div>
|
||||
<h1>{{ page.title }}</h1>
|
||||
<p class="view-subtitle">{{ template?.name || 'Page' }}</p>
|
||||
<p class="view-subtitle">{{ template?.name || ('pageView.pageFallback' | translate) }}</p>
|
||||
</div>
|
||||
<div class="view-actions">
|
||||
<button type="button" class="btn-primary" (click)="editMode()">
|
||||
<lucide-icon [img]="Pencil" [size]="14"></lucide-icon>
|
||||
Modifier
|
||||
{{ 'common.edit' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn-danger" (click)="deletePage()" title="Supprimer la page">
|
||||
<button type="button" class="btn-danger" (click)="deletePage()" [title]="'pageView.deleteTitle' | translate">
|
||||
<lucide-icon [img]="Trash2" [size]="14"></lucide-icon>
|
||||
Supprimer
|
||||
{{ 'common.delete' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
@@ -27,7 +27,7 @@
|
||||
@if (valueOf(field.name)) {
|
||||
<p class="view-section-body">{{ valueOf(field.name) }}</p>
|
||||
} @else {
|
||||
<p class="view-section-empty">Non renseigné</p>
|
||||
<p class="view-section-empty">{{ 'pageView.notFilled' | translate }}</p>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<p class="view-section-empty">Non renseigné</p>
|
||||
<p class="view-section-empty">{{ 'pageView.notFilled' | translate }}</p>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
@@ -80,7 +80,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
} @else {
|
||||
<p class="view-section-empty">Non renseigné</p>
|
||||
<p class="view-section-empty">{{ 'pageView.notFilled' | translate }}</p>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
@@ -89,7 +89,7 @@
|
||||
<!-- Tags -->
|
||||
@if ((page.tags?.length ?? 0) > 0) {
|
||||
<section class="view-section">
|
||||
<h2 class="view-section-title">Tags</h2>
|
||||
<h2 class="view-section-title">{{ 'pageView.tags' | translate }}</h2>
|
||||
<div class="view-chips">
|
||||
@for (tag of page.tags; track tag) {
|
||||
<span class="view-chip view-chip--tag">{{ tag }}</span>
|
||||
@@ -100,7 +100,7 @@
|
||||
<!-- Pages liées -->
|
||||
@if ((page.relatedPageIds?.length ?? 0) > 0) {
|
||||
<section class="view-section">
|
||||
<h2 class="view-section-title">Pages liées</h2>
|
||||
<h2 class="view-section-title">{{ 'pageView.relatedPages' | translate }}</h2>
|
||||
<div class="view-chips">
|
||||
@for (relId of page.relatedPageIds; track relId) {
|
||||
<a class="view-chip"
|
||||
@@ -116,7 +116,7 @@
|
||||
<section class="view-section view-section--private">
|
||||
<h2 class="view-section-title">
|
||||
<span class="view-section-icon">🔒</span>
|
||||
Notes privées
|
||||
{{ 'pageView.privateNotes' | translate }}
|
||||
</h2>
|
||||
<p class="view-section-body">{{ page.notes }}</p>
|
||||
</section>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
import { forkJoin } from 'rxjs';
|
||||
import { LucideAngularModule, Pencil, Trash2 } from 'lucide-angular';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -28,7 +29,7 @@ import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-page-view',
|
||||
imports: [RouterModule, LucideAngularModule, BreadcrumbComponent, ImageGalleryComponent],
|
||||
imports: [RouterModule, LucideAngularModule, TranslatePipe, BreadcrumbComponent, ImageGalleryComponent],
|
||||
templateUrl: './page-view.component.html',
|
||||
styleUrls: ['./page-view.component.scss']
|
||||
})
|
||||
@@ -52,7 +53,8 @@ export class PageViewComponent implements OnInit, OnDestroy {
|
||||
private pageService: PageService,
|
||||
private layoutService: LayoutService,
|
||||
private pageTitleService: PageTitleService,
|
||||
private confirmDialog: ConfirmDialogService
|
||||
private confirmDialog: ConfirmDialogService,
|
||||
private translate: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -131,7 +133,7 @@ export class PageViewComponent implements OnInit, OnDestroy {
|
||||
|
||||
/** Helper — résout l'ID d'une page liée en son titre (pour affichage dans les chips). */
|
||||
titleOfRelated(pageId: string): string {
|
||||
return this.allPages.find(p => p.id === pageId)?.title ?? '(page supprimée)';
|
||||
return this.allPages.find(p => p.id === pageId)?.title ?? this.translate.instant('pageView.deletedPage');
|
||||
}
|
||||
|
||||
editMode(): void {
|
||||
@@ -146,10 +148,10 @@ export class PageViewComponent implements OnInit, OnDestroy {
|
||||
if (!this.page) return;
|
||||
const page = this.page;
|
||||
this.confirmDialog.confirm({
|
||||
title: 'Supprimer la page',
|
||||
message: `Supprimer la page "${page.title}" ?`,
|
||||
details: ['Cette action est irréversible.'],
|
||||
confirmLabel: 'Supprimer',
|
||||
title: this.translate.instant('pageView.deleteTitle'),
|
||||
message: this.translate.instant('pageView.deleteMessage', { title: page.title }),
|
||||
details: [this.translate.instant('pageView.deleteIrreversible')],
|
||||
confirmLabel: this.translate.instant('common.delete'),
|
||||
variant: 'danger'
|
||||
}).then(ok => {
|
||||
if (!ok) return;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="page">
|
||||
|
||||
<header class="page-header">
|
||||
<h1>Créer un nouveau Template</h1>
|
||||
<p class="subtitle">Définissez un gabarit personnalisé pour créer des pages cohérentes</p>
|
||||
<h1>{{ 'templateCreate.title' | translate }}</h1>
|
||||
<p class="subtitle">{{ 'templateCreate.subtitle' | translate }}</p>
|
||||
</header>
|
||||
|
||||
<form [formGroup]="form" (ngSubmit)="submit()" class="template-form">
|
||||
@@ -11,32 +11,32 @@
|
||||
<div class="col-left">
|
||||
|
||||
<div class="field">
|
||||
<label for="template-name">Nom du template *</label>
|
||||
<input id="template-name" type="text" formControlName="name" placeholder="Ex: Auberge, Artefact, Monstre..." />
|
||||
<label for="template-name">{{ 'templateCreate.nameLabel' | translate }}</label>
|
||||
<input id="template-name" type="text" formControlName="name" [placeholder]="'templateCreate.namePlaceholder' | translate" />
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="template-description">Description</label>
|
||||
<textarea id="template-description" formControlName="description" rows="4" placeholder="À quoi sert ce template ?"></textarea>
|
||||
<label for="template-description">{{ 'common.description' | translate }}</label>
|
||||
<textarea id="template-description" formControlName="description" rows="4" [placeholder]="'templateCreate.descriptionPlaceholder' | translate"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="template-default-node">Dossier par défaut *</label>
|
||||
<label for="template-default-node">{{ 'templateCreate.defaultNodeLabel' | translate }}</label>
|
||||
|
||||
@if (nodes.length) {
|
||||
<select id="template-default-node" formControlName="defaultNodeId">
|
||||
<option value="" disabled>Sélectionnez un dossier</option>
|
||||
<option value="" disabled>{{ 'templateCreate.nodePlaceholder' | translate }}</option>
|
||||
@for (node of nodes; track node) {
|
||||
<option [value]="node.id">{{ node.name }}</option>
|
||||
}
|
||||
</select>
|
||||
<p class="hint">Les pages créées avec ce template seront placées dans ce dossier</p>
|
||||
<p class="hint">{{ 'templateCreate.defaultNodeHint' | translate }}</p>
|
||||
} @else {
|
||||
<p class="empty-hint">
|
||||
Aucun dossier dans ce Lore.
|
||||
{{ 'templateCreate.noNodes' | translate }}
|
||||
<a [routerLink]="['/lore', loreId, 'nodes', 'create']"
|
||||
[queryParams]="{ returnTo: nodeCreateReturnTo }"
|
||||
(click)="saveDraft()">Créer un dossier</a> d'abord.
|
||||
(click)="saveDraft()">{{ 'templateCreate.createNode' | translate }}</a> {{ 'templateCreate.firstSuffix' | translate }}
|
||||
</p>
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<!-- Colonne droite --------------------------------------------- -->
|
||||
<div class="col-right">
|
||||
|
||||
<label class="section-label">Champs du template *</label>
|
||||
<label class="section-label">{{ 'templateCreate.fieldsLabel' | translate }}</label>
|
||||
|
||||
<ul class="fields-list">
|
||||
@for (f of fields; track f; let i = $index; let first = $first; let last = $last) {
|
||||
@@ -56,13 +56,13 @@
|
||||
<button type="button" class="btn-icon btn-reorder"
|
||||
(click)="moveField(i, -1)"
|
||||
[disabled]="first"
|
||||
aria-label="Monter d'un cran" title="Monter">
|
||||
[attr.aria-label]="'templateCreate.moveUp' | translate" [title]="'templateCreate.moveUp' | translate">
|
||||
<lucide-icon [img]="ChevronUp" [size]="12"></lucide-icon>
|
||||
</button>
|
||||
<button type="button" class="btn-icon btn-reorder"
|
||||
(click)="moveField(i, 1)"
|
||||
[disabled]="last"
|
||||
aria-label="Descendre d'un cran" title="Descendre">
|
||||
[attr.aria-label]="'templateCreate.moveDown' | translate" [title]="'templateCreate.moveDown' | translate">
|
||||
<lucide-icon [img]="ChevronDown" [size]="12"></lucide-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -78,11 +78,11 @@
|
||||
[ngModel]="f.type"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
(ngModelChange)="setFieldType(i, $event)"
|
||||
title="Type du champ">
|
||||
<option value="TEXT">Texte</option>
|
||||
<option value="IMAGE">Image</option>
|
||||
<option value="KEY_VALUE_LIST">Liste clé/valeur</option>
|
||||
<option value="TABLE">Tableau</option>
|
||||
[title]="'templateCreate.fieldTypeTitle' | translate">
|
||||
<option value="TEXT">{{ 'templateCreate.typeText' | translate }}</option>
|
||||
<option value="IMAGE">{{ 'templateCreate.typeImage' | translate }}</option>
|
||||
<option value="KEY_VALUE_LIST">{{ 'templateCreate.typeKeyValue' | translate }}</option>
|
||||
<option value="TABLE">{{ 'templateCreate.typeTable' | translate }}</option>
|
||||
</select>
|
||||
@if (f.type === 'IMAGE') {
|
||||
<select
|
||||
@@ -90,14 +90,14 @@
|
||||
[ngModel]="f.layout ?? 'GALLERY'"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
(ngModelChange)="setFieldLayout(i, $event)"
|
||||
title="Mise en page des images">
|
||||
<option value="GALLERY">Grille</option>
|
||||
<option value="HERO">Heros</option>
|
||||
<option value="MASONRY">Mosaique</option>
|
||||
<option value="CAROUSEL">Carrousel</option>
|
||||
[title]="'templateCreate.layoutTitle' | translate">
|
||||
<option value="GALLERY">{{ 'templateCreate.layoutGallery' | translate }}</option>
|
||||
<option value="HERO">{{ 'templateCreate.layoutHero' | translate }}</option>
|
||||
<option value="MASONRY">{{ 'templateCreate.layoutMasonry' | translate }}</option>
|
||||
<option value="CAROUSEL">{{ 'templateCreate.layoutCarousel' | translate }}</option>
|
||||
</select>
|
||||
}
|
||||
<button type="button" class="btn-icon" (click)="removeField(i)" aria-label="Supprimer">
|
||||
<button type="button" class="btn-icon" (click)="removeField(i)" [attr.aria-label]="'common.delete' | translate">
|
||||
<lucide-icon [img]="Trash2" [size]="14"></lucide-icon>
|
||||
</button>
|
||||
</li>
|
||||
@@ -111,22 +111,20 @@
|
||||
[ngModel]="lbl"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
(ngModelChange)="updateLabel(f, li, $event)"
|
||||
[placeholder]="f.type === 'TABLE' ? 'Colonne' : 'Libellé'"
|
||||
[attr.aria-label]="(f.type === 'TABLE' ? 'Colonne ' : 'Libellé ') + (li + 1)" />
|
||||
<button type="button" class="kv-label-remove" (click)="removeLabel(f, li)" aria-label="Retirer">
|
||||
[placeholder]="(f.type === 'TABLE' ? 'templateCreate.column' : 'templateCreate.label') | translate"
|
||||
[attr.aria-label]="(f.type === 'TABLE' ? 'templateCreate.columnN' : 'templateCreate.labelN') | translate:{ n: (li + 1) }" />
|
||||
<button type="button" class="kv-label-remove" (click)="removeLabel(f, li)" [attr.aria-label]="'common.remove' | translate">
|
||||
<lucide-icon [img]="X" [size]="11"></lucide-icon>
|
||||
</button>
|
||||
</span>
|
||||
}
|
||||
<button type="button" class="btn-kv-add-label" (click)="addLabel(f)">
|
||||
<lucide-icon [img]="Plus" [size]="12"></lucide-icon>
|
||||
{{ f.type === 'TABLE' ? 'Colonne' : 'Libellé' }}
|
||||
{{ (f.type === 'TABLE' ? 'templateCreate.column' : 'templateCreate.label') | translate }}
|
||||
</button>
|
||||
@if (!(f.labels ?? []).length) {
|
||||
<span class="kv-labels-hint">
|
||||
{{ f.type === 'TABLE'
|
||||
? 'Ajoutez les colonnes du tableau (ex : Objet, Prix, Description…)'
|
||||
: 'Ajoutez les libellés des lignes (ex : FOR, DEX, CON…)' }}
|
||||
{{ (f.type === 'TABLE' ? 'templateCreate.tableLabelsHint' : 'templateCreate.kvLabelsHint') | translate }}
|
||||
</span>
|
||||
}
|
||||
</li>
|
||||
@@ -139,31 +137,31 @@
|
||||
type="text"
|
||||
[(ngModel)]="newFieldName"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
placeholder="+ Ajouter un champ"
|
||||
[placeholder]="'templateCreate.addFieldPlaceholder' | translate"
|
||||
(keydown.enter)="$event.preventDefault(); addField()" />
|
||||
<select
|
||||
class="type-select"
|
||||
[(ngModel)]="newFieldType"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
aria-label="Type du champ">
|
||||
<option value="TEXT">Texte</option>
|
||||
<option value="IMAGE">Image</option>
|
||||
<option value="KEY_VALUE_LIST">Liste clé/valeur</option>
|
||||
<option value="TABLE">Tableau</option>
|
||||
[attr.aria-label]="'templateCreate.fieldTypeTitle' | translate">
|
||||
<option value="TEXT">{{ 'templateCreate.typeText' | translate }}</option>
|
||||
<option value="IMAGE">{{ 'templateCreate.typeImage' | translate }}</option>
|
||||
<option value="KEY_VALUE_LIST">{{ 'templateCreate.typeKeyValue' | translate }}</option>
|
||||
<option value="TABLE">{{ 'templateCreate.typeTable' | translate }}</option>
|
||||
</select>
|
||||
<button type="button" class="btn-add" (click)="addField()" title="Ajouter le champ">
|
||||
<button type="button" class="btn-add" (click)="addField()" [title]="'templateCreate.addFieldTitle' | translate">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="hint">Texte = libre + utilisable par l'IA. Image = galerie. Liste clé/valeur = paires libellé/valeur (stats). Tableau = colonnes fixes + lignes ajoutées librement (boutique, inventaire…).</p>
|
||||
<p class="hint">{{ 'templateCreate.fieldsHelp' | translate }}</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Actions ---------------------------------------------------- -->
|
||||
<div class="actions-row">
|
||||
<button type="button" class="btn-secondary" (click)="cancel()">Annuler</button>
|
||||
<button type="submit" class="btn-primary" [disabled]="form.invalid">Créer le template</button>
|
||||
<button type="button" class="btn-secondary" (click)="cancel()">{{ 'common.cancel' | translate }}</button>
|
||||
<button type="submit" class="btn-primary" [disabled]="form.invalid">{{ 'templateCreate.createTemplate' | translate }}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
import { LucideAngularModule, Plus, Trash2, Type, Image as ImageIcon, ChevronUp, ChevronDown, ListOrdered, Table as TableIcon, X } from 'lucide-angular';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -20,7 +21,7 @@ import { popReturnTo } from '../return-stack.helper';
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-template-create',
|
||||
imports: [FormsModule, ReactiveFormsModule, RouterModule, LucideAngularModule],
|
||||
imports: [FormsModule, ReactiveFormsModule, RouterModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './template-create.component.html',
|
||||
styleUrls: ['./template-create.component.scss']
|
||||
})
|
||||
|
||||
@@ -3,38 +3,38 @@
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1>{{ template.name }}</h1>
|
||||
<p class="subtitle">Template</p>
|
||||
<p class="subtitle">{{ 'templateEdit.subtitle' | translate }}</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button type="button" class="btn-danger" (click)="delete()">Supprimer</button>
|
||||
<button type="button" class="btn-primary" (click)="save()" [disabled]="form.invalid">Sauvegarder</button>
|
||||
<button type="button" class="btn-danger" (click)="delete()">{{ 'common.delete' | translate }}</button>
|
||||
<button type="button" class="btn-primary" (click)="save()" [disabled]="form.invalid">{{ 'common.save' | translate }}</button>
|
||||
</div>
|
||||
</header>
|
||||
<form [formGroup]="form" class="template-form">
|
||||
<!-- Colonne gauche ---------------------------------------------- -->
|
||||
<div class="col-left">
|
||||
<div class="field">
|
||||
<label for="template-edit-name">Nom</label>
|
||||
<label for="template-edit-name">{{ 'common.name' | translate }}</label>
|
||||
<input id="template-edit-name" type="text" formControlName="name" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="template-edit-default-node">Dossier par défaut</label>
|
||||
<label for="template-edit-default-node">{{ 'templateEdit.defaultNodeLabel' | translate }}</label>
|
||||
<select id="template-edit-default-node" formControlName="defaultNodeId">
|
||||
<option value="">-- Aucun --</option>
|
||||
<option value="">{{ 'templateEdit.noneOption' | translate }}</option>
|
||||
@for (node of nodes; track node) {
|
||||
<option [value]="node.id">{{ node.name }}</option>
|
||||
}
|
||||
</select>
|
||||
<p class="hint">Les pages créées avec ce template seront placées dans ce dossier par défaut</p>
|
||||
<p class="hint">{{ 'templateEdit.defaultNodeHint' | translate }}</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="template-edit-description">Description</label>
|
||||
<label for="template-edit-description">{{ 'common.description' | translate }}</label>
|
||||
<textarea id="template-edit-description" formControlName="description" rows="6"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Colonne droite --------------------------------------------- -->
|
||||
<div class="col-right">
|
||||
<label class="section-label">Champs du template</label>
|
||||
<label class="section-label">{{ 'templateEdit.fieldsLabel' | translate }}</label>
|
||||
<ul class="fields-list">
|
||||
@for (f of fields; track f; let i = $index; let first = $first; let last = $last) {
|
||||
<li class="field-row">
|
||||
@@ -42,13 +42,13 @@
|
||||
<button type="button" class="btn-icon-ghost btn-reorder"
|
||||
(click)="moveField(i, -1)"
|
||||
[disabled]="first"
|
||||
aria-label="Monter d'un cran" title="Monter">
|
||||
[attr.aria-label]="'templateEdit.moveUp' | translate" [title]="'templateEdit.moveUp' | translate">
|
||||
<lucide-icon [img]="ChevronUp" [size]="12"></lucide-icon>
|
||||
</button>
|
||||
<button type="button" class="btn-icon-ghost btn-reorder"
|
||||
(click)="moveField(i, 1)"
|
||||
[disabled]="last"
|
||||
aria-label="Descendre d'un cran" title="Descendre">
|
||||
[attr.aria-label]="'templateEdit.moveDown' | translate" [title]="'templateEdit.moveDown' | translate">
|
||||
<lucide-icon [img]="ChevronDown" [size]="12"></lucide-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -66,11 +66,11 @@
|
||||
[ngModel]="f.type"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
(ngModelChange)="setFieldType(i, $event)"
|
||||
title="Type du champ">
|
||||
<option value="TEXT">Texte</option>
|
||||
<option value="IMAGE">Image</option>
|
||||
<option value="KEY_VALUE_LIST">Liste clé/valeur</option>
|
||||
<option value="TABLE">Tableau</option>
|
||||
[title]="'templateEdit.fieldTypeTitle' | translate">
|
||||
<option value="TEXT">{{ 'templateEdit.typeText' | translate }}</option>
|
||||
<option value="IMAGE">{{ 'templateEdit.typeImage' | translate }}</option>
|
||||
<option value="KEY_VALUE_LIST">{{ 'templateEdit.typeKeyValue' | translate }}</option>
|
||||
<option value="TABLE">{{ 'templateEdit.typeTable' | translate }}</option>
|
||||
</select>
|
||||
@if (f.type === 'IMAGE') {
|
||||
<select
|
||||
@@ -78,14 +78,14 @@
|
||||
[ngModel]="f.layout ?? 'GALLERY'"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
(ngModelChange)="setFieldLayout(i, $event)"
|
||||
title="Mise en page des images">
|
||||
<option value="GALLERY">Grille</option>
|
||||
<option value="HERO">Heros</option>
|
||||
<option value="MASONRY">Mosaique</option>
|
||||
<option value="CAROUSEL">Carrousel</option>
|
||||
[title]="'templateEdit.layoutTitle' | translate">
|
||||
<option value="GALLERY">{{ 'templateEdit.layoutGallery' | translate }}</option>
|
||||
<option value="HERO">{{ 'templateEdit.layoutHero' | translate }}</option>
|
||||
<option value="MASONRY">{{ 'templateEdit.layoutMasonry' | translate }}</option>
|
||||
<option value="CAROUSEL">{{ 'templateEdit.layoutCarousel' | translate }}</option>
|
||||
</select>
|
||||
}
|
||||
<button type="button" class="btn-icon-danger" (click)="removeField(i)" aria-label="Supprimer">
|
||||
<button type="button" class="btn-icon-danger" (click)="removeField(i)" [attr.aria-label]="'common.delete' | translate">
|
||||
<lucide-icon [img]="Trash2" [size]="14"></lucide-icon>
|
||||
</button>
|
||||
</li>
|
||||
@@ -99,22 +99,20 @@
|
||||
[ngModel]="lbl"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
(ngModelChange)="updateLabel(f, li, $event)"
|
||||
[placeholder]="f.type === 'TABLE' ? 'Colonne' : 'Libellé'"
|
||||
[attr.aria-label]="(f.type === 'TABLE' ? 'Colonne ' : 'Libellé ') + (li + 1)" />
|
||||
<button type="button" class="kv-label-remove" (click)="removeLabel(f, li)" aria-label="Retirer">
|
||||
[placeholder]="(f.type === 'TABLE' ? 'templateEdit.column' : 'templateEdit.label') | translate"
|
||||
[attr.aria-label]="(f.type === 'TABLE' ? 'templateEdit.columnN' : 'templateEdit.labelN') | translate:{ n: (li + 1) }" />
|
||||
<button type="button" class="kv-label-remove" (click)="removeLabel(f, li)" [attr.aria-label]="'common.remove' | translate">
|
||||
<lucide-icon [img]="X" [size]="11"></lucide-icon>
|
||||
</button>
|
||||
</span>
|
||||
}
|
||||
<button type="button" class="btn-kv-add-label" (click)="addLabel(f)">
|
||||
<lucide-icon [img]="Plus" [size]="12"></lucide-icon>
|
||||
{{ f.type === 'TABLE' ? 'Colonne' : 'Libellé' }}
|
||||
{{ (f.type === 'TABLE' ? 'templateEdit.column' : 'templateEdit.label') | translate }}
|
||||
</button>
|
||||
@if (!(f.labels ?? []).length) {
|
||||
<span class="kv-labels-hint">
|
||||
{{ f.type === 'TABLE'
|
||||
? 'Ajoutez les colonnes du tableau (ex : Objet, Prix, Description…)'
|
||||
: 'Ajoutez les libellés des lignes (ex : FOR, DEX, CON…)' }}
|
||||
{{ (f.type === 'TABLE' ? 'templateEdit.tableLabelsHint' : 'templateEdit.kvLabelsHint') | translate }}
|
||||
</span>
|
||||
}
|
||||
</li>
|
||||
@@ -126,23 +124,23 @@
|
||||
type="text"
|
||||
[(ngModel)]="newFieldName"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
placeholder="+ Ajouter un champ"
|
||||
[placeholder]="'templateEdit.addFieldPlaceholder' | translate"
|
||||
(keydown.enter)="$event.preventDefault(); addField()" />
|
||||
<select
|
||||
class="type-select"
|
||||
[(ngModel)]="newFieldType"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
aria-label="Type du champ">
|
||||
<option value="TEXT">Texte</option>
|
||||
<option value="IMAGE">Image</option>
|
||||
<option value="KEY_VALUE_LIST">Liste clé/valeur</option>
|
||||
<option value="TABLE">Tableau</option>
|
||||
[attr.aria-label]="'templateEdit.fieldTypeTitle' | translate">
|
||||
<option value="TEXT">{{ 'templateEdit.typeText' | translate }}</option>
|
||||
<option value="IMAGE">{{ 'templateEdit.typeImage' | translate }}</option>
|
||||
<option value="KEY_VALUE_LIST">{{ 'templateEdit.typeKeyValue' | translate }}</option>
|
||||
<option value="TABLE">{{ 'templateEdit.typeTable' | translate }}</option>
|
||||
</select>
|
||||
<button type="button" class="btn-add" (click)="addField()" title="Ajouter le champ">
|
||||
<button type="button" class="btn-add" (click)="addField()" [title]="'templateEdit.addFieldTitle' | translate">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
</button>
|
||||
</div>
|
||||
<p class="hint">Texte = libre + generable par l'IA. Image = galerie. Liste clé/valeur = paires libellé/valeur (stats). Tableau = colonnes fixes + lignes ajoutées librement (boutique, inventaire…).</p>
|
||||
<p class="hint">{{ 'templateEdit.fieldsHelp' | translate }}</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { forkJoin, Subject } from 'rxjs';
|
||||
import { switchMap, takeUntil } from 'rxjs/operators';
|
||||
import { LucideAngularModule, Plus, Trash2, Type, Image as ImageIcon, ChevronUp, ChevronDown, ListOrdered, Table as TableIcon, X } from 'lucide-angular';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { LoreService } from '../../services/lore.service';
|
||||
import { TemplateService } from '../../services/template.service';
|
||||
import { PageService } from '../../services/page.service';
|
||||
@@ -21,7 +22,7 @@ import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-template-edit',
|
||||
imports: [FormsModule, ReactiveFormsModule, LucideAngularModule],
|
||||
imports: [FormsModule, ReactiveFormsModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './template-edit.component.html',
|
||||
styleUrls: ['./template-edit.component.scss']
|
||||
})
|
||||
@@ -77,7 +78,8 @@ export class TemplateEditComponent implements OnInit, OnDestroy {
|
||||
private pageService: PageService,
|
||||
private layoutService: LayoutService,
|
||||
private pageTitleService: PageTitleService,
|
||||
private confirmDialog: ConfirmDialogService
|
||||
private confirmDialog: ConfirmDialogService,
|
||||
private translate: TranslateService
|
||||
) {
|
||||
this.form = this.fb.group({
|
||||
name: ['', Validators.required],
|
||||
@@ -196,9 +198,9 @@ export class TemplateEditComponent implements OnInit, OnDestroy {
|
||||
|
||||
delete(): void {
|
||||
this.confirmDialog.confirm({
|
||||
title: 'Supprimer le template',
|
||||
message: `Supprimer le template "${this.template?.name}" ?`,
|
||||
confirmLabel: 'Supprimer',
|
||||
title: this.translate.instant('templateEdit.deleteTitle'),
|
||||
message: this.translate.instant('templateEdit.deleteMessage', { name: this.template?.name }),
|
||||
confirmLabel: this.translate.instant('common.delete'),
|
||||
variant: 'danger'
|
||||
}).then(ok => {
|
||||
if (!ok) return;
|
||||
|
||||
Reference in New Issue
Block a user