feat: add i18n translations for book components, services, and readers (en/es) (#2738)
This commit is contained in:
+27
-25
@@ -1,7 +1,8 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerAudiobook'">
|
||||
@if (isLoading) {
|
||||
<div class="loading-container">
|
||||
<p-progressSpinner strokeWidth="3" />
|
||||
<span class="loading-text">Loading audiobook...</span>
|
||||
<span class="loading-text">{{ t('loading') }}</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="audiobook-player">
|
||||
@@ -23,12 +24,12 @@
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
(onClick)="closeReader()"
|
||||
pTooltip="Back"
|
||||
[pTooltip]="t('header.backTooltip')"
|
||||
tooltipPosition="bottom"
|
||||
/>
|
||||
<div class="header-info">
|
||||
<h1 class="book-title">{{ audiobookInfo.title || 'Untitled' }}</h1>
|
||||
<span class="book-author">{{ audiobookInfo.author || 'Unknown Author' }}</span>
|
||||
<h1 class="book-title">{{ audiobookInfo.title || t('untitled') }}</h1>
|
||||
<span class="book-author">{{ audiobookInfo.author || t('unknownAuthor') }}</span>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<p-button
|
||||
@@ -37,7 +38,7 @@
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
(onClick)="toggleBookmarkList()"
|
||||
pTooltip="Bookmarks"
|
||||
[pTooltip]="t('header.bookmarksTooltip')"
|
||||
tooltipPosition="bottom"
|
||||
/>
|
||||
<p-button
|
||||
@@ -46,7 +47,7 @@
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
(onClick)="toggleTrackList()"
|
||||
pTooltip="Chapters/Tracks"
|
||||
[pTooltip]="t('header.chaptersTracksTooltip')"
|
||||
tooltipPosition="bottom"
|
||||
/>
|
||||
</div>
|
||||
@@ -61,7 +62,7 @@
|
||||
<img
|
||||
[src]="coverUrl"
|
||||
(error)="onCoverError()"
|
||||
alt="Cover"
|
||||
[alt]="t('coverAlt')"
|
||||
class="cover-image"
|
||||
/>
|
||||
} @else {
|
||||
@@ -81,11 +82,11 @@
|
||||
<div class="track-info">
|
||||
@if (audiobookInfo.folderBased && currentTrack) {
|
||||
<span class="track-title">{{ currentTrack.title }}</span>
|
||||
<span class="track-number">Track {{ currentTrackIndex + 1 }} of {{ audiobookInfo.tracks?.length }}</span>
|
||||
<span class="track-number">{{ t('trackInfo.trackOf', { current: currentTrackIndex + 1, total: audiobookInfo.tracks?.length }) }}</span>
|
||||
} @else if (getCurrentChapter()) {
|
||||
<span class="track-title">{{ getCurrentChapter()?.title }}</span>
|
||||
@if (hasMultipleChapters()) {
|
||||
<span class="track-number">Chapter {{ getCurrentChapterIndex() + 1 }} of {{ audiobookInfo.chapters?.length }}</span>
|
||||
<span class="track-number">{{ t('trackInfo.chapterOf', { current: getCurrentChapterIndex() + 1, total: audiobookInfo.chapters?.length }) }}</span>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -119,7 +120,7 @@
|
||||
severity="secondary"
|
||||
(onClick)="previousTrack()"
|
||||
[disabled]="currentTrackIndex === 0"
|
||||
pTooltip="Previous Track"
|
||||
[pTooltip]="t('controls.previousTrackTooltip')"
|
||||
tooltipPosition="top"
|
||||
size="large"
|
||||
/>
|
||||
@@ -131,7 +132,7 @@
|
||||
severity="secondary"
|
||||
(onClick)="previousChapter()"
|
||||
[disabled]="!canGoPreviousChapter()"
|
||||
pTooltip="Previous Chapter"
|
||||
[pTooltip]="t('controls.previousChapterTooltip')"
|
||||
tooltipPosition="top"
|
||||
size="large"
|
||||
/>
|
||||
@@ -143,7 +144,7 @@
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
(onClick)="seekRelative(-30)"
|
||||
pTooltip="-30s"
|
||||
[pTooltip]="t('controls.rewindTooltip')"
|
||||
tooltipPosition="top"
|
||||
size="large"
|
||||
/>
|
||||
@@ -164,7 +165,7 @@
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
(onClick)="seekRelative(30)"
|
||||
pTooltip="+30s"
|
||||
[pTooltip]="t('controls.forwardTooltip')"
|
||||
tooltipPosition="top"
|
||||
size="large"
|
||||
/>
|
||||
@@ -177,7 +178,7 @@
|
||||
severity="secondary"
|
||||
(onClick)="nextTrack()"
|
||||
[disabled]="!audiobookInfo.tracks || currentTrackIndex >= audiobookInfo.tracks.length - 1"
|
||||
pTooltip="Next Track"
|
||||
[pTooltip]="t('controls.nextTrackTooltip')"
|
||||
tooltipPosition="top"
|
||||
size="large"
|
||||
/>
|
||||
@@ -189,7 +190,7 @@
|
||||
severity="secondary"
|
||||
(onClick)="nextChapter()"
|
||||
[disabled]="!canGoNextChapter()"
|
||||
pTooltip="Next Chapter"
|
||||
[pTooltip]="t('controls.nextChapterTooltip')"
|
||||
tooltipPosition="top"
|
||||
size="large"
|
||||
/>
|
||||
@@ -236,7 +237,7 @@
|
||||
<!-- Add bookmark button -->
|
||||
<p-button
|
||||
icon="pi pi-bookmark-fill"
|
||||
label="Add Bookmark"
|
||||
[label]="t('extra.addBookmark')"
|
||||
[rounded]="true"
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
@@ -248,7 +249,7 @@
|
||||
<p-button
|
||||
#sleepTimerBtn
|
||||
icon="pi pi-moon"
|
||||
[label]="sleepTimerActive ? formatSleepTimerRemaining() : 'Sleep Timer'"
|
||||
[label]="sleepTimerActive ? formatSleepTimerRemaining() : t('extra.sleepTimer')"
|
||||
[rounded]="true"
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
@@ -269,19 +270,19 @@
|
||||
@if (audiobookInfo.narrator) {
|
||||
<span class="detail-item">
|
||||
<i class="pi pi-user"></i>
|
||||
Narrated by {{ audiobookInfo.narrator }}
|
||||
{{ t('details.narratedBy', { narrator: audiobookInfo.narrator }) }}
|
||||
</span>
|
||||
}
|
||||
@if (audiobookInfo.bitrate) {
|
||||
<span class="detail-item">
|
||||
<i class="pi pi-sliders-h"></i>
|
||||
{{ audiobookInfo.bitrate }} kbps
|
||||
{{ t('details.kbps', { bitrate: audiobookInfo.bitrate }) }}
|
||||
</span>
|
||||
}
|
||||
@if (audiobookInfo.durationMs) {
|
||||
<span class="detail-item">
|
||||
<i class="pi pi-clock"></i>
|
||||
{{ formatDuration(audiobookInfo.durationMs) }} total
|
||||
{{ t('details.totalDuration', { duration: formatDuration(audiobookInfo.durationMs) }) }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
@@ -291,7 +292,7 @@
|
||||
@if (showTrackList) {
|
||||
<aside class="track-list-sidebar">
|
||||
<div class="sidebar-header">
|
||||
<h2>{{ audiobookInfo.folderBased ? 'Tracks' : 'Chapters' }}</h2>
|
||||
<h2>{{ audiobookInfo.folderBased ? t('sidebar.tracks') : t('sidebar.chapters') }}</h2>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
[rounded]="true"
|
||||
@@ -348,7 +349,7 @@
|
||||
@if (showBookmarkList) {
|
||||
<aside class="track-list-sidebar bookmark-sidebar">
|
||||
<div class="sidebar-header">
|
||||
<h2>Bookmarks</h2>
|
||||
<h2>{{ t('bookmarks.title') }}</h2>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
[rounded]="true"
|
||||
@@ -361,8 +362,8 @@
|
||||
@if (bookmarks.length === 0) {
|
||||
<div class="empty-bookmarks">
|
||||
<i class="pi pi-bookmark"></i>
|
||||
<p>No bookmarks yet</p>
|
||||
<span>Add a bookmark to save your place</span>
|
||||
<p>{{ t('bookmarks.empty') }}</p>
|
||||
<span>{{ t('bookmarks.emptyHint') }}</span>
|
||||
</div>
|
||||
} @else {
|
||||
<ul class="track-list">
|
||||
@@ -383,7 +384,7 @@
|
||||
severity="danger"
|
||||
size="small"
|
||||
(onClick)="deleteBookmark($event, bookmark.id)"
|
||||
pTooltip="Delete"
|
||||
[pTooltip]="t('bookmarks.deleteTooltip')"
|
||||
tooltipPosition="left"
|
||||
/>
|
||||
</li>
|
||||
@@ -395,3 +396,4 @@
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</ng-container>
|
||||
|
||||
+34
-29
@@ -12,6 +12,7 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {MenuItem, MessageService} from 'primeng/api';
|
||||
import {SelectButton} from 'primeng/selectbutton';
|
||||
import {Menu} from 'primeng/menu';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
import {AudiobookService} from './audiobook.service';
|
||||
import {AudiobookChapter, AudiobookInfo, AudiobookProgress, AudiobookTrack} from './audiobook.model';
|
||||
@@ -33,7 +34,8 @@ import {API_CONFIG} from '../../../core/config/api-config';
|
||||
ProgressSpinner,
|
||||
Tooltip,
|
||||
SelectButton,
|
||||
Menu
|
||||
Menu,
|
||||
TranslocoDirective
|
||||
],
|
||||
templateUrl: './audiobook-player.component.html',
|
||||
styleUrls: ['./audiobook-player.component.scss']
|
||||
@@ -51,6 +53,7 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
private messageService = inject(MessageService);
|
||||
private audiobookSessionService = inject(AudiobookSessionService);
|
||||
private pageTitle = inject(PageTitleService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
isLoading = true;
|
||||
audioLoading = false;
|
||||
@@ -84,15 +87,7 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
private sleepTimerInterval?: ReturnType<typeof setInterval>;
|
||||
private originalVolume = 1;
|
||||
|
||||
sleepTimerOptions: MenuItem[] = [
|
||||
{label: '15 minutes', command: () => this.setSleepTimer(15)},
|
||||
{label: '30 minutes', command: () => this.setSleepTimer(30)},
|
||||
{label: '45 minutes', command: () => this.setSleepTimer(45)},
|
||||
{label: '60 minutes', command: () => this.setSleepTimer(60)},
|
||||
{label: 'End of chapter', command: () => this.setSleepTimerEndOfChapter()},
|
||||
{separator: true},
|
||||
{label: 'Cancel timer', command: () => this.cancelSleepTimer(), visible: false}
|
||||
];
|
||||
sleepTimerOptions: MenuItem[] = [];
|
||||
|
||||
bookmarks: BookMark[] = [];
|
||||
|
||||
@@ -111,6 +106,16 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
private isSeeking = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.sleepTimerOptions = [
|
||||
{label: this.t.translate('readerAudiobook.sleepTimerMenu.minutes15'), command: () => this.setSleepTimer(15)},
|
||||
{label: this.t.translate('readerAudiobook.sleepTimerMenu.minutes30'), command: () => this.setSleepTimer(30)},
|
||||
{label: this.t.translate('readerAudiobook.sleepTimerMenu.minutes45'), command: () => this.setSleepTimer(45)},
|
||||
{label: this.t.translate('readerAudiobook.sleepTimerMenu.minutes60'), command: () => this.setSleepTimer(60)},
|
||||
{label: this.t.translate('readerAudiobook.sleepTimerMenu.endOfChapter'), command: () => this.setSleepTimerEndOfChapter()},
|
||||
{separator: true},
|
||||
{id: 'cancel-timer', label: this.t.translate('readerAudiobook.sleepTimerMenu.cancelTimer'), command: () => this.cancelSleepTimer(), visible: false}
|
||||
];
|
||||
|
||||
this.route.paramMap.pipe(takeUntil(this.destroy$)).subscribe(params => {
|
||||
this.bookId = +params.get('bookId')!;
|
||||
this.loadAudiobook();
|
||||
@@ -174,8 +179,8 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
error: () => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Error',
|
||||
detail: 'Failed to load audiobook'
|
||||
summary: this.t.translate('common.error'),
|
||||
detail: this.t.translate('readerAudiobook.toast.loadFailed')
|
||||
});
|
||||
this.isLoading = false;
|
||||
this.audioLoading = false;
|
||||
@@ -345,8 +350,8 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
this.audioLoading = false;
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Error',
|
||||
detail: 'Failed to load audio'
|
||||
summary: this.t.translate('common.error'),
|
||||
detail: this.t.translate('readerAudiobook.toast.audioLoadFailed')
|
||||
});
|
||||
}
|
||||
|
||||
@@ -388,8 +393,8 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
: this.getCurrentChapter()?.title || this.audiobookInfo.title;
|
||||
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
title: title || 'Untitled',
|
||||
artist: this.audiobookInfo.author || 'Unknown Author',
|
||||
title: title || this.t.translate('readerAudiobook.untitled'),
|
||||
artist: this.audiobookInfo.author || this.t.translate('readerAudiobook.unknownAuthor'),
|
||||
album: this.audiobookInfo.title,
|
||||
artwork: this.coverUrl
|
||||
? [{src: this.coverUrl, sizes: '512x512', type: 'image/png'}]
|
||||
@@ -850,8 +855,8 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.messageService.add({
|
||||
severity: 'info',
|
||||
summary: 'Sleep Timer',
|
||||
detail: `Playback will stop in ${minutes} minutes`
|
||||
summary: this.t.translate('readerAudiobook.extra.sleepTimer'),
|
||||
detail: this.t.translate('readerAudiobook.toast.sleepTimerSet', {minutes})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -865,8 +870,8 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.messageService.add({
|
||||
severity: 'info',
|
||||
summary: 'Sleep Timer',
|
||||
detail: 'Playback will stop at end of chapter'
|
||||
summary: this.t.translate('readerAudiobook.extra.sleepTimer'),
|
||||
detail: this.t.translate('readerAudiobook.toast.sleepTimerEndOfChapter')
|
||||
});
|
||||
}
|
||||
|
||||
@@ -906,13 +911,13 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.messageService.add({
|
||||
severity: 'info',
|
||||
summary: 'Sleep Timer',
|
||||
detail: 'Playback stopped by sleep timer'
|
||||
summary: this.t.translate('readerAudiobook.extra.sleepTimer'),
|
||||
detail: this.t.translate('readerAudiobook.toast.sleepTimerStopped')
|
||||
});
|
||||
}
|
||||
|
||||
private updateSleepTimerMenuVisibility(): void {
|
||||
const cancelItem = this.sleepTimerOptions.find(item => item.label === 'Cancel timer');
|
||||
const cancelItem = this.sleepTimerOptions.find(item => item.id === 'cancel-timer');
|
||||
if (cancelItem) {
|
||||
cancelItem.visible = this.sleepTimerActive;
|
||||
}
|
||||
@@ -920,7 +925,7 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
|
||||
formatSleepTimerRemaining(): string {
|
||||
if (this.sleepTimerEndOfChapter) {
|
||||
return 'End of chapter';
|
||||
return this.t.translate('readerAudiobook.extra.endOfChapter');
|
||||
}
|
||||
const minutes = Math.floor(this.sleepTimerRemaining / 60);
|
||||
const seconds = this.sleepTimerRemaining % 60;
|
||||
@@ -964,7 +969,7 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
} else if (currentChapter) {
|
||||
title = `${currentChapter.title} - ${this.formatTime(this.currentTime)}`;
|
||||
} else {
|
||||
title = `Bookmark at ${this.formatTime(this.currentTime)}`;
|
||||
title = this.t.translate('readerAudiobook.bookmarks.bookmarkAt', {time: this.formatTime(this.currentTime)});
|
||||
}
|
||||
|
||||
const request: CreateBookMarkRequest = {
|
||||
@@ -981,7 +986,7 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
this.bookmarks = [...this.bookmarks, bookmark];
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Bookmark Added',
|
||||
summary: this.t.translate('readerAudiobook.toast.bookmarkAdded'),
|
||||
detail: title
|
||||
});
|
||||
},
|
||||
@@ -989,8 +994,8 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
const isDuplicate = err?.status === 409;
|
||||
this.messageService.add({
|
||||
severity: isDuplicate ? 'warn' : 'error',
|
||||
summary: isDuplicate ? 'Bookmark Exists' : 'Error',
|
||||
detail: isDuplicate ? 'A bookmark already exists at this position' : 'Failed to add bookmark'
|
||||
summary: isDuplicate ? this.t.translate('readerAudiobook.toast.bookmarkExists') : this.t.translate('common.error'),
|
||||
detail: isDuplicate ? this.t.translate('readerAudiobook.toast.bookmarkExistsDetail') : this.t.translate('readerAudiobook.toast.bookmarkFailed')
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1079,7 +1084,7 @@ export class AudiobookPlayerComponent implements OnInit, OnDestroy {
|
||||
this.bookmarks = this.bookmarks.filter(b => b.id !== bookmarkId);
|
||||
this.messageService.add({
|
||||
severity: 'info',
|
||||
summary: 'Bookmark Deleted'
|
||||
summary: this.t.translate('readerAudiobook.toast.bookmarkDeleted')
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="end-of-comic-action">
|
||||
<button class="next-book-action-button" (click)="navigateToNextBook()">
|
||||
<span class="action-icon">📖</span>
|
||||
<span class="action-text">Continue to Next Book</span>
|
||||
<span class="action-text">{{ 'readerCbx.reader.continueToNextBook' | transloco }}</span>
|
||||
<span class="book-title">{{ getBookDisplayTitle(nextBookInSeries) }}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -89,7 +89,7 @@
|
||||
<div class="end-of-comic-action">
|
||||
<button class="next-book-action-button" (click)="navigateToNextBook()">
|
||||
<span class="action-icon">📖</span>
|
||||
<span class="action-text">Continue to Next Book</span>
|
||||
<span class="action-text">{{ 'readerCbx.reader.continueToNextBook' | transloco }}</span>
|
||||
<span class="book-title">{{ getBookDisplayTitle(nextBookInSeries) }}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -98,14 +98,14 @@
|
||||
}
|
||||
} @else {
|
||||
<div class="no-pages">
|
||||
<p>No pages available.</p>
|
||||
<p>{{ 'readerCbx.reader.noPagesAvailable' | transloco }}</p>
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
<div class="loader-overlay">
|
||||
<div class="loader-content">
|
||||
<div class="spinner"></div>
|
||||
<p class="loader-text">Loading book...</p>
|
||||
<p class="loader-text">{{ 'readerCbx.reader.loadingBook' | transloco }}</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {CbxReaderService} from '../../book/service/cbx-reader.service';
|
||||
import {BookService} from '../../book/service/book.service';
|
||||
import {CbxBackgroundColor, CbxFitMode, CbxPageSpread, CbxPageViewMode, CbxScrollMode, CbxReadingDirection, CbxSlideshowInterval, UserService} from '../../settings/user-management/user.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||
import {Book, BookSetting, BookType} from '../../book/model/book.model';
|
||||
import {BookState} from '../../book/model/state/book-state.model';
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
@@ -35,6 +36,7 @@ import {BookNoteV2} from '../../../shared/service/book-note-v2.service';
|
||||
CommonModule,
|
||||
ProgressSpinner,
|
||||
FormsModule,
|
||||
TranslocoPipe,
|
||||
CbxHeaderComponent,
|
||||
CbxSidebarComponent,
|
||||
CbxFooterComponent,
|
||||
@@ -126,6 +128,7 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
||||
private bookService = inject(BookService);
|
||||
private userService = inject(UserService);
|
||||
private messageService = inject(MessageService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private pageTitle = inject(PageTitleService);
|
||||
private readingSessionService = inject(ReadingSessionService);
|
||||
private headerService = inject(CbxHeaderService);
|
||||
@@ -247,15 +250,15 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
||||
this.readingSessionService.startSession(this.bookId, "CBX", (this.currentPage + 1).toString(), percentage);
|
||||
},
|
||||
error: (err) => {
|
||||
const errorMessage = err?.error?.message || 'Failed to load pages';
|
||||
this.messageService.add({severity: 'error', summary: 'Error', detail: errorMessage});
|
||||
const errorMessage = err?.error?.message || this.t.translate('shared.reader.failedToLoadPages');
|
||||
this.messageService.add({severity: 'error', summary: this.t.translate('common.error'), detail: errorMessage});
|
||||
this.isLoading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
error: (err) => {
|
||||
const errorMessage = err?.error?.message || 'Failed to load the book';
|
||||
this.messageService.add({severity: 'error', summary: 'Error', detail: errorMessage});
|
||||
const errorMessage = err?.error?.message || this.t.translate('shared.reader.failedToLoadBook');
|
||||
this.messageService.add({severity: 'error', summary: this.t.translate('common.error'), detail: errorMessage});
|
||||
this.isLoading = false;
|
||||
}
|
||||
});
|
||||
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
<div class="dialog-overlay" (click)="onOverlayClick($event)">
|
||||
<div class="dialog">
|
||||
<div class="dialog-header">
|
||||
<h2>{{ isEditing ? 'Edit Note' : 'Add Note' }}</h2>
|
||||
<h2>{{ isEditing ? ('readerCbx.noteDialog.editNote' | transloco) : ('readerCbx.noteDialog.addNote' | transloco) }}</h2>
|
||||
<button class="close-btn" (click)="onCancel()">
|
||||
<app-reader-icon name="close" [size]="18"></app-reader-icon>
|
||||
</button>
|
||||
@@ -9,24 +9,24 @@
|
||||
|
||||
<div class="dialog-body">
|
||||
<div class="page-info-section">
|
||||
<span class="section-label">Page</span>
|
||||
<p class="page-info">Page {{ data?.pageNumber }}</p>
|
||||
<span class="section-label">{{ 'readerCbx.noteDialog.pageLabel' | transloco }}</span>
|
||||
<p class="page-info">{{ 'readerCbx.noteDialog.pageInfo' | transloco: { pageNumber: data?.pageNumber } }}</p>
|
||||
</div>
|
||||
|
||||
<div class="note-section">
|
||||
<label class="section-label" for="noteContent">Your Note</label>
|
||||
<label class="section-label" for="noteContent">{{ 'readerCbx.noteDialog.yourNote' | transloco }}</label>
|
||||
<textarea
|
||||
id="noteContent"
|
||||
class="note-input"
|
||||
[(ngModel)]="noteContent"
|
||||
placeholder="Write your note here..."
|
||||
[placeholder]="'readerCbx.noteDialog.placeholder' | transloco"
|
||||
rows="6"
|
||||
autofocus
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div class="color-section">
|
||||
<span class="section-label">Note Color</span>
|
||||
<span class="section-label">{{ 'readerCbx.noteDialog.noteColor' | transloco }}</span>
|
||||
<div class="color-buttons">
|
||||
@for (color of noteColors; track color.value) {
|
||||
<button
|
||||
@@ -42,8 +42,8 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<button class="btn btn-secondary" (click)="onCancel()">Cancel</button>
|
||||
<button class="btn btn-primary" (click)="onSave()" [disabled]="!noteContent.trim()">{{ isEditing ? 'Update Note' : 'Save Note' }}</button>
|
||||
<button class="btn btn-secondary" (click)="onCancel()">{{ 'common.cancel' | transloco }}</button>
|
||||
<button class="btn btn-primary" (click)="onSave()" [disabled]="!noteContent.trim()">{{ isEditing ? ('readerCbx.noteDialog.updateNote' | transloco) : ('readerCbx.noteDialog.saveNote' | transloco) }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+15
-10
@@ -1,6 +1,7 @@
|
||||
import {Component, EventEmitter, Input, Output, OnChanges, SimpleChanges} from '@angular/core';
|
||||
import {Component, EventEmitter, inject, Input, Output, OnChanges, SimpleChanges} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||
import {ReaderIconComponent} from '../../ebook-reader/shared/icon.component';
|
||||
|
||||
export interface CbxNoteDialogData {
|
||||
@@ -18,11 +19,13 @@ export interface CbxNoteDialogResult {
|
||||
@Component({
|
||||
selector: 'app-cbx-note-dialog',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, ReaderIconComponent],
|
||||
imports: [CommonModule, FormsModule, TranslocoPipe, ReaderIconComponent],
|
||||
templateUrl: './cbx-note-dialog.component.html',
|
||||
styleUrls: ['./cbx-note-dialog.component.scss']
|
||||
})
|
||||
export class CbxNoteDialogComponent implements OnChanges {
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
@Input() data: CbxNoteDialogData | null = null;
|
||||
@Output() save = new EventEmitter<CbxNoteDialogResult>();
|
||||
@Output() cancel = new EventEmitter<void>();
|
||||
@@ -41,14 +44,16 @@ export class CbxNoteDialogComponent implements OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
noteColors = [
|
||||
{value: '#FFC107', label: 'Amber'},
|
||||
{value: '#4CAF50', label: 'Green'},
|
||||
{value: '#2196F3', label: 'Blue'},
|
||||
{value: '#E91E63', label: 'Pink'},
|
||||
{value: '#9C27B0', label: 'Purple'},
|
||||
{value: '#FF5722', label: 'Deep Orange'}
|
||||
];
|
||||
get noteColors() {
|
||||
return [
|
||||
{value: '#FFC107', label: this.t.translate('readerCbx.noteDialog.colorAmber')},
|
||||
{value: '#4CAF50', label: this.t.translate('readerCbx.noteDialog.colorGreen')},
|
||||
{value: '#2196F3', label: this.t.translate('readerCbx.noteDialog.colorBlue')},
|
||||
{value: '#E91E63', label: this.t.translate('readerCbx.noteDialog.colorPink')},
|
||||
{value: '#9C27B0', label: this.t.translate('readerCbx.noteDialog.colorPurple')},
|
||||
{value: '#FF5722', label: this.t.translate('readerCbx.noteDialog.colorDeepOrange')}
|
||||
];
|
||||
}
|
||||
|
||||
onSave(): void {
|
||||
if (this.noteContent.trim()) {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<div class="dialog-overlay" (click)="onOverlayClick($event)">
|
||||
<div class="dialog">
|
||||
<div class="dialog-header">
|
||||
<h2>Keyboard Shortcuts</h2>
|
||||
<h2>{{ 'readerCbx.shortcutsHelp.title' | transloco }}</h2>
|
||||
<button class="close-btn" (click)="onClose()">
|
||||
<app-reader-icon name="close" [size]="18"></app-reader-icon>
|
||||
</button>
|
||||
@@ -36,7 +36,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<button class="btn btn-primary" (click)="onClose()">Got it</button>
|
||||
<button class="btn btn-primary" (click)="onClose()">{{ 'readerCbx.shortcutsHelp.gotIt' | transloco }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+42
-37
@@ -1,5 +1,6 @@
|
||||
import {Component, EventEmitter, Output} from '@angular/core';
|
||||
import {Component, EventEmitter, inject, Output} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||
import {ReaderIconComponent} from '../../ebook-reader/shared/icon.component';
|
||||
|
||||
interface ShortcutItem {
|
||||
@@ -16,48 +17,52 @@ interface ShortcutGroup {
|
||||
@Component({
|
||||
selector: 'app-cbx-shortcuts-help',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ReaderIconComponent],
|
||||
imports: [CommonModule, TranslocoPipe, ReaderIconComponent],
|
||||
templateUrl: './cbx-shortcuts-help.component.html',
|
||||
styleUrls: ['./cbx-shortcuts-help.component.scss']
|
||||
})
|
||||
export class CbxShortcutsHelpComponent {
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
@Output() close = new EventEmitter<void>();
|
||||
|
||||
shortcutGroups: ShortcutGroup[] = [
|
||||
{
|
||||
title: 'Navigation',
|
||||
shortcuts: [
|
||||
{keys: ['←', '→'], description: 'Previous / Next page', mobileGesture: 'Swipe left/right'},
|
||||
{keys: ['Space'], description: 'Next page'},
|
||||
{keys: ['Shift', 'Space'], description: 'Previous page'},
|
||||
{keys: ['Home'], description: 'First page'},
|
||||
{keys: ['End'], description: 'Last page'},
|
||||
{keys: ['Page Up'], description: 'Previous page'},
|
||||
{keys: ['Page Down'], description: 'Next page'}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Display',
|
||||
shortcuts: [
|
||||
{keys: ['F'], description: 'Toggle fullscreen'},
|
||||
{keys: ['D'], description: 'Toggle reading direction (LTR/RTL)'},
|
||||
{keys: ['Escape'], description: 'Exit fullscreen / Close dialogs'},
|
||||
{keys: ['Double-click'], description: 'Toggle zoom (fit page / actual size)', mobileGesture: 'Double-tap'}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Playback',
|
||||
shortcuts: [
|
||||
{keys: ['P'], description: 'Toggle slideshow / auto-play'}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Other',
|
||||
shortcuts: [
|
||||
{keys: ['?'], description: 'Show this help dialog'}
|
||||
]
|
||||
}
|
||||
];
|
||||
get shortcutGroups(): ShortcutGroup[] {
|
||||
return [
|
||||
{
|
||||
title: this.t.translate('readerCbx.shortcutsHelp.groupNavigation'),
|
||||
shortcuts: [
|
||||
{keys: ['←', '→'], description: this.t.translate('readerCbx.shortcutsHelp.previousNextPage'), mobileGesture: this.t.translate('readerCbx.shortcutsHelp.swipeLeftRight')},
|
||||
{keys: ['Space'], description: this.t.translate('readerCbx.shortcutsHelp.nextPage')},
|
||||
{keys: ['Shift', 'Space'], description: this.t.translate('readerCbx.shortcutsHelp.previousPage')},
|
||||
{keys: ['Home'], description: this.t.translate('readerCbx.shortcutsHelp.firstPage')},
|
||||
{keys: ['End'], description: this.t.translate('readerCbx.shortcutsHelp.lastPage')},
|
||||
{keys: ['Page Up'], description: this.t.translate('readerCbx.shortcutsHelp.previousPage')},
|
||||
{keys: ['Page Down'], description: this.t.translate('readerCbx.shortcutsHelp.nextPage')}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: this.t.translate('readerCbx.shortcutsHelp.groupDisplay'),
|
||||
shortcuts: [
|
||||
{keys: ['F'], description: this.t.translate('readerCbx.shortcutsHelp.toggleFullscreen')},
|
||||
{keys: ['D'], description: this.t.translate('readerCbx.shortcutsHelp.toggleReadingDirection')},
|
||||
{keys: ['Escape'], description: this.t.translate('readerCbx.shortcutsHelp.exitFullscreenCloseDialogs')},
|
||||
{keys: ['Double-click'], description: this.t.translate('readerCbx.shortcutsHelp.toggleZoom'), mobileGesture: this.t.translate('readerCbx.shortcutsHelp.doubleTap')}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: this.t.translate('readerCbx.shortcutsHelp.groupPlayback'),
|
||||
shortcuts: [
|
||||
{keys: ['P'], description: this.t.translate('readerCbx.shortcutsHelp.toggleSlideshow')}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: this.t.translate('readerCbx.shortcutsHelp.groupOther'),
|
||||
shortcuts: [
|
||||
{keys: ['?'], description: this.t.translate('readerCbx.shortcutsHelp.showHelpDialog')}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
isMobile = window.innerWidth < 768;
|
||||
|
||||
|
||||
+10
-10
@@ -7,15 +7,15 @@
|
||||
[disabled]="!state.previousBookInSeries"
|
||||
[title]="getPreviousBookTooltip()">
|
||||
<app-reader-icon name="chevron-double-left" [size]="14" />
|
||||
<span class="label hide-on-mobile">Prev Book</span>
|
||||
<span class="label hide-on-mobile">{{ 'readerCbx.footer.prevBook' | transloco }}</span>
|
||||
</button>
|
||||
}
|
||||
|
||||
<div class="page-nav-left">
|
||||
<button class="nav-btn" (click)="onFirstPage()" [disabled]="!canGoPrevious" title="First Page">
|
||||
<button class="nav-btn" (click)="onFirstPage()" [disabled]="!canGoPrevious" [title]="'readerCbx.footer.firstPage' | transloco">
|
||||
<app-reader-icon name="chevron-first" [size]="16" />
|
||||
</button>
|
||||
<button class="nav-btn" (click)="onPreviousPage()" [disabled]="!canGoPrevious" title="Previous Page">
|
||||
<button class="nav-btn" (click)="onPreviousPage()" [disabled]="!canGoPrevious" [title]="'readerCbx.footer.previousPage' | transloco">
|
||||
<app-reader-icon name="chevron-left" [size]="16" />
|
||||
</button>
|
||||
<div class="page-info">
|
||||
@@ -23,13 +23,13 @@
|
||||
@if (displaySecondPage) {
|
||||
<span class="separator">-{{ displaySecondPage }}</span>
|
||||
}
|
||||
<span class="total"> of {{ state.totalPages }}</span>
|
||||
<span class="total"> {{ 'readerCbx.footer.of' | transloco }} {{ state.totalPages }}</span>
|
||||
</div>
|
||||
|
||||
<button class="nav-btn" (click)="onNextPage()" [disabled]="!canGoNext" title="Next Page">
|
||||
<button class="nav-btn" (click)="onNextPage()" [disabled]="!canGoNext" [title]="'readerCbx.footer.nextPage' | transloco">
|
||||
<app-reader-icon name="chevron-right" [size]="16" />
|
||||
</button>
|
||||
<button class="nav-btn" (click)="onLastPage()" [disabled]="!canGoNext" title="Last Page">
|
||||
<button class="nav-btn" (click)="onLastPage()" [disabled]="!canGoNext" [title]="'readerCbx.footer.lastPage' | transloco">
|
||||
<app-reader-icon name="chevron-last" [size]="16" />
|
||||
</button>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@
|
||||
[value]="sliderValue"
|
||||
(input)="onSliderChange($event)"
|
||||
list="page-ticks"
|
||||
title="Page Slider"/>
|
||||
[title]="'readerCbx.footer.pageSlider' | transloco"/>
|
||||
<datalist id="page-ticks">
|
||||
@for (tick of sliderTicks; track tick) {
|
||||
<option [value]="tick"></option>
|
||||
@@ -59,7 +59,7 @@
|
||||
[(ngModel)]="goToPageInput"
|
||||
[min]="1"
|
||||
[max]="state.totalPages"
|
||||
placeholder="Page"
|
||||
[placeholder]="'readerCbx.footer.pagePlaceholder' | transloco"
|
||||
class="page-input"
|
||||
(keyup.enter)="onGoToPage()"
|
||||
/>
|
||||
@@ -67,7 +67,7 @@
|
||||
class="go-btn"
|
||||
(click)="onGoToPage()"
|
||||
[disabled]="goToPageInput === null || goToPageInput < 1 || goToPageInput > state.totalPages">
|
||||
Go
|
||||
{{ 'readerCbx.footer.go' | transloco }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,7 +83,7 @@
|
||||
(click)="onNextBook()"
|
||||
[disabled]="!state.nextBookInSeries"
|
||||
[title]="getNextBookTooltip()">
|
||||
<span class="label hide-on-mobile">Next Book</span>
|
||||
<span class="label hide-on-mobile">{{ 'readerCbx.footer.nextBook' | transloco }}</span>
|
||||
<app-reader-icon name="chevron-double-right" [size]="14" />
|
||||
</button>
|
||||
}
|
||||
|
||||
+7
-5
@@ -1,6 +1,7 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {Book} from '../../../../book/model/book.model';
|
||||
@@ -10,12 +11,13 @@ import {CbxFooterService, CbxFooterState} from './cbx-footer.service';
|
||||
@Component({
|
||||
selector: 'app-cbx-footer',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, ReaderIconComponent],
|
||||
imports: [CommonModule, FormsModule, TranslocoPipe, ReaderIconComponent],
|
||||
templateUrl: './cbx-footer.component.html',
|
||||
styleUrls: ['./cbx-footer.component.scss']
|
||||
})
|
||||
export class CbxFooterComponent implements OnInit, OnDestroy {
|
||||
private footerService = inject(CbxFooterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private destroy$ = new Subject<void>();
|
||||
|
||||
isVisible = false;
|
||||
@@ -144,13 +146,13 @@ export class CbxFooterComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
getPreviousBookTooltip(): string {
|
||||
if (!this.state.previousBookInSeries) return 'No Previous Book';
|
||||
return `Previous: ${this.getBookDisplayTitle(this.state.previousBookInSeries)}`;
|
||||
if (!this.state.previousBookInSeries) return this.t.translate('readerCbx.footer.noPreviousBook');
|
||||
return this.t.translate('readerCbx.footer.previousBookTooltip', { title: this.getBookDisplayTitle(this.state.previousBookInSeries) });
|
||||
}
|
||||
|
||||
getNextBookTooltip(): string {
|
||||
if (!this.state.nextBookInSeries) return 'No Next Book';
|
||||
return `Next: ${this.getBookDisplayTitle(this.state.nextBookInSeries)}`;
|
||||
if (!this.state.nextBookInSeries) return this.t.translate('readerCbx.footer.noNextBook');
|
||||
return this.t.translate('readerCbx.footer.nextBookTooltip', { title: this.getBookDisplayTitle(this.state.nextBookInSeries) });
|
||||
}
|
||||
|
||||
private getBookDisplayTitle(book: Book): string {
|
||||
|
||||
+12
-12
@@ -1,12 +1,12 @@
|
||||
<div class="cbx-header" [class.visible]="isVisible">
|
||||
<div class="header-left">
|
||||
<button class="icon-btn" (click)="onOpenSidebar()" title="Contents">
|
||||
<button class="icon-btn" (click)="onOpenSidebar()" [title]="'readerCbx.header.contents' | transloco">
|
||||
<app-reader-icon name="menu" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn" (click)="onToggleBookmark()" [title]="isCurrentPageBookmarked ? 'Remove Bookmark' : 'Add Bookmark'" [class.active]="isCurrentPageBookmarked">
|
||||
<button class="icon-btn" (click)="onToggleBookmark()" [title]="isCurrentPageBookmarked ? ('readerCbx.header.removeBookmark' | transloco) : ('readerCbx.header.addBookmark' | transloco)" [class.active]="isCurrentPageBookmarked">
|
||||
<app-reader-icon name="bookmark" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn" (click)="onOpenNoteDialog()" [title]="currentPageHasNotes ? 'Page has notes - Add another' : 'Add Note'" [class.has-notes]="currentPageHasNotes">
|
||||
<button class="icon-btn" (click)="onOpenNoteDialog()" [title]="currentPageHasNotes ? ('readerCbx.header.pageHasNotesAddAnother' | transloco) : ('readerCbx.header.addNote' | transloco)" [class.has-notes]="currentPageHasNotes">
|
||||
<app-reader-icon name="note" [size]="20" />
|
||||
@if (currentPageHasNotes) {
|
||||
<span class="indicator-dot"></span>
|
||||
@@ -15,17 +15,17 @@
|
||||
</div>
|
||||
<span class="book-title">{{ bookTitle }}</span>
|
||||
<div class="header-right">
|
||||
<button class="icon-btn desktop-only" (click)="onToggleSlideshow()" [title]="state.isSlideshowActive ? 'Stop Slideshow (P)' : 'Start Slideshow (P)'" [class.active]="state.isSlideshowActive">
|
||||
<button class="icon-btn desktop-only" (click)="onToggleSlideshow()" [title]="state.isSlideshowActive ? ('readerCbx.header.stopSlideshow' | transloco) : ('readerCbx.header.startSlideshow' | transloco)" [class.active]="state.isSlideshowActive">
|
||||
<app-reader-icon [name]="state.isSlideshowActive ? 'pause' : 'play'" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn desktop-only" (click)="onToggleFullscreen()" [title]="state.isFullscreen ? 'Exit Fullscreen (F)' : 'Fullscreen (F)'">
|
||||
<button class="icon-btn desktop-only" (click)="onToggleFullscreen()" [title]="state.isFullscreen ? ('readerCbx.header.exitFullscreen' | transloco) : ('readerCbx.header.fullscreen' | transloco)">
|
||||
<app-reader-icon [name]="state.isFullscreen ? 'fullscreen-exit' : 'fullscreen'" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn desktop-only" (click)="onShowShortcutsHelp()" title="Keyboard Shortcuts (?)">
|
||||
<button class="icon-btn desktop-only" (click)="onShowShortcutsHelp()" [title]="'readerCbx.header.keyboardShortcuts' | transloco">
|
||||
<app-reader-icon name="help" [size]="20" />
|
||||
</button>
|
||||
<div class="overflow-menu mobile-only">
|
||||
<button class="icon-btn" (click)="overflowOpen = !overflowOpen; $event.stopPropagation()" title="More">
|
||||
<button class="icon-btn" (click)="overflowOpen = !overflowOpen; $event.stopPropagation()" [title]="'readerCbx.header.more' | transloco">
|
||||
<app-reader-icon name="dots-vertical" [size]="20" />
|
||||
</button>
|
||||
@if (overflowOpen) {
|
||||
@@ -33,23 +33,23 @@
|
||||
<div class="overflow-dropdown">
|
||||
<button class="overflow-item" (click)="onToggleSlideshow(); overflowOpen = false" [class.active]="state.isSlideshowActive">
|
||||
<app-reader-icon [name]="state.isSlideshowActive ? 'pause' : 'play'" [size]="18" />
|
||||
<span>{{ state.isSlideshowActive ? 'Stop Slideshow' : 'Start Slideshow' }}</span>
|
||||
<span>{{ state.isSlideshowActive ? ('readerCbx.header.stopSlideshowLabel' | transloco) : ('readerCbx.header.startSlideshowLabel' | transloco) }}</span>
|
||||
</button>
|
||||
<button class="overflow-item" (click)="onToggleFullscreen(); overflowOpen = false">
|
||||
<app-reader-icon [name]="state.isFullscreen ? 'fullscreen-exit' : 'fullscreen'" [size]="18" />
|
||||
<span>{{ state.isFullscreen ? 'Exit Fullscreen' : 'Fullscreen' }}</span>
|
||||
<span>{{ state.isFullscreen ? ('readerCbx.header.exitFullscreenLabel' | transloco) : ('readerCbx.header.fullscreenLabel' | transloco) }}</span>
|
||||
</button>
|
||||
<button class="overflow-item" (click)="onShowShortcutsHelp(); overflowOpen = false">
|
||||
<app-reader-icon name="help" [size]="18" />
|
||||
<span>Keyboard Shortcuts</span>
|
||||
<span>{{ 'readerCbx.header.keyboardShortcutsLabel' | transloco }}</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<button class="icon-btn" (click)="onOpenSettings()" title="Settings">
|
||||
<button class="icon-btn" (click)="onOpenSettings()" [title]="'readerCbx.header.settings' | transloco">
|
||||
<app-reader-icon name="settings" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn close-btn" (click)="onClose(); $event.stopPropagation()" title="Close Reader">
|
||||
<button class="icon-btn close-btn" (click)="onClose(); $event.stopPropagation()" [title]="'readerCbx.header.closeReader' | transloco">
|
||||
<app-reader-icon name="close" [size]="20" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
import {Component, inject, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {TranslocoPipe} from '@jsverse/transloco';
|
||||
import {CbxHeaderService, CbxHeaderState} from './cbx-header.service';
|
||||
import {ReaderIconComponent} from '../../../ebook-reader';
|
||||
import {CommonModule} from '@angular/common';
|
||||
@@ -8,7 +9,7 @@ import {CommonModule} from '@angular/common';
|
||||
@Component({
|
||||
selector: 'app-cbx-header',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ReaderIconComponent],
|
||||
imports: [CommonModule, TranslocoPipe, ReaderIconComponent],
|
||||
templateUrl: './cbx-header.component.html',
|
||||
styleUrls: ['./cbx-header.component.scss']
|
||||
})
|
||||
|
||||
+10
-10
@@ -4,7 +4,7 @@
|
||||
<div class="panel-body">
|
||||
<!-- Fit Mode -->
|
||||
<div class="control">
|
||||
<label>Fit Mode</label>
|
||||
<label>{{ 'readerCbx.quickSettings.fitMode' | transloco }}</label>
|
||||
<div class="control-right">
|
||||
<div class="button-group">
|
||||
@for (option of fitModeOptions; track option.value) {
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<!-- Scroll Mode -->
|
||||
<div class="control">
|
||||
<label>Scroll Mode</label>
|
||||
<label>{{ 'readerCbx.quickSettings.scrollMode' | transloco }}</label>
|
||||
<div class="control-right">
|
||||
<div class="button-group text-btns">
|
||||
@for (option of scrollModeOptions; track option.value) {
|
||||
@@ -41,9 +41,9 @@
|
||||
<!-- Page View (only in paginated mode) -->
|
||||
@if (isPaginated && !isPhonePortrait) {
|
||||
<div class="control">
|
||||
<label>Page View</label>
|
||||
<label>{{ 'readerCbx.quickSettings.pageView' | transloco }}</label>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ isTwoPageView ? 'Two-Page' : 'Single' }}</span>
|
||||
<span class="mode-label">{{ isTwoPageView ? ('readerCbx.quickSettings.twoPage' | transloco) : ('readerCbx.quickSettings.single' | transloco) }}</span>
|
||||
<button class="switch" [class.active]="isTwoPageView" (click)="onPageViewToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
@@ -54,9 +54,9 @@
|
||||
<!-- Page Spread (only in two-page mode) -->
|
||||
@if (isPaginated && isTwoPageView) {
|
||||
<div class="control">
|
||||
<label>Page Spread</label>
|
||||
<label>{{ 'readerCbx.quickSettings.pageSpread' | transloco }}</label>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ state.pageSpread === CbxPageSpread.ODD ? 'Odd First' : 'Even First' }}</span>
|
||||
<span class="mode-label">{{ state.pageSpread === CbxPageSpread.ODD ? ('readerCbx.quickSettings.oddFirst' | transloco) : ('readerCbx.quickSettings.evenFirst' | transloco) }}</span>
|
||||
<button class="switch" [class.active]="state.pageSpread === CbxPageSpread.EVEN" (click)="onPageSpreadToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
@@ -66,9 +66,9 @@
|
||||
|
||||
<!-- Reading Direction -->
|
||||
<div class="control">
|
||||
<label>Reading Direction</label>
|
||||
<label>{{ 'readerCbx.quickSettings.readingDirection' | transloco }}</label>
|
||||
<div class="control-right">
|
||||
<span class="mode-label">{{ state.readingDirection === CbxReadingDirection.LTR ? 'Left to Right' : 'Right to Left' }}</span>
|
||||
<span class="mode-label">{{ state.readingDirection === CbxReadingDirection.LTR ? ('readerCbx.quickSettings.leftToRight' | transloco) : ('readerCbx.quickSettings.rightToLeft' | transloco) }}</span>
|
||||
<button class="switch" [class.active]="state.readingDirection === CbxReadingDirection.RTL" (click)="onReadingDirectionToggle()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
<!-- Slideshow Interval -->
|
||||
<div class="control">
|
||||
<label>Slideshow Interval</label>
|
||||
<label>{{ 'readerCbx.quickSettings.slideshowInterval' | transloco }}</label>
|
||||
<div class="control-right">
|
||||
<div class="button-group text-btns">
|
||||
@for (option of slideshowIntervalOptions; track option.value) {
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
<!-- Background Color -->
|
||||
<div class="control">
|
||||
<label>Background</label>
|
||||
<label>{{ 'readerCbx.quickSettings.background' | transloco }}</label>
|
||||
<div class="control-right">
|
||||
<div class="button-group">
|
||||
@for (option of backgroundOptions; track option.value) {
|
||||
|
||||
+27
-19
@@ -1,5 +1,6 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {
|
||||
@@ -17,12 +18,13 @@ import {CbxQuickSettingsService, CbxQuickSettingsState} from './cbx-quick-settin
|
||||
@Component({
|
||||
selector: 'app-cbx-quick-settings',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ReaderIconComponent],
|
||||
imports: [CommonModule, TranslocoPipe, ReaderIconComponent],
|
||||
templateUrl: './cbx-quick-settings.component.html',
|
||||
styleUrls: ['./cbx-quick-settings.component.scss']
|
||||
})
|
||||
export class CbxQuickSettingsComponent implements OnInit, OnDestroy {
|
||||
private quickSettingsService = inject(CbxQuickSettingsService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private destroy$ = new Subject<void>();
|
||||
|
||||
state: CbxQuickSettingsState = {
|
||||
@@ -43,19 +45,23 @@ export class CbxQuickSettingsComponent implements OnInit, OnDestroy {
|
||||
protected readonly CbxReadingDirection = CbxReadingDirection;
|
||||
protected readonly CbxSlideshowInterval = CbxSlideshowInterval;
|
||||
|
||||
fitModeOptions: {value: CbxFitMode, label: string, icon: ReaderIconName}[] = [
|
||||
{value: CbxFitMode.FIT_PAGE, label: 'Fit Page', icon: 'fit-page'},
|
||||
{value: CbxFitMode.FIT_WIDTH, label: 'Fit Width', icon: 'fit-width'},
|
||||
{value: CbxFitMode.FIT_HEIGHT, label: 'Fit Height', icon: 'fit-height'},
|
||||
{value: CbxFitMode.ACTUAL_SIZE, label: 'Actual Size', icon: 'actual-size'},
|
||||
{value: CbxFitMode.AUTO, label: 'Automatic', icon: 'auto-fit'}
|
||||
];
|
||||
get fitModeOptions(): {value: CbxFitMode, label: string, icon: ReaderIconName}[] {
|
||||
return [
|
||||
{value: CbxFitMode.FIT_PAGE, label: this.t.translate('readerCbx.quickSettings.fitPage'), icon: 'fit-page'},
|
||||
{value: CbxFitMode.FIT_WIDTH, label: this.t.translate('readerCbx.quickSettings.fitWidth'), icon: 'fit-width'},
|
||||
{value: CbxFitMode.FIT_HEIGHT, label: this.t.translate('readerCbx.quickSettings.fitHeight'), icon: 'fit-height'},
|
||||
{value: CbxFitMode.ACTUAL_SIZE, label: this.t.translate('readerCbx.quickSettings.actualSize'), icon: 'actual-size'},
|
||||
{value: CbxFitMode.AUTO, label: this.t.translate('readerCbx.quickSettings.automatic'), icon: 'auto-fit'}
|
||||
];
|
||||
}
|
||||
|
||||
scrollModeOptions: {value: CbxScrollMode, label: string}[] = [
|
||||
{value: CbxScrollMode.PAGINATED, label: 'Paginated'},
|
||||
{value: CbxScrollMode.INFINITE, label: 'Infinite'},
|
||||
{value: CbxScrollMode.LONG_STRIP, label: 'Long Strip'}
|
||||
];
|
||||
get scrollModeOptions(): {value: CbxScrollMode, label: string}[] {
|
||||
return [
|
||||
{value: CbxScrollMode.PAGINATED, label: this.t.translate('readerCbx.quickSettings.paginated')},
|
||||
{value: CbxScrollMode.INFINITE, label: this.t.translate('readerCbx.quickSettings.infinite')},
|
||||
{value: CbxScrollMode.LONG_STRIP, label: this.t.translate('readerCbx.quickSettings.longStrip')}
|
||||
];
|
||||
}
|
||||
|
||||
slideshowIntervalOptions: {value: CbxSlideshowInterval, label: string}[] = [
|
||||
{value: CbxSlideshowInterval.THREE_SECONDS, label: '3s'},
|
||||
@@ -65,11 +71,13 @@ export class CbxQuickSettingsComponent implements OnInit, OnDestroy {
|
||||
{value: CbxSlideshowInterval.THIRTY_SECONDS, label: '30s'}
|
||||
];
|
||||
|
||||
backgroundOptions = [
|
||||
{value: CbxBackgroundColor.BLACK, label: 'Black', color: '#000000'},
|
||||
{value: CbxBackgroundColor.GRAY, label: 'Gray', color: '#808080'},
|
||||
{value: CbxBackgroundColor.WHITE, label: 'White', color: '#ffffff'}
|
||||
];
|
||||
get backgroundOptions() {
|
||||
return [
|
||||
{value: CbxBackgroundColor.BLACK, label: this.t.translate('readerCbx.quickSettings.black'), color: '#000000'},
|
||||
{value: CbxBackgroundColor.GRAY, label: this.t.translate('readerCbx.quickSettings.gray'), color: '#808080'},
|
||||
{value: CbxBackgroundColor.WHITE, label: this.t.translate('readerCbx.quickSettings.white'), color: '#ffffff'}
|
||||
];
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.quickSettingsService.state$
|
||||
@@ -99,7 +107,7 @@ export class CbxQuickSettingsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
get currentScrollModeLabel(): string {
|
||||
return this.scrollModeOptions.find(o => o.value === this.state.scrollMode)?.label || 'Paginated';
|
||||
return this.scrollModeOptions.find(o => o.value === this.state.scrollMode)?.label || this.t.translate('readerCbx.quickSettings.paginated');
|
||||
}
|
||||
|
||||
get currentSlideshowIntervalLabel(): string {
|
||||
|
||||
+15
-15
@@ -23,14 +23,14 @@
|
||||
[class.active]="activeTab === 'pages'"
|
||||
(click)="setActiveTab('pages')">
|
||||
<app-reader-icon name="book" class="tab-icon"></app-reader-icon>
|
||||
<span>Content</span>
|
||||
<span>{{ 'readerCbx.sidebar.contentTab' | transloco }}</span>
|
||||
</button>
|
||||
<button
|
||||
class="tab"
|
||||
[class.active]="activeTab === 'bookmarks'"
|
||||
(click)="setActiveTab('bookmarks')">
|
||||
<app-reader-icon name="bookmark" class="tab-icon"></app-reader-icon>
|
||||
<span>Bookmarks</span>
|
||||
<span>{{ 'readerCbx.sidebar.bookmarksTab' | transloco }}</span>
|
||||
@if (bookmarks.length > 0) {
|
||||
<span class="badge">{{ bookmarks.length }}</span>
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
[class.active]="activeTab === 'notes'"
|
||||
(click)="setActiveTab('notes')">
|
||||
<app-reader-icon name="note" class="tab-icon"></app-reader-icon>
|
||||
<span>Notes</span>
|
||||
<span>{{ 'readerCbx.sidebar.notesTab' | transloco }}</span>
|
||||
@if (notes.length > 0) {
|
||||
<span class="badge">{{ notes.length }}</span>
|
||||
}
|
||||
@@ -66,7 +66,7 @@
|
||||
@if (pages.length === 0) {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="book" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No pages found</p>
|
||||
<p>{{ 'readerCbx.sidebar.noPagesFound' | transloco }}</p>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@
|
||||
<span class="item-title">{{ bookmark.title }}</span>
|
||||
<span class="item-meta">{{ bookmark.createdAt | date: 'MMM d, y' }}</span>
|
||||
</div>
|
||||
<button class="delete-btn" (click)="onDeleteBookmark($event, bookmark.id)" aria-label="Delete bookmark">
|
||||
<button class="delete-btn" (click)="onDeleteBookmark($event, bookmark.id)" [attr.aria-label]="'readerCbx.sidebar.deleteBookmark' | transloco">
|
||||
<app-reader-icon name="trash" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
</li>
|
||||
@@ -88,8 +88,8 @@
|
||||
} @else {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="bookmark" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No bookmarks yet</p>
|
||||
<span class="empty-hint">Tap the bookmark icon to save your place</span>
|
||||
<p>{{ 'readerCbx.sidebar.noBookmarksYet' | transloco }}</p>
|
||||
<span class="empty-hint">{{ 'readerCbx.sidebar.bookmarkHint' | transloco }}</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -101,12 +101,12 @@
|
||||
<input
|
||||
type="text"
|
||||
class="search-input"
|
||||
placeholder="Search notes..."
|
||||
[placeholder]="'readerCbx.sidebar.searchNotesPlaceholder' | transloco"
|
||||
[(ngModel)]="notesSearchQuery"
|
||||
(ngModelChange)="onNotesSearchInput($event)"
|
||||
/>
|
||||
@if (notesSearchQuery) {
|
||||
<button class="clear-btn" (click)="clearNotesSearch()" aria-label="Clear search">
|
||||
<button class="clear-btn" (click)="clearNotesSearch()" [attr.aria-label]="'readerCbx.sidebar.clearSearch' | transloco">
|
||||
<app-reader-icon name="close" [size]="14"></app-reader-icon>
|
||||
</button>
|
||||
}
|
||||
@@ -126,10 +126,10 @@
|
||||
<span class="item-meta">{{ note.createdAt | date: 'MMM d, y' }}</span>
|
||||
</div>
|
||||
<div class="action-buttons">
|
||||
<button class="edit-btn" (click)="onEditNote($event, note)" aria-label="Edit note">
|
||||
<button class="edit-btn" (click)="onEditNote($event, note)" [attr.aria-label]="'readerCbx.sidebar.editNote' | transloco">
|
||||
<app-reader-icon name="edit" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
<button class="delete-btn" (click)="onDeleteNote($event, note.id)" aria-label="Delete note">
|
||||
<button class="delete-btn" (click)="onDeleteNote($event, note.id)" [attr.aria-label]="'readerCbx.sidebar.deleteNote' | transloco">
|
||||
<app-reader-icon name="trash" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -139,14 +139,14 @@
|
||||
} @else if (notes.length > 0 && notesSearchQuery) {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="search" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No matching notes</p>
|
||||
<span class="empty-hint">Try different search terms</span>
|
||||
<p>{{ 'readerCbx.sidebar.noMatchingNotes' | transloco }}</p>
|
||||
<span class="empty-hint">{{ 'readerCbx.sidebar.tryDifferentSearch' | transloco }}</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="note" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No notes yet</p>
|
||||
<span class="empty-hint">Tap the notes icon to add a note for the current page</span>
|
||||
<p>{{ 'readerCbx.sidebar.noNotesYet' | transloco }}</p>
|
||||
<span class="empty-hint">{{ 'readerCbx.sidebar.notesHint' | transloco }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {CommonModule, DatePipe} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {TranslocoPipe} from '@jsverse/transloco';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {CbxSidebarService, CbxSidebarTab, SidebarBookInfo} from './cbx-sidebar.service';
|
||||
@@ -14,7 +15,7 @@ import {ReaderIconComponent} from '../../../ebook-reader';
|
||||
standalone: true,
|
||||
templateUrl: './cbx-sidebar.component.html',
|
||||
styleUrls: ['./cbx-sidebar.component.scss'],
|
||||
imports: [CommonModule, FormsModule, ReaderIconComponent, DatePipe]
|
||||
imports: [CommonModule, FormsModule, TranslocoPipe, ReaderIconComponent, DatePipe]
|
||||
})
|
||||
export class CbxSidebarComponent implements OnInit, OnDestroy {
|
||||
private sidebarService = inject(CbxSidebarService);
|
||||
|
||||
+5
-3
@@ -1,6 +1,7 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {BehaviorSubject, Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
import {CbxPageInfo, CbxReaderService} from '../../../../book/service/cbx-reader.service';
|
||||
import {UrlHelperService} from '../../../../../shared/service/url-helper.service';
|
||||
import {Book} from '../../../../book/model/book.model';
|
||||
@@ -22,6 +23,7 @@ export class CbxSidebarService {
|
||||
private cbxReaderService = inject(CbxReaderService);
|
||||
private bookMarkService = inject(BookMarkService);
|
||||
private bookNoteV2Service = inject(BookNoteV2Service);
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
private destroy$ = new Subject<void>();
|
||||
private bookId!: number;
|
||||
@@ -63,7 +65,7 @@ export class CbxSidebarService {
|
||||
|
||||
this._bookInfo.next({
|
||||
id: book.id,
|
||||
title: book.metadata?.title || book.fileName || 'Untitled',
|
||||
title: book.metadata?.title || book.fileName || this.t.translate('readerCbx.sidebar.untitled'),
|
||||
authors: (book.metadata?.authors || []).join(', '),
|
||||
coverUrl: this.urlHelper.getThumbnailUrl(book.id, book.metadata?.coverUpdatedOn)
|
||||
});
|
||||
@@ -129,7 +131,7 @@ export class CbxSidebarService {
|
||||
const request: CreateBookMarkRequest = {
|
||||
bookId: this.bookId,
|
||||
cfi: pageNumber.toString(),
|
||||
title: title || `Page ${pageNumber}`
|
||||
title: title || `${this.t.translate('readerCbx.sidebar.page')} ${pageNumber}`
|
||||
};
|
||||
|
||||
this.bookMarkService.createBookmark(request)
|
||||
@@ -177,7 +179,7 @@ export class CbxSidebarService {
|
||||
cfi: pageNumber.toString(),
|
||||
noteContent,
|
||||
color: color || '#FFC107',
|
||||
chapterTitle: `Page ${pageNumber}`
|
||||
chapterTitle: `${this.t.translate('readerCbx.sidebar.page')} ${pageNumber}`
|
||||
};
|
||||
|
||||
this.bookNoteV2Service.createNote(request)
|
||||
|
||||
@@ -184,9 +184,9 @@ export class ReaderViewManagerService {
|
||||
this.annotationService.addAnnotations(this.view, annotations);
|
||||
}
|
||||
|
||||
updateHeadersAndFooters(chapterName: string, pageInfo?: PageInfo, theme?: ThemeInfo): void {
|
||||
updateHeadersAndFooters(chapterName: string, pageInfo?: PageInfo, theme?: ThemeInfo, timeRemainingLabel?: string): void {
|
||||
const renderer = this.getRenderer();
|
||||
PageDecorator.updateHeadersAndFooters(renderer, chapterName, pageInfo, theme);
|
||||
PageDecorator.updateHeadersAndFooters(renderer, chapterName, pageInfo, theme, timeRemainingLabel);
|
||||
}
|
||||
|
||||
getChapters(): TocItem[] {
|
||||
|
||||
+30
-28
@@ -1,67 +1,68 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.metadataDialog'">
|
||||
<div class="dialog-overlay" (click)="close.emit()">
|
||||
<div class="dialog" (click)="$event.stopPropagation()">
|
||||
<div class="dialog-header">
|
||||
<h2>Book Information</h2>
|
||||
<button class="close-btn" (click)="close.emit()">✕</button>
|
||||
<h2>{{ t('title') }}</h2>
|
||||
<button class="close-btn" (click)="close.emit()">✕</button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body">
|
||||
<div class="metadata-container">
|
||||
<div class="cover-section">
|
||||
@if (bookCoverUrl) {
|
||||
<img [src]="bookCoverUrl" [alt]="metadata?.title || 'Book cover'" class="book-cover">
|
||||
<img [src]="bookCoverUrl" [alt]="metadata?.title || t('unknown')" class="book-cover">
|
||||
} @else {
|
||||
<div class="cover-placeholder">
|
||||
<span class="placeholder-icon">📚</span>
|
||||
<span class="placeholder-icon">📚</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="metadata-section">
|
||||
<div class="metadata-group">
|
||||
<h3 class="section-title">Basic Information</h3>
|
||||
<h3 class="section-title">{{ t('basicInformation') }}</h3>
|
||||
|
||||
<div class="metadata-item">
|
||||
<span class="label">Title</span>
|
||||
<span class="value">{{ metadata?.title || 'Unknown' }}</span>
|
||||
<span class="label">{{ t('titleLabel') }}</span>
|
||||
<span class="value">{{ metadata?.title || t('unknown') }}</span>
|
||||
</div>
|
||||
|
||||
@if (metadata?.subtitle) {
|
||||
<div class="metadata-item">
|
||||
<span class="label">Subtitle</span>
|
||||
<span class="label">{{ t('subtitle') }}</span>
|
||||
<span class="value">{{ metadata?.subtitle }}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="metadata-item">
|
||||
<span class="label">Author(s)</span>
|
||||
<span class="label">{{ t('authors') }}</span>
|
||||
<span class="value">{{ formatAuthors(metadata?.authors) }}</span>
|
||||
</div>
|
||||
|
||||
@if (metadata?.publisher) {
|
||||
<div class="metadata-item">
|
||||
<span class="label">Publisher</span>
|
||||
<span class="label">{{ t('publisher') }}</span>
|
||||
<span class="value">{{ metadata?.publisher }}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (metadata?.publishedDate) {
|
||||
<div class="metadata-item">
|
||||
<span class="label">Published</span>
|
||||
<span class="label">{{ t('published') }}</span>
|
||||
<span class="value">{{ formatDate(metadata?.publishedDate) }}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (metadata?.language) {
|
||||
<div class="metadata-item">
|
||||
<span class="label">Language</span>
|
||||
<span class="label">{{ t('language') }}</span>
|
||||
<span class="value">{{ metadata?.language }}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (metadata?.pageCount) {
|
||||
<div class="metadata-item">
|
||||
<span class="label">Pages</span>
|
||||
<span class="label">{{ t('pages') }}</span>
|
||||
<span class="value">{{ metadata?.pageCount }}</span>
|
||||
</div>
|
||||
}
|
||||
@@ -69,16 +70,16 @@
|
||||
|
||||
@if (metadata?.seriesName) {
|
||||
<div class="metadata-group">
|
||||
<h3 class="section-title">Series</h3>
|
||||
<h3 class="section-title">{{ t('series') }}</h3>
|
||||
|
||||
<div class="metadata-item">
|
||||
<span class="label">Series Name</span>
|
||||
<span class="label">{{ t('seriesName') }}</span>
|
||||
<span class="value">{{ metadata?.seriesName }}</span>
|
||||
</div>
|
||||
|
||||
@if (metadata?.seriesNumber) {
|
||||
<div class="metadata-item">
|
||||
<span class="label">Book Number</span>
|
||||
<span class="label">{{ t('bookNumber') }}</span>
|
||||
<span class="value">
|
||||
{{ metadata?.seriesNumber }}@if (metadata?.seriesTotal) {
|
||||
/ {{ metadata?.seriesTotal }}
|
||||
@@ -91,7 +92,7 @@
|
||||
|
||||
@if (metadata?.isbn13 || metadata?.isbn10 || metadata?.asin) {
|
||||
<div class="metadata-group">
|
||||
<h3 class="section-title">Identifiers</h3>
|
||||
<h3 class="section-title">{{ t('identifiers') }}</h3>
|
||||
|
||||
@if (metadata?.isbn13) {
|
||||
<div class="metadata-item">
|
||||
@@ -118,15 +119,15 @@
|
||||
|
||||
@if (metadata?.rating || metadata?.goodreadsRating || metadata?.amazonRating) {
|
||||
<div class="metadata-group">
|
||||
<h3 class="section-title">Ratings</h3>
|
||||
<h3 class="section-title">{{ t('ratings') }}</h3>
|
||||
|
||||
@if (metadata?.goodreadsRating) {
|
||||
<div class="metadata-item">
|
||||
<span class="label">Goodreads</span>
|
||||
<span class="value">
|
||||
⭐ {{ metadata?.goodreadsRating?.toFixed(2) }}
|
||||
⭐ {{ metadata?.goodreadsRating?.toFixed(2) }}
|
||||
@if (metadata?.goodreadsReviewCount) {
|
||||
<span class="review-count">({{ metadata?.goodreadsReviewCount }} reviews)</span>
|
||||
<span class="review-count">({{ metadata?.goodreadsReviewCount }} {{ t('reviews') }})</span>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
@@ -136,9 +137,9 @@
|
||||
<div class="metadata-item">
|
||||
<span class="label">Amazon</span>
|
||||
<span class="value">
|
||||
⭐ {{ metadata?.amazonRating?.toFixed(2) }}
|
||||
⭐ {{ metadata?.amazonRating?.toFixed(2) }}
|
||||
@if (metadata?.amazonReviewCount) {
|
||||
<span class="review-count">({{ metadata?.amazonReviewCount }} reviews)</span>
|
||||
<span class="review-count">({{ metadata?.amazonReviewCount }} {{ t('reviews') }})</span>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
@@ -148,7 +149,7 @@
|
||||
|
||||
@if (metadata?.categories && metadata?.categories!.length > 0) {
|
||||
<div class="metadata-group">
|
||||
<h3 class="section-title">Categories</h3>
|
||||
<h3 class="section-title">{{ t('categories') }}</h3>
|
||||
<div class="tags-container">
|
||||
@for (category of metadata?.categories; track category) {
|
||||
<span class="tag">{{ category }}</span>
|
||||
@@ -159,7 +160,7 @@
|
||||
|
||||
@if (metadata?.tags && metadata?.tags!.length > 0) {
|
||||
<div class="metadata-group">
|
||||
<h3 class="section-title">Tags</h3>
|
||||
<h3 class="section-title">{{ t('tags') }}</h3>
|
||||
<div class="tags-container">
|
||||
@for (tag of metadata?.tags; track tag) {
|
||||
<span class="tag">{{ tag }}</span>
|
||||
@@ -170,16 +171,16 @@
|
||||
|
||||
@if (book?.fileSizeKb) {
|
||||
<div class="metadata-group">
|
||||
<h3 class="section-title">File Information</h3>
|
||||
<h3 class="section-title">{{ t('fileInformation') }}</h3>
|
||||
|
||||
<div class="metadata-item">
|
||||
<span class="label">File Size</span>
|
||||
<span class="label">{{ t('fileSize') }}</span>
|
||||
<span class="value">{{ formatFileSize(book?.fileSizeKb) }}</span>
|
||||
</div>
|
||||
|
||||
@if (book?.fileName) {
|
||||
<div class="metadata-item">
|
||||
<span class="label">File Name</span>
|
||||
<span class="label">{{ t('fileName') }}</span>
|
||||
<span class="value file-name">{{ book?.fileName }}</span>
|
||||
</div>
|
||||
}
|
||||
@@ -188,7 +189,7 @@
|
||||
|
||||
@if (metadata?.description) {
|
||||
<div class="metadata-group">
|
||||
<h3 class="section-title">Description</h3>
|
||||
<h3 class="section-title">{{ t('description') }}</h3>
|
||||
<p class="description">{{ metadata?.description }}</p>
|
||||
</div>
|
||||
}
|
||||
@@ -197,3 +198,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+7
-4
@@ -1,12 +1,14 @@
|
||||
import {Component, EventEmitter, inject, Input, Output} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
import {Book} from '../../../book/model/book.model';
|
||||
import {UrlHelperService} from '../../../../shared/service/url-helper.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-reader-book-metadata-dialog',
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
imports: [CommonModule, TranslocoDirective],
|
||||
templateUrl: './metadata-dialog.component.html',
|
||||
styleUrls: ['./metadata-dialog.component.scss']
|
||||
})
|
||||
@@ -15,6 +17,7 @@ export class ReaderBookMetadataDialogComponent {
|
||||
@Output() close = new EventEmitter<void>();
|
||||
|
||||
private urlHelperService = inject(UrlHelperService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
get metadata() {
|
||||
return this.book?.metadata;
|
||||
@@ -27,7 +30,7 @@ export class ReaderBookMetadataDialogComponent {
|
||||
}
|
||||
|
||||
formatDate(date: string | undefined): string {
|
||||
if (!date) return 'N/A';
|
||||
if (!date) return this.t.translate('readerEbook.metadataDialog.na');
|
||||
try {
|
||||
return new Date(date).toLocaleDateString('en-US', {
|
||||
year: 'numeric',
|
||||
@@ -40,12 +43,12 @@ export class ReaderBookMetadataDialogComponent {
|
||||
}
|
||||
|
||||
formatAuthors(authors: string[] | undefined): string {
|
||||
if (!authors || authors.length === 0) return 'Unknown';
|
||||
if (!authors || authors.length === 0) return this.t.translate('readerEbook.metadataDialog.unknown');
|
||||
return authors.join(', ');
|
||||
}
|
||||
|
||||
formatFileSize(sizeKb: number | undefined): string {
|
||||
if (!sizeKb) return 'N/A';
|
||||
if (!sizeKb) return this.t.translate('readerEbook.metadataDialog.na');
|
||||
if (sizeKb < 1024) return `${sizeKb.toFixed(1)} KB`;
|
||||
return `${(sizeKb / 1024).toFixed(2)} MB`;
|
||||
}
|
||||
|
||||
+9
-7
@@ -1,7 +1,8 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.noteDialog'">
|
||||
<div class="dialog-overlay" (click)="onOverlayClick($event)">
|
||||
<div class="dialog">
|
||||
<div class="dialog-header">
|
||||
<h2>{{ isEditing ? 'Edit Note' : 'Add Note' }}</h2>
|
||||
<h2>{{ isEditing ? t('editNote') : t('addNote') }}</h2>
|
||||
<button class="close-btn" (click)="onCancel()">
|
||||
<app-reader-icon name="close" [size]="18"></app-reader-icon>
|
||||
</button>
|
||||
@@ -10,25 +11,25 @@
|
||||
<div class="dialog-body">
|
||||
@if (data?.selectedText) {
|
||||
<div class="selected-text-section">
|
||||
<span class="section-label">Selected Text</span>
|
||||
<span class="section-label">{{ t('selectedText') }}</span>
|
||||
<p class="selected-text">"{{ data?.selectedText }}"</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="note-section">
|
||||
<label class="section-label" for="noteContent">Your Note</label>
|
||||
<label class="section-label" for="noteContent">{{ t('yourNote') }}</label>
|
||||
<textarea
|
||||
id="noteContent"
|
||||
class="note-input"
|
||||
[(ngModel)]="noteContent"
|
||||
placeholder="Write your note here..."
|
||||
[placeholder]="t('notePlaceholder')"
|
||||
rows="6"
|
||||
autofocus
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div class="color-section">
|
||||
<span class="section-label">Note Color</span>
|
||||
<span class="section-label">{{ t('noteColor') }}</span>
|
||||
<div class="color-buttons">
|
||||
@for (color of noteColors; track color.value) {
|
||||
<button
|
||||
@@ -44,8 +45,9 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<button class="btn btn-secondary" (click)="onCancel()">Cancel</button>
|
||||
<button class="btn btn-primary" (click)="onSave()" [disabled]="!noteContent.trim()">{{ isEditing ? 'Update Note' : 'Save Note' }}</button>
|
||||
<button class="btn btn-secondary" (click)="onCancel()">{{ 'common.cancel' | transloco }}</button>
|
||||
<button class="btn btn-primary" (click)="onSave()" [disabled]="!noteContent.trim()">{{ isEditing ? t('updateNote') : t('saveNote') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {Component, EventEmitter, Input, Output, OnChanges, SimpleChanges} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {TranslocoDirective, TranslocoPipe} from '@jsverse/transloco';
|
||||
import {ReaderIconComponent} from '../shared/icon.component';
|
||||
|
||||
export interface NoteDialogData {
|
||||
@@ -20,7 +21,7 @@ export interface NoteDialogResult {
|
||||
@Component({
|
||||
selector: 'app-reader-note-dialog',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, ReaderIconComponent],
|
||||
imports: [CommonModule, FormsModule, TranslocoDirective, TranslocoPipe, ReaderIconComponent],
|
||||
templateUrl: './note-dialog.component.html',
|
||||
styleUrls: ['./note-dialog.component.scss']
|
||||
})
|
||||
|
||||
+32
-30
@@ -1,3 +1,4 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.settingsDialog'">
|
||||
<div class="dialog-overlay" (click)="close.emit()">
|
||||
<div class="dialog" (click)="$event.stopPropagation()">
|
||||
<div class="tabs-row">
|
||||
@@ -6,39 +7,39 @@
|
||||
class="tab"
|
||||
[class.active]="activeTab === 'theme'"
|
||||
(click)="activeTab = 'theme'">
|
||||
Theme
|
||||
{{ t('themeTab') }}
|
||||
</button>
|
||||
<button
|
||||
class="tab"
|
||||
[class.active]="activeTab === 'typography'"
|
||||
(click)="activeTab = 'typography'">
|
||||
Typography
|
||||
{{ t('typographyTab') }}
|
||||
</button>
|
||||
<button
|
||||
class="tab"
|
||||
[class.active]="activeTab === 'layout'"
|
||||
(click)="activeTab = 'layout'">
|
||||
Layout
|
||||
{{ t('layoutTab') }}
|
||||
</button>
|
||||
</div>
|
||||
<button class="close-btn" (click)="close.emit()">✕</button>
|
||||
<button class="close-btn" (click)="close.emit()">✕</button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body">
|
||||
@if (activeTab === 'theme') {
|
||||
<div class="tab-content">
|
||||
<div class="section-header dark-mode-header">
|
||||
Dark Mode
|
||||
{{ t('darkMode') }}
|
||||
<span class="mode-switch-wrapper">
|
||||
<span class="mode-icon sun" [class.active]="!state.isDark">☀️</span>
|
||||
<span class="mode-icon sun" [class.active]="!state.isDark">☀️</span>
|
||||
<button class="switch" [class.active]="state.isDark" (click)="toggleDarkMode()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
<span class="mode-icon moon" [class.active]="state.isDark">🌙</span>
|
||||
<span class="mode-icon moon" [class.active]="state.isDark">🌙</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="section-header">Theme Colors</div>
|
||||
<div class="section-header">{{ t('themeColors') }}</div>
|
||||
<div class="theme-grid">
|
||||
@for (theme of themes; track theme.name) {
|
||||
<label class="theme-option">
|
||||
@@ -59,7 +60,7 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="section-header">Annotation Highlighter</div>
|
||||
<div class="section-header">{{ t('annotationHighlighter') }}</div>
|
||||
<div class="annotation-colors">
|
||||
@for (color of annotationColors; track color.name) {
|
||||
<button
|
||||
@@ -69,7 +70,7 @@
|
||||
[attr.aria-label]="color.label"
|
||||
(click)="setAnnotationColor(color.value)">
|
||||
@if (selectedAnnotationColor === color.value) {
|
||||
<span class="check-icon">✓</span>
|
||||
<span class="check-icon">✓</span>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
@@ -80,29 +81,29 @@
|
||||
@if (activeTab === 'typography') {
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="section-header">Font Settings</div>
|
||||
<div class="section-header">{{ t('fontSettings') }}</div>
|
||||
<div class="control">
|
||||
<label>Font Size</label>
|
||||
<label>{{ t('fontSize') }}</label>
|
||||
<div class="control-right">
|
||||
<div class="stepper">
|
||||
<button (click)="decreaseFontSize()">−</button>
|
||||
<button (click)="decreaseFontSize()">−</button>
|
||||
<span>{{ state.fontSize }}</span>
|
||||
<button (click)="increaseFontSize()">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control">
|
||||
<label>Line Height</label>
|
||||
<label>{{ t('lineHeight') }}</label>
|
||||
<div class="control-right">
|
||||
<div class="stepper">
|
||||
<button (click)="decreaseLineHeight()">−</button>
|
||||
<button (click)="decreaseLineHeight()">−</button>
|
||||
<span>{{ state.lineHeight | number:'1.1-1' }}</span>
|
||||
<button (click)="increaseLineHeight()">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-header">Font Family</div>
|
||||
<div class="section-header">{{ t('fontFamily') }}</div>
|
||||
<div class="font-grid">
|
||||
@for (font of fonts; track font.value) {
|
||||
<button
|
||||
@@ -120,10 +121,10 @@
|
||||
|
||||
@if (activeTab === 'layout') {
|
||||
<div class="tab-content">
|
||||
<div class="section-header">Layout</div>
|
||||
<div class="section-header">{{ t('layout') }}</div>
|
||||
|
||||
<div class="control">
|
||||
<label>Reading Flow</label>
|
||||
<label>{{ t('readingFlow') }}</label>
|
||||
<div class="control-right">
|
||||
<div class="radio-group">
|
||||
<label>
|
||||
@@ -134,7 +135,7 @@
|
||||
[checked]="state.flow === 'paginated'"
|
||||
(change)="setFlow('paginated')"
|
||||
/>
|
||||
Paginated
|
||||
{{ t('paginated') }}
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
@@ -144,17 +145,17 @@
|
||||
[checked]="state.flow === 'scrolled'"
|
||||
(change)="setFlow('scrolled')"
|
||||
/>
|
||||
Scrolled
|
||||
{{ t('scrolled') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<label>Max Columns</label>
|
||||
<label>{{ t('maxColumns') }}</label>
|
||||
<div class="control-right">
|
||||
<div class="stepper">
|
||||
<button (click)="decreaseMaxColumnCount()">−</button>
|
||||
<button (click)="decreaseMaxColumnCount()">−</button>
|
||||
<span>{{ state.maxColumnCount }}</span>
|
||||
<button (click)="increaseMaxColumnCount()">+</button>
|
||||
</div>
|
||||
@@ -162,7 +163,7 @@
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<label>Column Gap</label>
|
||||
<label>{{ t('columnGap') }}</label>
|
||||
<div class="control-right gap-control">
|
||||
<input
|
||||
#gapInput
|
||||
@@ -178,10 +179,10 @@
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<label>Max Width</label>
|
||||
<label>{{ t('maxWidth') }}</label>
|
||||
<div class="control-right">
|
||||
<div class="stepper">
|
||||
<button (click)="decreaseMaxInlineSize()">−</button>
|
||||
<button (click)="decreaseMaxInlineSize()">−</button>
|
||||
<span>{{ state.maxInlineSize }}</span>
|
||||
<button (click)="increaseMaxInlineSize()">+</button>
|
||||
</div>
|
||||
@@ -189,27 +190,27 @@
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<label>Max Height</label>
|
||||
<label>{{ t('maxHeight') }}</label>
|
||||
<div class="control-right">
|
||||
<div class="stepper">
|
||||
<button (click)="decreaseMaxBlockSize()">−</button>
|
||||
<button (click)="decreaseMaxBlockSize()">−</button>
|
||||
<span>{{ state.maxBlockSize }}</span>
|
||||
<button (click)="increaseMaxBlockSize()">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-header">Text Options</div>
|
||||
<div class="section-header">{{ t('textOptions') }}</div>
|
||||
|
||||
<div class="toggle-control">
|
||||
<span>Justify Text</span>
|
||||
<span>{{ t('justifyText') }}</span>
|
||||
<button class="switch" [class.active]="state.justify" (click)="toggleJustify()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="toggle-control">
|
||||
<span>Hyphenate</span>
|
||||
<span>{{ t('hyphenate') }}</span>
|
||||
<button class="switch" [class.active]="state.hyphenate" (click)="toggleHyphenate()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
@@ -219,3 +220,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
import {Component, EventEmitter, Inject, Input, OnInit, Output, Renderer2} from '@angular/core';
|
||||
import {DecimalPipe, DOCUMENT} from '@angular/common';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderStateService} from '../state/reader-state.service';
|
||||
import {ReaderViewManagerService} from '../core/view-manager.service';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
@@ -15,7 +16,7 @@ interface AnnotationColor {
|
||||
@Component({
|
||||
selector: 'app-settings-dialog',
|
||||
standalone: true,
|
||||
imports: [DecimalPipe],
|
||||
imports: [DecimalPipe, TranslocoDirective],
|
||||
templateUrl: './settings-dialog.component.html',
|
||||
styleUrls: ['./settings-dialog.component.scss']
|
||||
})
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<div class="dialog-overlay" (click)="onOverlayClick($event)">
|
||||
<div class="dialog">
|
||||
<div class="dialog-header">
|
||||
<h2>Keyboard Shortcuts</h2>
|
||||
<h2>{{ 'readerEbook.shortcutsHelp.title' | transloco }}</h2>
|
||||
<button class="close-btn" (click)="onClose()">
|
||||
<app-reader-icon name="close" [size]="18"></app-reader-icon>
|
||||
</button>
|
||||
@@ -36,7 +36,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<button class="btn btn-primary" (click)="onClose()">Got it</button>
|
||||
<button class="btn btn-primary" (click)="onClose()">{{ 'readerEbook.shortcutsHelp.gotIt' | transloco }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+43
-38
@@ -1,5 +1,6 @@
|
||||
import {Component, EventEmitter, Output} from '@angular/core';
|
||||
import {Component, EventEmitter, inject, Output} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {TranslocoPipe, TranslocoService} from '@jsverse/transloco';
|
||||
import {ReaderIconComponent} from '../shared/icon.component';
|
||||
|
||||
interface ShortcutItem {
|
||||
@@ -16,49 +17,53 @@ interface ShortcutGroup {
|
||||
@Component({
|
||||
selector: 'app-ebook-shortcuts-help',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ReaderIconComponent],
|
||||
imports: [CommonModule, TranslocoPipe, ReaderIconComponent],
|
||||
templateUrl: './shortcuts-help.component.html',
|
||||
styleUrls: ['./shortcuts-help.component.scss']
|
||||
})
|
||||
export class EbookShortcutsHelpComponent {
|
||||
@Output() close = new EventEmitter<void>();
|
||||
|
||||
shortcutGroups: ShortcutGroup[] = [
|
||||
{
|
||||
title: 'Navigation',
|
||||
shortcuts: [
|
||||
{keys: ['←'], description: 'Previous page', mobileGesture: 'Swipe right'},
|
||||
{keys: ['→'], description: 'Next page', mobileGesture: 'Swipe left'},
|
||||
{keys: ['Space'], description: 'Next page'},
|
||||
{keys: ['Shift', 'Space'], description: 'Previous page'},
|
||||
{keys: ['Home'], description: 'First section'},
|
||||
{keys: ['End'], description: 'Last section'},
|
||||
{keys: ['Page Up'], description: 'Previous page'},
|
||||
{keys: ['Page Down'], description: 'Next page'}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Panels',
|
||||
shortcuts: [
|
||||
{keys: ['T'], description: 'Table of contents'},
|
||||
{keys: ['S'], description: 'Search'},
|
||||
{keys: ['N'], description: 'Notes'}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Display',
|
||||
shortcuts: [
|
||||
{keys: ['F'], description: 'Toggle fullscreen'},
|
||||
{keys: ['Escape'], description: 'Exit fullscreen / Close dialogs'}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Other',
|
||||
shortcuts: [
|
||||
{keys: ['?'], description: 'Show this help dialog'}
|
||||
]
|
||||
}
|
||||
];
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
get shortcutGroups(): ShortcutGroup[] {
|
||||
return [
|
||||
{
|
||||
title: this.t.translate('readerEbook.shortcutsHelp.navigation'),
|
||||
shortcuts: [
|
||||
{keys: ['\u2190'], description: this.t.translate('readerEbook.shortcutsHelp.previousPage'), mobileGesture: this.t.translate('readerEbook.shortcutsHelp.swipeRight')},
|
||||
{keys: ['\u2192'], description: this.t.translate('readerEbook.shortcutsHelp.nextPage'), mobileGesture: this.t.translate('readerEbook.shortcutsHelp.swipeLeft')},
|
||||
{keys: ['Space'], description: this.t.translate('readerEbook.shortcutsHelp.nextPage')},
|
||||
{keys: ['Shift', 'Space'], description: this.t.translate('readerEbook.shortcutsHelp.previousPage')},
|
||||
{keys: ['Home'], description: this.t.translate('readerEbook.shortcutsHelp.firstSection')},
|
||||
{keys: ['End'], description: this.t.translate('readerEbook.shortcutsHelp.lastSection')},
|
||||
{keys: ['Page Up'], description: this.t.translate('readerEbook.shortcutsHelp.previousPage')},
|
||||
{keys: ['Page Down'], description: this.t.translate('readerEbook.shortcutsHelp.nextPage')}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: this.t.translate('readerEbook.shortcutsHelp.panels'),
|
||||
shortcuts: [
|
||||
{keys: ['T'], description: this.t.translate('readerEbook.shortcutsHelp.tableOfContents')},
|
||||
{keys: ['S'], description: this.t.translate('readerEbook.shortcutsHelp.searchShortcut')},
|
||||
{keys: ['N'], description: this.t.translate('readerEbook.shortcutsHelp.notesShortcut')}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: this.t.translate('readerEbook.shortcutsHelp.display'),
|
||||
shortcuts: [
|
||||
{keys: ['F'], description: this.t.translate('readerEbook.shortcutsHelp.toggleFullscreen')},
|
||||
{keys: ['Escape'], description: this.t.translate('readerEbook.shortcutsHelp.exitFullscreenCloseDialogs')}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: this.t.translate('readerEbook.shortcutsHelp.other'),
|
||||
shortcuts: [
|
||||
{keys: ['?'], description: this.t.translate('readerEbook.shortcutsHelp.showHelpDialog')}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
isMobile = window.innerWidth < 768;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="loader-overlay">
|
||||
<div class="loader-content">
|
||||
<div class="spinner"></div>
|
||||
<p class="loader-text">Loading book...</p>
|
||||
<p class="loader-text">{{ 'readerEbook.reader.loadingBook' | transloco }}</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import {EpubCustomFontService} from './features/fonts/custom-font.service';
|
||||
import {TextSelectionAction, TextSelectionPopupComponent} from './shared/selection-popup.component';
|
||||
import {NoteDialogData, NoteDialogResult, ReaderNoteDialogComponent} from './dialogs/note-dialog.component';
|
||||
import {EbookShortcutsHelpComponent} from './dialogs/shortcuts-help.component';
|
||||
import {TranslocoPipe} from '@jsverse/transloco';
|
||||
|
||||
@Component({
|
||||
selector: 'app-ebook-reader',
|
||||
@@ -45,7 +46,8 @@ import {EbookShortcutsHelpComponent} from './dialogs/shortcuts-help.component';
|
||||
ReaderNavbarComponent,
|
||||
TextSelectionPopupComponent,
|
||||
ReaderNoteDialogComponent,
|
||||
EbookShortcutsHelpComponent
|
||||
EbookShortcutsHelpComponent,
|
||||
TranslocoPipe
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
providers: [
|
||||
|
||||
+16
-14
@@ -2,6 +2,7 @@ import {inject, Injectable} from '@angular/core';
|
||||
import {Observable, of} from 'rxjs';
|
||||
import {catchError, map, tap} from 'rxjs/operators';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
import {
|
||||
Annotation,
|
||||
AnnotationService,
|
||||
@@ -14,6 +15,7 @@ import {Annotation as ViewAnnotation, ReaderAnnotationService} from './annotatio
|
||||
export class ReaderAnnotationHttpService {
|
||||
private annotationService = inject(AnnotationService);
|
||||
private messageService = inject(MessageService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readerAnnotationService = inject(ReaderAnnotationService);
|
||||
|
||||
private currentChapterTitle: string | null = null;
|
||||
@@ -44,8 +46,8 @@ export class ReaderAnnotationHttpService {
|
||||
tap(() => {
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Highlight Added',
|
||||
detail: 'Your highlight was saved successfully.'
|
||||
summary: this.t.translate('readerEbook.toast.highlightAddedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.highlightAddedDetail')
|
||||
});
|
||||
}),
|
||||
catchError(error => {
|
||||
@@ -54,13 +56,13 @@ export class ReaderAnnotationHttpService {
|
||||
isDuplicate
|
||||
? {
|
||||
severity: 'warn',
|
||||
summary: 'Highlight Already Exists',
|
||||
detail: 'You already have a highlight at this location.'
|
||||
summary: this.t.translate('readerEbook.toast.highlightExistsSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.highlightExistsDetail')
|
||||
}
|
||||
: {
|
||||
severity: 'error',
|
||||
summary: 'Unable to Add Highlight',
|
||||
detail: 'Something went wrong while adding the highlight. Please try again.'
|
||||
summary: this.t.translate('readerEbook.toast.highlightFailedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.highlightFailedDetail')
|
||||
}
|
||||
);
|
||||
return of(null);
|
||||
@@ -81,16 +83,16 @@ export class ReaderAnnotationHttpService {
|
||||
map(() => {
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Highlight Removed',
|
||||
detail: 'Your highlight was removed successfully.'
|
||||
summary: this.t.translate('readerEbook.toast.highlightRemovedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.highlightRemovedDetail')
|
||||
});
|
||||
return true;
|
||||
}),
|
||||
catchError(() => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Unable to Remove Highlight',
|
||||
detail: 'Something went wrong while removing the highlight. Please try again.'
|
||||
summary: this.t.translate('readerEbook.toast.highlightRemoveFailedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.highlightRemoveFailedDetail')
|
||||
});
|
||||
return of(false);
|
||||
})
|
||||
@@ -102,15 +104,15 @@ export class ReaderAnnotationHttpService {
|
||||
tap(() => {
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Note Updated',
|
||||
detail: 'Your note was saved successfully.'
|
||||
summary: this.t.translate('readerEbook.toast.noteAnnotationUpdatedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.noteAnnotationUpdatedDetail')
|
||||
});
|
||||
}),
|
||||
catchError(() => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Unable to Update Note',
|
||||
detail: 'Something went wrong while updating the note. Please try again.'
|
||||
summary: this.t.translate('readerEbook.toast.noteAnnotationUpdateFailedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.noteAnnotationUpdateFailedDetail')
|
||||
});
|
||||
return of(null);
|
||||
})
|
||||
|
||||
+8
-6
@@ -3,6 +3,7 @@ import {Observable, of} from 'rxjs';
|
||||
import {catchError, map} from 'rxjs/operators';
|
||||
import {BookMarkService} from '../../../../../shared/service/book-mark.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
@Injectable()
|
||||
export class ReaderBookmarkService {
|
||||
@@ -11,6 +12,7 @@ export class ReaderBookmarkService {
|
||||
|
||||
private bookMarkService = inject(BookMarkService);
|
||||
private messageService = inject(MessageService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
|
||||
updateCurrentPosition(cfi: string, chapterName?: string): void {
|
||||
@@ -32,8 +34,8 @@ export class ReaderBookmarkService {
|
||||
map(() => {
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Bookmark Added',
|
||||
detail: 'Your bookmark was added successfully.'
|
||||
summary: this.t.translate('readerEbook.toast.bookmarkAddedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.bookmarkAddedDetail')
|
||||
});
|
||||
return true;
|
||||
}),
|
||||
@@ -43,13 +45,13 @@ export class ReaderBookmarkService {
|
||||
isDuplicate
|
||||
? {
|
||||
severity: 'warn',
|
||||
summary: 'Bookmark Already Exists',
|
||||
detail: 'You already have a bookmark at this location.'
|
||||
summary: this.t.translate('readerEbook.toast.bookmarkExistsSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.bookmarkExistsDetail')
|
||||
}
|
||||
: {
|
||||
severity: 'error',
|
||||
summary: 'Unable to Add Bookmark',
|
||||
detail: 'Something went wrong while adding the bookmark. Please try again.'
|
||||
summary: this.t.translate('readerEbook.toast.bookmarkFailedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.bookmarkFailedDetail')
|
||||
}
|
||||
);
|
||||
return of(false);
|
||||
|
||||
@@ -2,6 +2,7 @@ import {inject, Injectable} from '@angular/core';
|
||||
import {BehaviorSubject, Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
import {BookNoteV2Service, CreateBookNoteV2Request, UpdateBookNoteV2Request} from '../../../../../shared/service/book-note-v2.service';
|
||||
import {NoteDialogData, NoteDialogResult} from '../../dialogs/note-dialog.component';
|
||||
import {ReaderSelectionService} from '../selection/selection.service';
|
||||
@@ -18,6 +19,7 @@ export interface NoteDialogState {
|
||||
export class ReaderNoteService {
|
||||
private bookNoteV2Service = inject(BookNoteV2Service);
|
||||
private messageService = inject(MessageService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private selectionService = inject(ReaderSelectionService);
|
||||
private progressService = inject(ReaderProgressService);
|
||||
private leftSidebarService = inject(ReaderLeftSidebarService);
|
||||
@@ -110,15 +112,15 @@ export class ReaderNoteService {
|
||||
this.leftSidebarService.refreshNotes();
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Note Saved',
|
||||
detail: 'Your note has been saved successfully.'
|
||||
summary: this.t.translate('readerEbook.toast.noteSavedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.noteSavedDetail')
|
||||
});
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Save Failed',
|
||||
detail: 'Failed to save the note. Please try again.'
|
||||
summary: this.t.translate('readerEbook.toast.saveFailedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.saveFailedDetail')
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -138,15 +140,15 @@ export class ReaderNoteService {
|
||||
this.leftSidebarService.refreshNotes();
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Note Updated',
|
||||
detail: 'Your note has been updated successfully.'
|
||||
summary: this.t.translate('readerEbook.toast.noteUpdatedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.noteUpdatedDetail')
|
||||
});
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Update Failed',
|
||||
detail: 'Failed to update the note. Please try again.'
|
||||
summary: this.t.translate('readerEbook.toast.updateFailedSummary'),
|
||||
detail: this.t.translate('readerEbook.toast.updateFailedDetail')
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+18
-16
@@ -1,10 +1,11 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.footer'">
|
||||
<div class="reader-navbar" [class.visible]="navbarVisible">
|
||||
<button class="icon-btn" title="Previous Section" [disabled]="!canGoPrevious" (click)="onPreviousSection()">
|
||||
<button class="icon-btn" [title]="t('previousSection')" [disabled]="!canGoPrevious" (click)="onPreviousSection()">
|
||||
<app-reader-icon name="chevron-left"></app-reader-icon>
|
||||
</button>
|
||||
|
||||
<div class="progress-section">
|
||||
<button class="location-btn" (click)="toggleLocationPopover()" title="Location">
|
||||
<button class="location-btn" (click)="toggleLocationPopover()" [title]="t('location')">
|
||||
<span class="location-text">{{ currentPercentage }}%</span>
|
||||
</button>
|
||||
|
||||
@@ -16,7 +17,7 @@
|
||||
[max]="100"
|
||||
[value]="currentPercentage"
|
||||
(input)="onProgressChange($event)"
|
||||
title="Progress"/>
|
||||
[title]="t('progress')"/>
|
||||
<div class="progress-ticks">
|
||||
@for (frac of displaySectionFractions; track frac) {
|
||||
<span class="progress-tick" [style.left.%]="frac * 100"></span>
|
||||
@@ -25,7 +26,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="icon-btn" title="Next Section" [disabled]="!canGoNext" (click)="onNextSection()">
|
||||
<button class="icon-btn" [title]="t('nextSection')" [disabled]="!canGoNext" (click)="onNextSection()">
|
||||
<app-reader-icon name="chevron-right"></app-reader-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -35,12 +36,12 @@
|
||||
<div class="popover-content">
|
||||
<div class="time-info">
|
||||
<div class="time-section">
|
||||
<span class="label">Time Left in Section</span>
|
||||
<span class="label">{{ t('timeLeftInSection') }}</span>
|
||||
<span class="value">{{ timeSection }}</span>
|
||||
</div>
|
||||
<div class="separator"></div>
|
||||
<div class="time-section">
|
||||
<span class="label">Time Left in Book</span>
|
||||
<span class="label">{{ t('timeLeftInBook') }}</span>
|
||||
<span class="value">{{ timeTotal }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,18 +50,18 @@
|
||||
|
||||
<div class="book-info">
|
||||
<div class="chapter-info">
|
||||
<span class="label">Chapter</span>
|
||||
<span class="label">{{ t('chapter') }}</span>
|
||||
<span class="chapter-name">{{ currentChapter }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<div class="info-column">
|
||||
<span class="label">Section</span>
|
||||
<span class="label">{{ t('section') }}</span>
|
||||
<span class="value">{{ sectionCurrent }} / {{ sectionTotal }}</span>
|
||||
</div>
|
||||
@if (progressData?.pageItem) {
|
||||
<div class="info-separator"></div>
|
||||
<div class="info-column">
|
||||
<span class="label">Page</span>
|
||||
<span class="label">{{ t('page') }}</span>
|
||||
<span class="value">{{ currentPage }}</span>
|
||||
</div>
|
||||
}
|
||||
@@ -71,26 +72,26 @@
|
||||
|
||||
<div class="nav-section">
|
||||
<div class="goto-row">
|
||||
<label>Go to</label>
|
||||
<label>{{ t('goTo') }}</label>
|
||||
<input type="number" [value]="currentPercentage" #percentInput
|
||||
(keydown.enter)="onGoToPercentage(percentInput.value)" [min]="0" [max]="100"/>
|
||||
<span>%</span>
|
||||
<button class="go-btn" (click)="onGoToPercentage(percentInput.value)" title="Go to percentage">Go</button>
|
||||
<button class="go-btn" (click)="onGoToPercentage(percentInput.value)" [title]="t('goToPercentage')">{{ t('go') }}</button>
|
||||
</div>
|
||||
<div class="section-navigation">
|
||||
<button class="nav-btn" title="First Section" (click)="onFirstSection()">
|
||||
<button class="nav-btn" [title]="t('firstSection')" (click)="onFirstSection()">
|
||||
<app-reader-icon name="chevron-first" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
<button class="nav-btn" title="Previous Section" (click)="onPreviousSection()">
|
||||
<button class="nav-btn" [title]="t('previousSection')" (click)="onPreviousSection()">
|
||||
<app-reader-icon name="chevron-left" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
<button class="nav-btn" title="Jump To...">
|
||||
<button class="nav-btn" [title]="t('jumpTo')">
|
||||
<app-reader-icon name="dots-vertical" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
<button class="nav-btn" title="Next Section" (click)="onNextSection()">
|
||||
<button class="nav-btn" [title]="t('nextSection')" (click)="onNextSection()">
|
||||
<app-reader-icon name="chevron-right" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
<button class="nav-btn" title="Last Section" (click)="onLastSection()">
|
||||
<button class="nav-btn" [title]="t('lastSection')" (click)="onLastSection()">
|
||||
<app-reader-icon name="chevron-last" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -98,3 +99,4 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</ng-container>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Component, EventEmitter, HostListener, inject, Input, Output} from '@angular/core';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderViewManagerService} from '../../core/view-manager.service';
|
||||
import {ReaderIconComponent} from '../../shared/icon.component';
|
||||
|
||||
@@ -30,7 +31,7 @@ interface RelocateEventDetail {
|
||||
@Component({
|
||||
selector: 'app-reader-navbar',
|
||||
standalone: true,
|
||||
imports: [ReaderIconComponent],
|
||||
imports: [TranslocoDirective, ReaderIconComponent],
|
||||
templateUrl: './footer.component.html',
|
||||
styleUrls: ['./footer.component.scss']
|
||||
})
|
||||
|
||||
+14
-12
@@ -1,28 +1,29 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.header'">
|
||||
<div class="reader-header" [class.visible]="isVisible" [style.background]="currentTheme.bg" [style.color]="currentTheme.fg">
|
||||
<div class="header-left">
|
||||
<button class="icon-btn" (click)="onShowChapters()" title="Chapters">
|
||||
<button class="icon-btn" (click)="onShowChapters()" [title]="t('chapters')">
|
||||
<app-reader-icon name="menu" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
<button class="icon-btn" (click)="onCreateBookmark()" [title]="isCurrentCfiBookmarked ? 'Remove Bookmark' : 'Add Bookmark'" [class.active]="isCurrentCfiBookmarked">
|
||||
<button class="icon-btn" (click)="onCreateBookmark()" [title]="isCurrentCfiBookmarked ? t('removeBookmark') : t('addBookmark')" [class.active]="isCurrentCfiBookmarked">
|
||||
<app-reader-icon name="bookmark"></app-reader-icon>
|
||||
</button>
|
||||
<button class="icon-btn" (click)="onOpenSearch()" title="Search">
|
||||
<button class="icon-btn" (click)="onOpenSearch()" [title]="t('search')">
|
||||
<app-reader-icon name="search"></app-reader-icon>
|
||||
</button>
|
||||
</div>
|
||||
<span class="chapter-title">{{ bookTitle }}</span>
|
||||
<div class="header-right">
|
||||
<button class="icon-btn desktop-only" (click)="onOpenNotes()" title="Notes">
|
||||
<button class="icon-btn desktop-only" (click)="onOpenNotes()" [title]="t('notes')">
|
||||
<app-reader-icon name="note"></app-reader-icon>
|
||||
</button>
|
||||
<button class="icon-btn desktop-only" (click)="onToggleFullscreen()" [title]="isFullscreen ? 'Exit Fullscreen' : 'Fullscreen'">
|
||||
<button class="icon-btn desktop-only" (click)="onToggleFullscreen()" [title]="isFullscreen ? t('exitFullscreen') : t('fullscreen')">
|
||||
<app-reader-icon [name]="isFullscreen ? 'fullscreen-exit' : 'fullscreen'" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
<button class="icon-btn desktop-only" (click)="onShowHelp()" title="Keyboard Shortcuts">
|
||||
<button class="icon-btn desktop-only" (click)="onShowHelp()" [title]="t('keyboardShortcuts')">
|
||||
<app-reader-icon name="help" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
<div class="overflow-menu mobile-only">
|
||||
<button class="icon-btn" (click)="overflowOpen = !overflowOpen; $event.stopPropagation()" title="More">
|
||||
<button class="icon-btn" (click)="overflowOpen = !overflowOpen; $event.stopPropagation()" [title]="t('more')">
|
||||
<app-reader-icon name="dots-vertical" [size]="20"></app-reader-icon>
|
||||
</button>
|
||||
@if (overflowOpen) {
|
||||
@@ -30,24 +31,25 @@
|
||||
<div class="overflow-dropdown" [style.background]="currentTheme.bg" [style.color]="currentTheme.fg">
|
||||
<button class="overflow-item" (click)="onOpenNotes(); overflowOpen = false">
|
||||
<app-reader-icon name="note" [size]="18"></app-reader-icon>
|
||||
<span>Notes</span>
|
||||
<span>{{ t('notes') }}</span>
|
||||
</button>
|
||||
<button class="overflow-item" (click)="onToggleFullscreen(); overflowOpen = false">
|
||||
<app-reader-icon [name]="isFullscreen ? 'fullscreen-exit' : 'fullscreen'" [size]="18"></app-reader-icon>
|
||||
<span>{{ isFullscreen ? 'Exit Fullscreen' : 'Fullscreen' }}</span>
|
||||
<span>{{ isFullscreen ? t('exitFullscreen') : t('fullscreen') }}</span>
|
||||
</button>
|
||||
<button class="overflow-item" (click)="onShowHelp(); overflowOpen = false">
|
||||
<app-reader-icon name="help" [size]="18"></app-reader-icon>
|
||||
<span>Keyboard Shortcuts</span>
|
||||
<span>{{ t('keyboardShortcuts') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<button class="icon-btn" (click)="onShowControls()" title="Settings">
|
||||
<button class="icon-btn" (click)="onShowControls()" [title]="t('settings')">
|
||||
<app-reader-icon name="settings"></app-reader-icon>
|
||||
</button>
|
||||
<button class="icon-btn close-btn" (click)="onClose(); $event.stopPropagation()" title="Close Reader">
|
||||
<button class="icon-btn close-btn" (click)="onClose(); $event.stopPropagation()" [title]="t('closeReader')">
|
||||
<app-reader-icon name="close"></app-reader-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderHeaderService} from './header.service';
|
||||
import {ReaderIconComponent} from '../../shared/icon.component';
|
||||
import {Router} from '@angular/router';
|
||||
@@ -8,7 +9,7 @@ import {Router} from '@angular/router';
|
||||
@Component({
|
||||
selector: 'app-reader-header',
|
||||
standalone: true,
|
||||
imports: [ReaderIconComponent],
|
||||
imports: [TranslocoDirective, ReaderIconComponent],
|
||||
templateUrl: './header.component.html',
|
||||
styleUrls: ['./header.component.scss']
|
||||
})
|
||||
|
||||
+10
-8
@@ -1,25 +1,26 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.quickSettings'">
|
||||
<div class="quick-settings-overlay" (click)="onOverlayClick()">
|
||||
<div class="quick-settings-panel" (click)="$event.stopPropagation()">
|
||||
<div class="pointer"></div>
|
||||
<div class="panel-body">
|
||||
<!-- Dark Mode -->
|
||||
<div class="control">
|
||||
<label>Dark Mode</label>
|
||||
<label>{{ t('darkMode') }}</label>
|
||||
<div class="control-right">
|
||||
<span class="mode-icon sun" [class.active]="!isDarkMode">☀️</span>
|
||||
<span class="mode-icon sun" [class.active]="!isDarkMode">☀️</span>
|
||||
<button class="switch" [class.active]="isDarkMode" (click)="toggleDarkMode()">
|
||||
<span class="slider"></span>
|
||||
</button>
|
||||
<span class="mode-icon moon" [class.active]="isDarkMode">🌙</span>
|
||||
<span class="mode-icon moon" [class.active]="isDarkMode">🌙</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Font Size -->
|
||||
<div class="control">
|
||||
<label>Font Size</label>
|
||||
<label>{{ t('fontSize') }}</label>
|
||||
<div class="control-right">
|
||||
<div class="stepper">
|
||||
<button (click)="decreaseFontSize()">−</button>
|
||||
<button (click)="decreaseFontSize()">−</button>
|
||||
<span>{{ state.fontSize }}%</span>
|
||||
<button (click)="increaseFontSize()">+</button>
|
||||
</div>
|
||||
@@ -28,10 +29,10 @@
|
||||
|
||||
<!-- Line Spacing -->
|
||||
<div class="control">
|
||||
<label>Line Spacing</label>
|
||||
<label>{{ t('lineSpacing') }}</label>
|
||||
<div class="control-right">
|
||||
<div class="stepper">
|
||||
<button (click)="decreaseLineHeight()">−</button>
|
||||
<button (click)="decreaseLineHeight()">−</button>
|
||||
<span>{{ state.lineHeight | number:'1.1-1' }}</span>
|
||||
<button (click)="increaseLineHeight()">+</button>
|
||||
</div>
|
||||
@@ -42,8 +43,9 @@
|
||||
<div class="panel-footer">
|
||||
<button class="more-settings-btn" (click)="onOpenFullSettings()">
|
||||
<app-reader-icon name="settings" [size]="16"></app-reader-icon>
|
||||
<span>More Settings</span>
|
||||
<span>{{ t('moreSettings') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
import {DecimalPipe} from '@angular/common';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderStateService} from '../../state/reader-state.service';
|
||||
import {ReaderIconComponent} from '../../shared/icon.component';
|
||||
import {BookService} from '../../../../book/service/book.service';
|
||||
@@ -8,7 +9,7 @@ import {EbookViewerSetting} from '../../../../book/model/book.model';
|
||||
@Component({
|
||||
selector: 'app-reader-quick-settings',
|
||||
standalone: true,
|
||||
imports: [DecimalPipe, ReaderIconComponent],
|
||||
imports: [DecimalPipe, TranslocoDirective, ReaderIconComponent],
|
||||
templateUrl: './quick-settings.component.html',
|
||||
styleUrls: ['./quick-settings.component.scss']
|
||||
})
|
||||
|
||||
+23
-21
@@ -1,3 +1,4 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.panel'">
|
||||
@if (isOpen) {
|
||||
<div class="sidebar-overlay" (click)="onOverlayClick()" [class.closing]="closing">
|
||||
<aside class="sidebar" (click)="$event.stopPropagation()" [class.closing]="closing">
|
||||
@@ -5,9 +6,9 @@
|
||||
<header class="sidebar-header">
|
||||
<h2 class="sidebar-title">
|
||||
@if (activeTab === 'search') {
|
||||
Search
|
||||
{{ t('searchTitle') }}
|
||||
} @else {
|
||||
Notes
|
||||
{{ t('notesTitle') }}
|
||||
}
|
||||
</h2>
|
||||
</header>
|
||||
@@ -19,7 +20,7 @@
|
||||
[class.active]="activeTab === 'search'"
|
||||
(click)="setActiveTab('search')">
|
||||
<app-reader-icon name="search" class="tab-icon"></app-reader-icon>
|
||||
<span>Search</span>
|
||||
<span>{{ t('searchTab') }}</span>
|
||||
@if (searchState.results.length > 0) {
|
||||
<span class="badge">{{ searchState.results.length }}</span>
|
||||
}
|
||||
@@ -29,7 +30,7 @@
|
||||
[class.active]="activeTab === 'notes'"
|
||||
(click)="setActiveTab('notes')">
|
||||
<app-reader-icon name="note" class="tab-icon"></app-reader-icon>
|
||||
<span>Notes</span>
|
||||
<span>{{ t('notesTab') }}</span>
|
||||
@if (notes.length > 0) {
|
||||
<span class="badge">{{ notes.length }}</span>
|
||||
}
|
||||
@@ -46,13 +47,13 @@
|
||||
<input
|
||||
type="text"
|
||||
class="search-input"
|
||||
placeholder="Search in book..."
|
||||
[placeholder]="t('searchPlaceholder')"
|
||||
[(ngModel)]="searchQuery"
|
||||
(ngModelChange)="onSearchInput($event)"
|
||||
autofocus
|
||||
/>
|
||||
@if (searchQuery) {
|
||||
<button class="clear-btn" (click)="clearSearch()" aria-label="Clear search">
|
||||
<button class="clear-btn" (click)="clearSearch()" [attr.aria-label]="t('clearSearch')">
|
||||
<app-reader-icon name="close" [size]="14"></app-reader-icon>
|
||||
</button>
|
||||
}
|
||||
@@ -64,8 +65,8 @@
|
||||
<div class="progress-fill" [style.width.%]="searchState.progress * 100"></div>
|
||||
</div>
|
||||
<div class="progress-info">
|
||||
<span class="progress-text">Searching... {{ (searchState.progress * 100) | number:'1.0-0' }}%</span>
|
||||
<button class="cancel-search-btn" (click)="onCancelSearch()" title="Cancel search">
|
||||
<span class="progress-text">{{ t('searching') }} {{ (searchState.progress * 100) | number:'1.0-0' }}%</span>
|
||||
<button class="cancel-search-btn" (click)="onCancelSearch()" [title]="t('cancelSearch')">
|
||||
<app-reader-icon name="close" [size]="14"></app-reader-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -74,7 +75,7 @@
|
||||
|
||||
@if (searchState.results.length > 0) {
|
||||
<div class="search-results-header">
|
||||
<span>{{ searchState.results.length }} result{{ searchState.results.length === 1 ? '' : 's' }} found</span>
|
||||
<span>{{ searchState.results.length === 1 ? t('resultsFound', { count: searchState.results.length }) : t('resultsFoundPlural', { count: searchState.results.length }) }}</span>
|
||||
</div>
|
||||
<ul class="item-list search-results">
|
||||
@for (result of searchState.results; track result.cfi) {
|
||||
@@ -95,14 +96,14 @@
|
||||
} @else if (!searchState.isSearching && searchQuery) {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="search" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No results found</p>
|
||||
<span class="empty-hint">Try different keywords</span>
|
||||
<p>{{ t('noResultsFound') }}</p>
|
||||
<span class="empty-hint">{{ t('tryDifferentKeywords') }}</span>
|
||||
</div>
|
||||
} @else if (!searchQuery) {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="search" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>Search this book</p>
|
||||
<span class="empty-hint">Enter text to find in the book</span>
|
||||
<p>{{ t('searchThisBook') }}</p>
|
||||
<span class="empty-hint">{{ t('enterTextToFind') }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -116,12 +117,12 @@
|
||||
<input
|
||||
type="text"
|
||||
class="search-input"
|
||||
placeholder="Search notes..."
|
||||
[placeholder]="t('searchNotes')"
|
||||
[(ngModel)]="notesSearchQuery"
|
||||
(ngModelChange)="onNotesSearchInput($event)"
|
||||
/>
|
||||
@if (notesSearchQuery) {
|
||||
<button class="clear-btn" (click)="clearNotesSearch()" aria-label="Clear search">
|
||||
<button class="clear-btn" (click)="clearNotesSearch()" [attr.aria-label]="t('clearSearch')">
|
||||
<app-reader-icon name="close" [size]="14"></app-reader-icon>
|
||||
</button>
|
||||
}
|
||||
@@ -144,10 +145,10 @@
|
||||
<span class="item-meta">{{ note.createdAt | date: 'MMM d, y' }}</span>
|
||||
</div>
|
||||
<div class="action-buttons">
|
||||
<button class="edit-btn" (click)="onEditNote($event, note)" aria-label="Edit note">
|
||||
<button class="edit-btn" (click)="onEditNote($event, note)" [attr.aria-label]="t('editNote')">
|
||||
<app-reader-icon name="edit" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
<button class="delete-btn" (click)="onDeleteNote($event, note.id)" aria-label="Delete note">
|
||||
<button class="delete-btn" (click)="onDeleteNote($event, note.id)" [attr.aria-label]="t('deleteNote')">
|
||||
<app-reader-icon name="trash" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -157,14 +158,14 @@
|
||||
} @else if (notes.length > 0 && notesSearchQuery) {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="search" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No matching notes</p>
|
||||
<span class="empty-hint">Try different search terms</span>
|
||||
<p>{{ t('noMatchingNotes') }}</p>
|
||||
<span class="empty-hint">{{ t('tryDifferentSearchTerms') }}</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="note" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No notes yet</p>
|
||||
<span class="empty-hint">Select text and tap the note icon to add a note</span>
|
||||
<p>{{ t('noNotesYet') }}</p>
|
||||
<span class="empty-hint">{{ t('noNotesHint') }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -174,3 +175,4 @@
|
||||
</aside>
|
||||
</div>
|
||||
}
|
||||
</ng-container>
|
||||
|
||||
@@ -3,6 +3,7 @@ import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil, debounceTime, distinctUntilChanged, filter} from 'rxjs/operators';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderLeftSidebarService, LeftSidebarTab} from './panel.service';
|
||||
import {BookNoteV2} from '../../../../../shared/service/book-note-v2.service';
|
||||
import {SearchState, SearchResult} from '../sidebar/sidebar.service';
|
||||
@@ -13,7 +14,7 @@ import {ReaderIconComponent} from '../../shared/icon.component';
|
||||
standalone: true,
|
||||
templateUrl: './panel.component.html',
|
||||
styleUrls: ['./panel.component.scss'],
|
||||
imports: [CommonModule, FormsModule, ReaderIconComponent]
|
||||
imports: [CommonModule, FormsModule, TranslocoDirective, ReaderIconComponent]
|
||||
})
|
||||
export class ReaderLeftSidebarComponent implements OnInit, OnDestroy {
|
||||
private leftSidebarService = inject(ReaderLeftSidebarService);
|
||||
|
||||
+12
-10
@@ -1,3 +1,4 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.sidebar'">
|
||||
@if (isOpen) {
|
||||
<div class="sidebar-overlay" (click)="onOverlayClick()" [class.closing]="closing">
|
||||
<aside class="sidebar" (click)="$event.stopPropagation()" [class.closing]="closing">
|
||||
@@ -6,7 +7,7 @@
|
||||
@if (bookInfo.coverUrl) {
|
||||
<img
|
||||
[src]="bookInfo.coverUrl"
|
||||
alt="Book cover"
|
||||
[alt]="t('bookCoverAlt')"
|
||||
class="book-cover"
|
||||
(click)="onCoverClick()"
|
||||
role="button"
|
||||
@@ -29,14 +30,14 @@
|
||||
[class.active]="activeTab === 'chapters'"
|
||||
(click)="setActiveTab('chapters')">
|
||||
<app-reader-icon name="book" class="tab-icon"></app-reader-icon>
|
||||
<span>Contents</span>
|
||||
<span>{{ t('contentsTab') }}</span>
|
||||
</button>
|
||||
<button
|
||||
class="tab"
|
||||
[class.active]="activeTab === 'bookmarks'"
|
||||
(click)="setActiveTab('bookmarks')">
|
||||
<app-reader-icon name="bookmark" class="tab-icon"></app-reader-icon>
|
||||
<span>Bookmarks</span>
|
||||
<span>{{ t('bookmarksTab') }}</span>
|
||||
@if (bookmarks.length > 0) {
|
||||
<span class="badge">{{ bookmarks.length }}</span>
|
||||
}
|
||||
@@ -46,7 +47,7 @@
|
||||
[class.active]="activeTab === 'highlights'"
|
||||
(click)="setActiveTab('highlights')">
|
||||
<app-reader-icon name="edit" class="tab-icon"></app-reader-icon>
|
||||
<span>Highlights</span>
|
||||
<span>{{ t('highlightsTab') }}</span>
|
||||
@if (annotations.length > 0) {
|
||||
<span class="badge">{{ annotations.length }}</span>
|
||||
}
|
||||
@@ -101,7 +102,7 @@
|
||||
<span class="item-title">{{ bookmark.title }}</span>
|
||||
<span class="item-meta">{{ bookmark.createdAt | date: 'MMM d, y' }}</span>
|
||||
</div>
|
||||
<button class="delete-btn" (click)="onDeleteBookmark($event, bookmark.id)" aria-label="Delete bookmark">
|
||||
<button class="delete-btn" (click)="onDeleteBookmark($event, bookmark.id)" [attr.aria-label]="t('deleteBookmark')">
|
||||
<app-reader-icon name="trash" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
</li>
|
||||
@@ -110,8 +111,8 @@
|
||||
} @else {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="bookmark" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No bookmarks yet</p>
|
||||
<span class="empty-hint">Tap the bookmark icon to save your place</span>
|
||||
<p>{{ t('noBookmarksYet') }}</p>
|
||||
<span class="empty-hint">{{ t('noBookmarksHint') }}</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -129,7 +130,7 @@
|
||||
}
|
||||
<span class="item-meta">{{ annotation.createdAt | date: 'MMM d, y' }}</span>
|
||||
</div>
|
||||
<button class="delete-btn" (click)="onDeleteAnnotation($event, annotation.id)" aria-label="Delete highlight">
|
||||
<button class="delete-btn" (click)="onDeleteAnnotation($event, annotation.id)" [attr.aria-label]="t('deleteHighlight')">
|
||||
<app-reader-icon name="trash" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
</li>
|
||||
@@ -138,8 +139,8 @@
|
||||
} @else {
|
||||
<div class="empty-state">
|
||||
<app-reader-icon name="edit" class="empty-icon" [size]="48" [strokeWidth]="1.5"></app-reader-icon>
|
||||
<p>No highlights yet</p>
|
||||
<span class="empty-hint">Select text to create a highlight</span>
|
||||
<p>{{ t('noHighlightsYet') }}</p>
|
||||
<span class="empty-hint">{{ t('noHighlightsHint') }}</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -148,3 +149,4 @@
|
||||
</aside>
|
||||
</div>
|
||||
}
|
||||
</ng-container>
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderSidebarService, SidebarBookInfo, SidebarTab} from './sidebar.service';
|
||||
import {TocItem} from 'epubjs';
|
||||
import {BookMark} from '../../../../../shared/service/book-mark.service';
|
||||
@@ -14,7 +15,7 @@ import {ReaderIconComponent} from '../../shared/icon.component';
|
||||
standalone: true,
|
||||
templateUrl: './sidebar.component.html',
|
||||
styleUrls: ['./sidebar.component.scss'],
|
||||
imports: [CommonModule, FormsModule, ReaderIconComponent]
|
||||
imports: [CommonModule, FormsModule, TranslocoDirective, ReaderIconComponent]
|
||||
})
|
||||
export class ReaderSidebarComponent implements OnInit, OnDestroy {
|
||||
private sidebarService = inject(ReaderSidebarService);
|
||||
|
||||
@@ -11,7 +11,7 @@ export interface ThemeInfo {
|
||||
export class PageDecorator {
|
||||
private static readonly DEFAULT_FONT_SIZE = '0.875rem';
|
||||
|
||||
static updateHeadersAndFooters(renderer: any, chapterName: string, pageInfo?: PageInfo, theme?: ThemeInfo): void {
|
||||
static updateHeadersAndFooters(renderer: any, chapterName: string, pageInfo?: PageInfo, theme?: ThemeInfo, timeRemainingLabel?: string): void {
|
||||
|
||||
if (!renderer) {
|
||||
return;
|
||||
@@ -21,7 +21,7 @@ export class PageDecorator {
|
||||
const isSingleColumn = columnCount === 1;
|
||||
|
||||
this.updateHeaders(renderer, chapterName, isSingleColumn, theme);
|
||||
this.updateFooters(renderer, pageInfo, isSingleColumn, theme);
|
||||
this.updateFooters(renderer, pageInfo, isSingleColumn, theme, timeRemainingLabel);
|
||||
}
|
||||
|
||||
private static updateHeaders(renderer: any, chapterName: string, isSingleColumn: boolean, theme?: ThemeInfo): void {
|
||||
@@ -40,7 +40,7 @@ export class PageDecorator {
|
||||
});
|
||||
}
|
||||
|
||||
private static updateFooters(renderer: any, pageInfo: PageInfo | undefined, isSingleColumn: boolean, theme?: ThemeInfo): void {
|
||||
private static updateFooters(renderer: any, pageInfo: PageInfo | undefined, isSingleColumn: boolean, theme?: ThemeInfo, timeRemainingLabel?: string): void {
|
||||
if (!renderer.feet || !Array.isArray(renderer.feet) || renderer.feet.length === 0 || !pageInfo) {
|
||||
return;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export class PageDecorator {
|
||||
|
||||
renderer.feet.forEach((footElement: HTMLElement, index: number) => {
|
||||
if (footElement) {
|
||||
const footerContent = this.createFooterContent(pageInfo, isSingleColumn, index, renderer.feet.length, footerStyle);
|
||||
const footerContent = this.createFooterContent(pageInfo, isSingleColumn, index, renderer.feet.length, footerStyle, timeRemainingLabel);
|
||||
footElement.replaceChildren(footerContent);
|
||||
}
|
||||
});
|
||||
@@ -88,11 +88,11 @@ export class PageDecorator {
|
||||
return headerContent;
|
||||
}
|
||||
|
||||
private static createFooterContent(pageInfo: PageInfo, isSingleColumn: boolean, index: number, totalColumns: number, style: string): HTMLElement {
|
||||
private static createFooterContent(pageInfo: PageInfo, isSingleColumn: boolean, index: number, totalColumns: number, style: string, timeRemainingLabel?: string): HTMLElement {
|
||||
const footerContent = document.createElement('div');
|
||||
footerContent.style.cssText = style;
|
||||
|
||||
const text = 'Time remaining in section: ' + (pageInfo.sectionTimeText ?? '0s');
|
||||
const text = timeRemainingLabel ?? ('Time remaining in section: ' + (pageInfo.sectionTimeText ?? '0s'));
|
||||
|
||||
if (isSingleColumn) {
|
||||
const timeSpan = document.createElement('span');
|
||||
|
||||
+7
-5
@@ -1,3 +1,4 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.selectionPopup'">
|
||||
@if (visible) {
|
||||
<div class="popup-backdrop" (click)="onDismiss($event)"></div>
|
||||
<div class="text-selection-popup"
|
||||
@@ -5,20 +6,20 @@
|
||||
[style.left.px]="position.x"
|
||||
[style.top.px]="position.y">
|
||||
|
||||
<button class="action-btn" (click)="onSelect()" title="Copy Text">
|
||||
<button class="action-btn" (click)="onSelect()" [title]="t('copyText')">
|
||||
<app-reader-icon name="copy" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<button class="action-btn" (click)="onSearch()" title="Search in book">
|
||||
<button class="action-btn" (click)="onSearch()" [title]="t('searchInBook')">
|
||||
<app-reader-icon name="search" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="annotation-container">
|
||||
<button class="action-btn" [class.active]="showAnnotationOptions" (click)="toggleAnnotationOptions()" title="Annotate">
|
||||
<button class="action-btn" [class.active]="showAnnotationOptions" (click)="toggleAnnotationOptions()" [title]="t('annotate')">
|
||||
<app-reader-icon name="edit" [size]="16"></app-reader-icon>
|
||||
<app-reader-icon name="chevron-down" class="chevron" [class.open]="showAnnotationOptions" [size]="10"></app-reader-icon>
|
||||
</button>
|
||||
@@ -57,15 +58,16 @@
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<button class="action-btn" (click)="onNote()" title="Add Note">
|
||||
<button class="action-btn" (click)="onNote()" [title]="t('addNote')">
|
||||
<app-reader-icon name="note" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
|
||||
@if (overlappingAnnotationId) {
|
||||
<div class="divider"></div>
|
||||
<button class="action-btn delete-btn" (click)="onDelete()" title="Delete Annotation">
|
||||
<button class="action-btn delete-btn" (click)="onDelete()" [title]="t('deleteAnnotation')">
|
||||
<app-reader-icon name="trash" [size]="16"></app-reader-icon>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</ng-container>
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderIconComponent} from './icon.component';
|
||||
|
||||
export type AnnotationStyle = 'highlight' | 'underline' | 'strikethrough' | 'squiggly';
|
||||
@@ -15,7 +16,7 @@ export interface TextSelectionAction {
|
||||
@Component({
|
||||
selector: 'app-text-selection-popup',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ReaderIconComponent],
|
||||
imports: [CommonModule, TranslocoDirective, ReaderIconComponent],
|
||||
templateUrl: './selection-popup.component.html',
|
||||
styleUrls: ['./selection-popup.component.scss']
|
||||
})
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {Subject} from 'rxjs';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
import {BookPatchService} from '../../../book/service/book-patch.service';
|
||||
import {ReadingSessionService} from '../../../../shared/service/reading-session.service';
|
||||
import {PageInfo, ThemeInfo} from '../core/view-manager.service';
|
||||
@@ -23,6 +24,7 @@ export interface ProgressState {
|
||||
export class ReaderProgressService {
|
||||
private bookPatchService = inject(BookPatchService);
|
||||
private readingSessionService = inject(ReadingSessionService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private viewManager = inject(ReaderViewManagerService);
|
||||
private stateService = inject(ReaderStateService);
|
||||
private annotationService = inject(ReaderAnnotationHttpService);
|
||||
@@ -144,10 +146,15 @@ export class ReaderProgressService {
|
||||
bg: this.stateService.currentState.theme.bg || this.stateService.currentState.theme.light.bg
|
||||
};
|
||||
|
||||
const timeLabel = this.t.translate('readerEbook.headerFooterUtil.timeRemainingInSection', {
|
||||
time: this._currentPageInfo?.sectionTimeText ?? '0s'
|
||||
});
|
||||
|
||||
this.viewManager.updateHeadersAndFooters(
|
||||
this._currentChapterName || '',
|
||||
this._currentPageInfo,
|
||||
theme
|
||||
theme,
|
||||
timeLabel
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user