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

Merged
huanghaosheng merged 2 commits from develop into v2 2026-06-22 11:20:01 +08:00
3 changed files with 7 additions and 7 deletions
Showing only changes of commit dcd08d031c - Show all commits

View File

@@ -12,6 +12,7 @@ require (
github.com/gorilla/websocket v1.5.3 github.com/gorilla/websocket v1.5.3
github.com/jackc/pgx/v5 v5.10.0 github.com/jackc/pgx/v5 v5.10.0
github.com/joho/godotenv v1.5.1 github.com/joho/godotenv v1.5.1
github.com/oklog/ulid/v2 v2.1.1
github.com/redis/go-redis/v9 v9.20.1 github.com/redis/go-redis/v9 v9.20.1
github.com/spf13/viper v1.21.0 github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1 github.com/stretchr/testify v1.11.1
@@ -53,7 +54,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nikolalohinski/gonja v1.5.3 // indirect github.com/nikolalohinski/gonja v1.5.3 // indirect
github.com/oklog/ulid/v2 v2.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect

View File

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

View File

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