From a6daa5d728d5017b93f892a76f059166f3f2e7c0 Mon Sep 17 00:00:00 2001 From: ZyphrZero <133507172+ZyphrZero@users.noreply.github.com> Date: Fri, 5 Dec 2025 14:45:36 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(ui):=20add=20settings=20menu?= =?UTF-8?q?=20and=20mask=20opacity=20control?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add SettingsMenu component for quick navigation between settings sections - Add mask opacity control to adjust overlay transparency - Optimize search suggestions with immediate response and smooth animations - Refine component styles for more compact interface - Fix Translation interface type definition for maskOpacity - Unify Bilibili API path to simplify environment handling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/App.tsx | 218 ++++++++++++++----------- src/components/GlobalContextMenu.tsx | 24 +-- src/components/SearchBox.tsx | 91 ++++++++--- src/components/SearchEngineManager.tsx | 64 ++++---- src/components/SettingsMenu.tsx | 66 ++++++++ src/components/SettingsModal.tsx | 48 +++--- src/components/ThemeSettings.tsx | 67 +++++--- src/components/WallpaperManager.tsx | 18 +- src/i18n/locales/en.ts | 1 + src/i18n/locales/zh.ts | 1 + src/i18n/types.ts | 1 + src/types.ts | 3 + src/utils/suggestions.ts | 6 +- vite.config.ts | 4 +- 14 files changed, 387 insertions(+), 225 deletions(-) create mode 100644 src/components/SettingsMenu.tsx diff --git a/src/App.tsx b/src/App.tsx index 702233a..c8dbf2b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,10 +3,11 @@ import React, { useState, useEffect, useMemo, useRef } from 'react'; import Clock from './components/Clock'; import SearchBox from './components/SearchBox'; import SettingsModal from './components/SettingsModal'; +import SettingsMenu from './components/SettingsMenu'; import ErrorBoundary from './components/ErrorBoundary'; import GlobalContextMenu from './components/GlobalContextMenu'; import { SettingsIcon } from './components/Icons'; -import { UserSettings, WallpaperFit } from './types'; +import { UserSettings, WallpaperFit, SettingsSection } from './types'; import { PRESET_WALLPAPERS, SEARCH_ENGINES, THEMES } from './constants'; import { loadSettings, saveSettings } from './utils/storage'; import { I18nProvider } from './i18n'; @@ -21,6 +22,7 @@ const DEFAULT_SETTINGS: UserSettings = { themeColor: THEMES[0].hex, searchOpacity: 0.8, enableMaskBlur: false, + maskOpacity: 0.2, backgroundUrl: PRESET_WALLPAPERS[0].url, backgroundType: PRESET_WALLPAPERS[0].type, wallpaperFit: 'cover', @@ -35,6 +37,8 @@ type ViewMode = 'search' | 'dashboard'; const App: React.FC = () => { // State for settings visibility const [isSettingsOpen, setIsSettingsOpen] = useState(false); + const [isSettingsMenuOpen, setIsSettingsMenuOpen] = useState(false); + const [activeSettingsSection, setActiveSettingsSection] = useState('general'); // State for view mode (Search Panel vs Dashboard Panel) const [viewMode, setViewMode] = useState('search'); @@ -100,7 +104,7 @@ const App: React.FC = () => { const handleSelectEngine = (name: string) => { setSettings(prev => ({ ...prev, selectedEngine: name })); }; - + const handleUpdateHistory = (newHistory: string[]) => { setSettings(prev => ({ ...prev, searchHistory: newHistory })); }; @@ -157,6 +161,12 @@ const App: React.FC = () => { setSettings(prev => ({ ...prev, language: lang })); }; + const handleSettingsMenuSelect = (section: SettingsSection) => { + setActiveSettingsSection(section); + setIsSettingsMenuOpen(false); + setIsSettingsOpen(true); + }; + return ( @@ -168,123 +178,135 @@ const App: React.FC = () => { {/* Context Menu Global Listener */} - {/* Background Layer */} -
- {settings.backgroundType === 'video' ? ( -