Add support for uploading and assigning custom SVG icons to libraries… (#1788)
* Add support for uploading and assigning custom SVG icons to libraries and shelves * Add few default icons
This commit is contained in:
+12
-3
@@ -60,11 +60,20 @@
|
||||
} @else {
|
||||
<div class="selected-icon-display">
|
||||
<div class="icon-preview">
|
||||
<i [class]="selectedIcon"></i>
|
||||
<app-icon-display
|
||||
[icon]="selectedIcon"
|
||||
size="24px"
|
||||
/>
|
||||
</div>
|
||||
<div class="icon-info">
|
||||
<span class="icon-label">Selected Icon</span>
|
||||
<span class="icon-name">{{ selectedIcon }}</span>
|
||||
<span class="icon-name">
|
||||
@if (selectedIcon.type === 'PRIME_NG') {
|
||||
{{ selectedIcon.value }}
|
||||
} @else {
|
||||
{{ selectedIcon.value }}
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
@@ -106,7 +115,7 @@
|
||||
label="Create Shelf"
|
||||
icon="pi pi-plus"
|
||||
severity="success"
|
||||
(onClick)="saveNewShelf()"
|
||||
(onClick)="createShelf()"
|
||||
[disabled]="!shelfName.trim()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
+12
-6
@@ -249,9 +249,19 @@
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
|
||||
|
||||
i {
|
||||
font-size: 1.25rem;
|
||||
app-icon-display {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--primary-contrast-color);
|
||||
|
||||
::ng-deep i {
|
||||
color: var(--primary-contrast-color);
|
||||
}
|
||||
|
||||
::ng-deep img {
|
||||
filter: brightness(0) invert(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,10 +291,6 @@
|
||||
.icon-preview {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
|
||||
i {
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-info {
|
||||
|
||||
+27
-20
@@ -2,12 +2,13 @@ import {Component, inject} from '@angular/core';
|
||||
import {DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {ShelfService} from '../../service/shelf.service';
|
||||
import {IconPickerService} from '../../../../shared/service/icon-picker.service';
|
||||
import {IconPickerService, IconSelection} from '../../../../shared/service/icon-picker.service';
|
||||
import {Shelf} from '../../model/shelf.model';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Button} from 'primeng/button';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {IconDisplayComponent} from '../../../../shared/components/icon-display/icon-display.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shelf-creator',
|
||||
@@ -17,7 +18,8 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
FormsModule,
|
||||
Button,
|
||||
InputText,
|
||||
Tooltip
|
||||
Tooltip,
|
||||
IconDisplayComponent
|
||||
],
|
||||
styleUrl: './shelf-creator.component.scss',
|
||||
})
|
||||
@@ -28,24 +30,7 @@ export class ShelfCreatorComponent {
|
||||
private iconPickerService = inject(IconPickerService);
|
||||
|
||||
shelfName: string = '';
|
||||
selectedIcon: string | null = null;
|
||||
|
||||
saveNewShelf(): void {
|
||||
const newShelf: Partial<Shelf> = {
|
||||
name: this.shelfName,
|
||||
icon: this.selectedIcon ? this.selectedIcon.replace('pi pi-', '') : 'heart'
|
||||
};
|
||||
this.shelfService.createShelf(newShelf as Shelf).subscribe({
|
||||
next: () => {
|
||||
this.messageService.add({severity: 'info', summary: 'Success', detail: `Shelf created: ${this.shelfName}`});
|
||||
this.dynamicDialogRef.close(true);
|
||||
},
|
||||
error: (e) => {
|
||||
this.messageService.add({severity: 'error', summary: 'Error', detail: 'Failed to create shelf'});
|
||||
console.error('Error creating shelf:', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
selectedIcon: IconSelection | null = null;
|
||||
|
||||
openIconPicker(): void {
|
||||
this.iconPickerService.open().subscribe(icon => {
|
||||
@@ -62,4 +47,26 @@ export class ShelfCreatorComponent {
|
||||
cancel(): void {
|
||||
this.dynamicDialogRef.close();
|
||||
}
|
||||
|
||||
createShelf(): void {
|
||||
const iconValue = this.selectedIcon?.value || 'bookmark';
|
||||
const iconType = this.selectedIcon?.type || 'PRIME_NG';
|
||||
|
||||
const newShelf: Partial<Shelf> = {
|
||||
name: this.shelfName,
|
||||
icon: iconValue,
|
||||
iconType: iconType
|
||||
};
|
||||
|
||||
this.shelfService.createShelf(newShelf as Shelf).subscribe({
|
||||
next: () => {
|
||||
this.messageService.add({severity: 'info', summary: 'Success', detail: `Shelf created: ${this.shelfName}`});
|
||||
this.dynamicDialogRef.close(true);
|
||||
},
|
||||
error: (e) => {
|
||||
this.messageService.add({severity: 'error', summary: 'Error', detail: 'Failed to create shelf'});
|
||||
console.error('Error creating shelf:', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -36,7 +36,11 @@
|
||||
@if (selectedIcon) {
|
||||
<div class="icon-container">
|
||||
<div class="icon-wrapper">
|
||||
<i [class]="selectedIcon" class="icon"></i>
|
||||
<app-icon-display
|
||||
[icon]="selectedIcon"
|
||||
size="24px"
|
||||
iconClass="icon"
|
||||
/>
|
||||
</div>
|
||||
<p-button icon="pi pi-times" (onClick)="clearSelectedIcon()" [rounded]="true" [text]="true" severity="danger"></p-button>
|
||||
</div>
|
||||
|
||||
+16
-6
@@ -1,13 +1,14 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {ShelfService} from '../../service/shelf.service';
|
||||
import {DialogService, DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {Button} from 'primeng/button';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {Shelf} from '../../model/shelf.model';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {IconPickerService} from '../../../../shared/service/icon-picker.service';
|
||||
import {IconPickerService, IconSelection} from '../../../../shared/service/icon-picker.service';
|
||||
import {IconDisplayComponent} from '../../../../shared/components/icon-display/icon-display.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shelf-edit-dialog',
|
||||
@@ -15,7 +16,8 @@ import {IconPickerService} from '../../../../shared/service/icon-picker.service'
|
||||
Button,
|
||||
InputText,
|
||||
ReactiveFormsModule,
|
||||
FormsModule
|
||||
FormsModule,
|
||||
IconDisplayComponent
|
||||
],
|
||||
templateUrl: './shelf-edit-dialog.component.html',
|
||||
standalone: true,
|
||||
@@ -30,7 +32,7 @@ export class ShelfEditDialogComponent implements OnInit {
|
||||
private iconPickerService = inject(IconPickerService);
|
||||
|
||||
shelfName: string = '';
|
||||
selectedIcon: string | null = null;
|
||||
selectedIcon: IconSelection | null = null;
|
||||
shelf!: Shelf | undefined;
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -38,7 +40,11 @@ export class ShelfEditDialogComponent implements OnInit {
|
||||
this.shelf = this.shelfService.getShelfById(shelfId);
|
||||
if (this.shelf) {
|
||||
this.shelfName = this.shelf.name;
|
||||
this.selectedIcon = 'pi pi-' + this.shelf.icon;
|
||||
if (this.shelf.iconType === 'PRIME_NG') {
|
||||
this.selectedIcon = {type: 'PRIME_NG', value: `pi pi-${this.shelf.icon}`};
|
||||
} else {
|
||||
this.selectedIcon = {type: 'CUSTOM_SVG', value: this.shelf.icon};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,9 +61,13 @@ export class ShelfEditDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
save() {
|
||||
const iconValue = this.selectedIcon?.value || 'bookmark';
|
||||
const iconType = this.selectedIcon?.type || 'PRIME_NG';
|
||||
|
||||
const shelf: Shelf = {
|
||||
name: this.shelfName,
|
||||
icon: this.selectedIcon?.replace('pi pi-', '') || 'heart'
|
||||
icon: iconValue,
|
||||
iconType: iconType
|
||||
};
|
||||
|
||||
this.shelfService.updateShelf(shelf, this.shelf?.id).subscribe({
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface Library {
|
||||
id?: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
iconType?: 'PRIME_NG' | 'CUSTOM_SVG';
|
||||
watch: boolean;
|
||||
fileNamingPattern?: string;
|
||||
sort?: SortOption;
|
||||
|
||||
@@ -4,5 +4,6 @@ export interface Shelf {
|
||||
id?: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
iconType?: 'PRIME_NG' | 'CUSTOM_SVG';
|
||||
sort?: SortOption;
|
||||
}
|
||||
|
||||
@@ -94,11 +94,20 @@
|
||||
} @else {
|
||||
<div class="selected-icon-display">
|
||||
<div class="icon-preview">
|
||||
<i [class]="selectedIcon"></i>
|
||||
<app-icon-display
|
||||
[icon]="selectedIcon"
|
||||
size="24px"
|
||||
/>
|
||||
</div>
|
||||
<div class="icon-info">
|
||||
<span class="icon-label">Selected Icon</span>
|
||||
<span class="icon-name">{{ selectedIcon }}</span>
|
||||
<span class="icon-name">
|
||||
@if (selectedIcon.type === 'PRIME_NG') {
|
||||
{{ selectedIcon.value }}
|
||||
} @else {
|
||||
{{ selectedIcon.value }} (Custom)
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
|
||||
@@ -11,21 +11,22 @@ import {InputText} from 'primeng/inputtext';
|
||||
import {BookFileType, Library, LibraryScanMode} from '../book/model/library.model';
|
||||
import {ToggleSwitch} from 'primeng/toggleswitch';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {IconPickerService} from '../../shared/service/icon-picker.service';
|
||||
import {IconPickerService, IconSelection} from '../../shared/service/icon-picker.service';
|
||||
import {Select} from 'primeng/select';
|
||||
import {Button} from 'primeng/button';
|
||||
import {IconDisplayComponent} from '../../shared/components/icon-display/icon-display.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-library-creator',
|
||||
standalone: true,
|
||||
templateUrl: './library-creator.component.html',
|
||||
imports: [TableModule, StepPanel, FormsModule, InputText, Stepper, StepList, Step, StepPanels, ToggleSwitch, Tooltip, Select, Button],
|
||||
imports: [TableModule, StepPanel, FormsModule, InputText, Stepper, StepList, Step, StepPanels, ToggleSwitch, Tooltip, Select, Button, IconDisplayComponent],
|
||||
styleUrl: './library-creator.component.scss'
|
||||
})
|
||||
export class LibraryCreatorComponent implements OnInit {
|
||||
chosenLibraryName: string = '';
|
||||
folders: string[] = [];
|
||||
selectedIcon: string | null = null;
|
||||
selectedIcon: IconSelection | null = null;
|
||||
|
||||
mode!: string;
|
||||
library!: Library | undefined;
|
||||
@@ -61,10 +62,16 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
this.mode = data.mode;
|
||||
this.library = this.libraryService.findLibraryById(data.libraryId);
|
||||
if (this.library) {
|
||||
const {name, icon, paths, watch, scanMode, defaultBookFormat} = this.library;
|
||||
const {name, icon, iconType, paths, watch, scanMode, defaultBookFormat} = this.library;
|
||||
this.chosenLibraryName = name;
|
||||
this.editModeLibraryName = name;
|
||||
this.selectedIcon = `pi pi-${icon}`;
|
||||
|
||||
if (iconType === 'CUSTOM_SVG') {
|
||||
this.selectedIcon = {type: 'CUSTOM_SVG', value: icon};
|
||||
} else {
|
||||
this.selectedIcon = {type: 'PRIME_NG', value: `pi pi-${icon}`};
|
||||
}
|
||||
|
||||
this.watch = watch;
|
||||
this.scanMode = scanMode || 'FILE_AS_BOOK';
|
||||
this.defaultBookFormat = defaultBookFormat || undefined;
|
||||
@@ -145,10 +152,14 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
}
|
||||
|
||||
createOrUpdateLibrary(): void {
|
||||
const iconValue = this.selectedIcon?.value || 'heart';
|
||||
const iconType = this.selectedIcon?.type || 'PRIME_NG';
|
||||
|
||||
if (this.mode === 'edit') {
|
||||
const library: Library = {
|
||||
name: this.chosenLibraryName,
|
||||
icon: this.selectedIcon?.replace('pi pi-', '') || 'heart',
|
||||
icon: iconValue,
|
||||
iconType: iconType,
|
||||
paths: this.folders.map(folder => ({path: folder})),
|
||||
watch: this.watch,
|
||||
scanMode: this.scanMode,
|
||||
@@ -167,7 +178,8 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
} else {
|
||||
const library: Library = {
|
||||
name: this.chosenLibraryName,
|
||||
icon: this.selectedIcon?.replace('pi pi-', '') || 'heart',
|
||||
icon: iconValue,
|
||||
iconType: iconType,
|
||||
paths: this.folders.map(folder => ({path: folder})),
|
||||
watch: this.watch,
|
||||
scanMode: this.scanMode,
|
||||
|
||||
@@ -29,13 +29,22 @@
|
||||
<div class="icon-picker-section">
|
||||
<div class="icon-picker-wrapper">
|
||||
<label>Shelf Icon</label>
|
||||
<p-button
|
||||
[icon]="form.get('icon')?.value || 'pi pi-plus'"
|
||||
(click)="openIconPicker()"
|
||||
[outlined]="form.get('icon')?.value"
|
||||
[severity]="form.get('icon')?.value ? 'success' : 'danger'"
|
||||
[label]="form.get('icon')?.value ? 'Icon Selected' : 'Select Icon'">
|
||||
</p-button>
|
||||
<div class="icon-display-container" (click)="openIconPicker()">
|
||||
@if (selectedIcon) {
|
||||
<app-icon-display
|
||||
[icon]="selectedIcon"
|
||||
[size]="'16px'"
|
||||
iconClass="selected-icon"
|
||||
alt="Selected shelf icon">
|
||||
</app-icon-display>
|
||||
<span class="icon-label">Click to change</span>
|
||||
} @else {
|
||||
<div class="icon-placeholder">
|
||||
<i class="pi pi-plus"></i>
|
||||
<span>Select Icon</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (isAdmin) {
|
||||
|
||||
@@ -152,6 +152,48 @@
|
||||
color: var(--text-color);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.icon-display-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.625rem 1rem;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
background: var(--card-background);
|
||||
|
||||
&:hover {
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.selected-icon {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.icon-label {
|
||||
font-size: 0.95rem;
|
||||
color: var(--text-secondary-color);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.icon-placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: var(--text-secondary-color);
|
||||
|
||||
i {
|
||||
font-size: 1.125rem;
|
||||
color: var(--primary-color)
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
|
||||
@@ -15,9 +15,10 @@ import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {MultiSelect} from 'primeng/multiselect';
|
||||
import {AutoComplete} from 'primeng/autocomplete';
|
||||
import {EMPTY_CHECK_OPERATORS, MULTI_VALUE_OPERATORS, parseValue, removeNulls, serializeDateRules} from '../service/magic-shelf-utils';
|
||||
import {IconPickerService} from '../../../shared/service/icon-picker.service';
|
||||
import {IconPickerService, IconSelection} from '../../../shared/service/icon-picker.service';
|
||||
import {CheckboxModule} from "primeng/checkbox";
|
||||
import {UserService} from "../../settings/user-management/user.service";
|
||||
import {IconDisplayComponent} from '../../../shared/components/icon-display/icon-display.component';
|
||||
|
||||
export type RuleOperator =
|
||||
| 'equals'
|
||||
@@ -154,7 +155,8 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
|
||||
InputNumber,
|
||||
MultiSelect,
|
||||
AutoComplete,
|
||||
CheckboxModule
|
||||
CheckboxModule,
|
||||
IconDisplayComponent
|
||||
]
|
||||
})
|
||||
export class MagicShelfComponent implements OnInit {
|
||||
@@ -210,6 +212,8 @@ export class MagicShelfComponent implements OnInit {
|
||||
userService = inject(UserService);
|
||||
private iconPicker = inject(IconPickerService);
|
||||
|
||||
selectedIcon: IconSelection | null = null;
|
||||
|
||||
trackByFn(ruleCtrl: AbstractControl, index: number): any {
|
||||
return ruleCtrl;
|
||||
}
|
||||
@@ -222,12 +226,20 @@ export class MagicShelfComponent implements OnInit {
|
||||
if (id) {
|
||||
this.shelfId = id;
|
||||
this.magicShelfService.getShelf(id).subscribe((data) => {
|
||||
const iconValue = data?.icon ?? null;
|
||||
|
||||
this.form = new FormGroup({
|
||||
name: new FormControl<string | null>(data?.name ?? null, {nonNullable: true, validators: [Validators.required]}),
|
||||
icon: new FormControl<string | null>(data?.icon ?? null, {nonNullable: true, validators: [Validators.required]}),
|
||||
icon: new FormControl<string | null>(iconValue, {nonNullable: true, validators: [Validators.required]}),
|
||||
isPublic: new FormControl<boolean>(data?.isPublic ?? false),
|
||||
group: data?.filterJson ? this.buildGroupFromData(JSON.parse(data.filterJson)) : this.createGroup()
|
||||
});
|
||||
|
||||
if (iconValue) {
|
||||
this.selectedIcon = iconValue.startsWith('pi ')
|
||||
? {type: 'PRIME_NG', value: iconValue}
|
||||
: {type: 'CUSTOM_SVG', value: iconValue};
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.form = new FormGroup({
|
||||
@@ -409,7 +421,11 @@ export class MagicShelfComponent implements OnInit {
|
||||
openIconPicker() {
|
||||
this.iconPicker.open().subscribe(icon => {
|
||||
if (icon) {
|
||||
this.form.get('icon')?.setValue(icon);
|
||||
this.selectedIcon = icon;
|
||||
const iconValue = icon.type === 'CUSTOM_SVG'
|
||||
? icon.value
|
||||
: icon.value;
|
||||
this.form.get('icon')?.setValue(iconValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -462,14 +478,14 @@ export class MagicShelfComponent implements OnInit {
|
||||
id: this.shelfId ?? undefined,
|
||||
name: value.name,
|
||||
icon: value.icon,
|
||||
isPublic: !!value.isPublic, // Ensure it's a boolean
|
||||
iconType: this.selectedIcon?.type,
|
||||
isPublic: !!value.isPublic,
|
||||
group: cleanedGroup
|
||||
}).subscribe({
|
||||
next: (savedShelf) => {
|
||||
this.messageService.add({severity: 'success', summary: 'Success', detail: 'Magic shelf saved successfully.'});
|
||||
if (savedShelf?.id) {
|
||||
this.shelfId = savedShelf.id;
|
||||
// Update the form with the saved data to reflect changes immediately
|
||||
this.form.patchValue({
|
||||
name: savedShelf.name,
|
||||
icon: savedShelf.icon,
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface MagicShelf {
|
||||
id?: number | null;
|
||||
name: string;
|
||||
icon?: string;
|
||||
iconType?: 'PRIME_NG' | 'CUSTOM_SVG';
|
||||
filterJson: string;
|
||||
isPublic?: boolean;
|
||||
}
|
||||
@@ -93,11 +94,12 @@ export class MagicShelfService {
|
||||
);
|
||||
}
|
||||
|
||||
saveShelf(data: { id?: number; name: string | null; icon: string | null; group: any, isPublic?: boolean | null }): Observable<MagicShelf> {
|
||||
saveShelf(data: { id?: number; name: string | null; icon: string | null; iconType?: 'PRIME_NG' | 'CUSTOM_SVG'; group: any, isPublic?: boolean | null }): Observable<MagicShelf> {
|
||||
const payload: MagicShelf = {
|
||||
id: data.id,
|
||||
name: data.name ?? '',
|
||||
icon: data.icon ?? 'pi pi-book',
|
||||
iconType: data.iconType,
|
||||
filterJson: JSON.stringify(data.group),
|
||||
isPublic: data.isPublic ?? false
|
||||
};
|
||||
|
||||
@@ -69,7 +69,6 @@ export class CoverSearchComponent implements OnInit {
|
||||
.pipe(finalize(() => this.loading = false))
|
||||
.subscribe({
|
||||
next: (images) => {
|
||||
console.log('API response received:', images);
|
||||
this.coverImages = images.sort((a, b) => a.index - b.index);
|
||||
this.hasSearched = true;
|
||||
},
|
||||
|
||||
@@ -616,7 +616,7 @@ export class CbxReaderComponent implements OnInit {
|
||||
next: (seriesBooks) => {
|
||||
const sortedBySeriesNumber = this.sortBooksBySeriesNumber(seriesBooks);
|
||||
const currentBookIndex = sortedBySeriesNumber.findIndex(b => b.id === book.id);
|
||||
|
||||
|
||||
if (currentBookIndex === -1) {
|
||||
console.warn('[SeriesNav] Current book not found in series');
|
||||
return;
|
||||
@@ -627,14 +627,6 @@ export class CbxReaderComponent implements OnInit {
|
||||
|
||||
this.previousBookInSeries = hasPreviousBook ? sortedBySeriesNumber[currentBookIndex - 1] : null;
|
||||
this.nextBookInSeries = hasNextBook ? sortedBySeriesNumber[currentBookIndex + 1] : null;
|
||||
|
||||
console.log('[SeriesNav] Navigation loaded:', {
|
||||
series: book.metadata?.seriesName,
|
||||
totalBooks: seriesBooks.length,
|
||||
currentPosition: currentBookIndex + 1,
|
||||
hasPrevious: hasPreviousBook,
|
||||
hasNext: hasNextBook
|
||||
});
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('[SeriesNav] Failed to load series information:', err);
|
||||
@@ -652,22 +644,22 @@ export class CbxReaderComponent implements OnInit {
|
||||
|
||||
getBookDisplayTitle(book: Book | null): string {
|
||||
if (!book) return '';
|
||||
|
||||
|
||||
const parts: string[] = [];
|
||||
|
||||
|
||||
if (book.metadata?.seriesNumber) {
|
||||
parts.push(`#${book.metadata.seriesNumber}`);
|
||||
}
|
||||
|
||||
|
||||
const title = book.metadata?.title || book.fileName;
|
||||
if (title) {
|
||||
parts.push(title);
|
||||
}
|
||||
|
||||
|
||||
if (book.metadata?.subtitle) {
|
||||
parts.push(book.metadata.subtitle);
|
||||
}
|
||||
|
||||
|
||||
return parts.join(' - ');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user