@local-civics/mgmt-ui 0.1.87 → 0.1.90

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
@@ -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;
@@ -565,7 +568,7 @@ type StartAnonymousLessonProps = {
565
568
  description: string;
566
569
  educatorName: string;
567
570
  studentName?: string;
568
- onStart: () => void;
571
+ onStart: (name: string) => void;
569
572
  };
570
573
  /**
571
574
  * StartAnonymousLesson
@@ -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) => {
@@ -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
  {
@@ -1906,13 +1932,18 @@ const Lesson = (props) => {
1906
1932
  onCopyLinkClick: props.onCopyLinkClick,
1907
1933
  onExportDataClick: props.onExportDataClick
1908
1934
  }
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: [
1935
+ ))))), /* @__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(
1936
+ StatsGroup,
1910
1937
  {
1911
- title: props.trial ? "# OF SUBMISSIONS" : "LESSON COMPLETION",
1912
- value: props.trial ? props.lessonsCompleted || 0 : percentageOfLessonsCompleted,
1913
- unit: props.trial ? "" : "%"
1938
+ data: [
1939
+ {
1940
+ title: props.trial ? "# OF SUBMISSIONS" : "LESSON COMPLETION",
1941
+ value: props.trial ? props.lessonsCompleted || 0 : percentageOfLessonsCompleted,
1942
+ unit: props.trial ? "" : "%"
1943
+ }
1944
+ ]
1914
1945
  }
1915
- ] }), !props.trial && /* @__PURE__ */ React__namespace.createElement(
1946
+ ), /* @__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
1947
  core.Select,
1917
1948
  {
1918
1949
  clearable: true,
@@ -2476,7 +2507,7 @@ const StartAnonymousLesson = (props) => {
2476
2507
  onChange: (e) => setName(e.target.value),
2477
2508
  classNames: { input: classes.input, label: classes.inputLabel }
2478
2509
  }
2479
- ), /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "right", mt: "md" }, /* @__PURE__ */ React__namespace.createElement(core.Button, { disabled: !name && !props.studentName, onClick: props.onStart, className: classes.control }, !props.studentName ? "Start lesson" : "Continue lesson"))))));
2510
+ ), /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "right", mt: "md" }, /* @__PURE__ */ React__namespace.createElement(core.Button, { disabled: !name && !props.studentName, onClick: () => props.onStart(name), className: classes.control }, !props.studentName ? "Start lesson" : "Continue lesson"))))));
2480
2511
  };
2481
2512
 
2482
2513
  var __defProp$3 = Object.defineProperty;
@@ -2500,21 +2531,6 @@ const BadgeGrid = (props) => {
2500
2531
  return /* @__PURE__ */ React__namespace.createElement(core.SimpleGrid, { cols: 3, breakpoints: [{ maxWidth: "sm", cols: 1 }] }, badges);
2501
2532
  };
2502
2533
  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
2534
  const isComplete = props.lessonsCompleted >= props.lessonsTotal;
2519
2535
  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(
2520
2536
  core.Text,
@@ -2524,7 +2540,7 @@ function TaskCard(props) {
2524
2540
  sx: (theme) => ({ color: theme.colorScheme === "dark" ? theme.white : theme.black })
2525
2541
  },
2526
2542
  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))));
2543
+ )), !!props.lessonsTotal && /* @__PURE__ */ React__namespace.createElement(core.Progress, { value: props.lessonsCompleted / props.lessonsTotal * 100, mt: 5 }));
2528
2544
  }
2529
2545
 
2530
2546
  const TrialHome = (props) => {
@@ -2589,6 +2605,8 @@ const useStyles$2 = core.createStyles((theme, { checked }) => ({
2589
2605
  border: `1px solid ${checked ? theme.fn.variant({ variant: "outline", color: theme.primaryColor }).border : theme.colorScheme === "dark" ? theme.colors.dark[8] : theme.colors.gray[3]}`,
2590
2606
  borderRadius: theme.radius.sm,
2591
2607
  padding: theme.spacing.md,
2608
+ paddingTop: theme.spacing.sm,
2609
+ paddingBottom: theme.spacing.sm,
2592
2610
  backgroundColor: checked ? theme.fn.variant({ variant: "light", color: theme.primaryColor }).background : theme.colorScheme === "dark" ? theme.colors.dark[8] : theme.white
2593
2611
  },
2594
2612
  body: {
@@ -2748,7 +2766,7 @@ const TrialRegistration = (props) => {
2748
2766
  const [lastName, setLastName] = React__namespace.useState("");
2749
2767
  const [schoolName, setSchoolName] = React__namespace.useState("");
2750
2768
  const [interests, setInterests] = React__namespace.useState({});
2751
- return /* @__PURE__ */ React__namespace.createElement("div", { className: classes.wrapper }, /* @__PURE__ */ React__namespace.createElement(core.SimpleGrid, { maw: 1200, ml: "auto", mr: "auto", cols: 2, spacing: 50, breakpoints: [{ maxWidth: "md", cols: 1 }] }, /* @__PURE__ */ React__namespace.createElement(core.Group, { spacing: "sm" }, /* @__PURE__ */ React__namespace.createElement(
2769
+ return /* @__PURE__ */ React__namespace.createElement("div", { className: classes.wrapper }, /* @__PURE__ */ React__namespace.createElement(core.SimpleGrid, { maw: 1300, ml: "auto", mr: "auto", cols: 2, spacing: 50, breakpoints: [{ maxWidth: "md", cols: 1 }] }, /* @__PURE__ */ React__namespace.createElement(core.Group, { spacing: "sm" }, /* @__PURE__ */ React__namespace.createElement(
2752
2770
  core.Image,
2753
2771
  {
2754
2772
  height: 200,