fix: 修复前端侧边栏弹出异常问题

This commit is contained in:
hhs
2026-06-22 11:15:41 +08:00
parent 1b99d24fc1
commit 6bca4e0d47
3 changed files with 7 additions and 7 deletions

View File

@@ -316,7 +316,7 @@ function AppContent() {
sessions={sessions}
activeSessionId={activeSessionId}
open={sidebarOpen}
onToggle={() => setSidebarOpen((v) => !v)}
onClose={() => setSidebarOpen(false)}
onNewSession={handleNewSession}
onSelectSession={handleSelectSession}
onDeleteSession={handleDeleteSession}

View File

@@ -12,7 +12,7 @@ interface SessionSidebarProps {
sessions: SessionSummary[];
activeSessionId: string | null;
open: boolean;
onToggle: () => void;
onClose: () => void;
onNewSession: () => void;
onSelectSession: (id: string) => void;
onDeleteSession: (id: string) => void;
@@ -56,7 +56,7 @@ export function SessionSidebar({
sessions,
activeSessionId,
open,
onToggle,
onClose,
onNewSession,
onSelectSession,
onDeleteSession,
@@ -88,7 +88,7 @@ export function SessionSidebar({
const handleSelect = (id: string) => {
onSelectSession(id);
// 选择后自动收起侧边栏
onToggle();
onClose();
};
// 过滤 + 分组
@@ -128,14 +128,14 @@ export function SessionSidebar({
return (
<>
<div className="sidebar-backdrop" onClick={onToggle} />
<div className="sidebar-backdrop" onClick={onClose} />
<div className="sidebar">
{/* 头部:新建 + 收起 */}
<div className="sidebar__header">
<button className="sidebar__new-btn" onClick={onNewSession}>
{t("sidebar.new")}
</button>
<button className="sidebar__toggle" onClick={onToggle} title={t("sidebar.collapse")}>
<button className="sidebar__toggle" onClick={onClose} title={t("sidebar.collapse")}>
</button>
</div>