@local-civics/mgmt-ui 0.1.200 → 0.1.202

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,21 +1155,13 @@ 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
- }
1164
1158
  const preparedItems = React__namespace.useMemo(() => {
1165
1159
  return props.items.map((item) => __spreadProps$8(__spreadValues$c({}, item), {
1166
1160
  fullName: item.givenName && item.familyName ? `${item.givenName} ${item.familyName}`.toLowerCase() : item.email.toLowerCase()
1167
1161
  }));
1168
1162
  }, [props.items]);
1169
- console.log("4. Prepared items (before sort hook):", preparedItems);
1170
1163
  console.groupEnd();
1171
1164
  const { items: sortedItems, requestSort, sortConfig } = useSortableData(preparedItems);
1172
- console.log("5. Final sorted items:", sortedItems);
1173
1165
  if (props.items.length === 0) {
1174
1166
  return /* @__PURE__ */ React__namespace.createElement(
1175
1167
  PlaceholderBanner,
@@ -1245,12 +1237,6 @@ function Table$c(props) {
1245
1237
  sortable: true,
1246
1238
  render: (row) => row.hasAccount ? /* @__PURE__ */ React__namespace.createElement(icons.IconCheck, { color: "green" }) : null
1247
1239
  },
1248
- {
1249
- accessor: "lastActivity",
1250
- title: "Last Active",
1251
- sortable: true,
1252
- render: (row) => row.lastActivity ? relativeTimeFromDates(row.lastActivity) : ""
1253
- },
1254
1240
  {
1255
1241
  accessor: "actions",
1256
1242
  title: "",
@@ -2592,7 +2578,7 @@ function Table$4(props) {
2592
2578
  onChange: (value) => props.onRoleChange && props.onRoleChange(row, value),
2593
2579
  data: [{ value: "student", label: "Student" }, { value: "educator", label: "Educator" }, { value: "admin", label: "Admin" }]
2594
2580
  }
2595
- ))), /* @__PURE__ */ React__namespace.createElement("td", null, row.hasAccount && /* @__PURE__ */ React__namespace.createElement(icons.IconCheck, { color: "green" })), /* @__PURE__ */ React__namespace.createElement("td", null, row.numberOfClasses), /* @__PURE__ */ React__namespace.createElement("td", null, row.lastActivity ? relativeTimeFromDates(row.lastActivity) : ""), /* @__PURE__ */ React__namespace.createElement("td", null, /* @__PURE__ */ React__namespace.createElement(core.Group, { noWrap: true, spacing: 0, position: "right" }, !row.readonly && !!props.onDelete && /* @__PURE__ */ React__namespace.createElement(core.ActionIcon, { color: "red" }, /* @__PURE__ */ React__namespace.createElement(icons.IconTrash, { onClick: () => openDeleteModal(row), size: 16, stroke: 1.5 }))))));
2581
+ ))), /* @__PURE__ */ React__namespace.createElement("td", null, row.hasAccount && /* @__PURE__ */ React__namespace.createElement(icons.IconCheck, { color: "green" })), /* @__PURE__ */ React__namespace.createElement("td", null, row.numberOfClasses), /* @__PURE__ */ React__namespace.createElement("td", null, /* @__PURE__ */ React__namespace.createElement(core.Group, { noWrap: true, spacing: 0, position: "right" }, !row.readonly && !!props.onDelete && /* @__PURE__ */ React__namespace.createElement(core.ActionIcon, { color: "red" }, /* @__PURE__ */ React__namespace.createElement(icons.IconTrash, { onClick: () => openDeleteModal(row), size: 16, stroke: 1.5 }))))));
2596
2582
  return /* @__PURE__ */ React__namespace.createElement(core.ScrollArea, null, /* @__PURE__ */ React__namespace.createElement(core.Table, { verticalSpacing: 20, sx: { minWidth: 700 }, highlightOnHover: true, striped: true }, /* @__PURE__ */ React__namespace.createElement("thead", null, /* @__PURE__ */ React__namespace.createElement("tr", null, /* @__PURE__ */ React__namespace.createElement("th", null, "Name"), /* @__PURE__ */ React__namespace.createElement("th", null, "Role"), /* @__PURE__ */ React__namespace.createElement("th", null, "Account Created?"), /* @__PURE__ */ React__namespace.createElement("th", null, "# of Classes"), /* @__PURE__ */ React__namespace.createElement("th", null, "Last Active"), /* @__PURE__ */ React__namespace.createElement("th", null))), /* @__PURE__ */ React__namespace.createElement("tbody", null, rows)));
2597
2583
  }
2598
2584
 
@@ -3811,22 +3797,6 @@ const SplitButton = (props) => {
3811
3797
  const { classes, theme } = useStyles$1();
3812
3798
  theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
3813
3799
  return /* @__PURE__ */ React__namespace.createElement(core.Stack, { spacing: "sm" }, /* @__PURE__ */ React__namespace.createElement(
3814
- core.Button,
3815
- {
3816
- component: reactRouterDom.Link,
3817
- to: props.href,
3818
- className: classes.button,
3819
- variant: "gradient"
3820
- },
3821
- "Preview"
3822
- ), /* @__PURE__ */ React__namespace.createElement(
3823
- core.Button,
3824
- {
3825
- leftIcon: /* @__PURE__ */ React__namespace.createElement(icons.IconClipboardCopy, { size: 14 }),
3826
- onClick: props.onCopyLinkClick
3827
- },
3828
- "Copy link"
3829
- ), /* @__PURE__ */ React__namespace.createElement(
3830
3800
  core.Button,
3831
3801
  {
3832
3802
  leftIcon: /* @__PURE__ */ React__namespace.createElement(icons.IconTableExport, { size: 14 }),
@@ -4005,25 +3975,41 @@ const useStyles = core.createStyles((theme) => ({
4005
3975
  }));
4006
3976
  const BadgeTable = ({ badges, students, loading }) => {
4007
3977
  const { byBadge } = useFilteredStudents(students);
4008
- 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(
4009
- Table,
4010
- {
4011
- loading,
4012
- items: byBadge(b.badgeId),
4013
- hideBadge: true
4014
- }
4015
- )))));
3978
+ const countFiles = (students2) => students2.reduce((acc, s) => {
3979
+ var _a;
3980
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
3981
+ }, 0);
3982
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, badges.map((b) => {
3983
+ const studentsForBadge = byBadge(b.badgeId);
3984
+ const fileCount = countFiles(studentsForBadge);
3985
+ 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(
3986
+ Table,
3987
+ {
3988
+ loading,
3989
+ items: studentsForBadge,
3990
+ hideBadge: true
3991
+ }
3992
+ )));
3993
+ }));
4016
3994
  };
4017
3995
  const LessonTableWrapper = ({ lessons, students, loading }) => {
4018
3996
  const { byLesson } = useFilteredStudents(students);
4019
- 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(
4020
- Table,
4021
- {
4022
- loading,
4023
- items: byLesson(l.lessonName),
4024
- hideLesson: true
4025
- }
4026
- )))));
3997
+ const countFiles = (students2) => students2.reduce((acc, s) => {
3998
+ var _a;
3999
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
4000
+ }, 0);
4001
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, lessons.map((l) => {
4002
+ const studentsForLesson = byLesson(l.lessonName);
4003
+ const fileCount = countFiles(studentsForLesson);
4004
+ 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(
4005
+ Table,
4006
+ {
4007
+ loading,
4008
+ items: studentsForLesson,
4009
+ hideLesson: true
4010
+ }
4011
+ )));
4012
+ }));
4027
4013
  };
4028
4014
  const PathwayTable = ({
4029
4015
  pathways,
@@ -4032,13 +4018,21 @@ const PathwayTable = ({
4032
4018
  loading
4033
4019
  }) => {
4034
4020
  const { byPathway } = useFilteredStudents(students);
4035
- 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(
4036
- Table,
4037
- {
4038
- loading,
4039
- items: byPathway(p.pathwayId, badges)
4040
- }
4041
- )))));
4021
+ const countFiles = (students2) => students2.reduce((acc, s) => {
4022
+ var _a;
4023
+ return acc + (((_a = s.submissions) == null ? void 0 : _a.length) || 0);
4024
+ }, 0);
4025
+ return /* @__PURE__ */ React__namespace.createElement(core.Accordion, null, pathways.map((p) => {
4026
+ const studentsForPathway = byPathway(p.pathwayId, badges);
4027
+ const fileCount = countFiles(studentsForPathway);
4028
+ 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(
4029
+ Table,
4030
+ {
4031
+ loading,
4032
+ items: studentsForPathway
4033
+ }
4034
+ )));
4035
+ }));
4042
4036
  };
4043
4037
  const FileLocker = (props) => {
4044
4038
  const { classes } = useStyles();