@local-civics/mgmt-ui 0.1.92 → 0.1.94

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
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useState } from 'react';
3
3
  import { createStyles, Group, Avatar, Text, Box, Badge as Badge$1, ThemeIcon, Collapse, Navbar as Navbar$1, Center, Image, Code, Burger, ScrollArea, UnstyledButton, Card, Modal, Loader, SimpleGrid, Tabs as Tabs$1, Button, Menu, ActionIcon, Title, Grid, Table as Table$h, Container, Stack as Stack$3, LoadingOverlay, Select, Autocomplete, Drawer, Divider, TextInput, Tooltip, Paper, Overlay, Anchor, Progress, Checkbox, createEmotionCache, MantineProvider, AppShell } from '@mantine/core';
4
- import { IconChevronRight, IconChevronLeft, IconSwitchHorizontal, IconLogout, IconHome2, IconGauge, IconCategory2, IconAlbum, IconLambda, IconBuilding, IconBatteryEco, IconBooks, IconBackpack, IconChevronDown, IconClipboardCopy, IconTableExport, IconArrowLeft, IconPlaylistAdd, IconCheck, IconTrash, IconDownload, IconX, IconCloudUpload, IconInfoCircle, IconColorSwatch, IconPointer, IconBadge, IconHistory, IconLego, IconNews, IconTools, IconPodium, IconAffiliate, IconGrowth, IconBrandInstagram, IconBrandLinkedin, IconBrandFacebook } from '@tabler/icons';
4
+ import { IconChevronRight, IconChevronLeft, IconSwitchHorizontal, IconLogout, IconHome2, IconGauge, IconCategory2, IconAlbum, IconLambda, IconBuilding, IconBatteryEco, IconBooks, IconBackpack, IconChevronDown, IconClipboardCopy, IconTableExport, IconArrowLeft, IconPlaylistAdd, IconCheck, IconTrash, IconDownload, IconX, IconCloudUpload, IconInfoCircle, IconColorSwatch, IconPointer, IconBadge, IconScribble, IconSchool, IconPodium, IconBriefcase, IconPresentation, IconNews, IconTools, IconBrandInstagram, IconBrandLinkedin, IconBrandFacebook } from '@tabler/icons';
5
5
  import { Link } from 'react-router-dom';
6
6
  import { NotificationsProvider } from '@mantine/notifications';
7
7
  export { showNotification, updateNotification } from '@mantine/notifications';
@@ -1701,7 +1701,15 @@ const useStyles$a = createStyles((theme) => ({
1701
1701
  const SplitButton$1 = (props) => {
1702
1702
  const { classes, theme } = useStyles$a();
1703
1703
  const menuIconColor = theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
1704
- return /* @__PURE__ */ React.createElement(Group, { noWrap: true, spacing: 0 }, /* @__PURE__ */ React.createElement(
1704
+ return /* @__PURE__ */ React.createElement(Stack$3, { spacing: "sm" }, /* @__PURE__ */ React.createElement(
1705
+ Button,
1706
+ {
1707
+ variant: "gradient",
1708
+ leftIcon: /* @__PURE__ */ React.createElement(IconClipboardCopy, { size: 14 }),
1709
+ onClick: props.onCopyLinkClick
1710
+ },
1711
+ "Assign"
1712
+ ), /* @__PURE__ */ React.createElement(Group, { noWrap: true, spacing: 0 }, /* @__PURE__ */ React.createElement(
1705
1713
  Button,
1706
1714
  {
1707
1715
  component: Link,
@@ -1719,21 +1727,14 @@ const SplitButton$1 = (props) => {
1719
1727
  className: classes.menuControl
1720
1728
  },
1721
1729
  /* @__PURE__ */ React.createElement(IconChevronDown, { size: 16, stroke: 1.5 })
1722
- )), /* @__PURE__ */ React.createElement(Menu.Dropdown, null, /* @__PURE__ */ React.createElement(
1723
- Menu.Item,
1724
- {
1725
- icon: /* @__PURE__ */ React.createElement(IconClipboardCopy, { size: 16, stroke: 1.5, color: menuIconColor }),
1726
- onClick: props.onCopyLinkClick
1727
- },
1728
- "Copy link"
1729
- ), !props.noExport && /* @__PURE__ */ React.createElement(
1730
+ )), /* @__PURE__ */ React.createElement(Menu.Dropdown, null, !props.noExport && /* @__PURE__ */ React.createElement(
1730
1731
  Menu.Item,
1731
1732
  {
1732
1733
  icon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 16, stroke: 1.5, color: menuIconColor }),
1733
1734
  onClick: props.onExportDataClick
1734
1735
  },
1735
1736
  "Export data (.csv)"
1736
- ))));
1737
+ )))));
1737
1738
  };
1738
1739
 
1739
1740
  function Stack$1(props) {
@@ -1897,6 +1898,14 @@ const Lesson = (props) => {
1897
1898
  });
1898
1899
  avatars.push(/* @__PURE__ */ React.createElement(Avatar, { src, radius: "xl" }));
1899
1900
  }
1901
+ const tabs = props.trial ? [
1902
+ { label: "By question", value: "question" },
1903
+ { label: "By student", value: "students" }
1904
+ ] : [
1905
+ { label: "By question", value: "question" },
1906
+ { label: "By student", value: "students" },
1907
+ { label: "By reflection", value: "reflections" }
1908
+ ];
1900
1909
  return /* @__PURE__ */ React.createElement(Container, { size: "lg", py: "xl" }, /* @__PURE__ */ React.createElement(Stack$3, { spacing: "md" }, /* @__PURE__ */ React.createElement(Grid, null, /* @__PURE__ */ React.createElement(Grid.Col, { sm: "auto" }, /* @__PURE__ */ React.createElement(UnstyledButton, { onClick: props.onBackClick }, /* @__PURE__ */ React.createElement(
1901
1910
  Badge$1,
1902
1911
  {
@@ -1939,30 +1948,26 @@ const Lesson = (props) => {
1939
1948
  return { value: g.classId, label: g.name };
1940
1949
  })
1941
1950
  }
1942
- ), /* @__PURE__ */ React.createElement(Stack$3, { spacing: 0 }, !props.trial && /* @__PURE__ */ React.createElement(
1951
+ ), /* @__PURE__ */ React.createElement(Stack$3, { spacing: 0 }, /* @__PURE__ */ React.createElement(
1943
1952
  Tabs,
1944
1953
  {
1945
1954
  value: tab,
1946
- data: [
1947
- { label: "By question", value: "question" },
1948
- { label: "By student", value: "students" },
1949
- { label: "By reflection", value: "reflections" }
1950
- ],
1955
+ data: tabs,
1951
1956
  onChange: setTab
1952
1957
  }
1953
- ), (!!props.trial || tab === "question") && /* @__PURE__ */ React.createElement(
1958
+ ), tab === "question" && /* @__PURE__ */ React.createElement(
1954
1959
  Stack,
1955
1960
  {
1956
1961
  loading: props.loading,
1957
1962
  items: props.questions
1958
1963
  }
1959
- ), !props.trial && tab === "reflections" && /* @__PURE__ */ React.createElement(
1964
+ ), tab === "reflections" && /* @__PURE__ */ React.createElement(
1960
1965
  Table$3,
1961
1966
  {
1962
1967
  loading: props.loading,
1963
1968
  items: props.reflections
1964
1969
  }
1965
- ), !props.trial && tab === "students" && /* @__PURE__ */ React.createElement(
1970
+ ), tab === "students" && /* @__PURE__ */ React.createElement(
1966
1971
  Table$2,
1967
1972
  {
1968
1973
  loading: props.loading,
@@ -2626,7 +2631,7 @@ function ImageCheckbox(_a) {
2626
2631
  onClick: () => handleChange(!value),
2627
2632
  className: cx(classes.button, className)
2628
2633
  }),
2629
- /* @__PURE__ */ React.createElement(ThemeIcon, { variant: "light", size: "lg", color: "blue" }, /* @__PURE__ */ React.createElement(Icon, { size: 40 })),
2634
+ /* @__PURE__ */ React.createElement(ThemeIcon, { variant: "light", size: "lg", color: "blue" }, /* @__PURE__ */ React.createElement(Icon, { size: 25 })),
2630
2635
  /* @__PURE__ */ React.createElement("div", { className: classes.body }, /* @__PURE__ */ React.createElement(Text, { weight: 500, size: "sm", sx: { lineHeight: 1 } }, title)),
2631
2636
  /* @__PURE__ */ React.createElement(
2632
2637
  Checkbox,
@@ -2732,19 +2737,21 @@ const useStyles$1 = createStyles((theme) => ({
2732
2737
  }
2733
2738
  }));
2734
2739
  const OPTIONS = [
2735
- { description: "high school", title: "High school", icon: IconHistory },
2736
- { description: "k - 8th", title: "K - 8th", icon: IconLego },
2737
- { description: "civics", title: "Civics", icon: IconNews },
2738
- { description: "project-based learning", title: "Project-based learning", icon: IconTools },
2740
+ { description: "elementary", title: "Elementary (K-5)", icon: IconScribble },
2741
+ { description: "middle", title: "Middle (6-8)", icon: IconBackpack },
2742
+ { description: "high school", title: "High School (9-12)", icon: IconSchool },
2739
2743
  { description: "college", title: "College", icon: IconPodium },
2740
- { description: "career", title: "Career", icon: IconAffiliate },
2741
- { description: "student leadership", title: "Student leadership", icon: IconGrowth }
2744
+ { description: "career", title: "Career", icon: IconBriefcase },
2745
+ { description: "work-based learning", title: "Work-Based Learning", icon: IconPresentation },
2746
+ { description: "student leadership", title: "Student Leadership", icon: IconPodium },
2747
+ { description: "civics", title: "Civics", icon: IconNews },
2748
+ { description: "project-based learning", title: "Project-Based Learning", icon: IconTools }
2742
2749
  ];
2743
2750
  const TrialRegistration = (props) => {
2744
2751
  const { classes } = useStyles$1();
2745
2752
  const [firstName, setFirstName] = React.useState("");
2746
2753
  const [lastName, setLastName] = React.useState("");
2747
- const [schoolName, setSchoolName] = React.useState("");
2754
+ const [organization, setOrganization] = React.useState({ organizationId: "", displayName: "" });
2748
2755
  const [interests, setInterests] = React.useState({});
2749
2756
  return /* @__PURE__ */ React.createElement("div", { className: classes.wrapper }, /* @__PURE__ */ React.createElement(SimpleGrid, { maw: 1300, ml: "auto", mr: "auto", cols: 2, spacing: 50, breakpoints: [{ maxWidth: "md", cols: 1 }] }, /* @__PURE__ */ React.createElement(Group, { spacing: "sm" }, /* @__PURE__ */ React.createElement(
2750
2757
  Image,
@@ -2782,14 +2789,20 @@ const TrialRegistration = (props) => {
2782
2789
  onChange: (e) => setLastName(e.target.value)
2783
2790
  }
2784
2791
  ), /* @__PURE__ */ React.createElement(
2785
- TextInput,
2792
+ Autocomplete,
2786
2793
  {
2787
- label: "School Name (Optional)",
2794
+ label: "School/Organization Name",
2788
2795
  placeholder: "What's the name of your school?",
2789
- classNames: { input: classes.input, label: classes.inputLabel },
2790
- onChange: (e) => setSchoolName(e.target.value)
2796
+ data: props.organizations.map((o) => {
2797
+ return __spreadProps$1(__spreadValues$1({}, o), { value: o.displayName });
2798
+ }),
2799
+ onItemSubmit: (item) => setOrganization({ organizationId: item.organizationId, displayName: item.displayName }),
2800
+ onChange: (next) => {
2801
+ setOrganization({ organizationId: "", displayName: next });
2802
+ return props.onQueryOrganizations(next);
2803
+ }
2791
2804
  }
2792
- )), /* @__PURE__ */ React.createElement(Text, { size: 14, weight: 500, mb: "md", mt: "xl" }, "What are you interested in teaching?"), /* @__PURE__ */ React.createElement(
2805
+ )), /* @__PURE__ */ React.createElement(Text, { size: 14, weight: 500, mb: "md", mt: "xl" }, "Where do you want to start? (Select as many as you want)"), /* @__PURE__ */ React.createElement(
2793
2806
  SelectGrid,
2794
2807
  {
2795
2808
  items: OPTIONS,
@@ -2799,7 +2812,13 @@ const TrialRegistration = (props) => {
2799
2812
  Button,
2800
2813
  {
2801
2814
  disabled: !firstName || !lastName,
2802
- onClick: () => props.onBegin({ firstName, lastName, schoolName, interests: Object.keys(interests) }),
2815
+ onClick: () => props.onBegin({
2816
+ firstName,
2817
+ lastName,
2818
+ organizationId: organization.organizationId,
2819
+ organizationName: organization.displayName,
2820
+ interests: Object.keys(interests)
2821
+ }),
2803
2822
  className: classes.control
2804
2823
  },
2805
2824
  "Begin trial"