@local-civics/mgmt-ui 0.1.234 → 0.1.236

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
@@ -603,8 +603,6 @@ const Badge = (props) => {
603
603
  iconAccent: "mint",
604
604
  imageURL: props.imageURL,
605
605
  onBackClick: props.onBackClick,
606
- onSecondaryClick: props.onPathwayClick,
607
- secondaryLabel: props.pathwayTitle ? "Go to Pathway" : void 0,
608
606
  breadcrumb: props.breadcrumb,
609
607
  title: props.displayName || "Badge",
610
608
  description: props.description,
@@ -3324,7 +3322,19 @@ const Pathway = (props) => {
3324
3322
  const numberOfStudents = props.students.length;
3325
3323
  const numberOfBadgesEarned = numberOfStudents > 0 ? props.students.filter((u) => u.isComplete).length : 0;
3326
3324
  const criteria = props.criteria || {};
3327
- const criteriaCategories = (props.categories || []).filter((c) => criteria[c.categoryId] !== void 0);
3325
+ const parentById = new Map((props.allCategories || []).map((c) => [c.categoryId, c.parentCategoryId]));
3326
+ const depthOf = (id) => {
3327
+ let depth = 0;
3328
+ let current = id;
3329
+ const seen = /* @__PURE__ */ new Set();
3330
+ while (parentById.get(current) && !seen.has(current)) {
3331
+ seen.add(current);
3332
+ current = parentById.get(current);
3333
+ depth++;
3334
+ }
3335
+ return depth;
3336
+ };
3337
+ const criteriaCategories = (props.categories || []).filter((c) => criteria[c.categoryId] !== void 0).sort((a, b) => depthOf(a.categoryId) - depthOf(b.categoryId));
3328
3338
  const rootCategoryIds = new Set(
3329
3339
  (props.allCategories || []).filter((c) => !c.parentCategoryId).map((c) => c.categoryId)
3330
3340
  );