@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.d.ts CHANGED
@@ -146,13 +146,11 @@ type BadgeProps = {
146
146
  trial?: boolean;
147
147
  lessonsCompleted?: number;
148
148
  pathwayId?: string;
149
- pathwayTitle?: string;
150
149
  breadcrumb?: PageHeaderBreadcrumbSegment[];
151
150
  onBackClick: () => void;
152
151
  onClassChange: (classId: string) => void;
153
152
  onCopyLinkClick: () => void;
154
153
  onExportDataClick: () => void;
155
- onPathwayClick?: () => void;
156
154
  };
157
155
  /**
158
156
  * Badge
package/dist/index.js CHANGED
@@ -623,8 +623,6 @@ const Badge = (props) => {
623
623
  iconAccent: "mint",
624
624
  imageURL: props.imageURL,
625
625
  onBackClick: props.onBackClick,
626
- onSecondaryClick: props.onPathwayClick,
627
- secondaryLabel: props.pathwayTitle ? "Go to Pathway" : void 0,
628
626
  breadcrumb: props.breadcrumb,
629
627
  title: props.displayName || "Badge",
630
628
  description: props.description,
@@ -3344,7 +3342,19 @@ const Pathway = (props) => {
3344
3342
  const numberOfStudents = props.students.length;
3345
3343
  const numberOfBadgesEarned = numberOfStudents > 0 ? props.students.filter((u) => u.isComplete).length : 0;
3346
3344
  const criteria = props.criteria || {};
3347
- const criteriaCategories = (props.categories || []).filter((c) => criteria[c.categoryId] !== void 0);
3345
+ const parentById = new Map((props.allCategories || []).map((c) => [c.categoryId, c.parentCategoryId]));
3346
+ const depthOf = (id) => {
3347
+ let depth = 0;
3348
+ let current = id;
3349
+ const seen = /* @__PURE__ */ new Set();
3350
+ while (parentById.get(current) && !seen.has(current)) {
3351
+ seen.add(current);
3352
+ current = parentById.get(current);
3353
+ depth++;
3354
+ }
3355
+ return depth;
3356
+ };
3357
+ const criteriaCategories = (props.categories || []).filter((c) => criteria[c.categoryId] !== void 0).sort((a, b) => depthOf(a.categoryId) - depthOf(b.categoryId));
3348
3358
  const rootCategoryIds = new Set(
3349
3359
  (props.allCategories || []).filter((c) => !c.parentCategoryId).map((c) => c.categoryId)
3350
3360
  );