feat: UI调整
This commit is contained in:
@@ -30,12 +30,12 @@ const MemoizedAppFooter = memo(AppFooter);
|
|||||||
*/
|
*/
|
||||||
export default function MainLayout() {
|
export default function MainLayout() {
|
||||||
return (
|
return (
|
||||||
<Box minH="100vh" display="flex" flexDirection="column">
|
<Box flex="1" h="100vh" w="100%" position="relative" display="flex" flexDirection="column">
|
||||||
{/* 导航栏 - 在所有页面间共享,memo 后不会在路由切换时重新渲染 */}
|
{/* 导航栏 - 在所有页面间共享,memo 后不会在路由切换时重新渲染 */}
|
||||||
<MemoizedHomeNavbar />
|
<MemoizedHomeNavbar />
|
||||||
|
|
||||||
{/* 页面内容区域 - flex: 1 占据剩余空间,包含错误边界、懒加载 */}
|
{/* 页面内容区域 - flex: 1 占据剩余空间,包含错误边界、懒加载 */}
|
||||||
<Box flex="1" w="100%" position="relative" overflow="hidden" pt="72px">
|
<Box flex="1" pt="72px">
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<Suspense fallback={<PageLoader message="页面加载中..." />}>
|
<Suspense fallback={<PageLoader message="页面加载中..." />}>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
@@ -47,11 +47,11 @@ export default function MainLayout() {
|
|||||||
<MemoizedAppFooter />
|
<MemoizedAppFooter />
|
||||||
|
|
||||||
{/* 返回顶部按钮 - 滚动超过阈值时显示 */}
|
{/* 返回顶部按钮 - 滚动超过阈值时显示 */}
|
||||||
<BackToTopButton
|
{/* <BackToTopButton
|
||||||
scrollThreshold={BACK_TO_TOP_CONFIG.scrollThreshold}
|
scrollThreshold={BACK_TO_TOP_CONFIG.scrollThreshold}
|
||||||
position={BACK_TO_TOP_CONFIG.position}
|
position={BACK_TO_TOP_CONFIG.position}
|
||||||
zIndex={BACK_TO_TOP_CONFIG.zIndex}
|
zIndex={BACK_TO_TOP_CONFIG.zIndex}
|
||||||
/>
|
/> */}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ const LeftSidebar = ({
|
|||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
w="320px"
|
w="320px"
|
||||||
|
h="100%"
|
||||||
display="flex"
|
display="flex"
|
||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
bg="rgba(17, 24, 39, 0.8)"
|
bg="rgba(17, 24, 39, 0.8)"
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ const RightSidebar = ({
|
|||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
w="320px"
|
w="320px"
|
||||||
|
h="100%"
|
||||||
display="flex"
|
display="flex"
|
||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
bg="rgba(17, 24, 39, 0.8)"
|
bg="rgba(17, 24, 39, 0.8)"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
// 超炫酷的 AI 投研助手 - HeroUI v3 现代深色主题版本
|
// 超炫酷的 AI 投研助手 - HeroUI v3 现代深色主题版本
|
||||||
// 使用 Framer Motion 物理动画引擎 + 毛玻璃效果
|
// 使用 Framer Motion 物理动画引擎 + 毛玻璃效果
|
||||||
|
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Box, Flex, useToast, useColorMode } from '@chakra-ui/react';
|
import { Box, Flex, useToast } from '@chakra-ui/react';
|
||||||
import { useAuth } from '@contexts/AuthContext';
|
import { useAuth } from '@contexts/AuthContext';
|
||||||
|
|
||||||
// 常量配置 - 从 TypeScript 模块导入
|
// 常量配置 - 从 TypeScript 模块导入
|
||||||
@@ -34,7 +34,6 @@ import { useAgentSessions, useAgentChat, useFileUpload } from './hooks';
|
|||||||
const AgentChat = () => {
|
const AgentChat = () => {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const { setColorMode } = useColorMode();
|
|
||||||
|
|
||||||
// ==================== UI 状态(主组件管理)====================
|
// ==================== UI 状态(主组件管理)====================
|
||||||
const [selectedModel, setSelectedModel] = useState(DEFAULT_MODEL_ID);
|
const [selectedModel, setSelectedModel] = useState(DEFAULT_MODEL_ID);
|
||||||
@@ -85,69 +84,55 @@ const AgentChat = () => {
|
|||||||
// ==================== 输入框引用(保留在主组件)====================
|
// ==================== 输入框引用(保留在主组件)====================
|
||||||
const inputRef = React.useRef(null);
|
const inputRef = React.useRef(null);
|
||||||
|
|
||||||
// ==================== 启用深色模式 ====================
|
|
||||||
useEffect(() => {
|
|
||||||
// 为 AgentChat 页面强制启用深色模式
|
|
||||||
setColorMode('dark');
|
|
||||||
document.documentElement.classList.add('dark');
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
// 组件卸载时不移除,让其他页面自己控制
|
|
||||||
// document.documentElement.classList.remove('dark');
|
|
||||||
};
|
|
||||||
}, [setColorMode]);
|
|
||||||
|
|
||||||
// ==================== 渲染组件 ====================
|
// ==================== 渲染组件 ====================
|
||||||
return (
|
return (
|
||||||
<Box flex={1} bg="gray.900">
|
<Flex h="100%" position="relative" bg="gray.900">
|
||||||
<Flex h="100%" overflow="hidden" position="relative">
|
{/* 左侧栏 */}
|
||||||
{/* 左侧栏 */}
|
<LeftSidebar
|
||||||
<LeftSidebar
|
isOpen={isLeftSidebarOpen}
|
||||||
isOpen={isLeftSidebarOpen}
|
onClose={() => setIsLeftSidebarOpen(false)}
|
||||||
onClose={() => setIsLeftSidebarOpen(false)}
|
sessions={sessions}
|
||||||
sessions={sessions}
|
currentSessionId={currentSessionId}
|
||||||
currentSessionId={currentSessionId}
|
onSessionSwitch={switchSession}
|
||||||
onSessionSwitch={switchSession}
|
onNewSession={createNewSession}
|
||||||
onNewSession={createNewSession}
|
isLoadingSessions={isLoadingSessions}
|
||||||
isLoadingSessions={isLoadingSessions}
|
user={user}
|
||||||
user={user}
|
/>
|
||||||
/>
|
|
||||||
|
|
||||||
{/* 中间聊天区 */}
|
{/* 中间聊天区 */}
|
||||||
<ChatArea
|
<ChatArea
|
||||||
messages={messages}
|
messages={messages}
|
||||||
inputValue={inputValue}
|
inputValue={inputValue}
|
||||||
onInputChange={setInputValue}
|
onInputChange={setInputValue}
|
||||||
isProcessing={isProcessing}
|
isProcessing={isProcessing}
|
||||||
onSendMessage={handleSendMessage}
|
onSendMessage={handleSendMessage}
|
||||||
onKeyPress={handleKeyPress}
|
onKeyPress={handleKeyPress}
|
||||||
uploadedFiles={uploadedFiles}
|
uploadedFiles={uploadedFiles}
|
||||||
onFileSelect={handleFileSelect}
|
onFileSelect={handleFileSelect}
|
||||||
onFileRemove={removeFile}
|
onFileRemove={removeFile}
|
||||||
selectedModel={selectedModel}
|
selectedModel={selectedModel}
|
||||||
isLeftSidebarOpen={isLeftSidebarOpen}
|
isLeftSidebarOpen={isLeftSidebarOpen}
|
||||||
isRightSidebarOpen={isRightSidebarOpen}
|
isRightSidebarOpen={isRightSidebarOpen}
|
||||||
onToggleLeftSidebar={() => setIsLeftSidebarOpen(true)}
|
onToggleLeftSidebar={() => setIsLeftSidebarOpen(true)}
|
||||||
onToggleRightSidebar={() => setIsRightSidebarOpen(true)}
|
onToggleRightSidebar={() => setIsRightSidebarOpen(true)}
|
||||||
onNewSession={createNewSession}
|
onNewSession={createNewSession}
|
||||||
userAvatar={user?.avatar}
|
userAvatar={user?.avatar}
|
||||||
inputRef={inputRef}
|
inputRef={inputRef}
|
||||||
fileInputRef={fileInputRef}
|
fileInputRef={fileInputRef}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* 右侧栏 */}
|
{/* 右侧栏 */}
|
||||||
<RightSidebar
|
<RightSidebar
|
||||||
isOpen={isRightSidebarOpen}
|
isOpen={isRightSidebarOpen}
|
||||||
onClose={() => setIsRightSidebarOpen(false)}
|
onClose={() => setIsRightSidebarOpen(false)}
|
||||||
selectedModel={selectedModel}
|
selectedModel={selectedModel}
|
||||||
onModelChange={setSelectedModel}
|
onModelChange={setSelectedModel}
|
||||||
selectedTools={selectedTools}
|
selectedTools={selectedTools}
|
||||||
onToolsChange={setSelectedTools}
|
onToolsChange={setSelectedTools}
|
||||||
sessionsCount={sessions.length}
|
sessionsCount={sessions.length}
|
||||||
messagesCount={messages.length}
|
messagesCount={messages.length}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user