File size: 2,401 Bytes
6c5d46f
71badb3
 
 
f489e78
 
 
a95320a
 
 
 
 
 
 
 
 
 
71badb3
a95320a
 
 
 
 
71badb3
a95320a
 
 
 
 
 
71badb3
a95320a
 
 
 
 
 
 
 
 
 
 
 
 
 
71badb3
 
 
a95320a
71badb3
 
 
a95320a
71badb3
f489e78
a95320a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71badb3
 
 
f489e78
71badb3
 
 
 
 
a95320a
71badb3
 
 
a95320a
71badb3
f489e78
a95320a
71badb3
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// web/src/components/sidebar/LeftSidebar.tsx
import React from "react";
import { Separator } from "../ui/separator";

import { CourseInfoSection } from "./CourseInfoSection";
import { SavedChatSection } from "./SavedChatSection";

import type {
  SavedChat,
  Workspace,
  LearningMode,
  Language,
  SpaceType,
  GroupMember,
  User,
  SavedItem,
} from "../../App";

type Props = {
  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;

  savedItems: SavedItem[];
  recentlySavedId: string | null;
  onUnsave: (id: string) => void;
  onSave: (
    content: string,
    type: "export" | "quiz" | "summary",
    saveAsChat?: boolean,
    format?: "pdf" | "text",
    workspaceId?: string
  ) => void;

  savedChats: SavedChat[];
  onLoadChat: (chat: SavedChat) => void;
  onDeleteSavedChat: (id: string) => void;
  onRenameSavedChat: (id: string, newTitle: string) => void;

  currentWorkspaceId: string;
  workspaces: Workspace[];

  selectedCourse: string;
  availableCourses: any[];
};

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">

      {/* Course info(不滚动) */}
      <div className="flex-shrink-0">
        <CourseInfoSection
          currentWorkspaceId={currentWorkspaceId}
          workspaces={workspaces}
          selectedCourse={selectedCourse}
          availableCourses={availableCourses as any}
        />
      </div>

      <Separator className="flex-shrink-0 bg-[#ECECF1]" />

      {/* Saved chats(唯一滚动区) */}
      <div className="flex-1 min-h-0 overflow-hidden">
        <div className="h-full min-h-0 panelScroll">
          <SavedChatSection
            isLoggedIn={isLoggedIn}
            savedChats={savedChats}
            onLoadChat={onLoadChat}
            onDeleteSavedChat={onDeleteSavedChat}
            onRenameSavedChat={onRenameSavedChat}
          />
        </div>
      </div>
    </div>
  );
}