Spaces:
Sleeping
Sleeping
Update web/src/components/sidebar/LeftSidebar.tsx
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758import React from "react";import { Separator } from "../ui/separator";import type { SavedChat, Workspace } from "../../App";import type { CourseDirectoryItem } from "../../lib/courseDirectory";import { CourseInfoSection } from "./CourseInfoSection";import { SavedChatSection } from "./SavedChatSection";export function LeftSidebar({isLoggedIn,savedChats,onLoadChat,onDeleteSavedChat,onRenameSavedChat,currentWorkspaceId,workspaces,selectedCourse,availableCourses,}: {isLoggedIn: boolean;savedChats: SavedChat[];onLoadChat: (chat: SavedChat) => void;onDeleteSavedChat: (id: string) => void;onRenameSavedChat?: (id: string, newTitle: string) => void;currentWorkspaceId: string;workspaces: Workspace[];selectedCourse: string;availableCourses: CourseDirectoryItem[];}) {return (<div className="h-full w-full flex flex-col min-h-0">{/* 强制可见:确认你改的就是运行中的 LeftSidebar */}<div className="px-4 pt-2 text-xs text-red-600 flex-shrink-0">SIDEBAR/LEFTSIDEBAR ACTIVE</div>{/* 顶部 Course Info(不滚动) */}<div className="flex-shrink-0"><CourseInfoSectioncurrentWorkspaceId={currentWorkspaceId}workspaces={workspaces}selectedCourse={selectedCourse}availableCourses={availableCourses}/></div>{/* Saved Chat(滚动区) */}<div className="flex-1 min-h-0 overflow-hidden">{/* 这条线确保视觉分割,且不参与滚动 */}<Separator className="bg-[#ECECF1]" />{/* 唯一滚动容器:使用你全局 CSS 的 panelScroll */}<div className="h-full min-h-0 panelScroll"><SavedChatSectionisLoggedIn={isLoggedIn}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899import React from "react";import { Separator } from "../ui/separator";import type {SavedChat,Workspace,LearningMode,Language,SpaceType,GroupMember,User,SavedItem,} from "../../App";import { CourseInfoSection } from "./CourseInfoSection";import { SavedChatSection } from "./SavedChatSection";type Props = {// ====== settings / user ======learningMode: LearningMode;language: Language;onLearningModeChange: (m: LearningMode) => void;onLanguageChange: (l: Language) => void;spaceType: SpaceType;groupMembers: GroupMember[];user: User | null;onLogin: (u: any) => void;onLogout: () => void;isLoggedIn: boolean;onEditProfile: () => void;// ====== saved items (暂时不动你现有逻辑;这里先不渲染也不会影响) ======savedItems: SavedItem[];recentlySavedId: string | null;onUnsave: (id: string) => void;onSave: (content: string,type: "export" | "quiz" | "summary",saveAsChat?: boolean,format?: "pdf" | "text",workspaceId?: string) => void;// ====== saved chats ======savedChats: SavedChat[];onLoadChat: (chat: SavedChat) => void;onDeleteSavedChat: (id: string) => void;onRenameSavedChat: (id: string, newTitle: string) => void;// ====== workspace / course ======currentWorkspaceId: string;workspaces: Workspace[];selectedCourse: string;availableCourses: any[]; // 你 App 里是 CourseInfo[],这里放宽避免类型冲突};export function LeftSidebar(props: Props) {const {isLoggedIn,savedChats,onLoadChat,onDeleteSavedChat,onRenameSavedChat,currentWorkspaceId,workspaces,selectedCourse,availableCourses,} = props;return (<div className="h-full w-full flex flex-col min-h-0">{/* ✅ 强制可见:用于确认你改的文件真的在跑 */}<div className="px-4 pt-2 text-xs text-red-600 flex-shrink-0">SIDEBAR ACTIVE (components/sidebar/LeftSidebar.tsx)</div>{/* ===== Course Info(不滚动)===== */}<div className="flex-shrink-0"><CourseInfoSectioncurrentWorkspaceId={currentWorkspaceId}workspaces={workspaces}selectedCourse={selectedCourse}availableCourses={availableCourses as any}/></div>{/* 固定分割线颜色 */}<Separator className="flex-shrink-0 bg-[#ECECF1]" />{/* ===== Saved Chat(唯一滚动区)===== */}<div className="flex-1 min-h-0 overflow-hidden">{/* 让 SavedChatSection 自己不要 overflow;滚动归这里 */}<div className="h-full min-h-0 panelScroll"><SavedChatSectionisLoggedIn={isLoggedIn}
web/src/components/sidebar/LeftSidebar.tsx+66-25