From 226bf7033e0f1fcfdbff2a9df6db1be15a8a8a87 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 11 Feb 2026 00:38:33 +0800 Subject: [PATCH] fix(layout): fixed some layout issues for RSVP, closes #3199 (#3254) --- .../components/annotator/WiktionaryPopup.tsx | 1 + .../reader/components/footerbar/FooterBar.tsx | 2 +- .../reader/components/rsvp/RSVPControl.tsx | 5 +- .../reader/components/rsvp/RSVPOverlay.tsx | 77 ++++++++++--------- 4 files changed, 48 insertions(+), 37 deletions(-) diff --git a/apps/readest-app/src/app/reader/components/annotator/WiktionaryPopup.tsx b/apps/readest-app/src/app/reader/components/annotator/WiktionaryPopup.tsx index b2cf6b46..58ca853b 100644 --- a/apps/readest-app/src/app/reader/components/annotator/WiktionaryPopup.tsx +++ b/apps/readest-app/src/app/reader/components/annotator/WiktionaryPopup.tsx @@ -270,6 +270,7 @@ const WiktionaryPopup: React.FC = ({ }; fetchDefinitions(lookupWord, langCode); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [_, lookupWord, lang]); return ( diff --git a/apps/readest-app/src/app/reader/components/footerbar/FooterBar.tsx b/apps/readest-app/src/app/reader/components/footerbar/FooterBar.tsx index 80f55c05..476790df 100644 --- a/apps/readest-app/src/app/reader/components/footerbar/FooterBar.tsx +++ b/apps/readest-app/src/app/reader/components/footerbar/FooterBar.tsx @@ -250,7 +250,7 @@ const FooterBar: React.FC = ({ )} - + ); }; diff --git a/apps/readest-app/src/app/reader/components/rsvp/RSVPControl.tsx b/apps/readest-app/src/app/reader/components/rsvp/RSVPControl.tsx index a7b503c7..e075d3b6 100644 --- a/apps/readest-app/src/app/reader/components/rsvp/RSVPControl.tsx +++ b/apps/readest-app/src/app/reader/components/rsvp/RSVPControl.tsx @@ -9,11 +9,13 @@ import { RSVPController, RsvpStartChoice, RsvpStopPosition } from '@/services/rs import { eventDispatcher } from '@/utils/event'; import { useTranslation } from '@/hooks/useTranslation'; import { BookNote } from '@/types/book'; +import { Insets } from '@/types/misc'; import RSVPOverlay from './RSVPOverlay'; import RSVPStartDialog from './RSVPStartDialog'; interface RSVPControlProps { bookKey: string; + gridInsets: Insets; } // Helper to expand a range to include the full sentence @@ -99,7 +101,7 @@ const expandRangeToSentence = (range: Range, doc: Document): Range => { return range; }; -const RSVPControl: React.FC = ({ bookKey }) => { +const RSVPControl: React.FC = ({ bookKey, gridInsets }) => { const _ = useTranslation(); const { getView, @@ -461,6 +463,7 @@ const RSVPControl: React.FC = ({ bookKey }) => { portalContainer && createPortal( = ({ + gridInsets, controller, chapters, currentChapterHref, @@ -293,9 +297,10 @@ const RSVPOverlay: React.FC = ({ aria-label={_('Speed Reading')} className='fixed inset-0 z-[10000] flex select-none flex-col' style={{ + paddingTop: `${gridInsets.top}px`, + paddingBottom: `${gridInsets.bottom * 0.33}px`, backgroundColor: bgColor, color: fgColor, - // Ensure solid background - no transparency backdropFilter: 'none', // @ts-expect-error CSS custom properties '--rsvp-accent': accentColor, @@ -305,64 +310,66 @@ const RSVPOverlay: React.FC = ({ onTouchStart={handleTouchStart} onTouchEnd={handleTouchEnd} > - {/* Header */} -
+ {/* ── Header ── */} +
{/* Chapter selector */} -
+
{showChapterDropdown && ( -
- {flatChapters.map((chapter, idx) => ( - - ))} -
+ <> + setShowChapterDropdown(false)} /> +
+ {flatChapters.map((chapter, idx) => ( + + ))} +
+ )}
-
- {_('{{number}} WPM', { number: state.wpm })} + {/* WPM badge */} +
+ {state.wpm} + WPM