From b1f29412479cf11a777fd9c8f37830c778e563c2 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Sun, 9 Mar 2025 18:33:52 +0800 Subject: [PATCH] fix: various fixes for updater, footerbar and note item (#545) * fix: don't open book if failed to download book * fix: various fixes for updater, footerbar and note item 1. now footerbar when invisible won't process pointer events 2. manually check updater won't be prevented by check interval 3. get rid of clamped text in note item --- .../src/app/reader/components/FooterBar.tsx | 107 ++++++++++-------- .../components/sidebar/BooknoteItem.tsx | 2 +- .../src/components/AboutWindow.tsx | 2 +- apps/readest-app/src/helpers/updater.ts | 5 +- 4 files changed, 63 insertions(+), 53 deletions(-) diff --git a/apps/readest-app/src/app/reader/components/FooterBar.tsx b/apps/readest-app/src/app/reader/components/FooterBar.tsx index d14ac968..d2f93a5d 100644 --- a/apps/readest-app/src/app/reader/components/FooterBar.tsx +++ b/apps/readest-app/src/app/reader/components/FooterBar.tsx @@ -67,64 +67,73 @@ const FooterBar: React.FC = ({ } }; + const isVisible = hoveredBookKey === bookKey; const progressInfo = bookFormat === 'PDF' ? section : pageinfo; const progressValid = !!progressInfo; const progressFraction = progressValid ? (progressInfo!.current + 1) / progressInfo!.total : 0; + return ( -
setHoveredBookKey(bookKey)} - onMouseLeave={() => setHoveredBookKey('')} - > -
+ <> +
setHoveredBookKey(bookKey)} + onTouchStart={() => setHoveredBookKey(bookKey)} + /> +
setHoveredBookKey('')} + aria-hidden={!isVisible} + > +
+
-
-
+ ); }; diff --git a/apps/readest-app/src/app/reader/components/sidebar/BooknoteItem.tsx b/apps/readest-app/src/app/reader/components/sidebar/BooknoteItem.tsx index 0030788d..2df1fa96 100644 --- a/apps/readest-app/src/app/reader/components/sidebar/BooknoteItem.tsx +++ b/apps/readest-app/src/app/reader/components/sidebar/BooknoteItem.tsx @@ -90,7 +90,7 @@ const BooknoteItem: React.FC = ({ bookKey, item }) => { {item.note && (
)} -
+
{ const [isUpdated, setIsUpdated] = React.useState(false); const handleCheckUpdate = async () => { - const update = await checkForAppUpdates(_); + const update = await checkForAppUpdates(_, false); if (!update) { setIsUpdated(true); } diff --git a/apps/readest-app/src/helpers/updater.ts b/apps/readest-app/src/helpers/updater.ts index 81ff3513..4b51632b 100644 --- a/apps/readest-app/src/helpers/updater.ts +++ b/apps/readest-app/src/helpers/updater.ts @@ -6,10 +6,11 @@ import { TranslationFunc } from '@/hooks/useTranslation'; const LAST_CHECK_KEY = 'lastAppUpdateCheck'; -export const checkForAppUpdates = async (_: TranslationFunc) => { +export const checkForAppUpdates = async (_: TranslationFunc, autoCheck = true) => { const lastCheck = localStorage.getItem(LAST_CHECK_KEY); const now = Date.now(); - if (lastCheck && now - parseInt(lastCheck, 10) < CHECK_UPDATE_INTERVAL_SEC * 1000) return; + if (autoCheck && lastCheck && now - parseInt(lastCheck, 10) < CHECK_UPDATE_INTERVAL_SEC * 1000) + return; localStorage.setItem(LAST_CHECK_KEY, now.toString()); console.log('Checking for updates');