From 58c907c7cc0191fec9a2a8732f7fbbb3c33223f4 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Fri, 17 Jan 2025 15:42:16 +0100 Subject: [PATCH] Various enhancements for mobile platforms (#188) * Larger area to toggle header/footer bar * Don't show rounded window on web platform * Disable tooltips on mobile platforms as there is no mouse pointer * Dedupe voices from web speech API --- apps/readest-app/src/app/library/page.tsx | 8 +++++++- .../src/app/reader/components/BooksGrid.tsx | 3 ++- .../src/app/reader/components/FooterBar.tsx | 6 ++++-- .../src/app/reader/components/HeaderBar.tsx | 6 ++++-- .../src/app/reader/components/Reader.tsx | 9 ++++++++- .../components/annotator/PopupButton.tsx | 2 +- .../reader/components/notebook/Notebook.tsx | 3 ++- .../reader/components/settings/ColorPanel.tsx | 6 +++--- .../reader/components/settings/DialogMenu.tsx | 2 +- .../components/settings/LayoutPanel.tsx | 6 +++--- .../app/reader/components/sidebar/SideBar.tsx | 5 +++-- .../components/sidebar/TabNavigation.tsx | 2 +- .../src/app/reader/hooks/useClickEvent.ts | 9 +-------- apps/readest-app/src/components/Button.tsx | 10 +++++++--- .../src/services/tts/WebSpeechClient.ts | 20 ++++++++++++++++--- 15 files changed, 64 insertions(+), 33 deletions(-) diff --git a/apps/readest-app/src/app/library/page.tsx b/apps/readest-app/src/app/library/page.tsx index 54189bf0..f4af003e 100644 --- a/apps/readest-app/src/app/library/page.tsx +++ b/apps/readest-app/src/app/library/page.tsx @@ -1,5 +1,6 @@ 'use client'; +import clsx from 'clsx'; import * as React from 'react'; import { useState, useRef, useEffect, Suspense } from 'react'; import { useRouter } from 'next/navigation'; @@ -233,7 +234,12 @@ const LibraryPage = () => { } return ( -
+
= ({ bookKeys, onCloseBook }) => {
{isBookmarked && } = ({ bookKey, pageinfo, isHoveredAnim
= ({ className={clsx( `header-bar absolute top-0 z-10 flex h-11 w-full items-center pr-4`, isTrafficLightVisible && isTopLeft && !isSideBarVisible ? 'pl-16' : 'pl-4', - `shadow-xs bg-base-100 rounded-window-top-right transition-opacity duration-300`, - !isSideBarVisible && 'rounded-window-top-left', + `shadow-xs bg-base-100 transition-opacity duration-300`, + isTauriAppPlatform() && 'rounded-window-top-right', + !isSideBarVisible && isTauriAppPlatform() && 'rounded-window-top-left', isHoveredAnim && 'hover-bar-anim', hoveredBookKey === bookKey || isDropdownOpen ? `visible` : `opacity-0`, isDropdownOpen && 'header-bar-pinned', diff --git a/apps/readest-app/src/app/reader/components/Reader.tsx b/apps/readest-app/src/app/reader/components/Reader.tsx index 2ee3d416..a9935666 100644 --- a/apps/readest-app/src/app/reader/components/Reader.tsx +++ b/apps/readest-app/src/app/reader/components/Reader.tsx @@ -1,11 +1,13 @@ 'use client'; +import clsx from 'clsx'; import * as React from 'react'; import { useEffect, Suspense, useRef } from 'react'; import { useEnv } from '@/context/EnvContext'; import { useLibraryStore } from '@/store/libraryStore'; import { useSettingsStore } from '@/store/settingsStore'; +import { isTauriAppPlatform } from '@/services/environment'; import { AboutWindow } from '@/components/AboutWindow'; import { Toast } from '@/components/Toast'; import ReaderContent from './ReaderContent'; @@ -33,7 +35,12 @@ const Reader: React.FC<{ ids?: string }> = ({ ids }) => { return ( library.length > 0 && settings.globalReadSettings && ( -
+
diff --git a/apps/readest-app/src/app/reader/components/annotator/PopupButton.tsx b/apps/readest-app/src/app/reader/components/annotator/PopupButton.tsx index 3ffd8068..07980ecd 100644 --- a/apps/readest-app/src/app/reader/components/annotator/PopupButton.tsx +++ b/apps/readest-app/src/app/reader/components/annotator/PopupButton.tsx @@ -15,7 +15,7 @@ const PopupButton: React.FC = ({ showTooltip, tooltipText, Ico }; return (
-
+
-
+
-
+
-
+