diff --git a/ui/src/lib/components/ChapterPickerOverlay.svelte b/ui/src/lib/components/ChapterPickerOverlay.svelte index e824d17..887e2ec 100644 --- a/ui/src/lib/components/ChapterPickerOverlay.svelte +++ b/ui/src/lib/components/ChapterPickerOverlay.svelte @@ -15,7 +15,7 @@ zIndex?: string; /** Called when a chapter row is tapped. The overlay does NOT close itself. */ onselect: (chapterNumber: number) => void; - /** Called when the close / chevron-down button is tapped. */ + /** Called when the close (✕) button is tapped. */ onclose: () => void; } @@ -40,12 +40,6 @@ ) ); - /** Scroll the active chapter into view instantly (no animation) when the - * list is first rendered so the user never has to hunt for their position. */ - function scrollIfActive(node: HTMLElement, isActive: boolean) { - if (isActive) node.scrollIntoView({ block: 'center', behavior: 'instant' }); - } - function handleClose() { search = ''; onclose(); @@ -73,9 +67,9 @@ class="p-2 rounded-full text-(--color-muted) hover:text-(--color-text) hover:bg-(--color-surface-2) transition-colors" aria-label="Close chapter picker" > - + - + Chapters @@ -105,7 +99,6 @@ + + + +
+ + {#if loading} + +
+ {#each [1, 2, 3] as _} +
+
+
+
+
+
+
+ {/each} +
+ + {:else if error} +

{error}

+ + {:else if entries.length === 0} +
+

No books in progress

+

Books you start reading will appear here.

+
+ + {:else} + {#each entries as entry, i} + {@const genres = parseGenres(entry.book.genres)} + {@const isCurrent = entry.book.slug === currentSlug} + + {/each} + {/if} + +
+ + diff --git a/ui/src/lib/components/ListeningMode.svelte b/ui/src/lib/components/ListeningMode.svelte index ad7f071..e02514f 100644 --- a/ui/src/lib/components/ListeningMode.svelte +++ b/ui/src/lib/components/ListeningMode.svelte @@ -98,7 +98,6 @@ // ── Chapter click-to-play ───────────────────────────────────────────────── function playChapter(chapterNumber: number) { audioStore.autoStartChapter = chapterNumber; - onclose(); goto(`/books/${audioStore.slug}/chapters/${chapterNumber}`); } @@ -434,17 +433,6 @@ {/if} - - {#if showChapterModal && audioStore.chapters.length > 0} - { showChapterModal = false; }} - /> - {/if} -
@@ -670,3 +658,16 @@
+ + +{#if showChapterModal && audioStore.chapters.length > 0} + { showChapterModal = false; }} + /> +{/if} diff --git a/ui/src/routes/books/[slug]/chapters/[n]/+page.svelte b/ui/src/routes/books/[slug]/chapters/[n]/+page.svelte index 66ec0e5..e36d4a1 100644 --- a/ui/src/routes/books/[slug]/chapters/[n]/+page.svelte +++ b/ui/src/routes/books/[slug]/chapters/[n]/+page.svelte @@ -5,6 +5,7 @@ import { page } from '$app/state'; import AudioPlayer from '$lib/components/AudioPlayer.svelte'; import CommentsSection from '$lib/components/CommentsSection.svelte'; + import CurrentlyReadingModal from '$lib/components/CurrentlyReadingModal.svelte'; import type { PageData } from './$types'; import * as m from '$lib/paraglide/messages.js'; import { audioStore } from '$lib/audio.svelte'; @@ -22,6 +23,9 @@ let settingsPanelOpen = $state(false); let settingsTab = $state<'reading' | 'listening'>('reading'); + // ── Currently reading modal ─────────────────────────────────────────────── + let readingModalOpen = $state(false); + const READER_FONTS = [ { id: 'system', label: 'System' }, { id: 'serif', label: 'Serif' }, @@ -517,6 +521,18 @@
+ +

{m.reader_chapter_n({ n: String(data.chapter.number) })}

@@ -1315,3 +1331,11 @@
{/if} {/if} + + +{#if readingModalOpen} + (readingModalOpen = false)} + /> +{/if}