feat(i18n): add Transloco translation framework with EN/ES and 7 language scaffolds (#2681)
* feat(i18n): add Transloco translation framework and translate all settings tabs (EN/ES) * feat(i18n): translate shared, layout, dashboard, library-creator, and app-root components (EN/ES) and scaffold 7 new languages * feat(i18n): translate bookdrop and metadata components (EN/ES), remove i18n-audit from tracking * fix(i18n): deep-merge English as fallback base for incomplete language translations
This commit is contained in:
@@ -1,273 +1,275 @@
|
||||
<div class="library-creator">
|
||||
<header class="dialog-header">
|
||||
<div class="header-content">
|
||||
<div class="header-icon">
|
||||
<i class="pi pi-book"></i>
|
||||
<ng-container *transloco="let t; prefix: 'libraryCreator.creator'">
|
||||
<div class="library-creator">
|
||||
<header class="dialog-header">
|
||||
<div class="header-content">
|
||||
<div class="header-icon">
|
||||
<i class="pi pi-book"></i>
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<h1>{{ mode === 'edit' ? t('titleEdit') : t('titleNew') }}</h1>
|
||||
<p>{{ t('subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<h1>{{ mode === 'edit' ? 'Edit Library' : 'New Library' }}</h1>
|
||||
<p>Configure your book collection</p>
|
||||
</div>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
[text]="true"
|
||||
[rounded]="true"
|
||||
severity="secondary"
|
||||
(onClick)="closeDialog()"
|
||||
/>
|
||||
</header>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
[text]="true"
|
||||
[rounded]="true"
|
||||
severity="secondary"
|
||||
(onClick)="closeDialog()"
|
||||
/>
|
||||
</header>
|
||||
|
||||
<div class="dialog-body">
|
||||
<section class="form-section">
|
||||
<div class="section-header">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<span>Library Details</span>
|
||||
</div>
|
||||
|
||||
<div class="form-row two-col">
|
||||
<div class="form-field">
|
||||
<label>
|
||||
Name <span class="required">*</span>
|
||||
</label>
|
||||
<div class="input-container">
|
||||
<input
|
||||
pInputText
|
||||
[(ngModel)]="chosenLibraryName"
|
||||
placeholder="My Library"
|
||||
class="input-full"
|
||||
/>
|
||||
@if (chosenLibraryName.trim()) {
|
||||
<i class="pi pi-check-circle field-status success"></i>
|
||||
}
|
||||
</div>
|
||||
<div class="dialog-body">
|
||||
<section class="form-section">
|
||||
<div class="section-header">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<span>{{ t('libraryDetails') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label>
|
||||
Icon (Optional)
|
||||
</label>
|
||||
@if (!selectedIcon) {
|
||||
<button class="icon-picker-trigger" (click)="openIconPicker()" type="button">
|
||||
<i class="pi pi-plus"></i>
|
||||
<span>Choose icon</span>
|
||||
</button>
|
||||
} @else {
|
||||
<div class="icon-selected">
|
||||
<div class="icon-preview">
|
||||
<app-icon-display [icon]="selectedIcon" size="16px" />
|
||||
</div>
|
||||
<span class="icon-value">
|
||||
@if (selectedIcon.type === 'PRIME_NG') {
|
||||
{{ selectedIcon.value }}
|
||||
} @else {
|
||||
Custom SVG
|
||||
}
|
||||
</span>
|
||||
<button class="icon-clear" (click)="clearSelectedIcon()" type="button">
|
||||
<i class="pi pi-times"></i>
|
||||
</button>
|
||||
<div class="form-row two-col">
|
||||
<div class="form-field">
|
||||
<label>
|
||||
{{ t('nameLabel') }} <span class="required">*</span>
|
||||
</label>
|
||||
<div class="input-container">
|
||||
<input
|
||||
pInputText
|
||||
[(ngModel)]="chosenLibraryName"
|
||||
[placeholder]="t('namePlaceholder')"
|
||||
class="input-full"
|
||||
/>
|
||||
@if (chosenLibraryName.trim()) {
|
||||
<i class="pi pi-check-circle field-status success"></i>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="form-section">
|
||||
<div class="section-header">
|
||||
<i class="pi pi-folder-open"></i>
|
||||
<span>Book Folders</span>
|
||||
<span class="section-badge">{{ folders.length }}</span>
|
||||
</div>
|
||||
|
||||
<div class="folders-zone">
|
||||
<button class="add-folder-trigger" (click)="openDirectoryPicker()" type="button">
|
||||
<i class="pi pi-plus-circle"></i>
|
||||
<span>Add folder</span>
|
||||
</button>
|
||||
|
||||
@if (folders.length > 0) {
|
||||
<div class="folders-list">
|
||||
@for (folder of folders; track folder; let i = $index) {
|
||||
<div class="folder-item">
|
||||
<div class="folder-info">
|
||||
<i class="pi pi-folder"></i>
|
||||
<span class="folder-path" [pTooltip]="folder" tooltipPosition="top">
|
||||
{{ folder }}
|
||||
</span>
|
||||
<div class="form-field">
|
||||
<label>
|
||||
{{ t('iconLabel') }}
|
||||
</label>
|
||||
@if (!selectedIcon) {
|
||||
<button class="icon-picker-trigger" (click)="openIconPicker()" type="button">
|
||||
<i class="pi pi-plus"></i>
|
||||
<span>{{ t('chooseIcon') }}</span>
|
||||
</button>
|
||||
} @else {
|
||||
<div class="icon-selected">
|
||||
<div class="icon-preview">
|
||||
<app-icon-display [icon]="selectedIcon" size="16px" />
|
||||
</div>
|
||||
<button class="folder-remove" (click)="removeFolder(i)" type="button">
|
||||
<span class="icon-value">
|
||||
@if (selectedIcon.type === 'PRIME_NG') {
|
||||
{{ selectedIcon.value }}
|
||||
} @else {
|
||||
{{ t('customSvg') }}
|
||||
}
|
||||
</span>
|
||||
<button class="icon-clear" (click)="clearSelectedIcon()" type="button">
|
||||
<i class="pi pi-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="empty-hint">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<span>Add folders containing your book files</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="form-section">
|
||||
<div class="section-header">
|
||||
<i class="pi pi-cog"></i>
|
||||
<span>Options</span>
|
||||
</div>
|
||||
|
||||
<div class="options-list">
|
||||
<div class="option-row">
|
||||
<div class="option-label">
|
||||
<span>Watch folders</span>
|
||||
<i
|
||||
class="pi pi-question-circle info-icon"
|
||||
pTooltip="Automatically detect new books added to folders"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<p-toggleswitch [(ngModel)]="watch" />
|
||||
<section class="form-section">
|
||||
<div class="section-header">
|
||||
<i class="pi pi-folder-open"></i>
|
||||
<span>{{ t('bookFolders') }}</span>
|
||||
<span class="section-badge">{{ folders.length }}</span>
|
||||
</div>
|
||||
|
||||
<div class="option-row">
|
||||
<div class="option-label">
|
||||
<span>Metadata source</span>
|
||||
<i
|
||||
class="pi pi-question-circle info-icon"
|
||||
pTooltip="Choose where to read metadata from when scanning books"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<p-select
|
||||
[(ngModel)]="metadataSource"
|
||||
[options]="metadataSourceOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select source"
|
||||
class="metadata-source-select"
|
||||
appendTo="body"
|
||||
/>
|
||||
</div>
|
||||
<div class="folders-zone">
|
||||
<button class="add-folder-trigger" (click)="openDirectoryPicker()" type="button">
|
||||
<i class="pi pi-plus-circle"></i>
|
||||
<span>{{ t('addFolder') }}</span>
|
||||
</button>
|
||||
|
||||
<div class="option-divider"></div>
|
||||
|
||||
<div class="option-row option-row-stacked">
|
||||
<div class="option-label">
|
||||
<span>Format priority</span>
|
||||
<i
|
||||
class="pi pi-question-circle info-icon"
|
||||
pTooltip="Drag to reorder preferred format when a book has multiple files"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<div
|
||||
class="format-chips"
|
||||
cdkDropList
|
||||
cdkDropListOrientation="mixed"
|
||||
[cdkDropListData]="formatPriority"
|
||||
(cdkDropListDropped)="onFormatPriorityDrop($event)"
|
||||
>
|
||||
@for (format of formatPriority; track format.type; let i = $index) {
|
||||
<div class="format-chip" cdkDrag>
|
||||
<span class="chip-rank">{{ i + 1 }}</span>
|
||||
<span class="chip-label">{{ format.type }}</span>
|
||||
<i class="pi pi-arrows-alt drag-indicator" cdkDragHandle></i>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="option-row">
|
||||
<div class="option-label">
|
||||
<span>Allowed formats</span>
|
||||
<i
|
||||
class="pi pi-question-circle info-icon"
|
||||
pTooltip="Select which book formats to include in scans"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<div class="allow-all-toggle">
|
||||
<p-checkbox
|
||||
[(ngModel)]="allowAllFormats"
|
||||
[binary]="true"
|
||||
inputId="allowAll"
|
||||
(onChange)="onAllowAllFormatsChange()"
|
||||
/>
|
||||
<label for="allowAll" class="allow-all-label">Allow all</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!allowAllFormats) {
|
||||
<div class="format-checkboxes">
|
||||
@for (format of allBookFormats; track format.type) {
|
||||
<div class="format-checkbox-item" [class.has-warning]="getFormatWarning(format.type)">
|
||||
<p-checkbox
|
||||
[ngModel]="isFormatSelected(format.type)"
|
||||
[binary]="true"
|
||||
[inputId]="'format-' + format.type"
|
||||
(onChange)="onFormatCheckboxChange(format.type, $event.checked)"
|
||||
/>
|
||||
<label [for]="'format-' + format.type" class="format-checkbox-label">
|
||||
{{ format.label }}
|
||||
</label>
|
||||
@if (getFormatWarning(format.type); as warning) {
|
||||
<i
|
||||
class="pi pi-exclamation-triangle warning-icon"
|
||||
[pTooltip]="warning"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (hasAnyFormatWarning()) {
|
||||
<div class="format-warning-message">
|
||||
@if (folders.length > 0) {
|
||||
<div class="folders-list">
|
||||
@for (folder of folders; track folder; let i = $index) {
|
||||
<div class="folder-item">
|
||||
<div class="folder-info">
|
||||
<i class="pi pi-folder"></i>
|
||||
<span class="folder-path" [pTooltip]="folder" tooltipPosition="top">
|
||||
{{ folder }}
|
||||
</span>
|
||||
</div>
|
||||
<button class="folder-remove" (click)="removeFolder(i)" type="button">
|
||||
<i class="pi pi-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="empty-hint">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<span>Deselected formats won't appear in future scans</span>
|
||||
<span>{{ t('emptyFoldersHint') }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="form-section">
|
||||
<div class="section-header">
|
||||
<i class="pi pi-cog"></i>
|
||||
<span>{{ t('options') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="options-list">
|
||||
<div class="option-row">
|
||||
<div class="option-label">
|
||||
<span>{{ t('watchFolders') }}</span>
|
||||
<i
|
||||
class="pi pi-question-circle info-icon"
|
||||
[pTooltip]="t('watchFoldersTooltip')"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<p-toggleswitch [(ngModel)]="watch" />
|
||||
</div>
|
||||
|
||||
<div class="option-row">
|
||||
<div class="option-label">
|
||||
<span>{{ t('metadataSource') }}</span>
|
||||
<i
|
||||
class="pi pi-question-circle info-icon"
|
||||
[pTooltip]="t('metadataSourceTooltip')"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<p-select
|
||||
[(ngModel)]="metadataSource"
|
||||
[options]="metadataSourceOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
[placeholder]="t('metadataSourcePlaceholder')"
|
||||
class="metadata-source-select"
|
||||
appendTo="body"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="option-divider"></div>
|
||||
|
||||
<div class="option-row option-row-stacked">
|
||||
<div class="option-label">
|
||||
<span>{{ t('formatPriority') }}</span>
|
||||
<i
|
||||
class="pi pi-question-circle info-icon"
|
||||
[pTooltip]="t('formatPriorityTooltip')"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<div
|
||||
class="format-chips"
|
||||
cdkDropList
|
||||
cdkDropListOrientation="mixed"
|
||||
[cdkDropListData]="formatPriority"
|
||||
(cdkDropListDropped)="onFormatPriorityDrop($event)"
|
||||
>
|
||||
@for (format of formatPriority; track format.type; let i = $index) {
|
||||
<div class="format-chip" cdkDrag>
|
||||
<span class="chip-rank">{{ i + 1 }}</span>
|
||||
<span class="chip-label">{{ format.type }}</span>
|
||||
<i class="pi pi-arrows-alt drag-indicator" cdkDragHandle></i>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="option-row">
|
||||
<div class="option-label">
|
||||
<span>{{ t('allowedFormats') }}</span>
|
||||
<i
|
||||
class="pi pi-question-circle info-icon"
|
||||
[pTooltip]="t('allowedFormatsTooltip')"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<div class="allow-all-toggle">
|
||||
<p-checkbox
|
||||
[(ngModel)]="allowAllFormats"
|
||||
[binary]="true"
|
||||
inputId="allowAll"
|
||||
(onChange)="onAllowAllFormatsChange()"
|
||||
/>
|
||||
<label for="allowAll" class="allow-all-label">{{ t('allowAll') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!allowAllFormats) {
|
||||
<div class="format-checkboxes">
|
||||
@for (format of allBookFormats; track format.type) {
|
||||
<div class="format-checkbox-item" [class.has-warning]="getFormatWarning(format.type)">
|
||||
<p-checkbox
|
||||
[ngModel]="isFormatSelected(format.type)"
|
||||
[binary]="true"
|
||||
[inputId]="'format-' + format.type"
|
||||
(onChange)="onFormatCheckboxChange(format.type, $event.checked)"
|
||||
/>
|
||||
<label [for]="'format-' + format.type" class="format-checkbox-label">
|
||||
{{ format.label }}
|
||||
</label>
|
||||
@if (getFormatWarning(format.type); as warning) {
|
||||
<i
|
||||
class="pi pi-exclamation-triangle warning-icon"
|
||||
[pTooltip]="warning"
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (hasAnyFormatWarning()) {
|
||||
<div class="format-warning-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<span>{{ t('deselectedFormatsWarning') }}</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer class="dialog-footer">
|
||||
<div class="validation-status">
|
||||
@if (!isLibraryDetailsValid() || !isDirectorySelectionValid()) {
|
||||
<div class="status-message warning">
|
||||
<i class="pi pi-exclamation-circle"></i>
|
||||
<span>
|
||||
@if (!chosenLibraryName.trim()) {
|
||||
{{ t('validation.enterName') }}
|
||||
} @else if (!selectedIcon) {
|
||||
{{ t('validation.selectIcon') }}
|
||||
} @else {
|
||||
{{ t('validation.addFolder') }}
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="status-message ready">
|
||||
<i class="pi pi-check-circle"></i>
|
||||
<span>{{ mode === 'edit' ? t('validation.readyUpdate') : t('validation.readyCreate') }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
<div class="footer-actions">
|
||||
<p-button
|
||||
[label]="'common.cancel' | transloco"
|
||||
severity="secondary"
|
||||
[outlined]="true"
|
||||
(onClick)="closeDialog()"
|
||||
/>
|
||||
<p-button
|
||||
[label]="mode === 'edit' ? t('buttonUpdate') : t('buttonCreate')"
|
||||
[icon]="mode === 'edit' ? 'pi pi-save' : 'pi pi-check'"
|
||||
severity="primary"
|
||||
[disabled]="!isLibraryDetailsValid() || !isDirectorySelectionValid()"
|
||||
(onClick)="createOrUpdateLibrary()"
|
||||
/>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<footer class="dialog-footer">
|
||||
<div class="validation-status">
|
||||
@if (!isLibraryDetailsValid() || !isDirectorySelectionValid()) {
|
||||
<div class="status-message warning">
|
||||
<i class="pi pi-exclamation-circle"></i>
|
||||
<span>
|
||||
@if (!chosenLibraryName.trim()) {
|
||||
Enter library name
|
||||
} @else if (!selectedIcon) {
|
||||
Select an icon
|
||||
} @else {
|
||||
Add at least one folder
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="status-message ready">
|
||||
<i class="pi pi-check-circle"></i>
|
||||
<span>Ready to {{ mode === 'edit' ? 'update' : 'create' }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="footer-actions">
|
||||
<p-button
|
||||
label="Cancel"
|
||||
severity="secondary"
|
||||
[outlined]="true"
|
||||
(onClick)="closeDialog()"
|
||||
/>
|
||||
<p-button
|
||||
[label]="mode === 'edit' ? 'Update' : 'Create'"
|
||||
[icon]="mode === 'edit' ? 'pi pi-save' : 'pi pi-check'"
|
||||
severity="primary"
|
||||
[disabled]="!isLibraryDetailsValid() || !isDirectorySelectionValid()"
|
||||
(onClick)="createOrUpdateLibrary()"
|
||||
/>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
@@ -18,12 +18,13 @@ import {map} from 'rxjs';
|
||||
import {CdkDragDrop, DragDropModule, moveItemInArray} from '@angular/cdk/drag-drop';
|
||||
import {Checkbox} from 'primeng/checkbox';
|
||||
import {Select} from 'primeng/select';
|
||||
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
@Component({
|
||||
selector: 'app-library-creator',
|
||||
standalone: true,
|
||||
templateUrl: './library-creator.component.html',
|
||||
imports: [FormsModule, InputText, ToggleSwitch, Tooltip, Button, IconDisplayComponent, DragDropModule, Checkbox, Select],
|
||||
imports: [FormsModule, InputText, ToggleSwitch, Tooltip, Button, IconDisplayComponent, DragDropModule, Checkbox, Select, TranslocoDirective, TranslocoPipe],
|
||||
styleUrl: './library-creator.component.scss'
|
||||
})
|
||||
export class LibraryCreatorComponent implements OnInit {
|
||||
@@ -41,13 +42,7 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
formatCounts: Record<string, number> = {};
|
||||
metadataSource: MetadataSource = 'EMBEDDED';
|
||||
|
||||
readonly metadataSourceOptions = [
|
||||
{label: 'Embedded Only', value: 'EMBEDDED', description: 'Use only embedded file metadata'},
|
||||
{label: 'Sidecar Only', value: 'SIDECAR', description: 'Use only sidecar JSON files'},
|
||||
{label: 'Prefer Sidecar', value: 'PREFER_SIDECAR', description: 'Use sidecar if available, fallback to embedded'},
|
||||
{label: 'Prefer Embedded', value: 'PREFER_EMBEDDED', description: 'Use embedded if available, fallback to sidecar'},
|
||||
{label: 'None', value: 'NONE', description: 'Don\'t read metadata from files'}
|
||||
];
|
||||
metadataSourceOptions: {label: string, value: string}[] = [];
|
||||
|
||||
readonly allBookFormats: {type: BookType, label: string}[] = [
|
||||
{type: 'EPUB', label: 'EPUB'},
|
||||
@@ -66,8 +61,16 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
private messageService = inject(MessageService);
|
||||
private router = inject(Router);
|
||||
private iconPicker = inject(IconPickerService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
ngOnInit(): void {
|
||||
this.metadataSourceOptions = [
|
||||
{label: this.t.translate('libraryCreator.creator.metadataSourceEmbedded'), value: 'EMBEDDED'},
|
||||
{label: this.t.translate('libraryCreator.creator.metadataSourceSidecar'), value: 'SIDECAR'},
|
||||
{label: this.t.translate('libraryCreator.creator.metadataSourcePreferSidecar'), value: 'PREFER_SIDECAR'},
|
||||
{label: this.t.translate('libraryCreator.creator.metadataSourcePreferEmbedded'), value: 'PREFER_EMBEDDED'},
|
||||
{label: this.t.translate('libraryCreator.creator.metadataSourceNone'), value: 'NONE'}
|
||||
];
|
||||
this.initializeFormatPriority();
|
||||
this.initializeAllowedFormats();
|
||||
|
||||
@@ -154,7 +157,7 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
if (this.mode !== 'edit') return null;
|
||||
const count = this.formatCounts[formatType];
|
||||
if (count && count > 0 && !this.selectedAllowedFormats.has(formatType)) {
|
||||
return `${count} existing book${count > 1 ? 's' : ''} will not appear in future scans`;
|
||||
return this.t.translate('libraryCreator.creator.formatWarning', {count});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -216,8 +219,8 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
if (exists) {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Library Name Exists',
|
||||
detail: 'This library name is already taken.',
|
||||
summary: this.t.translate('libraryCreator.creator.toast.nameExistsSummary'),
|
||||
detail: this.t.translate('libraryCreator.creator.toast.nameExistsDetail'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -240,11 +243,11 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
if (this.mode === 'edit') {
|
||||
this.libraryService.updateLibrary(library, this.library?.id).subscribe({
|
||||
next: () => {
|
||||
this.messageService.add({severity: 'success', summary: 'Library Updated', detail: 'The library was updated successfully.'});
|
||||
this.messageService.add({severity: 'success', summary: this.t.translate('libraryCreator.creator.toast.updatedSummary'), detail: this.t.translate('libraryCreator.creator.toast.updatedDetail')});
|
||||
this.dynamicDialogRef.close();
|
||||
},
|
||||
error: (e) => {
|
||||
this.messageService.add({severity: 'error', summary: 'Update Failed', detail: 'An error occurred while updating the library. Please try again.'});
|
||||
this.messageService.add({severity: 'error', summary: this.t.translate('libraryCreator.creator.toast.updateFailedSummary'), detail: this.t.translate('libraryCreator.creator.toast.updateFailedDetail')});
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
@@ -269,17 +272,17 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
this.router.navigate(['/library', createdLibrary.id, 'books']);
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Library Created',
|
||||
summary: this.t.translate('libraryCreator.creator.toast.createdSummary'),
|
||||
detail: count >= 500
|
||||
? `Library created with ${count} files. Loading in progress...`
|
||||
: 'The library was created successfully.'
|
||||
? this.t.translate('libraryCreator.creator.toast.createdLargeDetail', {count})
|
||||
: this.t.translate('libraryCreator.creator.toast.createdDetail')
|
||||
});
|
||||
this.dynamicDialogRef.close();
|
||||
}
|
||||
},
|
||||
error: (e) => {
|
||||
this.libraryService.setLargeLibraryLoading(false, 0);
|
||||
this.messageService.add({severity: 'error', summary: 'Creation Failed', detail: 'An error occurred while creating the library. Please try again.'});
|
||||
this.messageService.add({severity: 'error', summary: this.t.translate('libraryCreator.creator.toast.createFailedSummary'), detail: this.t.translate('libraryCreator.creator.toast.createFailedDetail')});
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
|
||||
+43
-41
@@ -1,50 +1,52 @@
|
||||
<div class="fullscreen-loader">
|
||||
<div class="library-loader-content">
|
||||
<div class="library-loader-header">
|
||||
<i class="pi pi-book"></i>
|
||||
<h2>Loading Library</h2>
|
||||
</div>
|
||||
<ng-container *transloco="let t; prefix: 'libraryCreator.loading'">
|
||||
<div class="fullscreen-loader">
|
||||
<div class="library-loader-content">
|
||||
<div class="library-loader-header">
|
||||
<i class="pi pi-book"></i>
|
||||
<h2>{{ t('title') }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="library-loader-body">
|
||||
<div class="book-title">
|
||||
@if (!isComplete) {
|
||||
<ng-container>
|
||||
{{ t('processing') }} <strong>{{ truncatedTitle }}</strong>
|
||||
</ng-container>
|
||||
}
|
||||
@if (isComplete) {
|
||||
<strong class="complete-message">
|
||||
<i class="pi pi-check-circle"></i>
|
||||
{{ t('complete') }}
|
||||
</strong>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="progress-info">
|
||||
<span>{{ current }} / {{ total }}</span>
|
||||
<span>{{ percentage }}%</span>
|
||||
</div>
|
||||
|
||||
<div class="progress-bar-container">
|
||||
<div class="progress-bar-fill" [style.width.%]="percentage"></div>
|
||||
</div>
|
||||
|
||||
<div class="library-loader-body">
|
||||
<div class="book-title">
|
||||
@if (!isComplete) {
|
||||
<ng-container>
|
||||
Processing: <strong>{{ truncatedTitle }}</strong>
|
||||
</ng-container>
|
||||
}
|
||||
@if (isComplete) {
|
||||
<strong class="complete-message">
|
||||
<i class="pi pi-check-circle"></i>
|
||||
Library Loading Complete!
|
||||
</strong>
|
||||
<div class="loader-animation">
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="progress-info">
|
||||
<span>{{ current }} / {{ total }}</span>
|
||||
<span>{{ percentage }}%</span>
|
||||
</div>
|
||||
|
||||
<div class="progress-bar-container">
|
||||
<div class="progress-bar-fill" [style.width.%]="percentage"></div>
|
||||
</div>
|
||||
|
||||
@if (!isComplete) {
|
||||
<div class="loader-animation">
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
@if (isComplete) {
|
||||
<div class="library-loader-footer">
|
||||
<button class="reload-button" (click)="onReload()">
|
||||
<i class="pi pi-bookmark"></i>
|
||||
{{ t('openLibrary') }}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (isComplete) {
|
||||
<div class="library-loader-footer">
|
||||
<button class="reload-button" (click)="onReload()">
|
||||
<i class="pi pi-bookmark"></i>
|
||||
Open Library
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
|
||||
@Component({
|
||||
selector: 'app-library-loading',
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
imports: [CommonModule, TranslocoDirective],
|
||||
templateUrl: './library-loading.component.html',
|
||||
styleUrl: './library-loading.component.scss'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user