@local-civics/mgmt-ui 0.1.259 → 0.1.262

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
@@ -667,13 +667,18 @@ const classOptionLabels = (classes) => {
667
667
  return labels;
668
668
  };
669
669
 
670
- const TABS$4 = [
671
- { label: "By lesson", value: "lessons" },
672
- { label: "By student", value: "students" }
670
+ const TABS$5 = [
671
+ { label: "By student", value: "students" },
672
+ { label: "By lesson", value: "lessons" }
673
673
  ];
674
674
  const Badge = (props) => {
675
675
  const classLabels = classOptionLabels(props.classes || []);
676
- const [tab, setTab] = useState("lessons");
676
+ const [localTab, setLocalTab] = useState("students");
677
+ const tab = TABS$5.some((t) => t.value === props.tab) ? props.tab : localTab;
678
+ const setTab = (next) => {
679
+ setLocalTab(next);
680
+ props.onTabChange && props.onTabChange(next);
681
+ };
677
682
  const [search, setSearch] = useState("");
678
683
  const statusFilter = props.statusFilter || "all";
679
684
  const activityLoading = !!props.activityLoading;
@@ -724,7 +729,7 @@ const Badge = (props) => {
724
729
  },
725
730
  /* @__PURE__ */ React.createElement("option", { value: "" }, "All classes"),
726
731
  props.classes.map((c) => /* @__PURE__ */ React.createElement("option", { key: c.classId, value: c.classId }, classLabels[c.classId] || c.name))
727
- )), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-3" }, !props.trial && /* @__PURE__ */ React.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$4.map((t) => /* @__PURE__ */ React.createElement(
732
+ )), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-3" }, !props.trial && /* @__PURE__ */ React.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$5.map((t) => /* @__PURE__ */ React.createElement(
728
733
  "button",
729
734
  {
730
735
  key: t.value,
@@ -1300,7 +1305,7 @@ function Table$7(props) {
1300
1305
  })));
1301
1306
  }
1302
1307
 
1303
- const TABS$3 = [
1308
+ const TABS$4 = [
1304
1309
  { label: "Badges", value: "badges" },
1305
1310
  { label: "Lessons", value: "lessons" }
1306
1311
  ];
@@ -1357,7 +1362,7 @@ const Student = (props) => {
1357
1362
  }
1358
1363
  ), /* @__PURE__ */ React.createElement(StatsGroup, { data: [
1359
1364
  {
1360
- title: "PROBLEMS SOLVED",
1365
+ title: "QUESTIONS ANSWERED",
1361
1366
  value: props.numberOfProblemsSolved
1362
1367
  },
1363
1368
  {
@@ -1368,7 +1373,7 @@ const Student = (props) => {
1368
1373
  title: "BADGE COMPLETION",
1369
1374
  value: numberOfBadgesCompleted
1370
1375
  }
1371
- ] }), /* @__PURE__ */ React.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$3.map((t) => /* @__PURE__ */ React.createElement(
1376
+ ] }), /* @__PURE__ */ React.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$4.map((t) => /* @__PURE__ */ React.createElement(
1372
1377
  "button",
1373
1378
  {
1374
1379
  key: t.value,
@@ -1673,11 +1678,19 @@ function Stack$2(props) {
1673
1678
  }
1674
1679
  const truncateWithEllipses = (text, max) => text.substr(0, max - 1) + (text.length > max ? "…" : "");
1675
1680
 
1681
+ const TABS$3 = [
1682
+ { label: "By student", value: "students" },
1683
+ { label: "By question", value: "question" }
1684
+ ];
1676
1685
  const initialsFor = (name) => name.split(/[ -]/).map((n) => n.charAt(0)).join("").toUpperCase();
1677
1686
  const Lesson = (props) => {
1678
1687
  const classLabels = classOptionLabels(props.classes || []);
1679
- const [pickedTab, setTab] = useState(null);
1680
- const tab = pickedTab != null ? pickedTab : (props.questions || []).some((q) => q.chart) ? "question" : "students";
1688
+ const [localTab, setLocalTab] = useState("students");
1689
+ const tab = TABS$3.some((t) => t.value === props.tab) ? props.tab : localTab;
1690
+ const setTab = (next) => {
1691
+ setLocalTab(next);
1692
+ props.onTabChange && props.onTabChange(next);
1693
+ };
1681
1694
  const [search, setSearch] = useState("");
1682
1695
  const statusFilter = props.statusFilter || "all";
1683
1696
  const numberOfStudents = props.students.length;
@@ -1690,10 +1703,6 @@ const Lesson = (props) => {
1690
1703
  (s) => matchesStudentStatus(s, statusFilter) && (!searchLower || (s.name || "").toLowerCase().includes(searchLower))
1691
1704
  );
1692
1705
  const activityLoading = !!props.activityLoading;
1693
- const tabs = [
1694
- { label: "By question", value: "question" },
1695
- { label: "By student", value: "students" }
1696
- ];
1697
1706
  return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-5 px-4 py-8" }, /* @__PURE__ */ React.createElement(
1698
1707
  PageHeader,
1699
1708
  {
@@ -1734,7 +1743,7 @@ const Lesson = (props) => {
1734
1743
  },
1735
1744
  /* @__PURE__ */ React.createElement("option", { value: "" }, "All classes"),
1736
1745
  props.classes.map((c) => /* @__PURE__ */ React.createElement("option", { key: c.classId, value: c.classId }, classLabels[c.classId] || c.name))
1737
- )), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, tabs.map((t) => /* @__PURE__ */ React.createElement(
1746
+ )), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$3.map((t) => /* @__PURE__ */ React.createElement(
1738
1747
  "button",
1739
1748
  {
1740
1749
  key: t.value,
@@ -3205,13 +3214,18 @@ const CategoryNode = (props) => {
3205
3214
  };
3206
3215
 
3207
3216
  const TABS$2 = [
3208
- { label: "By Badge", value: "badges" },
3209
- { label: "By student", value: "students" }
3217
+ { label: "By student", value: "students" },
3218
+ { label: "By Badge", value: "badges" }
3210
3219
  ];
3211
3220
  const Pathway = (props) => {
3212
3221
  var _a, _b, _c;
3213
3222
  const classLabels = classOptionLabels(props.classes || []);
3214
- const [tab, setTab] = useState("badges");
3223
+ const [localTab, setLocalTab] = useState("students");
3224
+ const tab = TABS$2.some((t) => t.value === props.tab) ? props.tab : localTab;
3225
+ const setTab = (next) => {
3226
+ setLocalTab(next);
3227
+ props.onTabChange && props.onTabChange(next);
3228
+ };
3215
3229
  const [categoriesOpen, setCategoriesOpen] = useState(false);
3216
3230
  const [selectedCategoryId, setSelectedCategoryId] = useState(void 0);
3217
3231
  const numberOfStudents = props.students.length;