@local-civics/mgmt-ui 0.1.259 → 0.1.263

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 CHANGED
@@ -191,6 +191,8 @@ type BadgeProps = {
191
191
  statusFilter?: BadgeStudentStatusFilter;
192
192
  onStatusFilterChange?: (filter: BadgeStudentStatusFilter) => void;
193
193
  onStudentClick?: (userId: string) => void;
194
+ tab?: string;
195
+ onTabChange?: (tab: string) => void;
194
196
  onBackClick: () => void;
195
197
  onClassChange: (classId: string) => void;
196
198
  onCopyLinkClick: () => void;
@@ -368,7 +370,7 @@ type StudentProps = {
368
370
  name: string;
369
371
  impactStatement: string;
370
372
  numberOfProblemsSolved: number;
371
- percentageOfLessonsCompleted: number;
373
+ percentageOfLessonsCompleted?: number;
372
374
  numberOfLessonsCompleted: number;
373
375
  badges: Item$b[];
374
376
  lessons: Item$a[];
@@ -485,6 +487,8 @@ type LessonProps = {
485
487
  statusFilter?: LessonStudentStatusFilter;
486
488
  onStatusFilterChange?: (filter: LessonStudentStatusFilter) => void;
487
489
  onStudentClick?: (userId: string) => void;
490
+ tab?: string;
491
+ onTabChange?: (tab: string) => void;
488
492
  onBackClick: () => void;
489
493
  onClassChange: (classId: string) => void;
490
494
  onCopyLinkClick: () => void;
@@ -829,6 +833,8 @@ type PathwayProps = {
829
833
  breadcrumb?: PageHeaderBreadcrumbSegment[];
830
834
  linkState?: any;
831
835
  onStudentClick?: (userId: string) => void;
836
+ tab?: string;
837
+ onTabChange?: (tab: string) => void;
832
838
  onBackClick: () => void;
833
839
  onClassChange: (classId: string) => void;
834
840
  onCopyLinkClick: () => void;
package/dist/index.js CHANGED
@@ -687,13 +687,18 @@ const classOptionLabels = (classes) => {
687
687
  return labels;
688
688
  };
689
689
 
690
- const TABS$4 = [
691
- { label: "By lesson", value: "lessons" },
692
- { label: "By student", value: "students" }
690
+ const TABS$5 = [
691
+ { label: "By student", value: "students" },
692
+ { label: "By lesson", value: "lessons" }
693
693
  ];
694
694
  const Badge = (props) => {
695
695
  const classLabels = classOptionLabels(props.classes || []);
696
- const [tab, setTab] = React.useState("lessons");
696
+ const [localTab, setLocalTab] = React.useState("students");
697
+ const tab = TABS$5.some((t) => t.value === props.tab) ? props.tab : localTab;
698
+ const setTab = (next) => {
699
+ setLocalTab(next);
700
+ props.onTabChange && props.onTabChange(next);
701
+ };
697
702
  const [search, setSearch] = React.useState("");
698
703
  const statusFilter = props.statusFilter || "all";
699
704
  const activityLoading = !!props.activityLoading;
@@ -744,7 +749,7 @@ const Badge = (props) => {
744
749
  },
745
750
  /* @__PURE__ */ React__namespace.createElement("option", { value: "" }, "All classes"),
746
751
  props.classes.map((c) => /* @__PURE__ */ React__namespace.createElement("option", { key: c.classId, value: c.classId }, classLabels[c.classId] || c.name))
747
- )), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col gap-3" }, !props.trial && /* @__PURE__ */ React__namespace.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$4.map((t) => /* @__PURE__ */ React__namespace.createElement(
752
+ )), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col gap-3" }, !props.trial && /* @__PURE__ */ React__namespace.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$5.map((t) => /* @__PURE__ */ React__namespace.createElement(
748
753
  "button",
749
754
  {
750
755
  key: t.value,
@@ -1320,7 +1325,7 @@ function Table$7(props) {
1320
1325
  })));
1321
1326
  }
1322
1327
 
1323
- const TABS$3 = [
1328
+ const TABS$4 = [
1324
1329
  { label: "Badges", value: "badges" },
1325
1330
  { label: "Lessons", value: "lessons" }
1326
1331
  ];
@@ -1377,7 +1382,7 @@ const Student = (props) => {
1377
1382
  }
1378
1383
  ), /* @__PURE__ */ React__namespace.createElement(StatsGroup, { data: [
1379
1384
  {
1380
- title: "PROBLEMS SOLVED",
1385
+ title: "QUESTIONS ANSWERED",
1381
1386
  value: props.numberOfProblemsSolved
1382
1387
  },
1383
1388
  {
@@ -1388,7 +1393,7 @@ const Student = (props) => {
1388
1393
  title: "BADGE COMPLETION",
1389
1394
  value: numberOfBadgesCompleted
1390
1395
  }
1391
- ] }), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$3.map((t) => /* @__PURE__ */ React__namespace.createElement(
1396
+ ] }), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$4.map((t) => /* @__PURE__ */ React__namespace.createElement(
1392
1397
  "button",
1393
1398
  {
1394
1399
  key: t.value,
@@ -1693,11 +1698,19 @@ function Stack$2(props) {
1693
1698
  }
1694
1699
  const truncateWithEllipses = (text, max) => text.substr(0, max - 1) + (text.length > max ? "…" : "");
1695
1700
 
1701
+ const TABS$3 = [
1702
+ { label: "By student", value: "students" },
1703
+ { label: "By question", value: "question" }
1704
+ ];
1696
1705
  const initialsFor = (name) => name.split(/[ -]/).map((n) => n.charAt(0)).join("").toUpperCase();
1697
1706
  const Lesson = (props) => {
1698
1707
  const classLabels = classOptionLabels(props.classes || []);
1699
- const [pickedTab, setTab] = React.useState(null);
1700
- const tab = pickedTab != null ? pickedTab : (props.questions || []).some((q) => q.chart) ? "question" : "students";
1708
+ const [localTab, setLocalTab] = React.useState("students");
1709
+ const tab = TABS$3.some((t) => t.value === props.tab) ? props.tab : localTab;
1710
+ const setTab = (next) => {
1711
+ setLocalTab(next);
1712
+ props.onTabChange && props.onTabChange(next);
1713
+ };
1701
1714
  const [search, setSearch] = React.useState("");
1702
1715
  const statusFilter = props.statusFilter || "all";
1703
1716
  const numberOfStudents = props.students.length;
@@ -1710,10 +1723,6 @@ const Lesson = (props) => {
1710
1723
  (s) => matchesStudentStatus(s, statusFilter) && (!searchLower || (s.name || "").toLowerCase().includes(searchLower))
1711
1724
  );
1712
1725
  const activityLoading = !!props.activityLoading;
1713
- const tabs = [
1714
- { label: "By question", value: "question" },
1715
- { label: "By student", value: "students" }
1716
- ];
1717
1726
  return /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col gap-5 px-4 py-8" }, /* @__PURE__ */ React__namespace.createElement(
1718
1727
  PageHeader,
1719
1728
  {
@@ -1754,7 +1763,7 @@ const Lesson = (props) => {
1754
1763
  },
1755
1764
  /* @__PURE__ */ React__namespace.createElement("option", { value: "" }, "All classes"),
1756
1765
  props.classes.map((c) => /* @__PURE__ */ React__namespace.createElement("option", { key: c.classId, value: c.classId }, classLabels[c.classId] || c.name))
1757
- )), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, tabs.map((t) => /* @__PURE__ */ React__namespace.createElement(
1766
+ )), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex w-fit gap-1 rounded-xl border border-slate-200 bg-white p-1" }, TABS$3.map((t) => /* @__PURE__ */ React__namespace.createElement(
1758
1767
  "button",
1759
1768
  {
1760
1769
  key: t.value,
@@ -2905,7 +2914,7 @@ const App = (props) => {
2905
2914
  {
2906
2915
  className: classes.link,
2907
2916
  component: "a",
2908
- href: "https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",
2917
+ href: "https://app.notion.com/p/localcivics/Help-Centre-3dc9ee47430e8025b038c19064307b2c",
2909
2918
  target: "_blank"
2910
2919
  },
2911
2920
  "Help Center"
@@ -3225,13 +3234,18 @@ const CategoryNode = (props) => {
3225
3234
  };
3226
3235
 
3227
3236
  const TABS$2 = [
3228
- { label: "By Badge", value: "badges" },
3229
- { label: "By student", value: "students" }
3237
+ { label: "By student", value: "students" },
3238
+ { label: "By Badge", value: "badges" }
3230
3239
  ];
3231
3240
  const Pathway = (props) => {
3232
3241
  var _a, _b, _c;
3233
3242
  const classLabels = classOptionLabels(props.classes || []);
3234
- const [tab, setTab] = React.useState("badges");
3243
+ const [localTab, setLocalTab] = React.useState("students");
3244
+ const tab = TABS$2.some((t) => t.value === props.tab) ? props.tab : localTab;
3245
+ const setTab = (next) => {
3246
+ setLocalTab(next);
3247
+ props.onTabChange && props.onTabChange(next);
3248
+ };
3235
3249
  const [categoriesOpen, setCategoriesOpen] = React.useState(false);
3236
3250
  const [selectedCategoryId, setSelectedCategoryId] = React.useState(void 0);
3237
3251
  const numberOfStudents = props.students.length;