From 462ca46fee04796cc8e5251fe5d4731ebc1adaaf Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Thu, 8 Jan 2026 17:29:33 +0100 Subject: [PATCH] feat(eink): optimize color and layout for e-ink mode (#2887) --- .../src/platform/macos.rs | 1 + .../readest-app/src-tauri/src/android/eink.rs | 122 ++++++++++++++++++ apps/readest-app/src-tauri/src/android/mod.rs | 3 + apps/readest-app/src-tauri/src/lib.rs | 73 +++++++---- .../src/app/library/components/BookItem.tsx | 2 +- .../src/app/library/components/Bookshelf.tsx | 4 +- .../app/library/components/BookshelfItem.tsx | 2 +- .../src/app/library/components/GroupItem.tsx | 2 +- .../app/library/components/LibraryHeader.tsx | 11 +- .../src/app/library/components/OPDSDialog.tsx | 5 +- .../library/components/SelectModeActions.tsx | 4 +- .../app/library/components/SettingsMenu.tsx | 2 +- .../src/app/library/components/ViewMenu.tsx | 2 +- .../app/opds/components/CatelogManager.tsx | 3 - .../app/opds/components/PublicationView.tsx | 16 +-- .../src/app/reader/components/HeaderBar.tsx | 2 +- .../src/app/reader/components/ViewMenu.tsx | 2 +- .../components/annotator/AnnotationNotes.tsx | 9 +- .../annotator/AnnotationRangeEditor.tsx | 8 +- .../annotator/AnnotationToolButton.tsx | 4 +- .../reader/components/annotator/Annotator.tsx | 13 +- .../components/annotator/HighlightOptions.tsx | 60 +++++---- .../components/annotator/QuickActionMenu.tsx | 2 +- .../reader/components/notebook/NoteEditor.tsx | 2 +- .../reader/components/notebook/Notebook.tsx | 2 +- .../reader/components/sidebar/BookMenu.tsx | 2 +- .../components/sidebar/BooknoteItem.tsx | 4 +- .../app/reader/components/sidebar/Header.tsx | 2 +- .../reader/components/sidebar/SearchBar.tsx | 38 ++++-- .../components/sidebar/SearchOptions.tsx | 5 +- .../src/components/AboutWindow.tsx | 2 +- apps/readest-app/src/components/Dialog.tsx | 2 +- apps/readest-app/src/components/Menu.tsx | 5 +- apps/readest-app/src/components/Popup.tsx | 100 +++++++------- apps/readest-app/src/components/Spinner.tsx | 6 +- apps/readest-app/src/components/Toast.tsx | 8 +- .../src/components/UpdaterWindow.tsx | 2 +- .../src/components/settings/ControlPanel.tsx | 2 +- apps/readest-app/src/hooks/useEinkMode.ts | 22 ++-- apps/readest-app/src/hooks/useTheme.ts | 9 +- apps/readest-app/src/services/appService.ts | 3 + apps/readest-app/src/services/constants.ts | 6 + .../src/services/nativeAppService.ts | 2 + apps/readest-app/src/store/themeStore.ts | 15 ++- apps/readest-app/src/styles/globals.css | 109 ++++++++++++++++ apps/readest-app/src/types/system.ts | 1 + apps/readest-app/tailwind.config.ts | 10 +- 47 files changed, 532 insertions(+), 179 deletions(-) create mode 100644 apps/readest-app/src-tauri/src/android/eink.rs create mode 100644 apps/readest-app/src-tauri/src/android/mod.rs diff --git a/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/src/platform/macos.rs b/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/src/platform/macos.rs index e69de29b..8b137891 100644 --- a/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/src/platform/macos.rs +++ b/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/src/platform/macos.rs @@ -0,0 +1 @@ + diff --git a/apps/readest-app/src-tauri/src/android/eink.rs b/apps/readest-app/src-tauri/src/android/eink.rs new file mode 100644 index 00000000..4b886e5f --- /dev/null +++ b/apps/readest-app/src-tauri/src/android/eink.rs @@ -0,0 +1,122 @@ +use std::process::Command; + +/// Known e-ink device manufacturers and brands (case-insensitive matching) +const EINK_MANUFACTURERS: &[&str] = &[ + "onyx", // BOOX devices + "boox", // BOOX devices (alternate) + "amazon", // Kindle devices + "kobo", // Kobo e-readers + "remarkable", // reMarkable tablets + "pocketbook", // PocketBook e-readers + "boyue", // Boyue/Likebook devices + "likebook", // Likebook devices + "dasung", // Dasung e-ink monitors + "bigme", // Bigme e-readers + "hisense", // Hisense e-ink phones (A5, A7, etc.) + "hanvon", // Hanvon e-readers + "tolino", // Tolino e-readers + "bookeen", // Bookeen e-readers + "supernote", // Supernote devices + "mobiscribe", // Mobiscribe e-readers + "xiaomi", // Xiaomi InkPalm (needs model check) + "meebook", // Meebook e-readers +]; + +/// Known e-ink device models (for manufacturers that also make non-e-ink devices) +const EINK_MODELS: &[&str] = &[ + "kindle", + "a5pro", + "a7cc", // Hisense e-ink models + "a7e", + "a9", + "inkpalm", // Xiaomi InkPalm + "eink", + "e-ink", + "paper", + "note air", + "note2", + "note3", + "note5", + "nova", + "poke", + "leaf", + "page", + "tab ultra", + "max lumi", +]; + +/// Get Android system property using getprop command +fn get_system_property(prop: &str) -> Option { + Command::new("getprop") + .arg(prop) + .output() + .ok() + .and_then(|output| { + if output.status.success() { + let value = String::from_utf8_lossy(&output.stdout).trim().to_string(); + if value.is_empty() { + None + } else { + Some(value) + } + } else { + None + } + }) +} + +/// Check if the current Android device is an e-ink device +pub fn is_eink_device() -> bool { + // Get device manufacturer and model + let manufacturer = get_system_property("ro.product.manufacturer") + .or_else(|| get_system_property("ro.product.brand")) + .unwrap_or_default() + .to_lowercase(); + + let model = get_system_property("ro.product.model") + .or_else(|| get_system_property("ro.product.device")) + .unwrap_or_default() + .to_lowercase(); + + let device = get_system_property("ro.product.device") + .unwrap_or_default() + .to_lowercase(); + + // Check if manufacturer matches known e-ink manufacturers + for eink_manufacturer in EINK_MANUFACTURERS { + if manufacturer.contains(eink_manufacturer) { + // Special case for manufacturers that make both e-ink and non-e-ink devices + if *eink_manufacturer == "hisense" || *eink_manufacturer == "xiaomi" { + // Need to also check the model for these manufacturers + for eink_model in EINK_MODELS { + if model.contains(eink_model) || device.contains(eink_model) { + return true; + } + } + } else { + return true; + } + } + } + + // Check if model matches known e-ink models + for eink_model in EINK_MODELS { + if model.contains(eink_model) || device.contains(eink_model) { + return true; + } + } + + // Check for e-ink specific system properties + if let Some(eink_support) = get_system_property("ro.eink.support") { + if eink_support == "1" || eink_support.to_lowercase() == "true" { + return true; + } + } + + // Check for BOOX specific property + if get_system_property("ro.onyx.devicename").is_some() { + return true; + } + + false +} diff --git a/apps/readest-app/src-tauri/src/android/mod.rs b/apps/readest-app/src-tauri/src/android/mod.rs new file mode 100644 index 00000000..50aecd38 --- /dev/null +++ b/apps/readest-app/src-tauri/src/android/mod.rs @@ -0,0 +1,3 @@ +pub mod eink; + +pub use eink::is_eink_device; diff --git a/apps/readest-app/src-tauri/src/lib.rs b/apps/readest-app/src-tauri/src/lib.rs index a38e883d..ce62d5dd 100644 --- a/apps/readest-app/src-tauri/src/lib.rs +++ b/apps/readest-app/src-tauri/src/lib.rs @@ -9,6 +9,9 @@ extern crate objc; #[cfg(target_os = "windows")] mod windows; +#[cfg(target_os = "android")] +mod android; + use tauri::utils::config::BackgroundThrottlingPolicy; #[cfg(target_os = "macos")] use tauri::TitleBarStyle; @@ -270,34 +273,54 @@ pub fn run() { eprintln!("Failed to initialize tauri_plugin_log: {e}"); }; + // Check for e-ink device on Android before building the window + #[cfg(target_os = "android")] + let is_eink = android::is_eink_device(); + #[cfg(not(target_os = "android"))] + let is_eink = false; + + let eink_script = if is_eink { + "window.__READEST_IS_EINK = true;" + } else { + "" + }; + + let init_script = format!( + r#" + {eink_script} + window.addEventListener('DOMContentLoaded', function() {{ + document.documentElement.classList.add('edge-to-edge'); + const isTauriLocal = window.location.protocol === 'tauri:' || + window.location.protocol === 'about:' || + window.location.hostname === 'tauri.localhost'; + const needsSafeArea = !isTauriLocal; + if (needsSafeArea && !document.getElementById('safe-area-style')) {{ + const style = document.createElement('style'); + style.id = 'safe-area-style'; + style.textContent = ` + body {{ + padding-top: env(safe-area-inset-top) !important; + padding-bottom: env(safe-area-inset-bottom) !important; + padding-left: env(safe-area-inset-left) !important; + padding-right: env(safe-area-inset-right) !important; + }} + `; + document.head.appendChild(style); + }} + }}); + "#, + eink_script = eink_script + ); + let app_handle = app.handle().clone(); let win_builder = WebviewWindowBuilder::new(app, "main", WebviewUrl::default()) .background_throttling(BackgroundThrottlingPolicy::Disabled) - .background_color(tauri::window::Color(50, 49, 48, 255)) - .initialization_script( - r#" - window.addEventListener('DOMContentLoaded', function() { - document.documentElement.classList.add('edge-to-edge'); - const isTauriLocal = window.location.protocol === 'tauri:' || - window.location.protocol === 'about:' || - window.location.hostname === 'tauri.localhost'; - const needsSafeArea = !isTauriLocal; - if (needsSafeArea && !document.getElementById('safe-area-style')) { - const style = document.createElement('style'); - style.id = 'safe-area-style'; - style.textContent = ` - body { - padding-top: env(safe-area-inset-top) !important; - padding-bottom: env(safe-area-inset-bottom) !important; - padding-left: env(safe-area-inset-left) !important; - padding-right: env(safe-area-inset-right) !important; - } - `; - document.head.appendChild(style); - } - }); - "#, - ) + .background_color(if is_eink { + tauri::window::Color(255, 255, 255, 255) + } else { + tauri::window::Color(50, 49, 48, 255) + }) + .initialization_script(&init_script) .on_navigation(move |url| { if url.scheme() == "alipays" || url.scheme() == "alipay" { let url_str = url.as_str().to_string(); diff --git a/apps/readest-app/src/app/library/components/BookItem.tsx b/apps/readest-app/src/app/library/components/BookItem.tsx index 57bfd3a8..30c0faca 100644 --- a/apps/readest-app/src/app/library/components/BookItem.tsx +++ b/apps/readest-app/src/app/library/components/BookItem.tsx @@ -61,7 +61,7 @@ const BookItem: React.FC = ({ >
= ({ - ); } diff --git a/apps/readest-app/src/app/library/components/SelectModeActions.tsx b/apps/readest-app/src/app/library/components/SelectModeActions.tsx index 7644224b..271c4107 100644 --- a/apps/readest-app/src/app/library/components/SelectModeActions.tsx +++ b/apps/readest-app/src/app/library/components/SelectModeActions.tsx @@ -41,8 +41,8 @@ const SelectModeActions: React.FC = ({ >
diff --git a/apps/readest-app/src/app/library/components/SettingsMenu.tsx b/apps/readest-app/src/app/library/components/SettingsMenu.tsx index 5d3d7f16..4ad25299 100644 --- a/apps/readest-app/src/app/library/components/SettingsMenu.tsx +++ b/apps/readest-app/src/app/library/components/SettingsMenu.tsx @@ -232,7 +232,7 @@ const SettingsMenu: React.FC = ({ setIsDropdownOpen }) => { return ( setIsDropdownOpen?.(false)} diff --git a/apps/readest-app/src/app/library/components/ViewMenu.tsx b/apps/readest-app/src/app/library/components/ViewMenu.tsx index 765cad53..6acd0612 100644 --- a/apps/readest-app/src/app/library/components/ViewMenu.tsx +++ b/apps/readest-app/src/app/library/components/ViewMenu.tsx @@ -99,7 +99,7 @@ const ViewMenu: React.FC = ({ setIsDropdownOpen }) => { return ( setIsDropdownOpen?.(false)} > {viewOptions.map((option) => ( diff --git a/apps/readest-app/src/app/opds/components/CatelogManager.tsx b/apps/readest-app/src/app/opds/components/CatelogManager.tsx index 8c9acb2e..a4282579 100644 --- a/apps/readest-app/src/app/opds/components/CatelogManager.tsx +++ b/apps/readest-app/src/app/opds/components/CatelogManager.tsx @@ -406,9 +406,6 @@ export function CatalogManager() {
-
- -
)} diff --git a/apps/readest-app/src/app/opds/components/PublicationView.tsx b/apps/readest-app/src/app/opds/components/PublicationView.tsx index 0cce350d..435a77f2 100644 --- a/apps/readest-app/src/app/opds/components/PublicationView.tsx +++ b/apps/readest-app/src/app/opds/components/PublicationView.tsx @@ -163,19 +163,13 @@ export function PublicationView({ - {downloadedBook ? _('Open') : getAcquisitionLabel(rel)} - +
{downloadedBook ? _('Open') : getAcquisitionLabel(rel)}
} >
= ({ size={iconSize16} tipColor={annotationQuickAction === null ? '#8F8F8F' : highlightHexColor} tipStyle={{ - opacity: annotationQuickAction === null ? 0.3 : 0.5, + opacity: annotationQuickAction === null ? 0.5 : 0.8, mixBlendMode: isDarkMode ? 'screen' : 'multiply', }} /> diff --git a/apps/readest-app/src/app/reader/components/ViewMenu.tsx b/apps/readest-app/src/app/reader/components/ViewMenu.tsx index ed9d7e3f..448036ef 100644 --- a/apps/readest-app/src/app/reader/components/ViewMenu.tsx +++ b/apps/readest-app/src/app/reader/components/ViewMenu.tsx @@ -147,7 +147,7 @@ const ViewMenu: React.FC = ({ bookKey, setIsDropdownOpen }) => { = ({ role='none' key={note.id || index} onClick={() => handleShowAnnotation?.(note)} - className={clsx('cursor-pointer rounded-lg bg-gray-600 shadow-lg transition-colors')} + className={clsx( + 'popup-container cursor-pointer rounded-lg bg-gray-600 shadow-lg transition-colors', + )} style={ isVertical ? { @@ -113,7 +115,8 @@ const AnnotationNotes: React.FC = ({
= ({ >
{note.note} - + {dayjs(note.createdAt).fromNow()}
diff --git a/apps/readest-app/src/app/reader/components/annotator/AnnotationRangeEditor.tsx b/apps/readest-app/src/app/reader/components/annotator/AnnotationRangeEditor.tsx index d22f9c63..f487444a 100644 --- a/apps/readest-app/src/app/reader/components/annotator/AnnotationRangeEditor.tsx +++ b/apps/readest-app/src/app/reader/components/annotator/AnnotationRangeEditor.tsx @@ -3,6 +3,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'; import { BookNote, HighlightColor } from '@/types/book'; import { Point, TextSelection } from '@/utils/sel'; +import { useThemeStore } from '@/store/themeStore'; import { useSettingsStore } from '@/store/settingsStore'; import { useResponsiveSize } from '@/hooks/useResponsiveSize'; import { useAnnotationEditor } from '../../hooks/useAnnotationEditor'; @@ -143,6 +144,9 @@ const AnnotationRangeEditor: React.FC = ({ onStartEdit, }) => { const { settings } = useSettingsStore(); + const { isDarkMode } = useThemeStore(); + const isEink = settings.globalViewSettings.isEink; + const einkFgColor = isDarkMode ? '#ffffff' : '#000000'; const { handlePositions, getHandlePositionsFromRange, handleAnnotationRangeChange } = useAnnotationEditor({ bookKey, annotation, getAnnotationText, setSelection }); @@ -223,7 +227,7 @@ const AnnotationRangeEditor: React.FC = ({ position={currentStart} isVertical={isVertical} type='start' - color={handleColorHex} + color={isEink ? einkFgColor : handleColorHex} onDragStart={handleStartDragStart} onDrag={handleStartDrag} onDragEnd={handleDragEnd} @@ -232,7 +236,7 @@ const AnnotationRangeEditor: React.FC = ({ position={currentEnd} isVertical={isVertical} type='end' - color={handleColorHex} + color={isEink ? einkFgColor : handleColorHex} onDragStart={handleEndDragStart} onDrag={handleEndDrag} onDragEnd={handleDragEnd} diff --git a/apps/readest-app/src/app/reader/components/annotator/AnnotationToolButton.tsx b/apps/readest-app/src/app/reader/components/annotator/AnnotationToolButton.tsx index cc73c8a7..487e8df4 100644 --- a/apps/readest-app/src/app/reader/components/annotator/AnnotationToolButton.tsx +++ b/apps/readest-app/src/app/reader/components/annotator/AnnotationToolButton.tsx @@ -30,7 +30,9 @@ const AnnotationToolButton: React.FC = ({ onClick={handleClick} className={clsx( 'flex h-8 min-h-8 w-8 items-center justify-center p-0', - disabled ? 'cursor-not-allowed opacity-50' : 'rounded-md hover:bg-gray-500', + disabled + ? 'cursor-not-allowed opacity-50' + : 'not-eink:hover:bg-gray-500 eink:hover:border rounded-md', )} disabled={disabled} > diff --git a/apps/readest-app/src/app/reader/components/annotator/Annotator.tsx b/apps/readest-app/src/app/reader/components/annotator/Annotator.tsx index ab4a8a2c..f771a022 100644 --- a/apps/readest-app/src/app/reader/components/annotator/Annotator.tsx +++ b/apps/readest-app/src/app/reader/components/annotator/Annotator.tsx @@ -8,6 +8,7 @@ import { BookNote, BooknoteGroup, HighlightColor, HighlightStyle } from '@/types import { NOTE_PREFIX } from '@/types/view'; import { NativeTouchEventType } from '@/types/system'; import { getLocale, getOSPlatform, uniqueId } from '@/utils/misc'; +import { useThemeStore } from '@/store/themeStore'; import { useBookDataStore } from '@/store/bookDataStore'; import { useSettingsStore } from '@/store/settingsStore'; import { useReaderStore } from '@/store/readerStore'; @@ -42,6 +43,7 @@ const Annotator: React.FC<{ bookKey: string }> = ({ bookKey }) => { const _ = useTranslation(); const { envConfig, appService } = useEnv(); const { settings } = useSettingsStore(); + const { isDarkMode } = useThemeStore(); const { getConfig, saveConfig, getBookData, updateBooknotes } = useBookDataStore(); const { getProgress, getView, getViewsById, getViewSettings } = useReaderStore(); const { setNotebookVisible, setNotebookNewAnnotation } = useNotebookStore(); @@ -293,10 +295,13 @@ const Annotator: React.FC<{ bookKey: string }> = ({ bookKey }) => { const onDrawAnnotation = (event: Event) => { const viewSettings = getViewSettings(bookKey)!; + const isEink = viewSettings.isEink; const detail = (event as CustomEvent).detail; const { draw, annotation, doc, range } = detail; const { style, color } = annotation as BookNote; const hexColor = getHighlightColorHex(settings, color); + const einkBgColor = isDarkMode ? '#000000' : '#ffffff'; + const einkFgColor = isDarkMode ? '#ffffff' : '#000000'; if (annotation.note) { const { defaultView } = doc; const node = range.startContainer; @@ -304,7 +309,7 @@ const Annotator: React.FC<{ bookKey: string }> = ({ bookKey }) => { const { writingMode } = defaultView.getComputedStyle(el); draw(Overlayer.bubble, { writingMode }); } else if (style === 'highlight') { - draw(Overlayer.highlight, { color: hexColor }); + draw(Overlayer.highlight, { color: isEink ? einkBgColor : hexColor }); } else if (['underline', 'squiggly'].includes(style as string)) { const { defaultView } = doc; const node = range.startContainer; @@ -318,7 +323,11 @@ const Annotator: React.FC<{ bookKey: string }> = ({ bookKey }) => { const padding = viewSettings.vertical ? (lineHeightValue - fontSizeValue) / 2 - strokeWidth + verticalCompensation : (lineHeightValue - fontSizeValue) / 2 - strokeWidth + horizontalCompensation; - draw(Overlayer[style as keyof typeof Overlayer], { writingMode, color: hexColor, padding }); + draw(Overlayer[style as keyof typeof Overlayer], { + writingMode, + color: isEink ? einkFgColor : hexColor, + padding, + }); } }; diff --git a/apps/readest-app/src/app/reader/components/annotator/HighlightOptions.tsx b/apps/readest-app/src/app/reader/components/annotator/HighlightOptions.tsx index 3e9d5d8b..fd176b7f 100644 --- a/apps/readest-app/src/app/reader/components/annotator/HighlightOptions.tsx +++ b/apps/readest-app/src/app/reader/components/annotator/HighlightOptions.tsx @@ -3,6 +3,7 @@ import React, { useState } from 'react'; import { FaCheckCircle } from 'react-icons/fa'; import { HighlightColor, HighlightStyle } from '@/types/book'; import { useEnv } from '@/context/EnvContext'; +import { useThemeStore } from '@/store/themeStore'; import { useSettingsStore } from '@/store/settingsStore'; import { useResponsiveSize } from '@/hooks/useResponsiveSize'; import { saveSysSettings } from '@/helpers/settings'; @@ -34,12 +35,15 @@ const HighlightOptions: React.FC = ({ }) => { const { envConfig } = useEnv(); const { settings } = useSettingsStore(); + const { isDarkMode } = useThemeStore(); const globalReadSettings = settings.globalReadSettings; + const isEink = settings.globalViewSettings.isEink; + const einkBgColor = isDarkMode ? '#000000' : '#ffffff'; + const einkFgColor = isDarkMode ? '#ffffff' : '#000000'; const customColors = globalReadSettings.customHighlightColors; const [selectedStyle, setSelectedStyle] = useState(_selectedStyle); const [selectedColor, setSelectedColor] = useState(_selectedColor); const size16 = useResponsiveSize(16); - const size18 = useResponsiveSize(18); const size28 = useResponsiveSize(28); const highlightOptionsHeightPx = useResponsiveSize(OPTIONS_HEIGHT_PIX); const highlightOptionsPaddingPx = useResponsiveSize(OPTIONS_PADDING_PIX); @@ -93,16 +97,17 @@ const HighlightOptions: React.FC = ({ - ))} + {colors + .filter((c) => (isEink ? selectedColor === c : true)) + .map((color) => ( + + ))}
); diff --git a/apps/readest-app/src/app/reader/components/annotator/QuickActionMenu.tsx b/apps/readest-app/src/app/reader/components/annotator/QuickActionMenu.tsx index c1450b50..36a26d4b 100644 --- a/apps/readest-app/src/app/reader/components/annotator/QuickActionMenu.tsx +++ b/apps/readest-app/src/app/reader/components/annotator/QuickActionMenu.tsx @@ -43,7 +43,7 @@ const QuickActionMenu: React.FC = ({ = ({ onSave, onEdit }) => { const canSave = Boolean(note.trim()); return ( -
+
{ handleEditNote(item, true); } }} - className='collapse-arrow border-base-300 bg-base-100 collapse border' + className='booknote-item collapse-arrow border-base-300 bg-base-100 collapse border' >
= ({ menuClassName, setIsDropdownOpen }) return ( setIsDropdownOpen?.(false)} > = ({ bookKey, item, onClick }) = role='button' ref={viewRef} className={clsx( - 'border-base-300 content group relative my-2 cursor-pointer rounded-lg p-2', + 'booknote-item border-base-300 content group relative my-2 cursor-pointer rounded-lg p-2', isCurrent ? 'bg-base-300/85 hover:bg-base-300 focus:bg-base-300' : 'hover:bg-base-300/55 focus:bg-base-300/55 bg-base-100', @@ -177,7 +177,7 @@ const BooknoteItem: React.FC = ({ bookKey, item, onClick }) =
} > diff --git a/apps/readest-app/src/app/reader/components/sidebar/SearchBar.tsx b/apps/readest-app/src/app/reader/components/sidebar/SearchBar.tsx index 2bd13cd5..d8bc88d6 100644 --- a/apps/readest-app/src/app/reader/components/sidebar/SearchBar.tsx +++ b/apps/readest-app/src/app/reader/components/sidebar/SearchBar.tsx @@ -37,9 +37,10 @@ const SearchBar: React.FC = ({ isVisible, bookKey, onHideSearchB const { settings } = useSettingsStore(); const { getBookData } = useBookDataStore(); const { getConfig, setConfig, saveConfig } = useBookDataStore(); - const { getView, getProgress } = useReaderStore(); + const { getView, getProgress, getViewSettings } = useReaderStore(); const { setSearchTerm, setSearchResults, setSearchProgress } = useSidebarStore(); const { getSearchNavState, getSearchStatus, setSearchStatus } = useSidebarStore(); + const viewSettings = getViewSettings(bookKey); const searchNavState = getSearchNavState(bookKey); const { searchTerm } = searchNavState; @@ -327,7 +328,7 @@ const SearchBar: React.FC = ({ isVisible, bookKey, onHideSearchB return (
-
+
@@ -338,31 +339,40 @@ const SearchBar: React.FC = ({ isVisible, bookKey, onHideSearchB spellCheck={false} onChange={handleInputChange} placeholder={_('Search...')} - className='w-full bg-transparent p-2 pr-0 font-sans text-sm font-light focus:outline-none' + className='search-input w-full bg-transparent p-2 pr-0 ps-10 font-sans text-sm font-light focus:outline-none' /> {searchTerm && ( )} -
+
} > @@ -373,7 +383,10 @@ const SearchBar: React.FC = ({ isVisible, bookKey, onHideSearchB {searchHistory.length > 0 && !searchTerm && (