SarahXia0405 commited on
Commit
9b87f77
·
verified ·
1 Parent(s): 9e2e22f

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

Browse files
web/src/components/sidebar/LeftSidebar.tsx CHANGED
@@ -32,7 +32,10 @@ import type {
32
  import type { CourseDirectoryItem } from "../../lib/courseDirectory";
33
 
34
  import clareAvatar from "../../assets/dfe44dab3ad8cd93953eac4a3e68bd1a5f999653.png";
35
- const Divider = () => <div className="w-full h-px bg-[#ECECF1] flex-shrink-0" />;
 
 
 
36
 
37
  type Props = {
38
  learningMode: LearningMode;
@@ -136,11 +139,33 @@ export function LeftSidebar(props: Props) {
136
  [workspaces, currentWorkspaceId]
137
  );
138
 
139
- // Treat only "team"/"group" as Team space; otherwise it's My Space
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  const isTeamSpace = useMemo(() => {
 
 
 
141
  const st = String(spaceType || "").toLowerCase();
142
  return st === "group" || st === "team";
143
- }, [spaceType]);
 
144
 
145
  // --------- CourseInfo resolution ---------
146
  const courseInfo = useMemo((): CourseDirectoryItem | null => {
 
32
  import type { CourseDirectoryItem } from "../../lib/courseDirectory";
33
 
34
  import clareAvatar from "../../assets/dfe44dab3ad8cd93953eac4a3e68bd1a5f999653.png";
35
+ const Divider = () => (
36
+ <div className="w-full h-[2px] bg-gray-200 flex-shrink-0" />
37
+ );
38
+
39
 
40
  type Props = {
41
  learningMode: LearningMode;
 
139
  [workspaces, currentWorkspaceId]
140
  );
141
 
142
+
143
+ const isMyWorkspace = useMemo(() => {
144
+ const ws: any = currentWorkspace as any;
145
+
146
+ // 常见 personal 标记(你后端 schema 之后可以对齐其中一个)
147
+ if (ws?.isPersonal === true) return true;
148
+ if (String(ws?.spaceType || "").toLowerCase().includes("my")) return true;
149
+ if (String(ws?.type || "").toLowerCase().includes("my")) return true;
150
+ if (String(ws?.kind || "").toLowerCase().includes("my")) return true;
151
+
152
+ // 兜底:workspace id/name 里含 my/personal
153
+ const id = String(ws?.id || "").toLowerCase();
154
+ const name = String(ws?.name || "").toLowerCase();
155
+ if (id.includes("my") || id.includes("personal")) return true;
156
+ if (name.includes("my space") || name.includes("personal")) return true;
157
+
158
+ return false;
159
+ }, [currentWorkspace]);
160
+
161
  const isTeamSpace = useMemo(() => {
162
+ // 如果 workspace 明确是 My Space,则强制 false
163
+ if (isMyWorkspace) return false;
164
+
165
  const st = String(spaceType || "").toLowerCase();
166
  return st === "group" || st === "team";
167
+ }, [spaceType, isMyWorkspace]);
168
+
169
 
170
  // --------- CourseInfo resolution ---------
171
  const courseInfo = useMemo((): CourseDirectoryItem | null => {