@local-civics/hub-ui 0.1.164 → 0.1.166

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
@@ -4923,7 +4923,7 @@ const PathwayProgress = (props) => {
4923
4923
  const nextProficiency = props.nextXP || 1;
4924
4924
  const config = defaultActivityProgressConfig();
4925
4925
  const height = props.height || "sm";
4926
- withHeight(config, height);
4926
+ withHeight$1(config, height);
4927
4927
  return /* @__PURE__ */ React__default.createElement("div", { className: "grid grid-cols-1 gap-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-x-2 items-center" }, props.icon && /* @__PURE__ */ React__default.createElement("div", { className: config.icon.container }, /* @__PURE__ */ React__default.createElement(Button, { disabled: !props.open, size: config.icon.size, icon: props.icon, onClick: props.onOpen })), /* @__PURE__ */ React__default.createElement("div", { className: "grow grid grid-cols-1 gap-2 items-center" }, /* @__PURE__ */ React__default.createElement("div", null, props.title && /* @__PURE__ */ React__default.createElement("p", { className: "capitalize text-xs text-slate-400" }, props.title), /* @__PURE__ */ React__default.createElement("div", { className: classname(config.progress) }, /* @__PURE__ */ React__default.createElement(Progress, { start: proficiency, end: nextProficiency }))), /* @__PURE__ */ React__default.createElement("div", { className: "flex" }, height !== "sm" && /* @__PURE__ */ React__default.createElement("div", { className: "grow flex gap-x-1" }, /* @__PURE__ */ React__default.createElement("p", { className: classname(config.xp.value) }, compact(proficiency)), /* @__PURE__ */ React__default.createElement("p", { className: classname(config.xp.suffix) }, "XP")), height !== "sm" && !!props.level && /* @__PURE__ */ React__default.createElement("p", { className: classname(config.magnitude) }, compact(nextProficiency - proficiency), " exp. until level ", props.level + 1)))));
4928
4928
  };
4929
4929
  const defaultActivityProgressConfig = () => {
@@ -4952,7 +4952,7 @@ const defaultActivityProgressConfig = () => {
4952
4952
  };
4953
4953
  return config;
4954
4954
  };
4955
- const withHeight = (config, height) => {
4955
+ const withHeight$1 = (config, height) => {
4956
4956
  height = height || "sm";
4957
4957
  switch (height) {
4958
4958
  case "sm":
@@ -5514,11 +5514,53 @@ const TaskList = (props) => {
5514
5514
  return /* @__PURE__ */ React__default.createElement("div", { className: "h-[16rem] lg:h-[22rem] w-full" }, /* @__PURE__ */ React__default.createElement(Board, { isLoading: props.isLoading, tabs, workflow, secondary: true }));
5515
5515
  };
5516
5516
 
5517
+ const PathwayProgressBarChart = ({
5518
+ targets,
5519
+ points,
5520
+ height = "sm"
5521
+ }) => {
5522
+ const entries = Object.entries(targets);
5523
+ const config = defaultChartConfig();
5524
+ withHeight(config, height);
5525
+ if (!entries.length)
5526
+ return null;
5527
+ return /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-1 gap-2" }, entries.map(([categoryId, max]) => {
5528
+ var _a;
5529
+ const value = (_a = points[categoryId]) != null ? _a : 0;
5530
+ return /* @__PURE__ */ React.createElement("div", { key: categoryId, className: "grid grid-cols-1 gap-1" }, /* @__PURE__ */ React.createElement("div", { className: "flex justify-between items-center" }, /* @__PURE__ */ React.createElement("p", { className: "capitalize text-xs text-slate-400" }, categoryId), /* @__PURE__ */ React.createElement("p", { className: classname(config.magnitude) }, value, " / ", max)), /* @__PURE__ */ React.createElement("div", { className: classname(config.progress) }, /* @__PURE__ */ React.createElement(Progress, { start: value, end: max || 1 })));
5531
+ }));
5532
+ };
5533
+ const defaultChartConfig = () => {
5534
+ return {
5535
+ progress: {
5536
+ height: ""
5537
+ },
5538
+ magnitude: {
5539
+ base: "text-gray-400",
5540
+ text: ""
5541
+ }
5542
+ };
5543
+ };
5544
+ const withHeight = (config, height) => {
5545
+ switch (height) {
5546
+ case "sm":
5547
+ config.progress.height = "h-4";
5548
+ config.magnitude.text = "text-sm";
5549
+ break;
5550
+ case "md":
5551
+ config.progress.height = "h-8";
5552
+ config.magnitude.text = "text-sm";
5553
+ break;
5554
+ }
5555
+ };
5556
+
5517
5557
  const PathwayCard = (props) => {
5518
- var _a, _b;
5558
+ var _a, _b, _c, _d;
5519
5559
  const badges = props.badges || [];
5520
5560
  const completedCount = badges.filter((b) => b.completedAt).length;
5521
5561
  const target = props.target || badges.length;
5562
+ const categoryTargets = (_a = props.criteria) != null ? _a : {};
5563
+ const points = (_b = props.points) != null ? _b : {};
5522
5564
  return /* @__PURE__ */ React.createElement(Card, { onClose: props.onClose }, /* @__PURE__ */ React.createElement("div", { className: "pb-5 text-zinc-600" }, /* @__PURE__ */ React.createElement("div", { className: "pb-5 px-5 flex gap-x-2" }, /* @__PURE__ */ React.createElement(
5523
5565
  BadgeEmblem,
5524
5566
  {
@@ -5526,7 +5568,14 @@ const PathwayCard = (props) => {
5526
5568
  alt: props.title,
5527
5569
  size: "md"
5528
5570
  }
5529
- ), /* @__PURE__ */ React.createElement("div", { className: "max-w-[20rem]" }, /* @__PURE__ */ React.createElement("p", { className: "font-semibold" }, props.title), /* @__PURE__ */ React.createElement("div", { className: "text-xs" }, /* @__PURE__ */ React.createElement("span", { className: "text-zinc-500 font-semibold" }, "Tags"), ((_a = props.displayTags) != null ? _a : []).length > 0 && /* @__PURE__ */ React.createElement("div", { className: "inline-block ml-1 text-green-500" }, ((_b = props.displayTags) != null ? _b : []).map((tag, index) => /* @__PURE__ */ React.createElement("span", { key: index, className: "font-semibold mr-1" }, tag)))), !!props.description && /* @__PURE__ */ React.createElement("p", { className: "mt-2 text-sm" }, props.description))), /* @__PURE__ */ React.createElement("div", { className: "p-5 grid grid-cols-1 gap-y-3 md:min-w-[30rem] max-w-[40rem] border-t border-zinc-200" }, /* @__PURE__ */ React.createElement("p", { className: "font-semibold" }, "Pathway Badges & Criteria"), /* @__PURE__ */ React.createElement("p", { className: "text-xs" }, "This pathway is comprised of ", target, " Badges. It includes required and elective programming."), /* @__PURE__ */ React.createElement("p", { className: "text-xs" }, "Progress: ", completedCount, " / ", target, " badges completed."), /* @__PURE__ */ React.createElement("div", { className: "mt-2 grid grid-cols-1 gap-y-2 max-h-[18rem] overflow-y-auto" }, badges.map((b) => {
5571
+ ), /* @__PURE__ */ React.createElement("div", { className: "max-w-[20rem]" }, /* @__PURE__ */ React.createElement("p", { className: "font-semibold" }, props.title), /* @__PURE__ */ React.createElement("div", { className: "text-xs" }, /* @__PURE__ */ React.createElement("span", { className: "text-zinc-500 font-semibold" }, "Tags"), ((_c = props.displayTags) != null ? _c : []).length > 0 && /* @__PURE__ */ React.createElement("div", { className: "inline-block ml-1 text-green-500" }, ((_d = props.displayTags) != null ? _d : []).map((tag, index) => /* @__PURE__ */ React.createElement("span", { key: index, className: "font-semibold mr-1" }, tag)))), !!props.description && /* @__PURE__ */ React.createElement("p", { className: "mt-2 text-sm" }, props.description))), /* @__PURE__ */ React.createElement("div", { className: "p-5 grid grid-cols-1 gap-y-3 md:min-w-[30rem] max-w-[40rem] border-t border-zinc-200" }, /* @__PURE__ */ React.createElement("p", { className: "font-semibold" }, "Pathway Badges & Criteria"), /* @__PURE__ */ React.createElement("p", { className: "text-xs" }, "This pathway is comprised of ", target, " Badges. It includes required and elective programming."), /* @__PURE__ */ React.createElement("p", { className: "text-xs" }, "Progress: ", completedCount, " / ", target, " badges completed."), /* @__PURE__ */ React.createElement(
5572
+ PathwayProgressBarChart,
5573
+ {
5574
+ targets: categoryTargets,
5575
+ points,
5576
+ height: "sm"
5577
+ }
5578
+ ), /* @__PURE__ */ React.createElement("div", { className: "mt-2 grid grid-cols-1 gap-y-2 max-h-[18rem] overflow-y-auto" }, badges.map((b) => {
5530
5579
  const buttonText = b.completedAt ? "Completed" : b.startedAt ? "Continue" : "Start";
5531
5580
  const buttonTheme = b.completedAt ? "light" : "dark";
5532
5581
  const iconName = b.completedAt ? "check & circle" : "circle";