@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.mjs CHANGED
@@ -1135,12 +1135,21 @@ var __spreadValues$c = (a, b) => {
1135
1135
  };
1136
1136
  var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
1137
1137
  function Table$c(props) {
1138
+ console.group("Class Table Data Check");
1139
+ console.log("1. Raw props:", props);
1140
+ console.log("2. Raw items from prop.items:", props.items);
1141
+ if (props.items.length > 0) {
1142
+ console.log("3. Type of lastActivity (first item):", typeof props.items[0].lastActivity, props.items[0].lastActivity);
1143
+ }
1138
1144
  const preparedItems = React.useMemo(() => {
1139
1145
  return props.items.map((item) => __spreadProps$8(__spreadValues$c({}, item), {
1140
1146
  fullName: item.givenName && item.familyName ? `${item.givenName} ${item.familyName}`.toLowerCase() : item.email.toLowerCase()
1141
1147
  }));
1142
1148
  }, [props.items]);
1149
+ console.log("4. Prepared items (before sort hook):", preparedItems);
1150
+ console.groupEnd();
1143
1151
  const { items: sortedItems, requestSort, sortConfig } = useSortableData(preparedItems);
1152
+ console.log("5. Final sorted items:", sortedItems);
1144
1153
  if (props.items.length === 0) {
1145
1154
  return /* @__PURE__ */ React.createElement(
1146
1155
  PlaceholderBanner,
@@ -3782,22 +3791,6 @@ const SplitButton = (props) => {
3782
3791
  const { classes, theme } = useStyles$1();
3783
3792
  theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
3784
3793
  return /* @__PURE__ */ React.createElement(Stack$5, { spacing: "sm" }, /* @__PURE__ */ React.createElement(
3785
- Button,
3786
- {
3787
- component: Link,
3788
- to: props.href,
3789
- className: classes.button,
3790
- variant: "gradient"
3791
- },
3792
- "Preview"
3793
- ), /* @__PURE__ */ React.createElement(
3794
- Button,
3795
- {
3796
- leftIcon: /* @__PURE__ */ React.createElement(IconClipboardCopy, { size: 14 }),
3797
- onClick: props.onCopyLinkClick
3798
- },
3799
- "Copy link"
3800
- ), /* @__PURE__ */ React.createElement(
3801
3794
  Button,
3802
3795
  {
3803
3796
  leftIcon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 14 }),
@@ -3976,25 +3969,41 @@ const useStyles = createStyles((theme) => ({
3976
3969
  }));
3977
3970
  const BadgeTable = ({ badges, students, loading }) => {
3978
3971
  const { byBadge } = useFilteredStudents(students);
3979
- return /* @__PURE__ */ React.createElement(Accordion, null, badges.map((b) => /* @__PURE__ */ React.createElement(Accordion.Item, { key: b.badgeId, value: b.badgeId }, /* @__PURE__ */ React.createElement(Accordion.Control, null, b.displayName), /* @__PURE__ */ React.createElement(Accordion.Panel, null, /* @__PURE__ */ React.createElement(
3980
- Table,
3981
- {
3982
- loading,
3983
- items: byBadge(b.badgeId),
3984
- hideBadge: true
3985
- }
3986
- )))));
3972
+ const countFiles = (students2) => students2.reduce((acc, s) => {
3973
+ var _a;
3974
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
3975
+ }, 0);
3976
+ return /* @__PURE__ */ React.createElement(Accordion, null, badges.map((b) => {
3977
+ const studentsForBadge = byBadge(b.badgeId);
3978
+ const fileCount = countFiles(studentsForBadge);
3979
+ return /* @__PURE__ */ React.createElement(Accordion.Item, { key: b.badgeId, value: b.badgeId }, /* @__PURE__ */ React.createElement(Accordion.Control, null, /* @__PURE__ */ React.createElement(Group, { position: "apart", w: "100%" }, /* @__PURE__ */ React.createElement(Text, null, b.displayName), /* @__PURE__ */ React.createElement(Badge$1, { size: "sm" }, fileCount))), /* @__PURE__ */ React.createElement(Accordion.Panel, null, /* @__PURE__ */ React.createElement(
3980
+ Table,
3981
+ {
3982
+ loading,
3983
+ items: studentsForBadge,
3984
+ hideBadge: true
3985
+ }
3986
+ )));
3987
+ }));
3987
3988
  };
3988
3989
  const LessonTableWrapper = ({ lessons, students, loading }) => {
3989
3990
  const { byLesson } = useFilteredStudents(students);
3990
- return /* @__PURE__ */ React.createElement(Accordion, null, lessons.map((l) => /* @__PURE__ */ React.createElement(Accordion.Item, { key: l.lessonId, value: l.lessonId }, /* @__PURE__ */ React.createElement(Accordion.Control, null, l.lessonName), /* @__PURE__ */ React.createElement(Accordion.Panel, null, /* @__PURE__ */ React.createElement(
3991
- Table,
3992
- {
3993
- loading,
3994
- items: byLesson(l.lessonName),
3995
- hideLesson: true
3996
- }
3997
- )))));
3991
+ const countFiles = (students2) => students2.reduce((acc, s) => {
3992
+ var _a;
3993
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
3994
+ }, 0);
3995
+ return /* @__PURE__ */ React.createElement(Accordion, null, lessons.map((l) => {
3996
+ const studentsForLesson = byLesson(l.lessonName);
3997
+ const fileCount = countFiles(studentsForLesson);
3998
+ return /* @__PURE__ */ React.createElement(Accordion.Item, { key: l.lessonId, value: l.lessonId }, /* @__PURE__ */ React.createElement(Accordion.Control, null, /* @__PURE__ */ React.createElement(Group, { position: "apart", w: "100%" }, /* @__PURE__ */ React.createElement(Text, null, l.lessonName), /* @__PURE__ */ React.createElement(Badge$1, { size: "sm" }, fileCount))), /* @__PURE__ */ React.createElement(Accordion.Panel, null, /* @__PURE__ */ React.createElement(
3999
+ Table,
4000
+ {
4001
+ loading,
4002
+ items: studentsForLesson,
4003
+ hideLesson: true
4004
+ }
4005
+ )));
4006
+ }));
3998
4007
  };
3999
4008
  const PathwayTable = ({
4000
4009
  pathways,
@@ -4003,13 +4012,21 @@ const PathwayTable = ({
4003
4012
  loading
4004
4013
  }) => {
4005
4014
  const { byPathway } = useFilteredStudents(students);
4006
- return /* @__PURE__ */ React.createElement(Accordion, null, pathways.map((p) => /* @__PURE__ */ React.createElement(Accordion.Item, { key: p.pathwayId, value: p.pathwayId }, /* @__PURE__ */ React.createElement(Accordion.Control, null, /* @__PURE__ */ React.createElement("strong", null, p.title), /* @__PURE__ */ React.createElement("div", null, p.description)), /* @__PURE__ */ React.createElement(Accordion.Panel, null, /* @__PURE__ */ React.createElement(
4007
- Table,
4008
- {
4009
- loading,
4010
- items: byPathway(p.pathwayId, badges)
4011
- }
4012
- )))));
4015
+ const countFiles = (students2) => students2.reduce((acc, s) => {
4016
+ var _a;
4017
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
4018
+ }, 0);
4019
+ return /* @__PURE__ */ React.createElement(Accordion, null, pathways.map((p) => {
4020
+ const studentsForPathway = byPathway(p.pathwayId, badges);
4021
+ const fileCount = countFiles(studentsForPathway);
4022
+ return /* @__PURE__ */ React.createElement(Accordion.Item, { key: p.pathwayId, value: p.pathwayId }, /* @__PURE__ */ React.createElement(Accordion.Control, null, /* @__PURE__ */ React.createElement(Group, { position: "apart", w: "100%" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("strong", null, p.title), /* @__PURE__ */ React.createElement("div", null, p.description)), /* @__PURE__ */ React.createElement(Badge$1, { size: "sm" }, fileCount))), /* @__PURE__ */ React.createElement(Accordion.Panel, null, /* @__PURE__ */ React.createElement(
4023
+ Table,
4024
+ {
4025
+ loading,
4026
+ items: studentsForPathway
4027
+ }
4028
+ )));
4029
+ }));
4013
4030
  };
4014
4031
  const FileLocker = (props) => {
4015
4032
  const { classes } = useStyles();