From 26c3f05daf60c3b49a4acbb70b88b97f1e5ecca0 Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 21 Dec 2025 16:05:22 +0800 Subject: [PATCH] feat(ui): add fade transition for view and panel switching Add smooth fade animations when navigating between views (Settings, MCP, Skills, Prompts) and opening full-screen panels (Add/Edit Provider). --- src/App.tsx | 156 ++++++++++++---------- src/components/common/FullScreenPanel.tsx | 8 +- 2 files changed, 91 insertions(+), 73 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c658f0db..3388f3c5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -299,78 +299,92 @@ function App() { }; const renderContent = () => { - switch (currentView) { - case "settings": - return ( - setCurrentView("providers")} - onImportSuccess={handleImportSuccess} - /> - ); - case "prompts": - return ( - setCurrentView("providers")} - appId={activeApp} - /> - ); - case "skills": - return ( - setCurrentView("providers")} - initialApp={activeApp} - /> - ); - case "mcp": - return ( - setCurrentView("providers")} - /> - ); - case "agents": - return setCurrentView("providers")} />; - default: - return ( -
- {/* 独立滚动容器 - 解决 Linux/Ubuntu 下 DndContext 与滚轮事件冲突 */} -
- - - setIsAddOpen(true)} - /> - - + const content = (() => { + switch (currentView) { + case "settings": + return ( + setCurrentView("providers")} + onImportSuccess={handleImportSuccess} + /> + ); + case "prompts": + return ( + setCurrentView("providers")} + appId={activeApp} + /> + ); + case "skills": + return ( + setCurrentView("providers")} + initialApp={activeApp} + /> + ); + case "mcp": + return ( + setCurrentView("providers")} + /> + ); + case "agents": + return setCurrentView("providers")} />; + default: + return ( +
+ {/* 独立滚动容器 - 解决 Linux/Ubuntu 下 DndContext 与滚轮事件冲突 */} +
+ + + setIsAddOpen(true)} + /> + + +
-
- ); - } + ); + } + })(); + + return ( + + + {content} + + + ); }; return ( diff --git a/src/components/common/FullScreenPanel.tsx b/src/components/common/FullScreenPanel.tsx index 56e3cab3..edf3a155 100644 --- a/src/components/common/FullScreenPanel.tsx +++ b/src/components/common/FullScreenPanel.tsx @@ -1,5 +1,6 @@ import React from "react"; import { createPortal } from "react-dom"; +import { motion } from "framer-motion"; import { ArrowLeft } from "lucide-react"; import { Button } from "@/components/ui/button"; @@ -35,7 +36,10 @@ export const FullScreenPanel: React.FC = ({ if (!isOpen) return null; return createPortal( -
@@ -71,7 +75,7 @@ export const FullScreenPanel: React.FC = ({
)} - , + , document.body, ); };