@local-civics/mgmt-ui 0.1.200 → 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
@@ -3811,22 +3811,6 @@ const SplitButton = (props) => {
3811
3811
  const { classes, theme } = useStyles$1();
3812
3812
  theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
3813
3813
  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
3814
  core.Button,
3831
3815
  {
3832
3816
  leftIcon: /* @__PURE__ */ React__namespace.createElement(icons.IconTableExport, { size: 14 }),
@@ -4005,25 +3989,41 @@ const useStyles = core.createStyles((theme) => ({
4005
3989
  }));
4006
3990
  const BadgeTable = ({ badges, students, loading }) => {
4007
3991
  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
- )))));
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
+ }));
4016
4008
  };
4017
4009
  const LessonTableWrapper = ({ lessons, students, loading }) => {
4018
4010
  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
- )))));
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
+ }));
4027
4027
  };
4028
4028
  const PathwayTable = ({
4029
4029
  pathways,
@@ -4032,13 +4032,21 @@ const PathwayTable = ({
4032
4032
  loading
4033
4033
  }) => {
4034
4034
  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
- )))));
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
+ }));
4042
4050
  };
4043
4051
  const FileLocker = (props) => {
4044
4052
  const { classes } = useStyles();