@local-civics/mgmt-ui 0.1.186 → 0.1.187
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.js +126 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +127 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ var __objRest$2 = (source, exclude) => {
|
|
|
62
62
|
}
|
|
63
63
|
return target;
|
|
64
64
|
};
|
|
65
|
-
const useStyles$
|
|
65
|
+
const useStyles$v = core.createStyles((theme) => ({
|
|
66
66
|
user: {
|
|
67
67
|
display: "block",
|
|
68
68
|
width: "100%",
|
|
@@ -73,7 +73,7 @@ const useStyles$u = core.createStyles((theme) => ({
|
|
|
73
73
|
}));
|
|
74
74
|
function UserButton(_a) {
|
|
75
75
|
var _b = _a, { image, name, email, icon } = _b, others = __objRest$2(_b, ["image", "name", "email", "icon"]);
|
|
76
|
-
const { classes } = useStyles$
|
|
76
|
+
const { classes } = useStyles$v();
|
|
77
77
|
return /* @__PURE__ */ React__namespace.createElement(core.Group, __spreadValues$9({ className: classes.user }, others), /* @__PURE__ */ React__namespace.createElement(core.Avatar, { src: image, radius: "xl" }), /* @__PURE__ */ React__namespace.createElement("div", { style: { flex: 1 } }, /* @__PURE__ */ React__namespace.createElement(core.Text, { size: "sm", weight: 500 }, name), /* @__PURE__ */ React__namespace.createElement(core.Text, { color: "dimmed", size: "xs" }, email)));
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -84,7 +84,7 @@ const compact = (num) => {
|
|
|
84
84
|
}).format(num || 0);
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
const useStyles$
|
|
87
|
+
const useStyles$u = core.createStyles((theme, _params, getRef) => {
|
|
88
88
|
const icon = getRef("icon");
|
|
89
89
|
return {
|
|
90
90
|
control: {
|
|
@@ -137,7 +137,7 @@ const useStyles$t = core.createStyles((theme, _params, getRef) => {
|
|
|
137
137
|
};
|
|
138
138
|
});
|
|
139
139
|
function LinksGroup({ icon: Icon, href, label, initiallyOpened, links, active, notifications }) {
|
|
140
|
-
const { classes, theme, cx } = useStyles$
|
|
140
|
+
const { classes, theme, cx } = useStyles$u();
|
|
141
141
|
const hasLinks = Array.isArray(links) && links.length > 0;
|
|
142
142
|
const hasActiveLinks = Array.isArray(links) && links.map((l) => !!active && active === `${label}/${l.label}`).reduce((a, b) => a || b, false);
|
|
143
143
|
const [opened, setOpened] = React.useState(initiallyOpened || hasActiveLinks || false);
|
|
@@ -201,7 +201,7 @@ var __spreadValues$8 = (a, b) => {
|
|
|
201
201
|
return a;
|
|
202
202
|
};
|
|
203
203
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
204
|
-
const useStyles$
|
|
204
|
+
const useStyles$t = core.createStyles((theme, _params, getRef) => {
|
|
205
205
|
const icon = getRef("icon");
|
|
206
206
|
return {
|
|
207
207
|
navbar: {
|
|
@@ -301,7 +301,7 @@ const TRIAL_PAGES = [
|
|
|
301
301
|
"Badges"
|
|
302
302
|
];
|
|
303
303
|
function Navbar(props) {
|
|
304
|
-
const { classes, cx } = useStyles$
|
|
304
|
+
const { classes, cx } = useStyles$t();
|
|
305
305
|
const [burgerOpen, setBurgerOpen] = React__namespace.useState(false);
|
|
306
306
|
const toggle = () => setBurgerOpen(!burgerOpen);
|
|
307
307
|
const links = data.map((item) => {
|
|
@@ -344,7 +344,7 @@ function Navbar(props) {
|
|
|
344
344
|
} }, /* @__PURE__ */ React__namespace.createElement(icons.IconLogout, { className: classes.linkIcon, stroke: 1.5 }), /* @__PURE__ */ React__namespace.createElement("span", null, "Logout"))))));
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
const useStyles$
|
|
347
|
+
const useStyles$s = core.createStyles((theme) => ({
|
|
348
348
|
inner: {
|
|
349
349
|
paddingTop: theme.spacing.xl,
|
|
350
350
|
paddingBottom: theme.spacing.xl * 4
|
|
@@ -380,7 +380,7 @@ const useStyles$r = core.createStyles((theme) => ({
|
|
|
380
380
|
}
|
|
381
381
|
}));
|
|
382
382
|
const GettingStarted = (props) => {
|
|
383
|
-
const { classes } = useStyles$
|
|
383
|
+
const { classes } = useStyles$s();
|
|
384
384
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
385
385
|
core.Modal,
|
|
386
386
|
{
|
|
@@ -394,7 +394,7 @@ const GettingStarted = (props) => {
|
|
|
394
394
|
);
|
|
395
395
|
};
|
|
396
396
|
|
|
397
|
-
const useStyles$
|
|
397
|
+
const useStyles$r = core.createStyles((theme) => ({
|
|
398
398
|
title: {
|
|
399
399
|
fontSize: 34,
|
|
400
400
|
fontWeight: 900,
|
|
@@ -435,7 +435,7 @@ const useStyles$q = core.createStyles((theme) => ({
|
|
|
435
435
|
}
|
|
436
436
|
}));
|
|
437
437
|
const SwitchAccount = (props) => {
|
|
438
|
-
const { classes, theme } = useStyles$
|
|
438
|
+
const { classes, theme } = useStyles$r();
|
|
439
439
|
const options = props.accounts.map((a) => {
|
|
440
440
|
return /* @__PURE__ */ React__namespace.createElement(core.UnstyledButton, { onClick: () => props.onClick && props.onClick(a.accountId), key: a.accountId, p: theme.spacing.md }, /* @__PURE__ */ React__namespace.createElement(core.Card, { withBorder: true, shadow: "md", radius: "md", className: classes.card, p: "xl" }, a.isAdmin && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(icons.IconBatteryEco, { size: 50, stroke: 2, color: theme.fn.primaryColor() })), a.isGroupAdmin && !a.isAdmin && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(icons.IconBooks, { size: 50, stroke: 2, color: theme.fn.primaryColor() })), !a.isAdmin && !a.isGroupAdmin && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(icons.IconBackpack, { size: 50, stroke: 2, color: theme.fn.primaryColor() })), /* @__PURE__ */ React__namespace.createElement(core.Text, { size: "lg", weight: 500, className: classes.cardTitle, mt: "md" }, a.name), /* @__PURE__ */ React__namespace.createElement(core.Text, { size: "sm", color: "dimmed", mt: "sm" }, a.isAdmin ? "Admin" : a.isGroupAdmin ? "Educator" : "Student")));
|
|
441
441
|
});
|
|
@@ -452,7 +452,7 @@ const SwitchAccount = (props) => {
|
|
|
452
452
|
);
|
|
453
453
|
};
|
|
454
454
|
|
|
455
|
-
const useStyles$
|
|
455
|
+
const useStyles$q = core.createStyles((theme) => ({
|
|
456
456
|
root: {
|
|
457
457
|
display: "flex",
|
|
458
458
|
backgroundImage: `linear-gradient(-60deg, ${theme.colors[theme.primaryColor][4]} 0%, ${theme.colors[theme.primaryColor][7]} 100%)`,
|
|
@@ -496,7 +496,7 @@ const useStyles$p = core.createStyles((theme) => ({
|
|
|
496
496
|
}
|
|
497
497
|
}));
|
|
498
498
|
const StatsGroup = ({ data, footer }) => {
|
|
499
|
-
const { classes } = useStyles$
|
|
499
|
+
const { classes } = useStyles$q();
|
|
500
500
|
const stats = data.map((stat) => {
|
|
501
501
|
const value = (() => {
|
|
502
502
|
if (stat.unit === "%") {
|
|
@@ -516,7 +516,7 @@ const Tabs = (props) => {
|
|
|
516
516
|
return /* @__PURE__ */ React__namespace.createElement(core.Tabs, { value: props.value, onTabChange: props.onChange }, /* @__PURE__ */ React__namespace.createElement(core.Tabs.List, null, tabs));
|
|
517
517
|
};
|
|
518
518
|
|
|
519
|
-
const useStyles$
|
|
519
|
+
const useStyles$p = core.createStyles((theme) => ({
|
|
520
520
|
button: {
|
|
521
521
|
borderTopRightRadius: 0,
|
|
522
522
|
borderBottomRightRadius: 0,
|
|
@@ -531,7 +531,7 @@ const useStyles$o = core.createStyles((theme) => ({
|
|
|
531
531
|
}
|
|
532
532
|
}));
|
|
533
533
|
const SplitButton$4 = (props) => {
|
|
534
|
-
const { classes, theme } = useStyles$
|
|
534
|
+
const { classes, theme } = useStyles$p();
|
|
535
535
|
theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
|
|
536
536
|
return /* @__PURE__ */ React__namespace.createElement(core.Stack, { spacing: "sm" }, /* @__PURE__ */ React__namespace.createElement(
|
|
537
537
|
core.Button,
|
|
@@ -559,7 +559,7 @@ const SplitButton$4 = (props) => {
|
|
|
559
559
|
));
|
|
560
560
|
};
|
|
561
561
|
|
|
562
|
-
const useStyles$
|
|
562
|
+
const useStyles$o = core.createStyles((theme) => ({
|
|
563
563
|
wrapper: {
|
|
564
564
|
display: "flex",
|
|
565
565
|
alignItems: "center",
|
|
@@ -610,7 +610,7 @@ const useStyles$n = core.createStyles((theme) => ({
|
|
|
610
610
|
}
|
|
611
611
|
}));
|
|
612
612
|
const PlaceholderBanner = (props) => {
|
|
613
|
-
const { classes } = useStyles$
|
|
613
|
+
const { classes } = useStyles$o();
|
|
614
614
|
const title = props.title || "Nothing to display";
|
|
615
615
|
const description = props.description || "We don't have anything to show you here just yet. Add data, check back later, or adjust your search.";
|
|
616
616
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: classes.wrapper }, /* @__PURE__ */ React__namespace.createElement("div", { className: classes.body }, /* @__PURE__ */ React__namespace.createElement(core.Title, { className: classes.title }, props.loading ? "Loading..." : title), /* @__PURE__ */ React__namespace.createElement(core.Text, { size: "sm", color: "dimmed" }, props.loading ? "Hold on, we're loading your data." : description)), /* @__PURE__ */ React__namespace.createElement(core.Image, { src: `https://cdn.localcivics.io/illustrations/${props.icon}.svg`, className: classes.image }));
|
|
@@ -682,7 +682,7 @@ function Table$i(props) {
|
|
|
682
682
|
return /* @__PURE__ */ React__namespace.createElement(core.ScrollArea.Autosize, { maxHeight: 600 }, /* @__PURE__ */ React__namespace.createElement(core.Table, { verticalSpacing: "sm", sx: { minWidth: 700 }, highlightOnHover: true, striped: true }, /* @__PURE__ */ React__namespace.createElement("thead", null, /* @__PURE__ */ React__namespace.createElement("tr", null, /* @__PURE__ */ React__namespace.createElement("th", null, "Lesson Name"), /* @__PURE__ */ React__namespace.createElement("th", null, "Lesson Completion"))), /* @__PURE__ */ React__namespace.createElement("tbody", null, rows)));
|
|
683
683
|
}
|
|
684
684
|
|
|
685
|
-
const useStyles$
|
|
685
|
+
const useStyles$n = core.createStyles((theme) => ({
|
|
686
686
|
title: {
|
|
687
687
|
fontSize: 34,
|
|
688
688
|
fontWeight: 900,
|
|
@@ -695,7 +695,7 @@ const useStyles$m = core.createStyles((theme) => ({
|
|
|
695
695
|
}
|
|
696
696
|
}));
|
|
697
697
|
const Badge = (props) => {
|
|
698
|
-
const { classes } = useStyles$
|
|
698
|
+
const { classes } = useStyles$n();
|
|
699
699
|
const [tab, setTab] = React.useState("lessons");
|
|
700
700
|
const numberOfStudents = props.students.length;
|
|
701
701
|
const numberOfBadges = numberOfStudents > 0 ? props.students.filter((u) => u.isComplete).length : 0;
|
|
@@ -793,7 +793,7 @@ function Table$h(props) {
|
|
|
793
793
|
return /* @__PURE__ */ React__namespace.createElement(core.ScrollArea.Autosize, { maxHeight: 600 }, /* @__PURE__ */ React__namespace.createElement(core.Table, { horizontalSpacing: 0, verticalSpacing: 0, sx: { minWidth: 700 } }, /* @__PURE__ */ React__namespace.createElement("tbody", null, rows)));
|
|
794
794
|
}
|
|
795
795
|
|
|
796
|
-
const useStyles$
|
|
796
|
+
const useStyles$m = core.createStyles((theme) => ({
|
|
797
797
|
title: {
|
|
798
798
|
fontSize: 34,
|
|
799
799
|
fontWeight: 900,
|
|
@@ -806,7 +806,7 @@ const useStyles$l = core.createStyles((theme) => ({
|
|
|
806
806
|
}
|
|
807
807
|
}));
|
|
808
808
|
const Badges = (props) => {
|
|
809
|
-
const { classes } = useStyles$
|
|
809
|
+
const { classes } = useStyles$m();
|
|
810
810
|
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.Badge, { variant: "filled", size: "lg" }, "Badges"), /* @__PURE__ */ React__namespace.createElement(core.Title, { order: 2, className: classes.title, mt: "md" }, "Badges and micro-credentials"), /* @__PURE__ */ React__namespace.createElement(core.Text, { color: "dimmed", className: classes.description, mt: "sm" }, "Key milestones that reflect skill development, micro-credentials, or academic progress"))), /* @__PURE__ */ React__namespace.createElement(
|
|
811
811
|
core.Autocomplete,
|
|
812
812
|
{
|
|
@@ -1036,7 +1036,63 @@ const SplitButton$3 = (props) => {
|
|
|
1036
1036
|
));
|
|
1037
1037
|
};
|
|
1038
1038
|
|
|
1039
|
+
function useSortableData(items, config = { key: "", direction: null }) {
|
|
1040
|
+
const [sortConfig, setSortConfig] = React.useState(config);
|
|
1041
|
+
const sortedItems = React.useMemo(() => {
|
|
1042
|
+
let sortableItems = [...items];
|
|
1043
|
+
if (sortConfig.direction !== null) {
|
|
1044
|
+
sortableItems.sort((a, b) => {
|
|
1045
|
+
const aValue = a[sortConfig.key];
|
|
1046
|
+
const bValue = b[sortConfig.key];
|
|
1047
|
+
if (aValue === bValue)
|
|
1048
|
+
return 0;
|
|
1049
|
+
if (aValue === null || aValue === void 0)
|
|
1050
|
+
return 1;
|
|
1051
|
+
if (bValue === null || bValue === void 0)
|
|
1052
|
+
return -1;
|
|
1053
|
+
if (typeof aValue === "number" && typeof bValue === "number") {
|
|
1054
|
+
return sortConfig.direction === "asc" ? aValue - bValue : bValue - aValue;
|
|
1055
|
+
}
|
|
1056
|
+
if (typeof aValue === "boolean" && typeof bValue === "boolean") {
|
|
1057
|
+
return sortConfig.direction === "asc" ? aValue === bValue ? 0 : aValue ? 1 : -1 : aValue === bValue ? 0 : aValue ? -1 : 1;
|
|
1058
|
+
}
|
|
1059
|
+
if (aValue instanceof Date && bValue instanceof Date) {
|
|
1060
|
+
return sortConfig.direction === "asc" ? aValue.getTime() - bValue.getTime() : bValue.getTime() - aValue.getTime();
|
|
1061
|
+
}
|
|
1062
|
+
return sortConfig.direction === "asc" ? String(aValue).localeCompare(String(bValue)) : String(bValue).localeCompare(String(aValue));
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
return sortableItems;
|
|
1066
|
+
}, [items, sortConfig]);
|
|
1067
|
+
const requestSort = (key) => {
|
|
1068
|
+
let direction = "asc";
|
|
1069
|
+
if (sortConfig.key === key && sortConfig.direction === "asc") {
|
|
1070
|
+
direction = "desc";
|
|
1071
|
+
} else if (sortConfig.key === key && sortConfig.direction === "desc") {
|
|
1072
|
+
direction = null;
|
|
1073
|
+
}
|
|
1074
|
+
setSortConfig({ key, direction });
|
|
1075
|
+
};
|
|
1076
|
+
return { items: sortedItems, requestSort, sortConfig };
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
const useStyles$l = core.createStyles((theme) => ({
|
|
1080
|
+
th: { padding: "0 !important" },
|
|
1081
|
+
control: {
|
|
1082
|
+
width: "100%",
|
|
1083
|
+
padding: `${theme.spacing.xs}px ${theme.spacing.md}px`,
|
|
1084
|
+
"&:hover": {
|
|
1085
|
+
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[6] : theme.colors.gray[0]
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}));
|
|
1089
|
+
function Th$1({ children, reversed, sorted, onSort }) {
|
|
1090
|
+
const { classes } = useStyles$l();
|
|
1091
|
+
const Icon = sorted ? reversed ? icons.IconChevronUp : icons.IconChevronDown : icons.IconSelector;
|
|
1092
|
+
return /* @__PURE__ */ React__namespace.createElement("th", { className: classes.th }, /* @__PURE__ */ React__namespace.createElement(core.UnstyledButton, { onClick: onSort, className: classes.control }, /* @__PURE__ */ React__namespace.createElement(core.Group, { position: "apart" }, /* @__PURE__ */ React__namespace.createElement(core.Text, { weight: 500, size: "sm" }, children), /* @__PURE__ */ React__namespace.createElement(core.Center, null, /* @__PURE__ */ React__namespace.createElement(Icon, { size: 14, stroke: 1.5 })))));
|
|
1093
|
+
}
|
|
1039
1094
|
function Table$b(props) {
|
|
1095
|
+
const { items: sortedItems, requestSort, sortConfig } = useSortableData(props.items);
|
|
1040
1096
|
if (props.items.length === 0) {
|
|
1041
1097
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
1042
1098
|
PlaceholderBanner,
|
|
@@ -1065,7 +1121,55 @@ function Table$b(props) {
|
|
|
1065
1121
|
data: [{ value: "student", label: "Student" }, { value: "educator", label: "Educator" }]
|
|
1066
1122
|
}
|
|
1067
1123
|
))), /* @__PURE__ */ React__namespace.createElement("td", null, row.badgesEarned), /* @__PURE__ */ React__namespace.createElement("td", null, row.lessonsCompleted), /* @__PURE__ */ React__namespace.createElement("td", null, row.hasAccount && /* @__PURE__ */ React__namespace.createElement(icons.IconCheck, { color: "green" })), /* @__PURE__ */ React__namespace.createElement("td", null, row.lastActivity ? relativeTimeFromDates(row.lastActivity) : ""), /* @__PURE__ */ React__namespace.createElement("td", null, /* @__PURE__ */ React__namespace.createElement(core.Group, { noWrap: true, spacing: 0, position: "right" }, !row.readonly && !!props.onDelete && /* @__PURE__ */ React__namespace.createElement(core.ActionIcon, { color: "red" }, /* @__PURE__ */ React__namespace.createElement(icons.IconTrash, { onClick: () => openDeleteModal(row), size: 16, stroke: 1.5 }))))));
|
|
1068
|
-
return /* @__PURE__ */ React__namespace.createElement(core.ScrollArea, null, /* @__PURE__ */ React__namespace.createElement(core.Table, { verticalSpacing: 20, sx: { minWidth: 700 }, highlightOnHover: true, striped: true }, /* @__PURE__ */ React__namespace.createElement("thead", null, /* @__PURE__ */ React__namespace.createElement("tr", null, /* @__PURE__ */ React__namespace.createElement(
|
|
1124
|
+
return /* @__PURE__ */ React__namespace.createElement(core.ScrollArea, null, /* @__PURE__ */ React__namespace.createElement(core.Table, { verticalSpacing: 20, sx: { minWidth: 700 }, highlightOnHover: true, striped: true }, /* @__PURE__ */ React__namespace.createElement("thead", null, /* @__PURE__ */ React__namespace.createElement("tr", null, /* @__PURE__ */ React__namespace.createElement(
|
|
1125
|
+
Th$1,
|
|
1126
|
+
{
|
|
1127
|
+
sorted: sortConfig.key === "givenName",
|
|
1128
|
+
reversed: sortConfig.direction === "desc",
|
|
1129
|
+
onSort: () => requestSort("givenName")
|
|
1130
|
+
},
|
|
1131
|
+
"Name"
|
|
1132
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
1133
|
+
Th$1,
|
|
1134
|
+
{
|
|
1135
|
+
sorted: sortConfig.key === "isAdmin",
|
|
1136
|
+
reversed: sortConfig.direction === "desc",
|
|
1137
|
+
onSort: () => requestSort("isAdmin")
|
|
1138
|
+
},
|
|
1139
|
+
"Role"
|
|
1140
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
1141
|
+
Th$1,
|
|
1142
|
+
{
|
|
1143
|
+
sorted: sortConfig.key === "badgesEarned",
|
|
1144
|
+
reversed: sortConfig.direction === "desc",
|
|
1145
|
+
onSort: () => requestSort("badgesEarned")
|
|
1146
|
+
},
|
|
1147
|
+
"Badges Earned"
|
|
1148
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
1149
|
+
Th$1,
|
|
1150
|
+
{
|
|
1151
|
+
sorted: sortConfig.key === "lessonsCompleted",
|
|
1152
|
+
reversed: sortConfig.direction === "desc",
|
|
1153
|
+
onSort: () => requestSort("lessonsCompleted")
|
|
1154
|
+
},
|
|
1155
|
+
"Lessons Completed"
|
|
1156
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
1157
|
+
Th$1,
|
|
1158
|
+
{
|
|
1159
|
+
sorted: sortConfig.key === "hasAccount",
|
|
1160
|
+
reversed: sortConfig.direction === "desc",
|
|
1161
|
+
onSort: () => requestSort("hasAccount")
|
|
1162
|
+
},
|
|
1163
|
+
"Account Created?"
|
|
1164
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
1165
|
+
Th$1,
|
|
1166
|
+
{
|
|
1167
|
+
sorted: sortConfig.key === "lastActivity",
|
|
1168
|
+
reversed: sortConfig.direction === "desc",
|
|
1169
|
+
onSort: () => requestSort("lastActivity")
|
|
1170
|
+
},
|
|
1171
|
+
"Last Active"
|
|
1172
|
+
), /* @__PURE__ */ React__namespace.createElement("th", null), " ")), /* @__PURE__ */ React__namespace.createElement("tbody", null, rows)));
|
|
1069
1173
|
}
|
|
1070
1174
|
|
|
1071
1175
|
var __defProp$7 = Object.defineProperty;
|
|
@@ -1267,46 +1371,6 @@ const DropzoneButton$1 = (props) => {
|
|
|
1267
1371
|
} }, "Select file"));
|
|
1268
1372
|
};
|
|
1269
1373
|
|
|
1270
|
-
function useSortableData(items, config = { key: "", direction: null }) {
|
|
1271
|
-
const [sortConfig, setSortConfig] = React.useState(config);
|
|
1272
|
-
const sortedItems = React.useMemo(() => {
|
|
1273
|
-
let sortableItems = [...items];
|
|
1274
|
-
if (sortConfig.direction !== null) {
|
|
1275
|
-
sortableItems.sort((a, b) => {
|
|
1276
|
-
const aValue = a[sortConfig.key];
|
|
1277
|
-
const bValue = b[sortConfig.key];
|
|
1278
|
-
if (aValue === bValue)
|
|
1279
|
-
return 0;
|
|
1280
|
-
if (aValue === null || aValue === void 0)
|
|
1281
|
-
return 1;
|
|
1282
|
-
if (bValue === null || bValue === void 0)
|
|
1283
|
-
return -1;
|
|
1284
|
-
if (typeof aValue === "number" && typeof bValue === "number") {
|
|
1285
|
-
return sortConfig.direction === "asc" ? aValue - bValue : bValue - aValue;
|
|
1286
|
-
}
|
|
1287
|
-
if (typeof aValue === "boolean" && typeof bValue === "boolean") {
|
|
1288
|
-
return sortConfig.direction === "asc" ? aValue === bValue ? 0 : aValue ? 1 : -1 : aValue === bValue ? 0 : aValue ? -1 : 1;
|
|
1289
|
-
}
|
|
1290
|
-
if (aValue instanceof Date && bValue instanceof Date) {
|
|
1291
|
-
return sortConfig.direction === "asc" ? aValue.getTime() - bValue.getTime() : bValue.getTime() - aValue.getTime();
|
|
1292
|
-
}
|
|
1293
|
-
return sortConfig.direction === "asc" ? String(aValue).localeCompare(String(bValue)) : String(bValue).localeCompare(String(aValue));
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
return sortableItems;
|
|
1297
|
-
}, [items, sortConfig]);
|
|
1298
|
-
const requestSort = (key) => {
|
|
1299
|
-
let direction = "asc";
|
|
1300
|
-
if (sortConfig.key === key && sortConfig.direction === "asc") {
|
|
1301
|
-
direction = "desc";
|
|
1302
|
-
} else if (sortConfig.key === key && sortConfig.direction === "desc") {
|
|
1303
|
-
direction = null;
|
|
1304
|
-
}
|
|
1305
|
-
setSortConfig({ key, direction });
|
|
1306
|
-
};
|
|
1307
|
-
return { items: sortedItems, requestSort, sortConfig };
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
1374
|
const useStyles$j = core.createStyles((theme) => ({
|
|
1311
1375
|
th: { padding: "0 !important" },
|
|
1312
1376
|
control: {
|
|
@@ -1352,15 +1416,7 @@ function Table$a(props) {
|
|
|
1352
1416
|
onSort: () => requestSort("name")
|
|
1353
1417
|
},
|
|
1354
1418
|
"Class Name"
|
|
1355
|
-
), /* @__PURE__ */ React__namespace.createElement(
|
|
1356
|
-
Th,
|
|
1357
|
-
{
|
|
1358
|
-
sorted: sortConfig.key === "description",
|
|
1359
|
-
reversed: sortConfig.direction === "desc",
|
|
1360
|
-
onSort: () => requestSort("description")
|
|
1361
|
-
},
|
|
1362
|
-
"Description"
|
|
1363
|
-
), /* @__PURE__ */ React__namespace.createElement(
|
|
1419
|
+
), /* @__PURE__ */ React__namespace.createElement("th", { style: { padding: "7px 16px" } }, /* @__PURE__ */ React__namespace.createElement(core.Text, { weight: 500, size: "sm" }, "Description")), /* @__PURE__ */ React__namespace.createElement(
|
|
1364
1420
|
Th,
|
|
1365
1421
|
{
|
|
1366
1422
|
sorted: sortConfig.key === "numberOfStudents",
|