@local-civics/mgmt-ui 0.1.88 → 0.1.91

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.d.ts CHANGED
@@ -106,7 +106,7 @@ type BadgeProps = {
106
106
  students: BadgeUserItem[];
107
107
  href: string;
108
108
  trial?: boolean;
109
- badgesEarned?: number;
109
+ lessonsCompleted?: number;
110
110
  onBackClick: () => void;
111
111
  onClassChange: (classId: string) => void;
112
112
  onCopyLinkClick: () => void;
@@ -449,6 +449,9 @@ type LessonProps = {
449
449
  questions: Item$2[];
450
450
  trial?: boolean;
451
451
  lessonsCompleted?: number;
452
+ contributors?: {
453
+ name: string;
454
+ }[];
452
455
  onBackClick: () => void;
453
456
  onClassChange: (classId: string) => void;
454
457
  onCopyLinkClick: () => void;
@@ -586,9 +589,6 @@ type TaskCardProps = {
586
589
  lessonsCompleted: number;
587
590
  lessonsTotal: number;
588
591
  href: string;
589
- users: {
590
- name: string;
591
- }[];
592
592
  };
593
593
 
594
594
  /**
package/dist/index.js CHANGED
@@ -10,8 +10,8 @@ var dropzone = require('@mantine/dropzone');
10
10
  var form = require('@mantine/form');
11
11
  var papa = require('papaparse');
12
12
  var modals = require('@mantine/modals');
13
- var reactCharts = require('react-charts');
14
13
  var AvatarInit = require('avatar-initials');
14
+ var reactCharts = require('react-charts');
15
15
  var hooks = require('@mantine/hooks');
16
16
 
17
17
  function _interopNamespaceDefault(e) {
@@ -403,10 +403,7 @@ const useStyles$k = core.createStyles((theme) => ({
403
403
  display: "flex",
404
404
  backgroundImage: `linear-gradient(-60deg, ${theme.colors[theme.primaryColor][4]} 0%, ${theme.colors[theme.primaryColor][7]} 100%)`,
405
405
  padding: theme.spacing.xl * 1.5,
406
- borderRadius: theme.radius.md,
407
- [theme.fn.smallerThan("sm")]: {
408
- flexDirection: "column"
409
- }
406
+ borderRadius: theme.radius.md
410
407
  },
411
408
  title: {
412
409
  color: theme.white,
@@ -444,7 +441,7 @@ const useStyles$k = core.createStyles((theme) => ({
444
441
  }
445
442
  }
446
443
  }));
447
- const StatsGroup = ({ data }) => {
444
+ const StatsGroup = ({ data, footer }) => {
448
445
  const { classes } = useStyles$k();
449
446
  const stats = data.map((stat) => {
450
447
  const value = (() => {
@@ -455,7 +452,7 @@ const StatsGroup = ({ data }) => {
455
452
  })();
456
453
  return /* @__PURE__ */ React__namespace.createElement("div", { key: stat.title, className: classes.stat }, /* @__PURE__ */ React__namespace.createElement(core.Text, { className: classes.count }, value.toLocaleString(), stat.unit), /* @__PURE__ */ React__namespace.createElement(core.Text, { className: classes.title }, stat.title));
457
454
  });
458
- return /* @__PURE__ */ React__namespace.createElement("div", { className: classes.root }, stats);
455
+ return /* @__PURE__ */ React__namespace.createElement("div", { className: classes.root }, stats, footer);
459
456
  };
460
457
 
461
458
  const Tabs = (props) => {
@@ -674,7 +671,7 @@ const Badge = (props) => {
674
671
  ))))), /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React__namespace.createElement(core.LoadingOverlay, { visible: props.loading, overlayBlur: 2 }), /* @__PURE__ */ React__namespace.createElement(core.Stack, null, /* @__PURE__ */ React__namespace.createElement(StatsGroup, { data: [
675
672
  {
676
673
  title: props.trial ? "LESSONS SUBMITTED" : "BADGE COMPLETION",
677
- value: props.trial ? props.badgesEarned || 0 : percentageOfBadgesEarned,
674
+ value: props.trial ? props.lessonsCompleted || 0 : percentageOfBadgesEarned,
678
675
  unit: props.trial ? "" : "%"
679
676
  }
680
677
  ] }), !props.trial && /* @__PURE__ */ React__namespace.createElement(
@@ -1749,7 +1746,7 @@ const SplitButton$1 = (props) => {
1749
1746
  onClick: props.onCopyLinkClick
1750
1747
  },
1751
1748
  "Copy link"
1752
- ), /* @__PURE__ */ React__namespace.createElement(
1749
+ ), !props.noExport && /* @__PURE__ */ React__namespace.createElement(
1753
1750
  core.Menu.Item,
1754
1751
  {
1755
1752
  icon: /* @__PURE__ */ React__namespace.createElement(icons.IconTableExport, { size: 16, stroke: 1.5, color: menuIconColor }),
@@ -1891,6 +1888,35 @@ const Lesson = (props) => {
1891
1888
  const [tab, setTab] = React.useState("question");
1892
1889
  const numberOfStudents = props.students.length;
1893
1890
  const percentageOfLessonsCompleted = numberOfStudents > 0 ? props.students.filter((u) => u.isComplete).length / numberOfStudents : 0;
1891
+ const contributors = props.contributors || [];
1892
+ const avatars = contributors.slice(0, 5).map((u, i) => {
1893
+ const fullName = u.name;
1894
+ let initials = fullName.split(/[ -]/).map((n) => n.charAt(0)).join("");
1895
+ const src = AvatarInit.initialAvatar({
1896
+ background: "#1c7ed6",
1897
+ color: "#fff",
1898
+ fontFamily: "'Lato', 'Lato-Regular', 'Helvetica Neue'",
1899
+ fontSize: 10,
1900
+ fontWeight: 250,
1901
+ size: 30,
1902
+ initials
1903
+ });
1904
+ return /* @__PURE__ */ React__namespace.createElement(core.Avatar, { key: i, src, radius: "xl" });
1905
+ });
1906
+ const remainingUsers = contributors.slice(5).length;
1907
+ if (remainingUsers) {
1908
+ const initials = "+" + compact(remainingUsers);
1909
+ const src = AvatarInit.initialAvatar({
1910
+ background: "#1c7ed6",
1911
+ color: "#fff",
1912
+ fontFamily: "'Lato', 'Lato-Regular', 'Helvetica Neue'",
1913
+ fontSize: 10,
1914
+ fontWeight: 250,
1915
+ size: 30,
1916
+ initials
1917
+ });
1918
+ avatars.push(/* @__PURE__ */ React__namespace.createElement(core.Avatar, { src, radius: "xl" }));
1919
+ }
1894
1920
  return /* @__PURE__ */ React__namespace.createElement(core.Container, { size: "lg", py: "xl" }, /* @__PURE__ */ React__namespace.createElement(core.Stack, { spacing: "md" }, /* @__PURE__ */ React__namespace.createElement(core.Grid, null, /* @__PURE__ */ React__namespace.createElement(core.Grid.Col, { sm: "auto" }, /* @__PURE__ */ React__namespace.createElement(core.UnstyledButton, { onClick: props.onBackClick }, /* @__PURE__ */ React__namespace.createElement(
1895
1921
  core.Badge,
1896
1922
  {
@@ -1903,16 +1929,22 @@ const Lesson = (props) => {
1903
1929
  SplitButton$1,
1904
1930
  {
1905
1931
  href: props.href,
1932
+ noExport: props.trial,
1906
1933
  onCopyLinkClick: props.onCopyLinkClick,
1907
1934
  onExportDataClick: props.onExportDataClick
1908
1935
  }
1909
- ))))), /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React__namespace.createElement(core.LoadingOverlay, { visible: props.loading, overlayBlur: 2 }), /* @__PURE__ */ React__namespace.createElement(core.Stack, null, /* @__PURE__ */ React__namespace.createElement(StatsGroup, { data: [
1936
+ ))))), /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React__namespace.createElement(core.LoadingOverlay, { visible: props.loading, overlayBlur: 2 }), /* @__PURE__ */ React__namespace.createElement(core.Stack, null, /* @__PURE__ */ React__namespace.createElement(
1937
+ StatsGroup,
1910
1938
  {
1911
- title: props.trial ? "# OF SUBMISSIONS" : "LESSON COMPLETION",
1912
- value: props.trial ? props.lessonsCompleted || 0 : percentageOfLessonsCompleted,
1913
- unit: props.trial ? "" : "%"
1939
+ data: [
1940
+ {
1941
+ title: props.trial ? "# OF SUBMISSIONS" : "LESSON COMPLETION",
1942
+ value: props.trial ? props.lessonsCompleted || 0 : percentageOfLessonsCompleted,
1943
+ unit: props.trial ? "" : "%"
1944
+ }
1945
+ ]
1914
1946
  }
1915
- ] }), !props.trial && /* @__PURE__ */ React__namespace.createElement(
1947
+ ), /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "apart" }, /* @__PURE__ */ React__namespace.createElement(core.Avatar.Group, { spacing: "sm" }, avatars)), !props.trial && /* @__PURE__ */ React__namespace.createElement(
1916
1948
  core.Select,
1917
1949
  {
1918
1950
  clearable: true,
@@ -2500,23 +2532,8 @@ const BadgeGrid = (props) => {
2500
2532
  return /* @__PURE__ */ React__namespace.createElement(core.SimpleGrid, { cols: 3, breakpoints: [{ maxWidth: "sm", cols: 1 }] }, badges);
2501
2533
  };
2502
2534
  function TaskCard(props) {
2503
- const avatars = props.users.slice(0, 3).map((u, i) => {
2504
- const fullName = u.name;
2505
- let initials = fullName.split(/[ -]/).map((n) => n.charAt(0)).join("");
2506
- const src = AvatarInit.initialAvatar({
2507
- background: "#f4f6f7",
2508
- color: "#888888",
2509
- fontFamily: "'Lato', 'Lato-Regular', 'Helvetica Neue'",
2510
- fontSize: 10,
2511
- fontWeight: 250,
2512
- size: 30,
2513
- initials
2514
- });
2515
- return /* @__PURE__ */ React__namespace.createElement(core.Avatar, { key: i, src, radius: "xl" });
2516
- });
2517
- const remainingUsers = props.users.slice(3).length;
2518
2535
  const isComplete = props.lessonsCompleted >= props.lessonsTotal;
2519
- return /* @__PURE__ */ React__namespace.createElement(core.Card, { withBorder: true, radius: "md" }, /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "apart" }, /* @__PURE__ */ React__namespace.createElement(core.ThemeIcon, { size: "lg", variant: "gradient", gradient: { from: "indigo", to: "cyan" } }, /* @__PURE__ */ React__namespace.createElement(icons.IconBadge, { size: 20 })), !!props.lessonsTotal && isComplete && /* @__PURE__ */ React__namespace.createElement(core.Badge, { variant: "gradient", gradient: { from: "indigo", to: "cyan" } }, "Complete"), !!props.lessonsTotal && !isComplete && /* @__PURE__ */ React__namespace.createElement(core.Badge, { variant: "filled" }, "Incomplete")), /* @__PURE__ */ React__namespace.createElement(core.UnstyledButton, { component: reactRouterDom.Link, to: props.href, mt: "md", sx: { ":hover": { textDecoration: "underline" } } }, /* @__PURE__ */ React__namespace.createElement(core.Text, { size: "lg", weight: 500 }, props.title)), /* @__PURE__ */ React__namespace.createElement(core.Text, { size: "sm", color: "dimmed", mt: 5 }, props.description), !!props.lessonsCompleted && /* @__PURE__ */ React__namespace.createElement(core.Text, { color: "dimmed", size: "sm", mt: "md" }, "Lessons completed:", " ", /* @__PURE__ */ React__namespace.createElement(
2536
+ return /* @__PURE__ */ React__namespace.createElement(core.Card, { withBorder: true, radius: "md" }, /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "apart", mb: 20 }, /* @__PURE__ */ React__namespace.createElement(core.ThemeIcon, { size: "lg", variant: "gradient", gradient: { from: "indigo", to: "cyan" } }, /* @__PURE__ */ React__namespace.createElement(icons.IconBadge, { size: 20 })), !!props.lessonsTotal && isComplete && /* @__PURE__ */ React__namespace.createElement(core.Badge, { variant: "gradient", gradient: { from: "indigo", to: "cyan" } }, "Complete"), !!props.lessonsTotal && !isComplete && /* @__PURE__ */ React__namespace.createElement(core.Badge, { variant: "filled" }, "Incomplete")), /* @__PURE__ */ React__namespace.createElement(core.UnstyledButton, { component: reactRouterDom.Link, to: props.href, mt: "md", sx: { ":hover": { textDecoration: "underline" } } }, /* @__PURE__ */ React__namespace.createElement(core.Text, { size: "lg", weight: 500 }, props.title)), /* @__PURE__ */ React__namespace.createElement(core.Text, { size: "sm", color: "dimmed", mt: 5, mb: 50 }, props.description), !!props.lessonsCompleted && /* @__PURE__ */ React__namespace.createElement(core.Text, { color: "dimmed", size: "sm", mt: "md" }, "Lessons completed:", " ", /* @__PURE__ */ React__namespace.createElement(
2520
2537
  core.Text,
2521
2538
  {
2522
2539
  span: true,
@@ -2524,7 +2541,7 @@ function TaskCard(props) {
2524
2541
  sx: (theme) => ({ color: theme.colorScheme === "dark" ? theme.white : theme.black })
2525
2542
  },
2526
2543
  props.lessonsCompleted
2527
- )), !!props.lessonsTotal && /* @__PURE__ */ React__namespace.createElement(core.Progress, { value: props.lessonsCompleted / props.lessonsTotal * 100, mt: 5 }), /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "apart", mt: "md" }, /* @__PURE__ */ React__namespace.createElement(core.Avatar.Group, { spacing: "sm" }, avatars, !!remainingUsers && /* @__PURE__ */ React__namespace.createElement(core.Avatar, { radius: "xl" }, "+", remainingUsers))));
2544
+ )), !!props.lessonsTotal && /* @__PURE__ */ React__namespace.createElement(core.Progress, { value: props.lessonsCompleted / props.lessonsTotal * 100, mt: 5 }));
2528
2545
  }
2529
2546
 
2530
2547
  const TrialHome = (props) => {