diff --git a/web/src/App.css b/web/src/App.css index 73a8a7b..e87596c 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -223,6 +223,40 @@ body { overflow: hidden; } +/* 波形动画 */ +.waveform-animation { + display: flex; + align-items: center; + justify-content: center; + gap: 4px; + height: 100%; +} + +.wave-bar { + width: 6px; + border-radius: 3px; + background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%); + animation: wave-animation 1s ease-in-out infinite; +} + +@keyframes wave-animation { + 0%, 100% { + height: 20%; + } + 50% { + height: 100%; + } +} + +.waveform-placeholder { + display: flex; + align-items: center; + justify-content: center; + height: 100%; + color: var(--text-secondary); + font-size: 14px; +} + /* 状态指示器 */ .status-indicator { display: inline-flex; diff --git a/web/src/App.tsx b/web/src/App.tsx index 0f4ccbe..25a9730 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -20,6 +20,8 @@ function App() { // 获取当前主题 useEffect(() => { + let unlistenFn: (() => void) | null = null + const loadTheme = async () => { try { const currentTheme = await window.__TAURI__.invoke('get_theme') as Theme @@ -30,20 +32,21 @@ function App() { // 使用默认主题,不影响页面显示 applyTheme('system') } - } - loadTheme() - // 监听主题变化事件 - let unlistenFn: (() => void) | null = null - window.__TAURI__.listen('theme-change', (event) => { - const newTheme = event.payload as string - setTheme(newTheme as Theme) - applyTheme(newTheme as Theme) - }).then(fn => { - unlistenFn = fn - }).catch(e => { - console.error('Failed to setup theme listener:', e) - }) + // 监听主题变化事件 + try { + const unlisten = await window.__TAURI__.listen('theme-change', (event) => { + const newTheme = event.payload as string + setTheme(newTheme as Theme) + applyTheme(newTheme as Theme) + }) + unlistenFn = unlisten + } catch (e) { + console.error('Failed to setup theme listener:', e) + } + } + + loadTheme() return () => { if (unlistenFn) {