SarahXia0405 commited on
Commit
a95320a
·
verified ·
1 Parent(s): 591631c

Update web/src/components/sidebar/LeftSidebar.tsx

Browse files
web/src/components/sidebar/LeftSidebar.tsx CHANGED
@@ -1,58 +1,99 @@
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}
 
1
  import React from "react";
2
  import { Separator } from "../ui/separator";
3
 
4
+ import type {
5
+ SavedChat,
6
+ Workspace,
7
+ LearningMode,
8
+ Language,
9
+ SpaceType,
10
+ GroupMember,
11
+ User,
12
+ SavedItem,
13
+ } from "../../App";
14
 
15
  import { CourseInfoSection } from "./CourseInfoSection";
16
  import { SavedChatSection } from "./SavedChatSection";
17
 
18
+ type Props = {
19
+ // ====== settings / user ======
20
+ learningMode: LearningMode;
21
+ language: Language;
22
+ onLearningModeChange: (m: LearningMode) => void;
23
+ onLanguageChange: (l: Language) => void;
24
 
25
+ spaceType: SpaceType;
26
+ groupMembers: GroupMember[];
27
+
28
+ user: User | null;
29
+ onLogin: (u: any) => void;
30
+ onLogout: () => void;
31
  isLoggedIn: boolean;
32
+
33
+ onEditProfile: () => void;
34
+
35
+ // ====== saved items (暂时不动你现有逻辑;这里先不渲染也不会影响) ======
36
+ savedItems: SavedItem[];
37
+ recentlySavedId: string | null;
38
+ onUnsave: (id: string) => void;
39
+ onSave: (
40
+ content: string,
41
+ type: "export" | "quiz" | "summary",
42
+ saveAsChat?: boolean,
43
+ format?: "pdf" | "text",
44
+ workspaceId?: string
45
+ ) => void;
46
+
47
+ // ====== saved chats ======
48
  savedChats: SavedChat[];
49
  onLoadChat: (chat: SavedChat) => void;
50
  onDeleteSavedChat: (id: string) => void;
51
+ onRenameSavedChat: (id: string, newTitle: string) => void;
52
 
53
+ // ====== workspace / course ======
54
  currentWorkspaceId: string;
55
  workspaces: Workspace[];
56
+
57
  selectedCourse: string;
58
+ availableCourses: any[]; // 你 App 里是 CourseInfo[],这里放宽避免类型冲突
59
+ };
60
+
61
+ export function LeftSidebar(props: Props) {
62
+ const {
63
+ isLoggedIn,
64
+ savedChats,
65
+ onLoadChat,
66
+ onDeleteSavedChat,
67
+ onRenameSavedChat,
68
+ currentWorkspaceId,
69
+ workspaces,
70
+ selectedCourse,
71
+ availableCourses,
72
+ } = props;
73
+
74
  return (
75
  <div className="h-full w-full flex flex-col min-h-0">
76
+ {/* 强制可见:用于确认你改的文件真的在跑 */}
77
  <div className="px-4 pt-2 text-xs text-red-600 flex-shrink-0">
78
+ SIDEBAR ACTIVE (components/sidebar/LeftSidebar.tsx)
79
  </div>
80
 
81
+ {/* ===== Course Info(不滚动)===== */}
82
  <div className="flex-shrink-0">
83
  <CourseInfoSection
84
  currentWorkspaceId={currentWorkspaceId}
85
  workspaces={workspaces}
86
  selectedCourse={selectedCourse}
87
+ availableCourses={availableCourses as any}
88
  />
89
  </div>
90
 
91
+ {/* 固定分割线颜色 */}
92
+ <Separator className="flex-shrink-0 bg-[#ECECF1]" />
 
 
93
 
94
+ {/* ===== Saved Chat(唯一滚动区)===== */}
95
+ <div className="flex-1 min-h-0 overflow-hidden">
96
+ {/* 让 SavedChatSection 自己不要 overflow;滚动归这里 */}
97
  <div className="h-full min-h-0 panelScroll">
98
  <SavedChatSection
99
  isLoggedIn={isLoggedIn}