@nualang/nualang-ui-components 0.1.1387 → 0.1.1388

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,7 +45,6 @@ export default function CreateAssignmentDialog({
45
45
  createAssignment,
46
46
  username,
47
47
  getMemberDetails,
48
- getClassroom,
49
48
  getCourses,
50
49
  initialData = {},
51
50
  dialogTitle,
@@ -74,45 +73,11 @@ export default function CreateAssignmentDialog({
74
73
  });
75
74
  const [isTitleEdited, setIsTitleEdited] = useState(Boolean(initialData.title));
76
75
  const [isCreating, setIsCreating] = useState(false);
77
- const classroomQuery = useQueries({
78
- queries: (Array.isArray(assignment.classroomId) ? assignment.classroomId : [assignment.classroomId]).map(cId => ({
79
- queryKey: classroomQuerys.classroomKeys.item(cId, username),
80
- queryFn: () => getClassroom(cId, filters),
81
- queryOptions: {
82
- enabled: !!(Array.isArray(assignment.classroomId) ? assignment.classroomId.length > 0 : assignment.classroomId)
83
- }
84
- })),
85
- combine: results => {
86
- const normalizedData = results.map(result => {
87
- const data = result.data;
88
- if (data?.classroomId) {
89
- return data;
90
- }
91
- if (data?.Item?.classroomId) {
92
- return data.Item;
93
- }
94
- return null;
95
- }).filter(Boolean);
96
- return {
97
- data: normalizedData,
98
- pending: results.some(result => result.isPending)
99
- };
100
- }
101
- });
102
76
  const selectedClassroomCourses = useMemo(() => {
103
- if (!classroomQuery.pending && classroomQuery.data.length > 0) {
104
- const allCourses = classroomQuery.data.flatMap(classroom => classroom.courses || []);
105
- const seen = new Set();
106
- const uniqueCourses = allCourses.filter(courseId => {
107
- if (seen.has(courseId)) return false;
108
- seen.add(courseId);
109
- return true;
110
- });
111
- return uniqueCourses;
112
- } else {
113
- return [];
114
- }
115
- }, [classroomQuery.data, classroomQuery.pending]);
77
+ const selectedIds = Array.isArray(assignment.classroomId) ? assignment.classroomId : [assignment.classroomId];
78
+ const allCourses = (classrooms || []).filter(c => selectedIds.includes(c.classroomId)).flatMap(c => c.courses || []);
79
+ return [...new Set(allCourses)];
80
+ }, [classrooms, assignment.classroomId]);
116
81
  const coursesQuery = courseQuerys.useCourses(async filters => {
117
82
  const response = await getCourses(filters);
118
83
  return response;
@@ -515,7 +515,7 @@ function Topic({
515
515
  total: 0,
516
516
  percentage: 0
517
517
  };
518
- }, [isMember, topic?.topicId, topic?.completions?.length, isChallengeModeStudent, isReadWriteModeStudent]);
518
+ }, [isMember, topic?.topicId, topic?.completions?.length, topic?.roleplays?.length, topic?.bots?.length, isChallengeModeStudent, isReadWriteModeStudent]);
519
519
  const {
520
520
  percentage,
521
521
  completed,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1387",
3
+ "version": "0.1.1388",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -101,7 +101,7 @@
101
101
  "@mui/system": "^7.0.2",
102
102
  "@mui/x-date-pickers": "^8.27.2",
103
103
  "@nualang/eslint-config-nualang": "0.2.0-alpha-5",
104
- "@nualang/nualang-api-and-queries": "^1.1.50",
104
+ "@nualang/nualang-api-and-queries": "^1.1.51",
105
105
  "@react-theming/storybook-addon": "^1.1.10",
106
106
  "@storybook/addon-docs": "^10.0.2",
107
107
  "@storybook/addon-links": "^10.0.2",