diff --git a/ui/src/routes/+page.svelte b/ui/src/routes/+page.svelte index a8ce37b..9460b28 100644 --- a/ui/src/routes/+page.svelte +++ b/ui/src/routes/+page.svelte @@ -90,17 +90,13 @@ // Auto-advance carousel every CAROUSEL_INTERVAL ms when there are multiple books. // autoAdvanceSeed is bumped on manual swipe/dot to restart the interval. let autoAdvanceSeed = $state(0); - // progressStart tracks when the current interval began (for the progress bar). - let progressStart = $state(browser ? performance.now() : 0); $effect(() => { if (heroBooks.length <= 1) return; const len = heroBooks.length; void autoAdvanceSeed; // restart when seed changes - progressStart = browser ? performance.now() : 0; const id = setInterval(() => { heroIndex = (heroIndex + 1) % len; - progressStart = browser ? performance.now() : 0; }, CAROUSEL_INTERVAL); return () => clearInterval(id); }); @@ -109,8 +105,7 @@ autoAdvanceSeed++; } - // ── Swipe handling ─────────────────────────────────────────────────────── - let swipeStartX = 0; + // ── Swipe handling ─────────────────────────────────────────────────────── let swipeStartX = 0; function onSwipeStart(e: TouchEvent) { swipeStartX = e.touches[0].clientX; } @@ -127,22 +122,6 @@ resetAutoAdvance(); } - // ── Progress bar animation ─────────────────────────────────────────────── - // rAF loop drives a 0→1 progress value that resets on each advance. - let rafProgress = $state(0); - $effect(() => { - if (!browser || heroBooks.length <= 1) return; - void autoAdvanceSeed; // re-subscribe so effect re-runs on manual nav - void heroIndex; - let raf: number; - function tick() { - rafProgress = Math.min((performance.now() - progressStart) / CAROUSEL_INTERVAL, 1); - raf = requestAnimationFrame(tick); - } - raf = requestAnimationFrame(tick); - return () => cancelAnimationFrame(raf); - }); - function playChapter(slug: string, chapter: number) { audioStore.autoStartChapter = chapter; goto(`/books/${slug}/chapters/${chapter}`); @@ -210,10 +189,6 @@ Listen - {#if heroBook.book.total_chapters > 0 && heroBook.chapter < heroBook.book.total_chapters} - {@const ahead = heroBook.book.total_chapters - heroBook.chapter} - - {/if} {#each parseGenres(heroBook.book.genres).slice(0, 2) as genre} {genre} {/each} @@ -221,7 +196,7 @@ - + {#if heroBooks.length > 1}