From de2dafe661a74c7696c43f34e997ea38f47647ef Mon Sep 17 00:00:00 2001 From: imeepos Date: Thu, 10 Jul 2025 10:10:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=92=8C=E5=86=85=E5=AE=B9=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 TitleBar 组件窗口控制功能 - 实现真正的最小化、最大化/还原、关闭功能 - 添加窗口状态监听和图标切换 - 保持窗口拖动功能 - 修复内容滚动问题 - Layout 组件移除 overflow-hidden,启用滚动 - EditorPage 修复 flex 布局滚动问题 - 确保所有内容区域可正常滚动 - 增强 HomePage 内容 - 添加更多功能介绍和测试内容 - 改善用户体验和界面展示 - 技术改进 - 使用 @tauri-apps/api/window API - 优化 CSS 布局和滚动行为 - 添加窗口事件监听器 --- src/components/Layout.tsx | 4 +-- src/components/TitleBar.tsx | 64 ++++++++++++++++++++++++++++++------- src/pages/EditorPage.tsx | 2 +- src/pages/HomePage.tsx | 58 +++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 15 deletions(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index ebf31f3..0e95c84 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -14,9 +14,9 @@ const Layout: React.FC = ({ children }) => { return (
-
+
{!isEditorPage && } -
+
{children}
diff --git a/src/components/TitleBar.tsx b/src/components/TitleBar.tsx index c25fd6b..c3cc108 100644 --- a/src/components/TitleBar.tsx +++ b/src/components/TitleBar.tsx @@ -1,20 +1,60 @@ -import React from 'react' -import { Minimize2, Maximize2, X } from 'lucide-react' +import React, { useState, useEffect } from 'react' +import { Minimize2, Maximize2, Square, X } from 'lucide-react' +import { getCurrentWindow } from '@tauri-apps/api/window' const TitleBar: React.FC = () => { - const handleMinimize = () => { - // TODO: Implement minimize functionality with Tauri - console.log('Minimize window') + const [isMaximized, setIsMaximized] = useState(false) + + useEffect(() => { + const checkMaximized = async () => { + const window = getCurrentWindow() + const maximized = await window.isMaximized() + setIsMaximized(maximized) + } + + checkMaximized() + + // Listen for window resize events + const unlisten = getCurrentWindow().listen('tauri://resize', () => { + checkMaximized() + }) + + return () => { + unlisten.then(fn => fn()) + } + }, []) + + const handleMinimize = async () => { + try { + const window = getCurrentWindow() + await window.minimize() + } catch (error) { + console.error('Failed to minimize window:', error) + } } - const handleMaximize = () => { - // TODO: Implement maximize functionality with Tauri - console.log('Maximize window') + const handleMaximize = async () => { + try { + const window = getCurrentWindow() + if (isMaximized) { + await window.unmaximize() + setIsMaximized(false) + } else { + await window.maximize() + setIsMaximized(true) + } + } catch (error) { + console.error('Failed to toggle maximize window:', error) + } } - const handleClose = () => { - // TODO: Implement close functionality with Tauri - console.log('Close window') + const handleClose = async () => { + try { + const window = getCurrentWindow() + await window.close() + } catch (error) { + console.error('Failed to close window:', error) + } } return ( @@ -40,7 +80,7 @@ const TitleBar: React.FC = () => { onClick={handleMaximize} className="w-6 h-6 flex items-center justify-center hover:bg-secondary-700 rounded transition-colors" > - + {isMaximized ? : }
-
+
{/* Media Library Sidebar */} diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index fc1cba6..3a8dd67 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -155,6 +155,64 @@ const HomePage: React.FC = () => {
+ + {/* Additional Content for Testing Scroll */} +
+

更多功能

+ +
+
+

视频效果

+
    +
  • • 滤镜和颜色调整
  • +
  • • 转场效果
  • +
  • • 动画和运动图形
  • +
  • • 绿幕抠像
  • +
  • • 画中画效果
  • +
+
+ +
+

音频功能

+
    +
  • • 降噪和音频修复
  • +
  • • 音频均衡器
  • +
  • • 音频同步
  • +
  • • 语音识别
  • +
  • • 音频可视化
  • +
+
+ +
+

导出选项

+
    +
  • • 多种格式支持
  • +
  • • 自定义分辨率
  • +
  • • 批量导出
  • +
  • • 云端渲染
  • +
  • • 直播推流
  • +
+
+ +
+

协作功能

+
    +
  • • 团队协作
  • +
  • • 版本控制
  • +
  • • 评论和反馈
  • +
  • • 云端同步
  • +
  • • 权限管理
  • +
+
+
+
+ + {/* Footer */} +
+

+ © 2025 MixVideo V2. 专业视频编辑软件,让创作更简单。 +

+
) }