From 9da58f0cb102337205830c62333524cbbcddf7ba Mon Sep 17 00:00:00 2001 From: yannyang Date: Mon, 27 Jul 2026 12:21:37 +0800 Subject: [PATCH] fix: fix chat outline active --- src/components/Sidebar.tsx | 5 +- src/pages/chat/components/AgentSidebar.css | 61 +++++++++++++ src/pages/chat/components/AgentSidebar.tsx | 91 +++++++++++++------ src/pages/chat/components/ChatHeader.tsx | 5 +- src/pages/chat/components/ChatOutline.css | 4 + src/pages/chat/components/ChatPageWeb.tsx | 84 +++++++++++++++-- .../chat/components/messages/MessageItem.css | 2 +- .../chat/components/messages/MessageItem.tsx | 4 +- src/pages/chat/hooks/useChatData.ts | 15 +-- src/pages/chat/hooks/useChatScroll.ts | 25 +++-- .../chat/styles/chat-page-web-standard-pc.css | 1 - 11 files changed, 244 insertions(+), 53 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 3a78e0b..acfc16e 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -13,7 +13,8 @@ import { LeftOutlined, RightOutlined, UserOutlined, - CreditCardOutlined + CreditCardOutlined, + ShoppingCartOutlined } from '@ant-design/icons'; import { useAuth } from '../store/auth'; import kaiwuIcon from '../assets/brand/kaiwu-icon-gradient-transparent.png'; @@ -55,7 +56,7 @@ const NAV_GROUPS: Array<{ { label: '商城', items: [ - { to: '/points-mall', icon: , label: 'Token 商城' }, + { to: '/points-mall', icon: , label: 'Token 商城' }, { to: '/pricing', icon: , label: '会员计划' } ] } diff --git a/src/pages/chat/components/AgentSidebar.css b/src/pages/chat/components/AgentSidebar.css index 2c54ac0..4f58aa4 100644 --- a/src/pages/chat/components/AgentSidebar.css +++ b/src/pages/chat/components/AgentSidebar.css @@ -5,6 +5,67 @@ display: flex; flex-direction: column; height: 100%; + transition: width 0.3s ease; + position: relative; +} + +.chat-side.is-collapsed { + width: 68px !important; +} + +.chat-agent-sidebar-toggle { + position: absolute; + right: -12px; + top: 24px; + width: 24px; + height: 24px; + background: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + z-index: 1001; + box-shadow: 0 2px 8px rgba(0,0,0,0.08); + color: var(--color-text-secondary); + font-size: 12px; + transition: all 0.2s; +} + +.chat-agent-sidebar-toggle:hover { + color: var(--color-brand); + border-color: var(--color-brand); + transform: scale(1.1); +} + +.chat-side.is-collapsed .chat-agent-sidebar-header { + padding: 16px 8px 8px; +} + +.chat-side.is-collapsed .chat-agent-create-btn { + padding: 0 !important; + width: 40px; + margin: 0 auto; +} + +.chat-side.is-collapsed .chat-agent-sidebar-list { + padding: 8px; +} + +.chat-side.is-collapsed .chat-agent-item { + justify-content: center; + padding: 8px 0; + border-left: none; +} + +.chat-side.is-collapsed .chat-agent-item.active { + background: var(--color-surface-3); +} + +.chat-side.is-collapsed .chat-agent-item.active::after { + right: 4px; + bottom: 4px; } .chat-side.is-full { diff --git a/src/pages/chat/components/AgentSidebar.tsx b/src/pages/chat/components/AgentSidebar.tsx index 312258b..b6a376b 100644 --- a/src/pages/chat/components/AgentSidebar.tsx +++ b/src/pages/chat/components/AgentSidebar.tsx @@ -1,5 +1,5 @@ -import { Button, Spin, Empty, Tabs } from 'antd'; -import { PlusOutlined } from '@ant-design/icons'; +import { Button, Spin, Empty, Tabs, Tooltip } from 'antd'; +import { PlusOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons'; import { useEffect, useState, useMemo } from 'react'; import type { Agent } from '../../../api'; import './AgentSidebar.css'; @@ -12,8 +12,18 @@ export default function AgentSidebar(props: { onCreate: () => void; onSelect: (agentId: string) => void; isSidebar?: boolean; + collapsed?: boolean; + onToggleCollapse?: () => void; }) { - const { agentList, activeAgentId, onCreate, onSelect, isSidebar = true } = props; + const { + agentList, + activeAgentId, + onCreate, + onSelect, + isSidebar = true, + collapsed = false, + onToggleCollapse + } = props; const [loadingTimeout, setLoadingTimeout] = useState(false); const [activeTab, setActiveTab] = useState('mine'); @@ -52,7 +62,13 @@ export default function AgentSidebar(props: { }, [filteredList]); return ( -