@local-civics/mgmt-ui 0.1.199 → 0.1.201

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.
package/dist/index.js CHANGED
@@ -1155,12 +1155,21 @@ var __spreadValues$c = (a, b) => {
1155
1155
  };
1156
1156
  var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
1157
1157
  function Table$c(props) {
1158
+ console.group("Class Table Data Check");
1159
+ console.log("1. Raw props:", props);
1160
+ console.log("2. Raw items from prop.items:", props.items);
1161
+ if (props.items.length > 0) {
1162
+ console.log("3. Type of lastActivity (first item):", typeof props.items[0].lastActivity, props.items[0].lastActivity);
1163
+ }
1158
1164
  const preparedItems = React__namespace.useMemo(() => {
1159
1165
  return props.items.map((item) => __spreadProps$8(__spreadValues$c({}, item), {
1160
1166
  fullName: item.givenName && item.familyName ? `${item.givenName} ${item.familyName}`.toLowerCase() : item.email.toLowerCase()
1161
1167
  }));
1162
1168
  }, [props.items]);
1169
+ console.log("4. Prepared items (before sort hook):", preparedItems);
1170
+ console.groupEnd();
1163
1171
  const { items: sortedItems, requestSort, sortConfig } = useSortableData(preparedItems);
1172
+ console.log("5. Final sorted items:", sortedItems);
1164
1173
  if (props.items.length === 0) {
1165
1174
  return /* @__PURE__ */ React__namespace.createElement(
1166
1175
  PlaceholderBanner,
@@ -3802,22 +3811,6 @@ const SplitButton = (props) => {
3802
3811
  const { classes, theme } = useStyles$1();
3803
3812
  theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
3804
3813
  return /* @__PURE__ */ React__namespace.createElement(core.Stack, { spacing: "sm" }, /* @__PURE__ */ React__namespace.createElement(
3805
- core.Button,
3806
- {
3807
- component: reactRouterDom.Link,
3808
- to: props.href,
3809
- className: classes.button,
3810
- variant: "gradient"
3811
- },
3812
- "Preview"
3813
- ), /* @__PURE__ */ React__namespace.createElement(
3814
- core.Button,
3815
- {
3816
- leftIcon: /* @__PURE__ */ React__namespace.createElement(icons.IconClipboardCopy, { size: 14 }),
3817
- onClick: props.onCopyLinkClick
3818
- },
3819
- "Copy link"
3820
- ), /* @__PURE__ */ React__namespace.createElement(
3821
3814
  core.Button,
3822
3815
  {
3823
3816
  leftIcon: /* @__PURE__ */ React__namespace.createElement(icons.IconTableExport, { size: 14 }),
@@ -3996,25 +3989,41 @@ const useStyles = core.createStyles((theme) => ({
3996
3989
  }));
3997
3990
  const BadgeTable = ({ badges, students, loading }) => {
3998
3991
  const { byBadge } = useFilteredStudents(students);
3999
- return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, badges.map((b) => /* @__PURE__ */ React__namespace.createElement(core.Accordion.Item, { key: b.badgeId, value: b.badgeId }, /* @__PURE__ */ React__namespace.createElement(core.Accordion.Control, null, b.displayName), /* @__PURE__ */ React__namespace.createElement(core.Accordion.Panel, null, /* @__PURE__ */ React__namespace.createElement(
4000
- Table,
4001
- {
4002
- loading,
4003
- items: byBadge(b.badgeId),
4004
- hideBadge: true
4005
- }
4006
- )))));
3992
+ const countFiles = (students2) => students2.reduce((acc, s) => {
3993
+ var _a;
3994
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
3995
+ }, 0);
3996
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, badges.map((b) => {
3997
+ const studentsForBadge = byBadge(b.badgeId);
3998
+ const fileCount = countFiles(studentsForBadge);
3999
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion.Item, { key: b.badgeId, value: b.badgeId }, /* @__PURE__ */ React__namespace.createElement(core.Accordion.Control, null, /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "apart", w: "100%" }, /* @__PURE__ */ React__namespace.createElement(core.Text, null, b.displayName), /* @__PURE__ */ React__namespace.createElement(core.Badge, { size: "sm" }, fileCount))), /* @__PURE__ */ React__namespace.createElement(core.Accordion.Panel, null, /* @__PURE__ */ React__namespace.createElement(
4000
+ Table,
4001
+ {
4002
+ loading,
4003
+ items: studentsForBadge,
4004
+ hideBadge: true
4005
+ }
4006
+ )));
4007
+ }));
4007
4008
  };
4008
4009
  const LessonTableWrapper = ({ lessons, students, loading }) => {
4009
4010
  const { byLesson } = useFilteredStudents(students);
4010
- return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, lessons.map((l) => /* @__PURE__ */ React__namespace.createElement(core.Accordion.Item, { key: l.lessonId, value: l.lessonId }, /* @__PURE__ */ React__namespace.createElement(core.Accordion.Control, null, l.lessonName), /* @__PURE__ */ React__namespace.createElement(core.Accordion.Panel, null, /* @__PURE__ */ React__namespace.createElement(
4011
- Table,
4012
- {
4013
- loading,
4014
- items: byLesson(l.lessonName),
4015
- hideLesson: true
4016
- }
4017
- )))));
4011
+ const countFiles = (students2) => students2.reduce((acc, s) => {
4012
+ var _a;
4013
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
4014
+ }, 0);
4015
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, lessons.map((l) => {
4016
+ const studentsForLesson = byLesson(l.lessonName);
4017
+ const fileCount = countFiles(studentsForLesson);
4018
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion.Item, { key: l.lessonId, value: l.lessonId }, /* @__PURE__ */ React__namespace.createElement(core.Accordion.Control, null, /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "apart", w: "100%" }, /* @__PURE__ */ React__namespace.createElement(core.Text, null, l.lessonName), /* @__PURE__ */ React__namespace.createElement(core.Badge, { size: "sm" }, fileCount))), /* @__PURE__ */ React__namespace.createElement(core.Accordion.Panel, null, /* @__PURE__ */ React__namespace.createElement(
4019
+ Table,
4020
+ {
4021
+ loading,
4022
+ items: studentsForLesson,
4023
+ hideLesson: true
4024
+ }
4025
+ )));
4026
+ }));
4018
4027
  };
4019
4028
  const PathwayTable = ({
4020
4029
  pathways,
@@ -4023,13 +4032,21 @@ const PathwayTable = ({
4023
4032
  loading
4024
4033
  }) => {
4025
4034
  const { byPathway } = useFilteredStudents(students);
4026
- return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, pathways.map((p) => /* @__PURE__ */ React__namespace.createElement(core.Accordion.Item, { key: p.pathwayId, value: p.pathwayId }, /* @__PURE__ */ React__namespace.createElement(core.Accordion.Control, null, /* @__PURE__ */ React__namespace.createElement("strong", null, p.title), /* @__PURE__ */ React__namespace.createElement("div", null, p.description)), /* @__PURE__ */ React__namespace.createElement(core.Accordion.Panel, null, /* @__PURE__ */ React__namespace.createElement(
4027
- Table,
4028
- {
4029
- loading,
4030
- items: byPathway(p.pathwayId, badges)
4031
- }
4032
- )))));
4035
+ const countFiles = (students2) => students2.reduce((acc, s) => {
4036
+ var _a;
4037
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
4038
+ }, 0);
4039
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, pathways.map((p) => {
4040
+ const studentsForPathway = byPathway(p.pathwayId, badges);
4041
+ const fileCount = countFiles(studentsForPathway);
4042
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion.Item, { key: p.pathwayId, value: p.pathwayId }, /* @__PURE__ */ React__namespace.createElement(core.Accordion.Control, null, /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "apart", w: "100%" }, /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement("strong", null, p.title), /* @__PURE__ */ React__namespace.createElement("div", null, p.description)), /* @__PURE__ */ React__namespace.createElement(core.Badge, { size: "sm" }, fileCount))), /* @__PURE__ */ React__namespace.createElement(core.Accordion.Panel, null, /* @__PURE__ */ React__namespace.createElement(
4043
+ Table,
4044
+ {
4045
+ loading,
4046
+ items: studentsForPathway
4047
+ }
4048
+ )));
4049
+ }));
4033
4050
  };
4034
4051
  const FileLocker = (props) => {
4035
4052
  const { classes } = useStyles();