From f31b1b379652753e3c0a131c44d1f1eb8f74569f Mon Sep 17 00:00:00 2001 From: adityachandelgit <> Date: Fri, 28 Mar 2025 10:53:51 -0600 Subject: [PATCH] - Prevent buttons from overlapping the EPUB content area - Display chapter name in the header section --- .../component/epub-viewer.component.html | 64 ++++++++++--------- .../component/epub-viewer.component.scss | 24 +++---- .../component/epub-viewer.component.ts | 8 +-- 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html index 2ba218bf2..910216c09 100644 --- a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html +++ b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html @@ -2,41 +2,47 @@
- - - - -
-

Chapter 1: Introduction | Page 3 of 120

-
- - -
-
-

Font Size: {{ fontSize }}%

-
- - -
- - - - - - -
+
+ + +
    +
  • + {{ chapter.label }} +
  • +
+
- + +

{{ currentChapter }}

+ +
+ + +
+
+

Font Size: {{ fontSize }}%

+
+ + +
+ + + + + + +
+
+
+
+ +
- +
diff --git a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.scss b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.scss index 1bfd7be6b..8eff16afb 100644 --- a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.scss +++ b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.scss @@ -1,10 +1,15 @@ -.epub-viewer-container { +.epub-header { display: flex; - flex-direction: column; - justify-content: center; + flex-direction: row; align-items: center; + justify-content: space-between; + padding-left: 1rem; + padding-right: 1rem; +} + +.epub-viewer-container { + overflow: hidden; height: 100vh; - position: relative; } #epubContainer { @@ -16,7 +21,6 @@ .menu-toggle-button, .settings-toggle-button { - position: absolute; top: 10px; z-index: 1000; margin: 0; @@ -30,16 +34,6 @@ right: 10px; } -.epub-header { - position: absolute; - top: 2%; - left: 50%; - transform: translate(-50%, -50%); - z-index: 500; - text-align: center; - color: #333; -} - .epub-controls-left, .epub-controls-right { position: absolute; diff --git a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.ts b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.ts index 566b04512..7d46811d1 100644 --- a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.ts +++ b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.ts @@ -35,8 +35,7 @@ export function getCfiFromHref(book: any, href: string): string { export function getChapter(book: any, location: any) { const locationHref = location.start.href; - - let match = flatten(book.navigation.toc) + return flatten(book.navigation.toc) .filter((chapter: any) => { return book.canonical(chapter.href).includes(book.canonical(locationHref)); }) @@ -44,8 +43,6 @@ export function getChapter(book: any, location: any) { const locationAfterChapter = EpubCFI.prototype.compare(location.start.cfi, getCfiFromHref(book, chapter.href)) > 0; return locationAfterChapter ? chapter : result; }, null); - - return match; } @Component({ @@ -60,6 +57,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy { isLoading = true; chapters: { label: string; href: string }[] = []; + currentChapter = ''; isDrawerVisible = false; isSettingsDrawerVisible = false; private book: any; @@ -263,7 +261,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy { if (this.rendition) { this.rendition.on('relocated', (location: any) => { const currentChapter = getChapter(this.book, location); - console.log(currentChapter?.label || 'Unknown Chapter'); + this.currentChapter = currentChapter?.label; this.bookService.saveEpubProgress(this.epub.id, location.start.cfi).subscribe(); }); }