@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 +4 -4
- package/dist/index.js +48 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10,8 +10,8 @@ import { Dropzone, MIME_TYPES } from '@mantine/dropzone';
|
|
|
10
10
|
import { useForm } from '@mantine/form';
|
|
11
11
|
import * as papa from 'papaparse';
|
|
12
12
|
import { openConfirmModal, ModalsProvider } from '@mantine/modals';
|
|
13
|
-
import { Chart } from 'react-charts';
|
|
14
13
|
import AvatarInit from 'avatar-initials';
|
|
14
|
+
import { Chart } from 'react-charts';
|
|
15
15
|
import { useUncontrolled } from '@mantine/hooks';
|
|
16
16
|
|
|
17
17
|
var __defProp$9 = Object.defineProperty;
|
|
@@ -383,10 +383,7 @@ const useStyles$k = createStyles((theme) => ({
|
|
|
383
383
|
display: "flex",
|
|
384
384
|
backgroundImage: `linear-gradient(-60deg, ${theme.colors[theme.primaryColor][4]} 0%, ${theme.colors[theme.primaryColor][7]} 100%)`,
|
|
385
385
|
padding: theme.spacing.xl * 1.5,
|
|
386
|
-
borderRadius: theme.radius.md
|
|
387
|
-
[theme.fn.smallerThan("sm")]: {
|
|
388
|
-
flexDirection: "column"
|
|
389
|
-
}
|
|
386
|
+
borderRadius: theme.radius.md
|
|
390
387
|
},
|
|
391
388
|
title: {
|
|
392
389
|
color: theme.white,
|
|
@@ -424,7 +421,7 @@ const useStyles$k = createStyles((theme) => ({
|
|
|
424
421
|
}
|
|
425
422
|
}
|
|
426
423
|
}));
|
|
427
|
-
const StatsGroup = ({ data }) => {
|
|
424
|
+
const StatsGroup = ({ data, footer }) => {
|
|
428
425
|
const { classes } = useStyles$k();
|
|
429
426
|
const stats = data.map((stat) => {
|
|
430
427
|
const value = (() => {
|
|
@@ -435,7 +432,7 @@ const StatsGroup = ({ data }) => {
|
|
|
435
432
|
})();
|
|
436
433
|
return /* @__PURE__ */ React.createElement("div", { key: stat.title, className: classes.stat }, /* @__PURE__ */ React.createElement(Text, { className: classes.count }, value.toLocaleString(), stat.unit), /* @__PURE__ */ React.createElement(Text, { className: classes.title }, stat.title));
|
|
437
434
|
});
|
|
438
|
-
return /* @__PURE__ */ React.createElement("div", { className: classes.root }, stats);
|
|
435
|
+
return /* @__PURE__ */ React.createElement("div", { className: classes.root }, stats, footer);
|
|
439
436
|
};
|
|
440
437
|
|
|
441
438
|
const Tabs = (props) => {
|
|
@@ -654,7 +651,7 @@ const Badge = (props) => {
|
|
|
654
651
|
))))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React.createElement(LoadingOverlay, { visible: props.loading, overlayBlur: 2 }), /* @__PURE__ */ React.createElement(Stack$3, null, /* @__PURE__ */ React.createElement(StatsGroup, { data: [
|
|
655
652
|
{
|
|
656
653
|
title: props.trial ? "LESSONS SUBMITTED" : "BADGE COMPLETION",
|
|
657
|
-
value: props.trial ? props.
|
|
654
|
+
value: props.trial ? props.lessonsCompleted || 0 : percentageOfBadgesEarned,
|
|
658
655
|
unit: props.trial ? "" : "%"
|
|
659
656
|
}
|
|
660
657
|
] }), !props.trial && /* @__PURE__ */ React.createElement(
|
|
@@ -1729,7 +1726,7 @@ const SplitButton$1 = (props) => {
|
|
|
1729
1726
|
onClick: props.onCopyLinkClick
|
|
1730
1727
|
},
|
|
1731
1728
|
"Copy link"
|
|
1732
|
-
), /* @__PURE__ */ React.createElement(
|
|
1729
|
+
), !props.noExport && /* @__PURE__ */ React.createElement(
|
|
1733
1730
|
Menu.Item,
|
|
1734
1731
|
{
|
|
1735
1732
|
icon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 16, stroke: 1.5, color: menuIconColor }),
|
|
@@ -1871,6 +1868,35 @@ const Lesson = (props) => {
|
|
|
1871
1868
|
const [tab, setTab] = useState("question");
|
|
1872
1869
|
const numberOfStudents = props.students.length;
|
|
1873
1870
|
const percentageOfLessonsCompleted = numberOfStudents > 0 ? props.students.filter((u) => u.isComplete).length / numberOfStudents : 0;
|
|
1871
|
+
const contributors = props.contributors || [];
|
|
1872
|
+
const avatars = contributors.slice(0, 5).map((u, i) => {
|
|
1873
|
+
const fullName = u.name;
|
|
1874
|
+
let initials = fullName.split(/[ -]/).map((n) => n.charAt(0)).join("");
|
|
1875
|
+
const src = AvatarInit.initialAvatar({
|
|
1876
|
+
background: "#1c7ed6",
|
|
1877
|
+
color: "#fff",
|
|
1878
|
+
fontFamily: "'Lato', 'Lato-Regular', 'Helvetica Neue'",
|
|
1879
|
+
fontSize: 10,
|
|
1880
|
+
fontWeight: 250,
|
|
1881
|
+
size: 30,
|
|
1882
|
+
initials
|
|
1883
|
+
});
|
|
1884
|
+
return /* @__PURE__ */ React.createElement(Avatar, { key: i, src, radius: "xl" });
|
|
1885
|
+
});
|
|
1886
|
+
const remainingUsers = contributors.slice(5).length;
|
|
1887
|
+
if (remainingUsers) {
|
|
1888
|
+
const initials = "+" + compact(remainingUsers);
|
|
1889
|
+
const src = AvatarInit.initialAvatar({
|
|
1890
|
+
background: "#1c7ed6",
|
|
1891
|
+
color: "#fff",
|
|
1892
|
+
fontFamily: "'Lato', 'Lato-Regular', 'Helvetica Neue'",
|
|
1893
|
+
fontSize: 10,
|
|
1894
|
+
fontWeight: 250,
|
|
1895
|
+
size: 30,
|
|
1896
|
+
initials
|
|
1897
|
+
});
|
|
1898
|
+
avatars.push(/* @__PURE__ */ React.createElement(Avatar, { src, radius: "xl" }));
|
|
1899
|
+
}
|
|
1874
1900
|
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(
|
|
1875
1901
|
Badge$1,
|
|
1876
1902
|
{
|
|
@@ -1883,16 +1909,22 @@ const Lesson = (props) => {
|
|
|
1883
1909
|
SplitButton$1,
|
|
1884
1910
|
{
|
|
1885
1911
|
href: props.href,
|
|
1912
|
+
noExport: props.trial,
|
|
1886
1913
|
onCopyLinkClick: props.onCopyLinkClick,
|
|
1887
1914
|
onExportDataClick: props.onExportDataClick
|
|
1888
1915
|
}
|
|
1889
|
-
))))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React.createElement(LoadingOverlay, { visible: props.loading, overlayBlur: 2 }), /* @__PURE__ */ React.createElement(Stack$3, null, /* @__PURE__ */ React.createElement(
|
|
1916
|
+
))))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React.createElement(LoadingOverlay, { visible: props.loading, overlayBlur: 2 }), /* @__PURE__ */ React.createElement(Stack$3, null, /* @__PURE__ */ React.createElement(
|
|
1917
|
+
StatsGroup,
|
|
1890
1918
|
{
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1919
|
+
data: [
|
|
1920
|
+
{
|
|
1921
|
+
title: props.trial ? "# OF SUBMISSIONS" : "LESSON COMPLETION",
|
|
1922
|
+
value: props.trial ? props.lessonsCompleted || 0 : percentageOfLessonsCompleted,
|
|
1923
|
+
unit: props.trial ? "" : "%"
|
|
1924
|
+
}
|
|
1925
|
+
]
|
|
1894
1926
|
}
|
|
1895
|
-
|
|
1927
|
+
), /* @__PURE__ */ React.createElement(Group, { position: "apart" }, /* @__PURE__ */ React.createElement(Avatar.Group, { spacing: "sm" }, avatars)), !props.trial && /* @__PURE__ */ React.createElement(
|
|
1896
1928
|
Select,
|
|
1897
1929
|
{
|
|
1898
1930
|
clearable: true,
|
|
@@ -2480,23 +2512,8 @@ const BadgeGrid = (props) => {
|
|
|
2480
2512
|
return /* @__PURE__ */ React.createElement(SimpleGrid, { cols: 3, breakpoints: [{ maxWidth: "sm", cols: 1 }] }, badges);
|
|
2481
2513
|
};
|
|
2482
2514
|
function TaskCard(props) {
|
|
2483
|
-
const avatars = props.users.slice(0, 3).map((u, i) => {
|
|
2484
|
-
const fullName = u.name;
|
|
2485
|
-
let initials = fullName.split(/[ -]/).map((n) => n.charAt(0)).join("");
|
|
2486
|
-
const src = AvatarInit.initialAvatar({
|
|
2487
|
-
background: "#f4f6f7",
|
|
2488
|
-
color: "#888888",
|
|
2489
|
-
fontFamily: "'Lato', 'Lato-Regular', 'Helvetica Neue'",
|
|
2490
|
-
fontSize: 10,
|
|
2491
|
-
fontWeight: 250,
|
|
2492
|
-
size: 30,
|
|
2493
|
-
initials
|
|
2494
|
-
});
|
|
2495
|
-
return /* @__PURE__ */ React.createElement(Avatar, { key: i, src, radius: "xl" });
|
|
2496
|
-
});
|
|
2497
|
-
const remainingUsers = props.users.slice(3).length;
|
|
2498
2515
|
const isComplete = props.lessonsCompleted >= props.lessonsTotal;
|
|
2499
|
-
return /* @__PURE__ */ React.createElement(Card, { withBorder: true, radius: "md" }, /* @__PURE__ */ React.createElement(Group, { position: "apart" }, /* @__PURE__ */ React.createElement(ThemeIcon, { size: "lg", variant: "gradient", gradient: { from: "indigo", to: "cyan" } }, /* @__PURE__ */ React.createElement(IconBadge, { size: 20 })), !!props.lessonsTotal && isComplete && /* @__PURE__ */ React.createElement(Badge$1, { variant: "gradient", gradient: { from: "indigo", to: "cyan" } }, "Complete"), !!props.lessonsTotal && !isComplete && /* @__PURE__ */ React.createElement(Badge$1, { variant: "filled" }, "Incomplete")), /* @__PURE__ */ React.createElement(UnstyledButton, { component: Link, to: props.href, mt: "md", sx: { ":hover": { textDecoration: "underline" } } }, /* @__PURE__ */ React.createElement(Text, { size: "lg", weight: 500 }, props.title)), /* @__PURE__ */ React.createElement(Text, { size: "sm", color: "dimmed", mt: 5 }, props.description), !!props.lessonsCompleted && /* @__PURE__ */ React.createElement(Text, { color: "dimmed", size: "sm", mt: "md" }, "Lessons completed:", " ", /* @__PURE__ */ React.createElement(
|
|
2516
|
+
return /* @__PURE__ */ React.createElement(Card, { withBorder: true, radius: "md" }, /* @__PURE__ */ React.createElement(Group, { position: "apart", mb: 20 }, /* @__PURE__ */ React.createElement(ThemeIcon, { size: "lg", variant: "gradient", gradient: { from: "indigo", to: "cyan" } }, /* @__PURE__ */ React.createElement(IconBadge, { size: 20 })), !!props.lessonsTotal && isComplete && /* @__PURE__ */ React.createElement(Badge$1, { variant: "gradient", gradient: { from: "indigo", to: "cyan" } }, "Complete"), !!props.lessonsTotal && !isComplete && /* @__PURE__ */ React.createElement(Badge$1, { variant: "filled" }, "Incomplete")), /* @__PURE__ */ React.createElement(UnstyledButton, { component: Link, to: props.href, mt: "md", sx: { ":hover": { textDecoration: "underline" } } }, /* @__PURE__ */ React.createElement(Text, { size: "lg", weight: 500 }, props.title)), /* @__PURE__ */ React.createElement(Text, { size: "sm", color: "dimmed", mt: 5, mb: 50 }, props.description), !!props.lessonsCompleted && /* @__PURE__ */ React.createElement(Text, { color: "dimmed", size: "sm", mt: "md" }, "Lessons completed:", " ", /* @__PURE__ */ React.createElement(
|
|
2500
2517
|
Text,
|
|
2501
2518
|
{
|
|
2502
2519
|
span: true,
|
|
@@ -2504,7 +2521,7 @@ function TaskCard(props) {
|
|
|
2504
2521
|
sx: (theme) => ({ color: theme.colorScheme === "dark" ? theme.white : theme.black })
|
|
2505
2522
|
},
|
|
2506
2523
|
props.lessonsCompleted
|
|
2507
|
-
)), !!props.lessonsTotal && /* @__PURE__ */ React.createElement(Progress, { value: props.lessonsCompleted / props.lessonsTotal * 100, mt: 5 })
|
|
2524
|
+
)), !!props.lessonsTotal && /* @__PURE__ */ React.createElement(Progress, { value: props.lessonsCompleted / props.lessonsTotal * 100, mt: 5 }));
|
|
2508
2525
|
}
|
|
2509
2526
|
|
|
2510
2527
|
const TrialHome = (props) => {
|