From 76d616a30894f09176085d5247e66931bd3fe8bb Mon Sep 17 00:00:00 2001 From: Admin Date: Fri, 6 Mar 2026 17:39:40 +0500 Subject: [PATCH] feat: nav progress bar, chapter list polling, live chapter fallback, and jump to current page --- ui/src/app.css | 10 +++ ui/src/routes/+layout.svelte | 8 ++- .../[slug]/[n]/+server.ts | 46 ++++++++++++++ ui/src/routes/books/[slug]/+page.svelte | 49 ++++++++++++++- .../books/[slug]/chapters/[n]/+page.svelte | 61 +++++++++++++++---- 5 files changed, 158 insertions(+), 16 deletions(-) create mode 100644 ui/src/routes/api/chapter-text-preview/[slug]/[n]/+server.ts diff --git a/ui/src/app.css b/ui/src/app.css index e7bc911..c106a57 100644 --- a/ui/src/app.css +++ b/ui/src/app.css @@ -53,3 +53,13 @@ html { margin: 2em 0; } +/* ── Navigation progress bar ───────────────────────────────────────── */ +@keyframes progress-bar { + 0% { width: 0%; opacity: 1; } + 80% { width: 90%; opacity: 1; } + 100% { width: 100%; opacity: 0; } +} +.animate-progress-bar { + animation: progress-bar 8s cubic-bezier(0.1, 0.05, 0.1, 1) forwards; +} + diff --git a/ui/src/routes/+layout.svelte b/ui/src/routes/+layout.svelte index 0553763..7014c0d 100644 --- a/ui/src/routes/+layout.svelte +++ b/ui/src/routes/+layout.svelte @@ -1,6 +1,6 @@ @@ -85,13 +112,21 @@ {/if} -{#if !data.html} +{#if fetchingContent} +
+ + + + + Fetching chapter… +
+{:else if !html}
-

Chapter content not available.

+

{fetchError || 'Chapter content not available.'}

{:else}
- {@html data.html} + {@html html}
{/if}