diff --git a/frontend-react/src/App.jsx b/frontend-react/src/App.jsx index 535a64a..9e6922d 100644 --- a/frontend-react/src/App.jsx +++ b/frontend-react/src/App.jsx @@ -1,9 +1,9 @@ +// frontend-react/src/App.jsx import React from 'react'; import Toolbar from './components/ToolBar/ToolBar'; import ChatBox from './components/ChatBox/ChatBox'; -import DicePanel from './components/DicePanel/DicePanel'; -import ImageDisplay from './components/ImageDisplay/ImageDisplay'; -import PresetPanel from './components/PresetPanel/PresetPanel'; +import SideBarLeft from './components/SideBarLeft/SideBarLeft'; +import SideBarRight from './components/SideBarRight/SideBarRight'; import './index.css'; function App() { @@ -15,7 +15,7 @@ function App() {
{/* 左侧栏 - 预设面板 */}
- +
{/* 中间栏:聊天框 */} @@ -25,12 +25,7 @@ function App() { {/* 右侧栏 */}
-
- {/* 图片展示放在顶部 */} -
-
- {/* 骰子面板放在底部 */} -
+
diff --git a/frontend-react/src/components/RoleSelector/RoleSelector.jsx b/frontend-react/src/components/RoleSelector/RoleSelector.jsx index d60d97d..34a79b1 100644 --- a/frontend-react/src/components/RoleSelector/RoleSelector.jsx +++ b/frontend-react/src/components/RoleSelector/RoleSelector.jsx @@ -1,5 +1,5 @@ import React, { useEffect, useRef } from 'react'; -import useRoleSelectorStore from '../../store/Slices/RoleSelectorSlice'; +import useRoleSelectorStore from '../../Store/Slices/RoleSelectorSlice'; import useChatBoxStore from '../../Store/Slices/ChatBoxSlice'; import './RoleSelector.css'; diff --git a/frontend-react/src/components/SideBarLeft/SideBarLeft.css b/frontend-react/src/components/SideBarLeft/SideBarLeft.css new file mode 100644 index 0000000..9fa5163 --- /dev/null +++ b/frontend-react/src/components/SideBarLeft/SideBarLeft.css @@ -0,0 +1,42 @@ +/* frontend-react/src/components/SideBarLeft/SideBarLeft.css */ +.sidebar-left { + width: 250px; + height: 100%; + display: flex; + flex-direction: column; + overflow: hidden; +} + +.sidebar-tabs { + display: flex; + border-bottom: 1px solid #e0e0e0; +} + +.tab-button { + flex: 1; + padding: 10px 5px; + background: none; + border: none; + cursor: pointer; + transition: background-color 0.3s; + font-size: 14px; +} + +.tab-button:hover { + background-color: #f5f5f5; +} + +.tab-button.active { + border-bottom: 2px solid #4a90e2; + font-weight: bold; +} + +.sidebar-content { + flex: 1; + overflow-y: auto; + padding: 10px; +} + +.tab-content { + height: 100%; +} diff --git a/frontend-react/src/components/SideBarLeft/SideBarLeft.jsx b/frontend-react/src/components/SideBarLeft/SideBarLeft.jsx new file mode 100644 index 0000000..fd7011b --- /dev/null +++ b/frontend-react/src/components/SideBarLeft/SideBarLeft.jsx @@ -0,0 +1,44 @@ +// frontend-react/src/components/SideBarLeft/SideBarLeft.jsx +import React, { useState } from 'react'; +import './SideBarLeft.css'; + +const SideBarLeft = () => { + const [activeTab, setActiveTab] = useState('gallery'); + + const handleTabChange = (tab) => { + setActiveTab(tab); + }; + + return ( +
+
+ + + +
+ +
+ {activeTab === 'gallery' &&
画廊内容
} + {activeTab === 'config' &&
配置内容
} + {activeTab === 'worldbook' &&
世界书内容
} +
+
+ ); +}; + +export default SideBarLeft; diff --git a/frontend-react/src/components/SideBarRight/SideBarRight.css b/frontend-react/src/components/SideBarRight/SideBarRight.css new file mode 100644 index 0000000..9b934c7 --- /dev/null +++ b/frontend-react/src/components/SideBarRight/SideBarRight.css @@ -0,0 +1,56 @@ +/* frontend-react/src/components/SideBarRight/SideBarRight.css */ +.sidebar-right { + width: 300px; + height: 100%; + display: flex; + flex-direction: column; + overflow: hidden; +} + +.right-top, .right-bottom { + display: flex; + flex-direction: column; + overflow: hidden; +} + +.right-top { + flex: 1; +} + +.right-bottom { + height: 200px; +} + +.sidebar-tabs { + display: flex; + border-bottom: 1px solid #e0e0e0; +} + +.tab-button { + flex: 1; + padding: 10px 5px; + background: none; + border: none; + cursor: pointer; + transition: background-color 0.3s; + font-size: 14px; +} + +.tab-button:hover { + background-color: #f5f5f5; +} + +.tab-button.active { + border-bottom: 2px solid #4a90e2; + font-weight: bold; +} + +.sidebar-content { + flex: 1; + overflow-y: auto; + padding: 10px; +} + +.tab-content { + height: 100%; +} diff --git a/frontend-react/src/components/SideBarRight/SideBarRight.jsx b/frontend-react/src/components/SideBarRight/SideBarRight.jsx new file mode 100644 index 0000000..b82a305 --- /dev/null +++ b/frontend-react/src/components/SideBarRight/SideBarRight.jsx @@ -0,0 +1,68 @@ +// frontend-react/src/components/SideBarRight/SideBarRight.jsx +import React, { useState } from 'react'; +import './SideBarRight.css'; +import DicePanel from '../DicePanel/DicePanel'; +import ImageDisplay from '../ImageDisplay/ImageDisplay'; + +const SideBarRight = () => { + const [topActiveTab, setTopActiveTab] = useState('dice'); + const [bottomActiveTab, setBottomActiveTab] = useState('macros'); + + const handleTopTabChange = (tab) => { + setTopActiveTab(tab); + }; + + const handleBottomTabChange = (tab) => { + setBottomActiveTab(tab); + }; + + return ( +
+
+
+ + +
+ +
+ {topActiveTab === 'dice' && } + {topActiveTab === 'debug' &&
上下文调试内容
} +
+
+ +
+
+ + +
+ +
+ {bottomActiveTab === 'macros' &&
快捷宏内容
} + {bottomActiveTab === 'table' &&
动态表格内容
} +
+
+
+ ); +}; + +export default SideBarRight; diff --git a/frontend-react/src/components/ToolBar/ToolBar.css b/frontend-react/src/components/ToolBar/ToolBar.css index 43920cf..cb75ff3 100644 --- a/frontend-react/src/components/ToolBar/ToolBar.css +++ b/frontend-react/src/components/ToolBar/ToolBar.css @@ -34,17 +34,18 @@ /* 工具栏图标 */ .toolbar-icon { - width: 36px; height: 36px; + padding: 0 12px; border-radius: 6px; display: flex; align-items: center; - justify-content: center; + gap: 8px; cursor: pointer; transition: all 0.2s ease; font-size: 18px; color: #555; background-color: #f5f5f5; + white-space: nowrap; } .toolbar-icon:hover { @@ -59,6 +60,15 @@ color: #fff; } +/* 图标标签文本 */ +.icon-label { + font-size: 14px; + max-width: 150px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + /* ==================== 弹出面板通用样式 ==================== */ .close-panel-button { diff --git a/frontend-react/src/components/ToolBar/ToolBar.jsx b/frontend-react/src/components/ToolBar/ToolBar.jsx index 28188b9..0555cc1 100644 --- a/frontend-react/src/components/ToolBar/ToolBar.jsx +++ b/frontend-react/src/components/ToolBar/ToolBar.jsx @@ -1,10 +1,14 @@ -import React, { useState, useRef } from 'react'; +// frontend-react/src/components/ToolBar/ToolBar.jsx +import React, { useState, useRef, useEffect } from 'react'; import RoleSelector from '../RoleSelector/RoleSelector'; +import useRoleSelectorStore from '../../Store/Slices/RoleSelectorSlice'; import './ToolBar.css'; const Toolbar = () => { const [activePanel, setActivePanel] = useState(null); const panelRef = useRef(null); + const selectedRole = useRoleSelectorStore((state) => state.selectedRole); + const selectedChat = useRoleSelectorStore((state) => state.selectedChat); // 点击外部关闭面板 React.useEffect(() => { @@ -20,6 +24,13 @@ const Toolbar = () => { }; }, []); + // 监听selectedRole和selectedChat的变化 + useEffect(() => { + console.log('当前选中的角色:', selectedRole); + console.log('当前选中的聊天:', selectedChat); + // 这里可以添加其他需要响应角色变化的逻辑 + }, [selectedRole, selectedChat]); + // 处理面板切换 const handlePanelToggle = (panelName) => { if (activePanel === panelName) { @@ -34,38 +45,73 @@ const Toolbar = () => { setActivePanel(null); }; + // 截断文本 + const truncateText = (text, maxLength = 20) => { + if (!text) return '未选择'; + return text.length > maxLength ? text.substring(0, maxLength) + '...' : text; + }; + + // 构建显示文本 + const getDisplayText = () => { + if (!selectedRole) return '未选择'; + return selectedChat ? `${selectedRole} / ${selectedChat}` : selectedRole; + }; + return ( <>
- {/* 左侧工具栏图标 */} + {/* 左侧:当前角色 */}
- {/* Logo图标 */}
handlePanelToggle(null)} + title="当前角色" + onClick={() => handlePanelToggle('currentRole')} > - 🤖 + 👤 + 当前角色 +
+
+ {truncateText(getDisplayText())}
- {/* 中间操作图标 */} + {/* 中间:角色管理 */}
- {/* 角色选择图标 */}
handlePanelToggle('role')} > - 👤 + 🎭 + 全局世界书 +
+
+ {truncateText(getDisplayText())}
- {/* 右侧工具栏图标 */} + {/* 全局世界书 */} +
+
+
handlePanelToggle('worldBook')} + > + 📚 + 全局世界书 +
+
+ 全局世界书 +
+
+
+ + {/* 右侧:设置和拓展 */}
{
handlePanelToggle('help')} + title="拓展" + onClick={() => handlePanelToggle('extensions')} > - ❓ + ➕
@@ -91,7 +137,7 @@ const Toolbar = () => {
-

角色管理

+

用户角色管理

@@ -103,33 +149,69 @@ const Toolbar = () => {
)} - {activePanel === 'settings' && ( + {/* 当前角色面板(暂时留空) */} + {activePanel === 'currentRole' && (
-

设置

+

当前ai角色

-

设置内容...

+

当前角色详情...

)} - {activePanel === 'help' && ( + {/* 全局世界书面板 */} + {activePanel === 'worldBook' && (
-

帮助

+

全局世界书

-

帮助内容...

+

全局世界书内容...

+
+
+
+ )} + + {/* 设置面板 */} + {activePanel === 'settings' && ( +
+
+
+

系统设置

+ +
+
+

系统设置内容...

+
+
+
+ )} + + {/* 拓展面板 */} + {activePanel === 'extensions' && ( +
+
+
+

功能拓展

+ +
+
+

功能拓展内容...

@@ -138,4 +220,4 @@ const Toolbar = () => { ); }; -export default Toolbar; +export default Toolbar; \ No newline at end of file diff --git a/frontend-react/src/index.css b/frontend-react/src/index.css index 27bbb73..ec6c2f2 100644 --- a/frontend-react/src/index.css +++ b/frontend-react/src/index.css @@ -1,12 +1,13 @@ +/* frontend-react/src/index.css */ html, body { margin: 0; padding: 0; - height: 100vh; /* 使用视口高度作为基准 */ + height: 100vh; width: 100%; } .app { - height: 100%; /* 继承body的100vh */ + height: 100%; display: flex; flex-direction: column; } @@ -28,58 +29,48 @@ html, body { html, body, .app { height: 100%; width: 100%; - overflow: hidden; /* 防止出现滚动条 */ + overflow: hidden; } .app { display: flex; flex-direction: column; + height: 100%; + width: 100%; + overflow: hidden; } /* 主内容区域 */ .main-container { - flex: 1; /* 这会让主容器占据剩余的所有空间 */ + flex: 1; display: flex; - overflow: hidden; /* 防止内容溢出 */ + overflow: hidden; } /* 左侧栏 */ .sidebar-left { - width: 250px; /* 或者你想要的宽度 */ - height: 继承父元素高度; /* 确保高度填满 */ - overflow-y: auto; /* 内容过多时显示滚动条 */ + width: 250px; + height: 100%; + overflow: hidden; } /* 中间聊天区域 */ .chat-area { - flex: 1; /* 占据剩余空间 */ - height: 100%; /* 确保高度填满 */ + flex: 1; + height: 100%; display: flex; flex-direction: column; - overflow: hidden; /* 防止内容溢出 */ + overflow: hidden; } /* 右侧栏 */ .sidebar-right { - width: 300px; /* 或者你想要的宽度 */ - height: 100%; /* 确保高度填满 */ - display: flex; - flex-direction: column; -} - -/* 右侧栏顶部 */ -.right-top { - flex: 1; /* 占据剩余空间 */ - overflow-y: auto; -} - -/* 右侧栏底部 */ -.right-bottom { - height: 200px; /* 或者你想要的高度 */ - overflow-y: auto; + width: 300px; + height: 100%; + overflow: hidden; } .toolbar { - height: 60px; /* 或其他合适的固定高度 */ - flex-shrink: 0; /* 防止被压缩 */ + height: 60px; + flex-shrink: 0; }