From 32bf9f0ffe5bb2c8231be29f0be740b6680f5e84 Mon Sep 17 00:00:00 2001 From: handsomezhuzhu <2658601135@qq.com> Date: Sat, 20 Dec 2025 22:49:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=8A=9F=E8=83=BD=E5=AE=8C?= =?UTF-8?q?=E5=96=84=EF=BC=8C=E6=90=9C=E7=B4=A2=E6=A1=86=E5=8F=91=E5=85=89?= =?UTF-8?q?=E6=9D=A1=E5=8F=AF=E4=BB=A5=E8=B0=83=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- pnpm-lock.yaml | 3 +++ src/App.tsx | 4 +++- src/components/SearchBox.tsx | 8 +++++--- src/components/ThemeSettings.tsx | 21 +++++++++++++++++++++ src/i18n/locales/en.ts | 1 + src/i18n/locales/zh.ts | 1 + src/i18n/types.ts | 1 + src/types.ts | 1 + 9 files changed, 38 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 026935f..bf67291 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ }, "dependencies": { "react": "^19.2.0", - "react-dom": "^19.2.1" + "react-dom": "^19.2.1", + "workbox-window": "^7.4.0" }, "devDependencies": { "@tailwindcss/postcss": "^4.1.17", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6ac036..6bc7f4c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: react-dom: specifier: ^19.2.1 version: 19.2.1(react@19.2.1) + workbox-window: + specifier: ^7.4.0 + version: 7.4.0 devDependencies: '@tailwindcss/postcss': specifier: ^4.1.17 diff --git a/src/App.tsx b/src/App.tsx index f1d95ff..727ec23 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -30,7 +30,8 @@ const DEFAULT_SETTINGS: UserSettings = { enableSearchHistory: true, searchHistory: [], language: 'zh', - motto: '同是天涯沦落人,相逢何必曾相识' + motto: '同是天涯沦落人,相逢何必曾相识', + searchGlow: 0.35 }; type ViewMode = 'search' | 'dashboard'; @@ -247,6 +248,7 @@ const App: React.FC = () => { onSelectEngine={handleSelectEngine} themeColor={settings.themeColor} opacity={settings.searchOpacity} + searchGlow={settings.searchGlow} onInteractionChange={setIsSearchActive} enableHistory={settings.enableSearchHistory} history={settings.searchHistory} diff --git a/src/components/SearchBox.tsx b/src/components/SearchBox.tsx index 4878cba..6bb4689 100644 --- a/src/components/SearchBox.tsx +++ b/src/components/SearchBox.tsx @@ -12,6 +12,7 @@ interface SearchBoxProps { onSelectEngine: (name: string) => void; themeColor: string; opacity: number; + searchGlow: number; onInteractionChange?: (isActive: boolean) => void; enableHistory: boolean; history: string[]; @@ -24,6 +25,7 @@ const SearchBox: React.FC = ({ onSelectEngine, themeColor, opacity, + searchGlow, onInteractionChange, enableHistory, history, @@ -219,7 +221,7 @@ const SearchBox: React.FC = ({ style={{ backgroundColor: isActive ? themeColor : 'transparent', filter: isActive ? 'blur(45px)' : 'blur(0px)', // High blur for aperture effect - opacity: isActive ? 0.35 : 0, + opacity: isActive ? searchGlow : 0, transform: isActive ? 'scale(1.15)' : 'scale(0.8)', zIndex: 10 }} @@ -229,8 +231,8 @@ const SearchBox: React.FC = ({
diff --git a/src/components/ThemeSettings.tsx b/src/components/ThemeSettings.tsx index 8180fa0..adaf276 100644 --- a/src/components/ThemeSettings.tsx +++ b/src/components/ThemeSettings.tsx @@ -37,6 +37,10 @@ const ThemeSettings: React.FC = ({ settings, onUpdateSetting onUpdateSettings({ ...settings, searchOpacity: parseFloat(e.target.value) }); }; + const handleSearchGlowChange = (e: React.ChangeEvent) => { + onUpdateSettings({ ...settings, searchGlow: parseFloat(e.target.value) }); + }; + const handleMaskOpacityChange = (e: React.ChangeEvent) => { onUpdateSettings({ ...settings, maskOpacity: parseFloat(e.target.value) }); }; @@ -200,6 +204,23 @@ const ThemeSettings: React.FC = ({ settings, onUpdateSetting />
+ {/* Search box glow slider */} +
+
+ {t.searchGlow} + {Math.round(settings.searchGlow * 100)}% +
+ +
+ {/* Mask opacity slider */}
diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 9d009a5..45e9703 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -16,6 +16,7 @@ export const en: Translation = { searchHistory: 'Search History', backgroundBlur: 'Background Blur', searchBoxOpacity: 'Search Box Opacity', + searchGlow: 'Search Box Glow', maskOpacity: 'Mask Opacity', // Wallpaper Settings diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index acb11f0..ca1c562 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -16,6 +16,7 @@ export const zh: Translation = { searchHistory: '搜索历史记录', backgroundBlur: '背景模糊度', searchBoxOpacity: '搜索框不透明度', + searchGlow: '搜索框发光强度', maskOpacity: '遮罩层不透明度', // Wallpaper Settings diff --git a/src/i18n/types.ts b/src/i18n/types.ts index 4a4fff7..ec62170 100644 --- a/src/i18n/types.ts +++ b/src/i18n/types.ts @@ -16,6 +16,7 @@ export interface Translation { searchHistory: string; backgroundBlur: string; searchBoxOpacity: string; + searchGlow: string; maskOpacity: string; // Wallpaper Settings diff --git a/src/types.ts b/src/types.ts index 69b2b3a..47f866f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -39,6 +39,7 @@ export interface UserSettings { searchHistory: string[]; language: Language; motto: string; + searchGlow: number; } export type SettingsSection = 'general' | 'wallpaper' | 'search';