Implement streaming EPUB reader with on-demand loading (#2350)
Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
@@ -88,9 +88,11 @@
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
<div class="loading-container">
|
||||
<p-progressSpinner class="custom-spinner"></p-progressSpinner>
|
||||
<p class="loading-text">Processing pages... This may take a few seconds on first load. Future loads will be significantly faster.</p>
|
||||
<div class="loader-overlay">
|
||||
<div class="loader-content">
|
||||
<div class="spinner"></div>
|
||||
<p class="loader-text">Loading book...</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -458,3 +458,45 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loader-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.loader-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.2);
|
||||
border-top-color: #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
.loader-text {
|
||||
color: #fff;
|
||||
font-size: 1.1rem;
|
||||
margin: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -313,11 +313,14 @@ $transition-fast: 150ms ease;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-nav-left,
|
||||
.page-nav-right {
|
||||
.page-nav-left {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.page-nav-right {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-nav-left {
|
||||
margin: 0 auto;
|
||||
justify-content: center;
|
||||
|
||||
+22
-18
@@ -1,21 +1,25 @@
|
||||
<div class="cbx-header" [class.visible]="isVisible">
|
||||
<button class="icon-btn" (click)="onOpenSidebar()" title="Contents">
|
||||
<app-reader-icon name="menu" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn" (click)="onToggleBookmark()" [title]="isCurrentPageBookmarked ? 'Remove Bookmark' : 'Add Bookmark'" [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">
|
||||
<app-reader-icon name="note" [size]="20" />
|
||||
@if (currentPageHasNotes) {
|
||||
<span class="indicator-dot"></span>
|
||||
}
|
||||
</button>
|
||||
<div class="header-left">
|
||||
<button class="icon-btn" (click)="onOpenSidebar()" title="Contents">
|
||||
<app-reader-icon name="menu" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn" (click)="onToggleBookmark()" [title]="isCurrentPageBookmarked ? 'Remove Bookmark' : 'Add Bookmark'" [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">
|
||||
<app-reader-icon name="note" [size]="20" />
|
||||
@if (currentPageHasNotes) {
|
||||
<span class="indicator-dot"></span>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
<span class="book-title">{{ bookTitle }}</span>
|
||||
<button class="icon-btn" (click)="onOpenSettings()" title="Settings">
|
||||
<app-reader-icon name="settings" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn close-btn" (click)="onClose(); $event.stopPropagation()" title="Close Reader">
|
||||
<app-reader-icon name="close" [size]="20" />
|
||||
</button>
|
||||
<div class="header-right">
|
||||
<button class="icon-btn" (click)="onOpenSettings()" title="Settings">
|
||||
<app-reader-icon name="settings" [size]="20" />
|
||||
</button>
|
||||
<button class="icon-btn close-btn" (click)="onClose(); $event.stopPropagation()" title="Close Reader">
|
||||
<app-reader-icon name="close" [size]="20" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+21
-7
@@ -25,6 +25,13 @@
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
|
||||
.header-left,
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
@@ -47,7 +54,7 @@
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
&:last-of-type {
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
@@ -85,7 +92,10 @@
|
||||
}
|
||||
|
||||
.book-title {
|
||||
flex: 1;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
max-width: calc(100% - 240px);
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
@@ -96,21 +106,25 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
min-height: 1.2em;
|
||||
padding: 0 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.cbx-header {
|
||||
padding: 0 8px;
|
||||
padding: 0 4px;
|
||||
|
||||
.icon-btn {
|
||||
padding: 10px;
|
||||
padding: 5px;
|
||||
margin-right: 6px;
|
||||
|
||||
app-reader-icon {
|
||||
transform: scale(0.9);
|
||||
}
|
||||
}
|
||||
|
||||
.book-title {
|
||||
font-size: 13px;
|
||||
padding: 0 8px;
|
||||
font-size: 12px;
|
||||
max-width: calc(100% - 160px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import {Component, inject, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {CbxHeaderService} from './cbx-header.service';
|
||||
import {ReaderIconComponent} from '../../../ebook-reader/shared/icon.component';
|
||||
import {ReaderIconComponent} from '../../../ebook-reader';
|
||||
import {CommonModule} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
|
||||
Reference in New Issue
Block a user