Mise en place de l'anglais comme deuxième langue pour l'application
This commit is contained in:
+5
-5
@@ -13,7 +13,7 @@
|
||||
@if (status !== 'created' && needsArc) {
|
||||
<div class="nac-targets">
|
||||
<label>
|
||||
Arc
|
||||
{{ 'notebookActionCard.arc' | translate }}
|
||||
<select [(ngModel)]="selectedArcId" (ngModelChange)="syncChapter()">
|
||||
@for (a of arcs; track a) {
|
||||
<option [value]="a.id">{{ a.name }}</option>
|
||||
@@ -22,7 +22,7 @@
|
||||
</label>
|
||||
@if (needsChapter) {
|
||||
<label>
|
||||
Chapitre
|
||||
{{ 'notebookActionCard.chapter' | translate }}
|
||||
<select [(ngModel)]="selectedChapterId">
|
||||
@for (c of targetChapters; track c) {
|
||||
<option [value]="c.id">{{ c.name }}</option>
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@if (needsArc && arcs.length === 0) {
|
||||
<p class="nac-warn">
|
||||
Crée d'abord un arc {{ needsChapter ? 'et un chapitre ' : '' }}dans la campagne pour pouvoir y rattacher cet élément.
|
||||
{{ (needsChapter ? 'notebookActionCard.warnArcChapter' : 'notebookActionCard.warnArc') | translate }}
|
||||
</p>
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@
|
||||
@if (status !== 'created') {
|
||||
<button class="nac-create" (click)="create()" [disabled]="!canCreate">
|
||||
<lucide-icon [img]="Plus" [size]="13"></lucide-icon>
|
||||
{{ status === 'creating' ? 'Création…' : 'Créer dans la campagne' }}
|
||||
{{ (status === 'creating' ? 'notebookActionCard.creating' : 'notebookActionCard.createInCampaign') | translate }}
|
||||
</button>
|
||||
}
|
||||
@if (status === 'created') {
|
||||
<button class="nac-open" (click)="openCreated()">
|
||||
<lucide-icon [img]="Check" [size]="13"></lucide-icon> Créé — ouvrir
|
||||
<lucide-icon [img]="Check" [size]="13"></lucide-icon> {{ 'notebookActionCard.createdOpen' | translate }}
|
||||
<lucide-icon [img]="ExternalLink" [size]="12"></lucide-icon>
|
||||
</button>
|
||||
}
|
||||
|
||||
+10
-8
@@ -2,6 +2,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { LucideAngularModule, Plus, Check, Drama, Clapperboard, BookText, GitBranch, Dices, ExternalLink } from 'lucide-angular';
|
||||
import { CampaignService } from '../../../services/campaign.service';
|
||||
import { NpcService } from '../../../services/npc.service';
|
||||
@@ -15,7 +16,7 @@ import { NotebookAction } from '../../../services/notebook-action.model';
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-notebook-action-card',
|
||||
imports: [FormsModule, LucideAngularModule],
|
||||
imports: [FormsModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './notebook-action-card.component.html',
|
||||
styleUrls: ['./notebook-action-card.component.scss']
|
||||
})
|
||||
@@ -42,7 +43,8 @@ export class NotebookActionCardComponent implements OnInit {
|
||||
private campaignService: CampaignService,
|
||||
private npcService: NpcService,
|
||||
private tableService: RandomTableService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
private translate: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -52,11 +54,11 @@ export class NotebookActionCardComponent implements OnInit {
|
||||
|
||||
get typeLabel(): string {
|
||||
switch (this.action.type) {
|
||||
case 'npc': return 'PNJ';
|
||||
case 'scene': return 'Scène';
|
||||
case 'chapter': return 'Chapitre';
|
||||
case 'arc': return 'Arc';
|
||||
case 'table': return 'Table aléatoire';
|
||||
case 'npc': return this.translate.instant('notebookActionCard.typeNpc');
|
||||
case 'scene': return this.translate.instant('notebookActionCard.typeScene');
|
||||
case 'chapter': return this.translate.instant('notebookActionCard.typeChapter');
|
||||
case 'arc': return this.translate.instant('notebookActionCard.typeArc');
|
||||
case 'table': return this.translate.instant('notebookActionCard.typeTable');
|
||||
default: return this.action.type;
|
||||
}
|
||||
}
|
||||
@@ -200,7 +202,7 @@ export class NotebookActionCardComponent implements OnInit {
|
||||
|
||||
private fail(err: unknown): void {
|
||||
this.status = 'error';
|
||||
this.errorMsg = (err as { error?: { message?: string } })?.error?.message || 'Échec de la création.';
|
||||
this.errorMsg = (err as { error?: { message?: string } })?.error?.message || this.translate.instant('notebookActionCard.createError');
|
||||
}
|
||||
|
||||
openCreated(): void {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="nbd-page">
|
||||
<div class="nbd-toolbar">
|
||||
<button class="btn-back" (click)="back()">
|
||||
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon> Ateliers
|
||||
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon> {{ 'notebookDetail.backToList' | translate }}
|
||||
</button>
|
||||
<input class="nbd-title" [(ngModel)]="detail.name" (blur)="rename()" (keyup.enter)="rename()">
|
||||
</div>
|
||||
@@ -10,10 +10,10 @@
|
||||
<!-- Sources -->
|
||||
<aside class="nbd-sources">
|
||||
<div class="nbd-sources-head">
|
||||
<h3><lucide-icon [img]="FileText" [size]="15"></lucide-icon> Sources</h3>
|
||||
<h3><lucide-icon [img]="FileText" [size]="15"></lucide-icon> {{ 'notebookDetail.sources' | translate }}</h3>
|
||||
<label class="btn-upload" [class.disabled]="uploading">
|
||||
<lucide-icon [img]="Upload" [size]="13"></lucide-icon>
|
||||
{{ uploading ? 'Indexation…' : 'Ajouter un PDF' }}
|
||||
{{ (uploading ? 'notebookDetail.indexing' : 'notebookDetail.addPdf') | translate }}
|
||||
<input type="file" accept="application/pdf" hidden (change)="onFile($event)" [disabled]="uploading">
|
||||
</label>
|
||||
</div>
|
||||
@@ -23,7 +23,7 @@
|
||||
@if (readySourceCount > 1) {
|
||||
<p class="nbd-sources-hint"
|
||||
[class.partial]="selectedSourceIds.size < readySourceCount">
|
||||
{{ selectedSourceIds.size }}/{{ readySourceCount }} source(s) utilisée(s) par le chat et l'analyse approfondie
|
||||
{{ 'notebookDetail.sourcesUsed' | translate:{ selected: selectedSourceIds.size, total: readySourceCount } }}
|
||||
</p>
|
||||
}
|
||||
@for (s of sources; track s) {
|
||||
@@ -34,9 +34,9 @@
|
||||
class="nbd-source-check"
|
||||
[checked]="isSelected(s)"
|
||||
(change)="toggleSource(s)"
|
||||
[title]="isSelected(s)
|
||||
? 'Source utilisée par le chat — décocher pour l\'exclure'
|
||||
: 'Source ignorée par le chat — cocher pour l\'inclure'" />
|
||||
[title]="(isSelected(s)
|
||||
? 'notebookDetail.sourceIncludedTitle'
|
||||
: 'notebookDetail.sourceExcludedTitle') | translate" />
|
||||
} @else {
|
||||
<lucide-icon
|
||||
[img]="s.status === 'FAILED' ? AlertCircle : Loader"
|
||||
@@ -48,24 +48,24 @@
|
||||
<div class="nbd-source-name">{{ s.filename }}</div>
|
||||
<div class="nbd-source-meta">
|
||||
@if (s.status === 'READY') {
|
||||
<span>{{ s.pageCount }} p. · {{ s.chunkCount }} extraits</span>
|
||||
<span>{{ 'notebookDetail.sourceMeta' | translate:{ pages: s.pageCount, chunks: s.chunkCount } }}</span>
|
||||
}
|
||||
@if (s.status === 'INDEXING') {
|
||||
<span>indexation en cours…</span>
|
||||
<span>{{ 'notebookDetail.indexingInProgress' | translate }}</span>
|
||||
}
|
||||
@if (s.status === 'FAILED') {
|
||||
<span>échec de l'indexation</span>
|
||||
<span>{{ 'notebookDetail.indexingFailed' | translate }}</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<button class="nbd-source-del" (click)="removeSource(s)" title="Supprimer">
|
||||
<button class="nbd-source-del" (click)="removeSource(s)" [title]="'common.delete' | translate">
|
||||
<lucide-icon [img]="Trash2" [size]="13"></lucide-icon>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
@if (sources.length === 0 && !uploading) {
|
||||
<p class="nbd-empty">
|
||||
Ajoute un PDF source pour commencer à discuter avec.
|
||||
{{ 'notebookDetail.sourcesEmpty' | translate }}
|
||||
</p>
|
||||
}
|
||||
</aside>
|
||||
@@ -76,32 +76,32 @@
|
||||
@if (viewingArchive) {
|
||||
<span class="nbd-archive-banner">
|
||||
<lucide-icon [img]="History" [size]="13"></lucide-icon>
|
||||
Archive du {{ archiveLabel(viewingArchive) }} — lecture seule
|
||||
{{ 'notebookDetail.archiveBanner' | translate:{ label: archiveLabel(viewingArchive) } }}
|
||||
</span>
|
||||
<button type="button" class="nbd-chat-btn" (click)="closeArchive()">
|
||||
<lucide-icon [img]="X" [size]="13"></lucide-icon>
|
||||
Revenir au chat
|
||||
{{ 'notebookDetail.backToChat' | translate }}
|
||||
</button>
|
||||
} @else {
|
||||
@if (referencedArchiveIds.size > 0) {
|
||||
<span class="nbd-ref-badge"
|
||||
title="Le contenu de ces archives est injecté comme référence dans chaque question">
|
||||
[title]="'notebookDetail.refBadgeTitle' | translate">
|
||||
<lucide-icon [img]="History" [size]="12"></lucide-icon>
|
||||
{{ referencedArchiveIds.size }} archive(s) en référence
|
||||
{{ 'notebookDetail.refBadge' | translate:{ n: referencedArchiveIds.size } }}
|
||||
</span>
|
||||
}
|
||||
<span class="nbd-chat-head-spacer"></span>
|
||||
<button type="button" class="nbd-chat-btn" (click)="toggleArchives()"
|
||||
[class.active]="archivesOpen"
|
||||
title="Conversations archivées (lecture seule + référence)">
|
||||
[title]="'notebookDetail.archivesBtnTitle' | translate">
|
||||
<lucide-icon [img]="History" [size]="13"></lucide-icon>
|
||||
Archives
|
||||
{{ 'notebookDetail.archives' | translate }}
|
||||
</button>
|
||||
<button type="button" class="nbd-chat-btn nbd-chat-btn--danger" (click)="clearChat()"
|
||||
[disabled]="sending || messages.length === 0"
|
||||
title="Vider la conversation (le fil actuel est archivé, pas supprimé)">
|
||||
[title]="'notebookDetail.clearBtnTitle' | translate">
|
||||
<lucide-icon [img]="Eraser" [size]="13"></lucide-icon>
|
||||
Vider
|
||||
{{ 'notebookDetail.clear' | translate }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
@@ -109,12 +109,9 @@
|
||||
@if (archivesOpen && !viewingArchive) {
|
||||
<div class="nbd-archives">
|
||||
@if (archives.length === 0) {
|
||||
<p class="nbd-empty">Aucune conversation archivée pour l'instant — « Vider » archive le fil courant ici.</p>
|
||||
<p class="nbd-empty">{{ 'notebookDetail.archivesEmpty' | translate }}</p>
|
||||
} @else {
|
||||
<p class="nbd-archives-help">
|
||||
Cochez une archive pour l'utiliser comme <strong>référence</strong> dans le chat ;
|
||||
cliquez sur son nom pour la relire.
|
||||
</p>
|
||||
<p class="nbd-archives-help" [innerHTML]="'notebookDetail.archivesHelp' | translate"></p>
|
||||
}
|
||||
@for (a of archives; track a.archivedAt) {
|
||||
<div class="nbd-archive-row" [class.referenced]="isReferenced(a)">
|
||||
@@ -123,9 +120,9 @@
|
||||
class="nbd-archive-check"
|
||||
[checked]="isReferenced(a)"
|
||||
(change)="toggleReference(a)"
|
||||
[title]="isReferenced(a)
|
||||
? 'Archive utilisée comme référence — décocher pour la retirer'
|
||||
: 'Utiliser cette archive comme référence dans le chat'" />
|
||||
[title]="(isReferenced(a)
|
||||
? 'notebookDetail.archiveRefOnTitle'
|
||||
: 'notebookDetail.archiveRefOffTitle') | translate" />
|
||||
<button type="button" class="nbd-archive-item" (click)="openArchive(a)">
|
||||
<lucide-icon [img]="History" [size]="13"></lucide-icon>
|
||||
{{ archiveLabel(a) }}
|
||||
@@ -143,7 +140,7 @@
|
||||
@if (m.role === 'assistant') {
|
||||
<lucide-icon [img]="Sparkles" [size]="12"></lucide-icon>
|
||||
}
|
||||
{{ m.role === 'user' ? 'Vous' : 'IA' }}
|
||||
{{ (m.role === 'user' ? 'notebookDetail.roleUser' : 'notebookDetail.roleAi') | translate }}
|
||||
</div>
|
||||
@if (m.role === 'assistant') {
|
||||
<div class="nbd-msg-content md" [innerHTML]="m.content | markdown"></div>
|
||||
@@ -155,9 +152,9 @@
|
||||
} @else {
|
||||
@if (messages.length === 0) {
|
||||
<p class="nbd-empty">
|
||||
Pose une question sur ta source, ou demande une adaptation pour ta campagne.
|
||||
{{ 'notebookDetail.chatEmpty' | translate }}
|
||||
@if (!hasReadySource()) {
|
||||
<span><br>(Ajoute d'abord une source indexée pour des réponses ancrées.)</span>
|
||||
<span [innerHTML]="'notebookDetail.chatEmptyNoSource' | translate"></span>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
@@ -167,14 +164,14 @@
|
||||
@if (m.role === 'assistant') {
|
||||
<lucide-icon [img]="Sparkles" [size]="12"></lucide-icon>
|
||||
}
|
||||
{{ m.role === 'user' ? 'Vous' : 'IA' }}
|
||||
{{ (m.role === 'user' ? 'notebookDetail.roleUser' : 'notebookDetail.roleAi') | translate }}
|
||||
</div>
|
||||
@if (m.role === 'assistant') {
|
||||
@if (parsedOf(m); as p) {
|
||||
@if (sending && deepProgress && !p.text) {
|
||||
<div class="nbd-deep-progress">
|
||||
<lucide-icon [img]="Layers" [size]="13"></lucide-icon>
|
||||
Analyse approfondie du document… {{ deepProgress.current }}/{{ deepProgress.total }}
|
||||
{{ 'notebookDetail.deepProgress' | translate:{ current: deepProgress.current, total: deepProgress.total } }}
|
||||
</div>
|
||||
}
|
||||
@if (p.text) {
|
||||
@@ -192,7 +189,7 @@
|
||||
</app-notebook-action-card>
|
||||
}
|
||||
@if (sourcesLabel(m); as label) {
|
||||
<div class="nbd-msg-sources" title="Pages de la source utilisées pour ancrer cette réponse">
|
||||
<div class="nbd-msg-sources" [title]="'notebookDetail.sourcesPagesTitle' | translate">
|
||||
📖 {{ label }}
|
||||
</div>
|
||||
}
|
||||
@@ -207,14 +204,14 @@
|
||||
@if (!viewingArchive) {
|
||||
<div class="nbd-input">
|
||||
<textarea [(ngModel)]="draft" rows="2"
|
||||
placeholder="Demande une adaptation, un résumé, un PNJ inspiré de la source…"
|
||||
[placeholder]="'notebookDetail.draftPlaceholder' | translate"
|
||||
(keydown.enter)="$event.preventDefault(); send()"></textarea>
|
||||
<button class="btn-deep" (click)="send(true)" [disabled]="sending || !draft.trim()"
|
||||
title="Analyse approfondie : lit TOUT le document (plus lent, exhaustif). Idéal pour « liste tous les… »">
|
||||
[title]="'notebookDetail.deepBtnTitle' | translate">
|
||||
<lucide-icon [img]="Layers" [size]="15"></lucide-icon>
|
||||
</button>
|
||||
<button class="btn-send" (click)="send()" [disabled]="sending || !draft.trim()"
|
||||
title="Réponse rapide (recherche ciblée dans le document)">
|
||||
[title]="'notebookDetail.sendBtnTitle' | translate">
|
||||
<lucide-icon [img]="Send" [size]="15"></lucide-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,7 @@ import { loadCampaignTreeData } from '../../campaign-tree.helper';
|
||||
import { NotebookActionCardComponent } from '../notebook-action-card/notebook-action-card.component';
|
||||
import { MarkdownPipe } from '../../../shared/markdown.pipe';
|
||||
import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dialog.service';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
|
||||
/**
|
||||
* Atelier (workspace) : sources indexées (gauche) + chat ancré RAG (droite).
|
||||
@@ -23,7 +24,7 @@ import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dia
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-notebook-detail',
|
||||
imports: [FormsModule, LucideAngularModule, NotebookActionCardComponent, MarkdownPipe],
|
||||
imports: [FormsModule, LucideAngularModule, NotebookActionCardComponent, MarkdownPipe, TranslatePipe],
|
||||
templateUrl: './notebook-detail.component.html',
|
||||
styleUrls: ['./notebook-detail.component.scss']
|
||||
})
|
||||
@@ -68,7 +69,8 @@ export class NotebookDetailComponent implements OnInit {
|
||||
private characterService: CharacterService,
|
||||
private npcService: NpcService,
|
||||
private enemyService: EnemyService,
|
||||
private confirmDialog: ConfirmDialogService
|
||||
private confirmDialog: ConfirmDialogService,
|
||||
private translate: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -208,7 +210,7 @@ export class NotebookDetailComponent implements OnInit {
|
||||
next: () => { this.uploading = false; this.reloadSources(); },
|
||||
error: (err) => {
|
||||
this.uploading = false;
|
||||
this.uploadError = err?.error?.message || 'Échec de l\'indexation. Réessaie ou vérifie le modèle d\'embedding.';
|
||||
this.uploadError = err?.error?.message || this.translate.instant('notebookDetail.uploadError');
|
||||
this.reloadSources();
|
||||
}
|
||||
});
|
||||
@@ -232,10 +234,10 @@ export class NotebookDetailComponent implements OnInit {
|
||||
clearChat(): void {
|
||||
if (this.sending || this.messages.length === 0) return;
|
||||
this.confirmDialog.confirm({
|
||||
title: 'Vider la conversation',
|
||||
message: 'Repartir d\'une conversation vierge ?',
|
||||
details: ['Le fil actuel est archivé (pas supprimé) : il restera consultable via « Archives ».'],
|
||||
confirmLabel: 'Vider',
|
||||
title: this.translate.instant('notebookDetail.clearTitle'),
|
||||
message: this.translate.instant('notebookDetail.clearMessage'),
|
||||
details: [this.translate.instant('notebookDetail.clearDetail')],
|
||||
confirmLabel: this.translate.instant('notebookDetail.clear'),
|
||||
variant: 'danger'
|
||||
}).then(ok => {
|
||||
if (!ok) return;
|
||||
@@ -287,10 +289,11 @@ export class NotebookDetailComponent implements OnInit {
|
||||
/** Libellé d'une archive : date du clear + nb d'échanges. */
|
||||
archiveLabel(a: NotebookArchive): string {
|
||||
const date = new Date(a.archivedAt);
|
||||
const locale = this.translate.getCurrentLang() === 'en' ? 'en-US' : 'fr-FR';
|
||||
const when = isNaN(date.getTime())
|
||||
? a.archivedAt
|
||||
: date.toLocaleString('fr-FR', { dateStyle: 'short', timeStyle: 'short' });
|
||||
return `${when} · ${a.messages.length} message(s)`;
|
||||
: date.toLocaleString(locale, { dateStyle: 'short', timeStyle: 'short' });
|
||||
return this.translate.instant('notebookDetail.archiveLabel', { when, n: a.messages.length });
|
||||
}
|
||||
|
||||
// --- Chat ---
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
<div class="nbl-page">
|
||||
<div class="nbl-toolbar">
|
||||
<button class="btn-back" (click)="back()">
|
||||
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon> Retour
|
||||
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon> {{ 'common.back' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<header class="nbl-header">
|
||||
<h1><lucide-icon [img]="BookOpen" [size]="22"></lucide-icon> Ateliers d'adaptation</h1>
|
||||
<h1><lucide-icon [img]="BookOpen" [size]="22"></lucide-icon> {{ 'notebookList.title' | translate }}</h1>
|
||||
<p class="nbl-hint">
|
||||
Discute avec l'IA à partir d'un PDF source (recherche dans le document) pour adapter
|
||||
son contenu à ta campagne. La source et la conversation sont conservées.
|
||||
{{ 'notebookList.hint' | translate }}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div class="nbl-create">
|
||||
<input type="text" [(ngModel)]="newName" placeholder="Nom de l'atelier (ex: Adaptation du module X)"
|
||||
<input type="text" [(ngModel)]="newName" [placeholder]="'notebookList.namePlaceholder' | translate"
|
||||
(keyup.enter)="create()">
|
||||
<button class="btn-create" (click)="create()" [disabled]="creating">
|
||||
<lucide-icon [img]="Plus" [size]="14"></lucide-icon>
|
||||
{{ creating ? 'Création…' : 'Nouvel atelier' }}
|
||||
{{ (creating ? 'common.creating' : 'notebookList.newNotebook') | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="nbl-list">
|
||||
@if (notebooks.length === 0) {
|
||||
<p class="empty">Aucun atelier pour l'instant.</p>
|
||||
<p class="empty">{{ 'notebookList.empty' | translate }}</p>
|
||||
}
|
||||
@for (nb of notebooks; track nb) {
|
||||
<button class="nbl-item" (click)="open(nb)">
|
||||
<lucide-icon [img]="BookOpen" [size]="16"></lucide-icon>
|
||||
<span class="nbl-item-name">{{ nb.name }}</span>
|
||||
<span class="nbl-del" (click)="remove(nb, $event)" title="Supprimer">
|
||||
<span class="nbl-del" (click)="remove(nb, $event)" [title]="'common.delete' | translate">
|
||||
<lucide-icon [img]="Trash2" [size]="14"></lucide-icon>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { NotebookService } from '../../../services/notebook.service';
|
||||
import { CampaignSidebarService } from '../../../services/campaign-sidebar.service';
|
||||
import { Notebook } from '../../../services/notebook.model';
|
||||
import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dialog.service';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
|
||||
/**
|
||||
* Liste des ateliers (notebooks) d'une campagne + création.
|
||||
@@ -14,7 +15,7 @@ import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dia
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-notebook-list',
|
||||
imports: [FormsModule, LucideAngularModule],
|
||||
imports: [FormsModule, LucideAngularModule, TranslatePipe],
|
||||
templateUrl: './notebook-list.component.html',
|
||||
styleUrls: ['./notebook-list.component.scss']
|
||||
})
|
||||
@@ -34,7 +35,8 @@ export class NotebookListComponent implements OnInit {
|
||||
private router: Router,
|
||||
private service: NotebookService,
|
||||
private campaignSidebar: CampaignSidebarService,
|
||||
private confirmDialog: ConfirmDialogService
|
||||
private confirmDialog: ConfirmDialogService,
|
||||
private translate: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -55,7 +57,7 @@ export class NotebookListComponent implements OnInit {
|
||||
create(): void {
|
||||
if (this.creating) return;
|
||||
this.creating = true;
|
||||
this.service.create(this.campaignId, this.newName.trim() || 'Nouvel atelier').subscribe({
|
||||
this.service.create(this.campaignId, this.newName.trim() || this.translate.instant('notebookList.defaultName')).subscribe({
|
||||
next: (nb) => this.router.navigate(['/campaigns', this.campaignId, 'notebooks', nb.id]),
|
||||
error: () => this.creating = false
|
||||
});
|
||||
@@ -68,9 +70,9 @@ export class NotebookListComponent implements OnInit {
|
||||
remove(nb: Notebook, ev: Event): void {
|
||||
ev.stopPropagation();
|
||||
this.confirmDialog.confirm({
|
||||
title: 'Supprimer l\'atelier',
|
||||
message: `Supprimer « ${nb.name} » et ses sources indexées ?`,
|
||||
confirmLabel: 'Supprimer',
|
||||
title: this.translate.instant('notebookList.deleteTitle'),
|
||||
message: this.translate.instant('notebookList.deleteMessage', { name: nb.name }),
|
||||
confirmLabel: this.translate.instant('common.delete'),
|
||||
variant: 'danger'
|
||||
}).then(ok => {
|
||||
if (!ok) return;
|
||||
|
||||
Reference in New Issue
Block a user