@local-civics/mgmt-ui 0.1.88 → 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 +3 -3
- package/dist/index.js +44 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -28
- 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) => {
|
|
@@ -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
|
{
|
|
@@ -1886,13 +1912,18 @@ const Lesson = (props) => {
|
|
|
1886
1912
|
onCopyLinkClick: props.onCopyLinkClick,
|
|
1887
1913
|
onExportDataClick: props.onExportDataClick
|
|
1888
1914
|
}
|
|
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(
|
|
1915
|
+
))))), /* @__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
|
+
StatsGroup,
|
|
1890
1917
|
{
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1918
|
+
data: [
|
|
1919
|
+
{
|
|
1920
|
+
title: props.trial ? "# OF SUBMISSIONS" : "LESSON COMPLETION",
|
|
1921
|
+
value: props.trial ? props.lessonsCompleted || 0 : percentageOfLessonsCompleted,
|
|
1922
|
+
unit: props.trial ? "" : "%"
|
|
1923
|
+
}
|
|
1924
|
+
]
|
|
1894
1925
|
}
|
|
1895
|
-
|
|
1926
|
+
), /* @__PURE__ */ React.createElement(Group, { position: "apart" }, /* @__PURE__ */ React.createElement(Avatar.Group, { spacing: "sm" }, avatars)), !props.trial && /* @__PURE__ */ React.createElement(
|
|
1896
1927
|
Select,
|
|
1897
1928
|
{
|
|
1898
1929
|
clearable: true,
|
|
@@ -2480,21 +2511,6 @@ const BadgeGrid = (props) => {
|
|
|
2480
2511
|
return /* @__PURE__ */ React.createElement(SimpleGrid, { cols: 3, breakpoints: [{ maxWidth: "sm", cols: 1 }] }, badges);
|
|
2481
2512
|
};
|
|
2482
2513
|
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
2514
|
const isComplete = props.lessonsCompleted >= props.lessonsTotal;
|
|
2499
2515
|
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(
|
|
2500
2516
|
Text,
|
|
@@ -2504,7 +2520,7 @@ function TaskCard(props) {
|
|
|
2504
2520
|
sx: (theme) => ({ color: theme.colorScheme === "dark" ? theme.white : theme.black })
|
|
2505
2521
|
},
|
|
2506
2522
|
props.lessonsCompleted
|
|
2507
|
-
)), !!props.lessonsTotal && /* @__PURE__ */ React.createElement(Progress, { value: props.lessonsCompleted / props.lessonsTotal * 100, mt: 5 })
|
|
2523
|
+
)), !!props.lessonsTotal && /* @__PURE__ */ React.createElement(Progress, { value: props.lessonsCompleted / props.lessonsTotal * 100, mt: 5 }));
|
|
2508
2524
|
}
|
|
2509
2525
|
|
|
2510
2526
|
const TrialHome = (props) => {
|