SarahXia0405 commited on
Commit
71badb3
·
verified ·
1 Parent(s): cceb576

Create LeftSidebar.tsx

Browse files
web/src/components/sidebar/LeftSidebar.tsx ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from "react";
2
+ import { Separator } from "../ui/separator";
3
+
4
+ import type { SavedChat, Workspace } from "../../App";
5
+ import type { CourseDirectoryItem } from "../../lib/courseDirectory";
6
+
7
+ import { CourseInfoSection } from "./CourseInfoSection";
8
+ import { SavedChatSection } from "./SavedChatSection";
9
+
10
+ export function LeftSidebar({
11
+ isLoggedIn,
12
+ savedChats,
13
+ onLoadChat,
14
+ onDeleteSavedChat,
15
+ onRenameSavedChat,
16
+
17
+ currentWorkspaceId,
18
+ workspaces,
19
+ selectedCourse,
20
+ availableCourses,
21
+ }: {
22
+ isLoggedIn: boolean;
23
+ savedChats: SavedChat[];
24
+ onLoadChat: (chat: SavedChat) => void;
25
+ onDeleteSavedChat: (id: string) => void;
26
+ onRenameSavedChat?: (id: string, newTitle: string) => void;
27
+
28
+ currentWorkspaceId: string;
29
+ workspaces: Workspace[];
30
+ selectedCourse: string;
31
+ availableCourses: CourseDirectoryItem[];
32
+ }) {
33
+ return (
34
+ <div className="h-full w-full flex flex-col min-h-0">
35
+ {/* 强制可见:确认你改的就是运行中的 LeftSidebar */}
36
+ <div className="px-4 pt-2 text-xs text-red-600 flex-shrink-0">
37
+ SIDEBAR/LEFTSIDEBAR ACTIVE
38
+ </div>
39
+
40
+ {/* 顶部 Course Info(不滚动) */}
41
+ <div className="flex-shrink-0">
42
+ <CourseInfoSection
43
+ currentWorkspaceId={currentWorkspaceId}
44
+ workspaces={workspaces}
45
+ selectedCourse={selectedCourse}
46
+ availableCourses={availableCourses}
47
+ />
48
+ </div>
49
+
50
+ {/* Saved Chat(滚动区) */}
51
+ <div className="flex-1 min-h-0 overflow-hidden">
52
+ {/* 这条线确保视觉分割,且不参与滚动 */}
53
+ <Separator className="bg-[#ECECF1]" />
54
+
55
+ {/* 唯一滚动容器:使用你全局 CSS 的 panelScroll */}
56
+ <div className="h-full min-h-0 panelScroll">
57
+ <SavedChatSection
58
+ isLoggedIn={isLoggedIn}
59
+ savedChats={savedChats}
60
+ onLoadChat={onLoadChat}
61
+ onDeleteSavedChat={onDeleteSavedChat}
62
+ onRenameSavedChat={onRenameSavedChat}
63
+ />
64
+ </div>
65
+ </div>
66
+ </div>
67
+ );
68
+ }