From 7776788325175897df0b7eb1ae3365c02e44c18e Mon Sep 17 00:00:00 2001 From: chrox Date: Mon, 11 Nov 2024 16:50:10 +0100 Subject: [PATCH] UI tweaks and shortcuts to toggle notebook with 'n' --- .../tauri_traffic_light_positioner_plugin.rs | 2 +- apps/readest-app/src-tauri/tauri.conf.json | 2 +- .../src/app/reader/components/HeaderBar.tsx | 5 ++++- .../src/app/reader/components/SectionInfo.tsx | 2 +- .../app/reader/components/sidebar/Header.tsx | 22 ++++++++++--------- .../src/app/reader/hooks/useBookShortcuts.ts | 4 +++- apps/readest-app/src/helpers/shortcuts.ts | 4 +++- 7 files changed, 25 insertions(+), 16 deletions(-) diff --git a/apps/readest-app/src-tauri/src/tauri_traffic_light_positioner_plugin.rs b/apps/readest-app/src-tauri/src/tauri_traffic_light_positioner_plugin.rs index dfd76255..e3d12d09 100644 --- a/apps/readest-app/src-tauri/src/tauri_traffic_light_positioner_plugin.rs +++ b/apps/readest-app/src-tauri/src/tauri_traffic_light_positioner_plugin.rs @@ -7,7 +7,7 @@ use tauri::{ }; // 0.8 const WINDOW_CONTROL_PAD_X: f64 = 10.0; -const WINDOW_CONTROL_PAD_Y: f64 = 21.0; +const WINDOW_CONTROL_PAD_Y: f64 = 20.0; struct UnsafeWindowHandle(*mut std::ffi::c_void); unsafe impl Send for UnsafeWindowHandle {} diff --git a/apps/readest-app/src-tauri/tauri.conf.json b/apps/readest-app/src-tauri/tauri.conf.json index 3faf9ce9..bb4e457b 100644 --- a/apps/readest-app/src-tauri/tauri.conf.json +++ b/apps/readest-app/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "Readest", - "version": "0.5.5", + "version": "0.5.6", "identifier": "com.bilingify.digest", "build": { "frontendDist": "../out", diff --git a/apps/readest-app/src/app/reader/components/HeaderBar.tsx b/apps/readest-app/src/app/reader/components/HeaderBar.tsx index 367887f7..ef89a991 100644 --- a/apps/readest-app/src/app/reader/components/HeaderBar.tsx +++ b/apps/readest-app/src/app/reader/components/HeaderBar.tsx @@ -3,6 +3,7 @@ import React, { useRef, useState } from 'react'; import { PiDotsThreeVerticalBold } from 'react-icons/pi'; import { useReaderStore } from '@/store/readerStore'; +import useFullScreen from '@/hooks/useFullScreen'; import WindowButtons from '@/components/WindowButtons'; import Dropdown from '@/components/Dropdown'; import SidebarToggler from './SidebarToggler'; @@ -26,6 +27,7 @@ const HeaderBar: React.FC = ({ onSetSettingsDialogOpen, }) => { const headerRef = useRef(null); + const { isFullScreen } = useFullScreen(); const [isDropdownOpen, setIsDropdownOpen] = useState(false); const { hoveredBookKey, isSideBarVisible, setHoveredBookKey } = useReaderStore(); @@ -38,7 +40,8 @@ const HeaderBar: React.FC = ({
= ({ chapter, gapLeft }) => { return (

{chapter || ''}

diff --git a/apps/readest-app/src/app/reader/components/sidebar/Header.tsx b/apps/readest-app/src/app/reader/components/sidebar/Header.tsx index 1e46fb4e..655fdec1 100644 --- a/apps/readest-app/src/app/reader/components/sidebar/Header.tsx +++ b/apps/readest-app/src/app/reader/components/sidebar/Header.tsx @@ -18,7 +18,7 @@ const SidebarHeader: React.FC<{ return (
@@ -27,23 +27,25 @@ const SidebarHeader: React.FC<{
-
- } > - +
+ +
); diff --git a/apps/readest-app/src/app/reader/hooks/useBookShortcuts.ts b/apps/readest-app/src/app/reader/hooks/useBookShortcuts.ts index fc4c1b57..1c04f352 100644 --- a/apps/readest-app/src/app/reader/hooks/useBookShortcuts.ts +++ b/apps/readest-app/src/app/reader/hooks/useBookShortcuts.ts @@ -14,7 +14,8 @@ const useBookShortcuts = ({ openSplitView, getNextBookKey, }: UseBookShortcutsProps) => { - const { getView, toggleSideBar, setSideBarBookKey, getViewSettings } = useReaderStore(); + const { getView, setSideBarBookKey, getViewSettings } = useReaderStore(); + const { toggleSideBar, toggleNotebook } = useReaderStore(); const viewSettings = getViewSettings(sideBarBookKey ?? ''); const fontSize = viewSettings?.defaultFontSize ?? 16; const lineHeight = viewSettings?.lineHeight ?? 1.6; @@ -49,6 +50,7 @@ const useBookShortcuts = ({ onOpenSplitView: openSplitView, onSwitchSideBar: switchSideBar, onToggleSideBar: toggleSideBar, + onToggleNotebook: toggleNotebook, onReloadPage: reloadPage, onGoLeft: goLeft, onGoRight: goRight, diff --git a/apps/readest-app/src/helpers/shortcuts.ts b/apps/readest-app/src/helpers/shortcuts.ts index a0ee9db7..f81c7ce8 100644 --- a/apps/readest-app/src/helpers/shortcuts.ts +++ b/apps/readest-app/src/helpers/shortcuts.ts @@ -1,6 +1,7 @@ export interface ShortcutConfig { onSwitchSideBar: string[]; onToggleSideBar: string[]; + onToggleNotebook: string[]; onOpenSplitView: string[]; onReloadPage: string[]; onGoLeft: string[]; @@ -11,7 +12,8 @@ export interface ShortcutConfig { const DEFAULT_SHORTCUTS: ShortcutConfig = { onSwitchSideBar: ['ctrl+Tab', 'opt+Tab', 'alt+Tab'], - onToggleSideBar: ['t'], + onToggleSideBar: ['s'], + onToggleNotebook: ['n'], onOpenSplitView: ['shift+p'], onReloadPage: ['shift+r'], onGoLeft: ['ArrowLeft', 'PageUp', 'h'],