@local-civics/hub-ui 0.1.178 → 0.1.180

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
@@ -5568,13 +5568,25 @@ const PathwayCard = (props) => {
5568
5568
  },
5569
5569
  [props.criteria]
5570
5570
  );
5571
+ const categoryIdByLabel = React.useMemo(
5572
+ () => {
5573
+ var _a2;
5574
+ return Object.entries((_a2 = props.categoryNames) != null ? _a2 : {}).reduce((acc, [id, label]) => {
5575
+ acc[label] = id;
5576
+ return acc;
5577
+ }, {});
5578
+ },
5579
+ [props.categoryNames]
5580
+ );
5571
5581
  const [activeFilters, setActiveFilters] = React.useState(
5572
5582
  () => /* @__PURE__ */ new Set()
5573
5583
  );
5574
5584
  const filteredBadges = activeFilters.size === 0 ? badges : badges.filter(
5575
5585
  (b) => {
5576
5586
  var _a2;
5577
- return (_a2 = b.categories) == null ? void 0 : _a2.some((c) => activeFilters.has(c));
5587
+ return (_a2 = b.categories) == null ? void 0 : _a2.some(
5588
+ (categoryId) => activeFilters.has(categoryId)
5589
+ );
5578
5590
  }
5579
5591
  );
5580
5592
  const filterClassName = "inline-block px-4 py-2 bg-gray-600 text-white rounded-full cursor-pointer text-sm";
@@ -5615,7 +5627,10 @@ const PathwayCard = (props) => {
5615
5627
  "div",
5616
5628
  {
5617
5629
  key: id,
5618
- onClick: () => toggleFilter(id),
5630
+ onClick: () => {
5631
+ var _a3;
5632
+ return toggleFilter((_a3 = categoryIdByLabel[label]) != null ? _a3 : id);
5633
+ },
5619
5634
  className: isActive ? `${filterClassName} bg-gray-700` : "inline-block px-4 py-2 rounded-full hover:bg-gray-200 cursor-pointer text-sm"
5620
5635
  },
5621
5636
  label