Estimated time is hooked up, but not functional. Needs word count.

This commit is contained in:
Joseph Milazzo 2025-07-07 16:52:18 -05:00
parent f27308190d
commit 9b7eb11359
2 changed files with 19 additions and 15 deletions

View file

@ -127,6 +127,8 @@
<!--Just render a blank div here--> <!--Just render a blank div here-->
} @else { } @else {
<!--BookFusion: Page X 10 pages left, 30% -->
<span class="me-1"> <span class="me-1">
{{t('page-num-label', {page: pageNum()})}} / {{maxPages}} {{t('page-num-label', {page: pageNum()})}} / {{maxPages}}
</span> </span>
@ -134,12 +136,12 @@
<span> {{t('completion-label', {percent: (pageNum() / maxPages) | percent})}}</span> <span> {{t('completion-label', {percent: (pageNum() / maxPages) | percent})}}</span>
@let timeLeft = readingTimeLeft(); @let timeLeft = readingTimeLeftResource.value();
@if (timeLeft) { @if (timeLeft) {
, ,
<span class="time-left" [ngbTooltip]="t('time-left-alt')"> <span class="time-left" [ngbTooltip]="t('time-left-alt')">
<i class="fa-solid fa-clock" aria-hidden="true"></i> <i class="fa-solid fa-clock" aria-hidden="true"></i>
{{timeLeft | readTimeLeft }} {{timeLeft! | readTimeLeft }}
</span> </span>
} }

View file

@ -15,6 +15,7 @@ import {
OnInit, OnInit,
Renderer2, Renderer2,
RendererStyleFlags2, RendererStyleFlags2,
resource,
Signal, Signal,
ViewChild, ViewChild,
ViewContainerRef ViewContainerRef
@ -61,7 +62,6 @@ import {ColumnLayoutClassPipe} from "../../_pipes/column-layout-class.pipe";
import {WritingStyleClassPipe} from "../../_pipes/writing-style-class.pipe"; import {WritingStyleClassPipe} from "../../_pipes/writing-style-class.pipe";
import {ChapterService} from "../../../_services/chapter.service"; import {ChapterService} from "../../../_services/chapter.service";
import {ReadTimeLeftPipe} from "../../../_pipes/read-time-left.pipe"; import {ReadTimeLeftPipe} from "../../../_pipes/read-time-left.pipe";
import {HourEstimateRange} from "../../../_models/series-detail/hour-estimate-range";
interface HistoryPoint { interface HistoryPoint {
@ -262,13 +262,21 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
*/ */
horizontalScrollbarNeeded = false; horizontalScrollbarNeeded = false;
scrollbarNeeded = false; scrollbarNeeded = false;
// readingDirection: ReadingDirection = ReadingDirection.LeftToRight;
// clickToPaginate = false;
/** /**
* Used solely for fullscreen to apply a hack * Used solely for fullscreen to apply a hack
*/ */
darkMode = model<boolean>(true); darkMode = model<boolean>(true);
readingTimeLeft = model<HourEstimateRange | null>(null); readingTimeLeftResource = resource({
request: () => ({
chapterId: this.chapterId,
seriesId: this.seriesId,
pageNumber: this.pageNum()
}),
loader: async ({ request }) => {
return this.readerService.getTimeLeftForChapter(this.seriesId, this.chapterId).toPromise();
}
});
/** /**
* Anchors that map to the page number. When you click on one of these, we will load a given page up for the user. * Anchors that map to the page number. When you click on one of these, we will load a given page up for the user.
*/ */
@ -287,11 +295,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
*/ */
isFullscreen: boolean = false; isFullscreen: boolean = false;
/**
* How to render the page content
*/
//layoutMode: BookPageLayoutMode = BookPageLayoutMode.Default;
//layoutMode = model<BookPageLayoutMode>(BookPageLayoutMode.Default);
/** /**
* Width of the document (in non-column layout), used for column layout virtual paging * Width of the document (in non-column layout), used for column layout virtual paging
@ -1478,7 +1481,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.applyFullscreen(); this.applyFullscreen();
break; break;
case "writingStyle": case "writingStyle":
this.applyWritingStyle(res.object as WritingStyle); this.applyWritingStyle();
break; break;
case "layoutMode": case "layoutMode":
this.applyLayoutMode(res.object as BookPageLayoutMode); this.applyLayoutMode(res.object as BookPageLayoutMode);
@ -1553,7 +1556,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.incognitoMode = false; this.incognitoMode = false;
const newRoute = this.readerService.getNextChapterUrl(this.router.url, this.chapterId, this.incognitoMode, this.readingListMode, this.readingListId); const newRoute = this.readerService.getNextChapterUrl(this.router.url, this.chapterId, this.incognitoMode, this.readingListMode, this.readingListId);
window.history.replaceState({}, '', newRoute); window.history.replaceState({}, '', newRoute);
this.toastr.info('Incognito mode is off. Progress will now start being tracked.'); this.toastr.info(translate('toasts.incognito-off'));
this.saveProgress(); this.saveProgress();
} }
@ -1578,8 +1581,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
} }
} }
applyWritingStyle(writingStyle: WritingStyle) { applyWritingStyle() {
//this.readerSettingsService.updateWritingStyle(writingStyle);
setTimeout(() => this.updateImageSizes()); setTimeout(() => this.updateImageSizes());
if (this.layoutMode() !== BookPageLayoutMode.Default) { if (this.layoutMode() !== BookPageLayoutMode.Default) {
const lastSelector = this.lastSeenScrollPartPath; const lastSelector = this.lastSeenScrollPartPath;