@local-civics/hub-ui 0.1.254 → 0.1.256

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
@@ -6572,7 +6572,8 @@ const PathwayDetail = (props) => {
6572
6572
  }
6573
6573
  return depth;
6574
6574
  };
6575
- const categoryIds = Object.keys(props.rawCriteria || {}).filter((id) => !rootCategoryIds.has(id)).sort((a, b) => depthOf(a) - depthOf(b));
6575
+ const barCategoryIds = Object.keys(props.rawCriteria || {}).sort((a, b) => depthOf(a) - depthOf(b));
6576
+ const categoryIds = barCategoryIds.filter((id) => !rootCategoryIds.has(id));
6576
6577
  const [catFilter, setCatFilter] = React.useState(null);
6577
6578
  const [categoriesOpen, setCategoriesOpen] = React.useState(false);
6578
6579
  const filteredBadges = catFilter ? badges.filter((b) => {
@@ -6588,7 +6589,7 @@ const PathwayDetail = (props) => {
6588
6589
  },
6589
6590
  /* @__PURE__ */ React.createElement(IconCategory2, { size: 15, stroke: 2 }),
6590
6591
  "View Pathway Structure"
6591
- ), categoryIds.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "mt-4 flex flex-col gap-3" }, categoryIds.map((id, i) => {
6592
+ ), barCategoryIds.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "mt-4 flex flex-col gap-3" }, barCategoryIds.map((id, i) => {
6592
6593
  var _a2, _b, _c;
6593
6594
  const accent = ACCENT_ORDER[i % ACCENT_ORDER.length];
6594
6595
  const label = ((_a2 = props.categoryNames) == null ? void 0 : _a2[id]) || id;
@@ -6857,11 +6858,12 @@ const formatDate$1 = (value) => {
6857
6858
  };
6858
6859
  const CommentsCard = (props) => {
6859
6860
  const comments = props.comments || [];
6860
- const total = comments.length;
6861
- const needsAttention = comments.filter((c) => c.requireValidation && (!c.resolvedAt || c.needsSubmission)).length;
6861
+ const needsValidation = comments.filter((c) => c.requireValidation && !c.resolvedAt).length;
6862
+ const needsSubmission = comments.filter((c) => c.requireValidation && !!c.resolvedAt && c.needsSubmission).length;
6862
6863
  const resolved = comments.filter((c) => !!c.resolvedAt && !c.needsSubmission).length;
6864
+ const open = needsValidation + needsSubmission;
6863
6865
  const recent = [...comments].sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()).slice(0, RECENT_COUNT);
6864
- return /* @__PURE__ */ React.createElement("div", { className: "flex flex-1 flex-col overflow-hidden rounded-2xl border border-mint-400/20 bg-white shadow-[0_4px_20px_rgba(88,214,141,0.12)]" }, /* @__PURE__ */ React.createElement("div", { className: "h-1 bg-gradient-to-r from-mint-400 to-sky-blue-400" }), /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center justify-between gap-3 border-b border-slate-100 px-4 py-3.5" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React.createElement("div", { className: "flex h-9 w-9 items-center justify-center rounded-[10px] bg-mint-400/15" }, /* @__PURE__ */ React.createElement(IconMessageCircle, { size: 18, stroke: 2, className: "text-mint-400" })), /* @__PURE__ */ React.createElement("div", { className: "text-sm font-bold text-dark-blue-400" }, "Comments"), needsAttention > 0 && /* @__PURE__ */ React.createElement(Pill, { label: `${needsAttention} need attention`, accent: "gold" })), props.onViewAll && /* @__PURE__ */ React.createElement(
6866
+ return /* @__PURE__ */ React.createElement("div", { className: "flex flex-1 flex-col overflow-hidden rounded-2xl border border-mint-400/20 bg-white shadow-[0_4px_20px_rgba(88,214,141,0.12)]" }, /* @__PURE__ */ React.createElement("div", { className: "h-1 bg-gradient-to-r from-mint-400 to-sky-blue-400" }), /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center justify-between gap-3 border-b border-slate-100 px-4 py-3.5" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React.createElement("div", { className: "flex h-9 w-9 items-center justify-center rounded-[10px] bg-mint-400/15" }, /* @__PURE__ */ React.createElement(IconMessageCircle, { size: 18, stroke: 2, className: "text-mint-400" })), /* @__PURE__ */ React.createElement("div", { className: "text-sm font-bold text-dark-blue-400" }, "Comments"), open > 0 && /* @__PURE__ */ React.createElement(Pill, { label: `${open} open`, accent: "gold" })), props.onViewAll && /* @__PURE__ */ React.createElement(
6865
6867
  "button",
6866
6868
  {
6867
6869
  type: "button",
@@ -6869,7 +6871,7 @@ const CommentsCard = (props) => {
6869
6871
  className: "shrink-0 text-xs font-bold text-sky-blue-400 hover:underline"
6870
6872
  },
6871
6873
  "View All \u2192"
6872
- )), /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-3 gap-2 border-b border-slate-100 px-4 py-3" }, /* @__PURE__ */ React.createElement(StatCell$1, { label: "Total", value: total }), /* @__PURE__ */ React.createElement(StatCell$1, { label: "Needs Attention", value: needsAttention }), /* @__PURE__ */ React.createElement(StatCell$1, { label: "Resolved", value: resolved })), /* @__PURE__ */ React.createElement("div", { className: "relative flex-1 p-4" }, /* @__PURE__ */ React.createElement(Loader, { isLoading: props.isLoading }, recent.length === 0 && /* @__PURE__ */ React.createElement("p", { className: "text-sm text-slate-400" }, "No comments yet."), recent.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-2.5" }, recent.map((c) => /* @__PURE__ */ React.createElement(
6874
+ )), /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-3 gap-2 border-b border-slate-100 px-4 py-3" }, /* @__PURE__ */ React.createElement(StatCell$1, { label: "Needs validation", value: needsValidation }), /* @__PURE__ */ React.createElement(StatCell$1, { label: "Needs submission", value: needsSubmission }), /* @__PURE__ */ React.createElement(StatCell$1, { label: "Resolved", value: resolved })), /* @__PURE__ */ React.createElement("div", { className: "relative flex-1 p-4" }, /* @__PURE__ */ React.createElement(Loader, { isLoading: props.isLoading }, recent.length === 0 && /* @__PURE__ */ React.createElement("p", { className: "text-sm text-slate-400" }, "No comments yet."), recent.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-2.5" }, recent.map((c) => /* @__PURE__ */ React.createElement(
6873
6875
  CommentRow,
6874
6876
  {
6875
6877
  key: c.commentId,
@@ -6883,8 +6885,8 @@ const StatCell$1 = (props) => /* @__PURE__ */ React.createElement("div", { class
6883
6885
  const CommentRow = (props) => {
6884
6886
  const c = props.comment;
6885
6887
  const resolved = !!c.resolvedAt;
6886
- const materialLabel = c.badgeName || c.lessonName;
6887
- const onClick = c.badgeId && props.onBadgeClick ? () => props.onBadgeClick(c.badgeId) : c.lessonId && props.onLessonClick ? () => props.onLessonClick(c.lessonId) : void 0;
6888
+ const materialLabel = c.lessonName || c.badgeName;
6889
+ const onClick = c.lessonId && props.onLessonClick ? () => props.onLessonClick(c.lessonId) : c.badgeId && props.onBadgeClick ? () => props.onBadgeClick(c.badgeId) : void 0;
6888
6890
  return /* @__PURE__ */ React.createElement("div", { className: "rounded-lg border border-slate-100 bg-slate-50 p-3" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center justify-between gap-2" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, onClick ? /* @__PURE__ */ React.createElement(
6889
6891
  "button",
6890
6892
  {
@@ -6896,15 +6898,15 @@ const CommentRow = (props) => {
6896
6898
  ) : /* @__PURE__ */ React.createElement("span", { className: "text-xs font-bold text-dark-blue-400" }, materialLabel || "General"), (c.badgeId || c.lessonId) && /* @__PURE__ */ React.createElement(
6897
6899
  "span",
6898
6900
  {
6899
- className: `rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide ${c.badgeId ? "bg-mint-400/15 text-dark-blue-400" : "bg-gold-400/15 text-dark-blue-400"}`
6901
+ className: `rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide ${c.lessonId ? "bg-gold-400/15 text-dark-blue-400" : "bg-mint-400/15 text-dark-blue-400"}`
6900
6902
  },
6901
- c.badgeId ? "Badge" : "Lesson"
6903
+ c.lessonId ? "Lesson" : "Badge"
6902
6904
  )), /* @__PURE__ */ React.createElement("div", { className: "shrink-0 text-[10.5px] text-slate-400" }, formatDate$1(c.createdAt))), /* @__PURE__ */ React.createElement("p", { className: "mt-1.5 line-clamp-2 text-xs text-slate-600" }, c.commentText), c.requireValidation && /* @__PURE__ */ React.createElement(
6903
6905
  "span",
6904
6906
  {
6905
6907
  className: `mt-2 inline-block rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide ${!resolved ? "bg-gold-100 text-dark-blue-400" : c.needsSubmission ? "bg-sky-blue-400/15 text-dark-blue-400" : "bg-mint-100 text-dark-blue-400"}`
6906
6908
  },
6907
- !resolved ? "Needs Validation" : c.needsSubmission ? "Needs Submission" : "Resolved"
6909
+ !resolved ? "Needs validation" : c.needsSubmission ? "Needs submission" : "Resolved"
6908
6910
  ));
6909
6911
  };
6910
6912
 
@@ -7297,18 +7299,18 @@ const formatDate = (iso) => {
7297
7299
  };
7298
7300
  const CommentCard = (props) => {
7299
7301
  const { comment } = props;
7300
- const target = comment.badgeId ? {
7301
- label: comment.badgeName || "Badge",
7302
- kind: "badge",
7303
- onClick: props.onBadgeClick ? () => props.onBadgeClick(comment.badgeId) : void 0
7304
- } : comment.lessonId ? {
7302
+ const target = comment.lessonId ? {
7305
7303
  label: comment.lessonName || "Lesson",
7306
7304
  kind: "lesson",
7307
7305
  onClick: props.onLessonClick ? () => props.onLessonClick(comment.lessonId) : void 0
7306
+ } : comment.badgeId ? {
7307
+ label: comment.badgeName || "Badge",
7308
+ kind: "badge",
7309
+ onClick: props.onBadgeClick ? () => props.onBadgeClick(comment.badgeId) : void 0
7308
7310
  } : { label: "General", kind: "general", onClick: void 0 };
7309
7311
  const needsAttention = comment.requireValidation && !comment.resolvedAt;
7310
7312
  const actionLabel = needsAttention && target.kind === "badge" ? "Resubmit this badge" : target.kind === "badge" ? "View this badge" : target.kind === "lesson" ? "View this lesson" : void 0;
7311
- return /* @__PURE__ */ React.createElement("div", { className: `rounded-2xl border bg-white p-4 ${needsAttention ? "border-gold-400/40" : "border-slate-200"}` }, /* @__PURE__ */ React.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-extrabold text-dark-blue-400" }, target.label), /* @__PURE__ */ React.createElement("div", { className: "mt-0.5 flex items-center gap-1.5 text-[11px] text-slate-400" }, comment.commenterName && /* @__PURE__ */ React.createElement("span", null, "Commenter: ", comment.commenterName), comment.commenterName && comment.createdAt && /* @__PURE__ */ React.createElement("span", null, "\xB7"), comment.createdAt && /* @__PURE__ */ React.createElement("span", null, formatDate(comment.createdAt)))), comment.requireValidation && (!comment.resolvedAt ? /* @__PURE__ */ React.createElement("span", { className: "shrink-0 rounded-full bg-gold-400/15 px-2.5 py-1 text-[10px] font-bold text-dark-blue-400" }, "Needs attention") : comment.needsSubmission ? /* @__PURE__ */ React.createElement("span", { className: "shrink-0 rounded-full bg-sky-blue-400/15 px-2.5 py-1 text-[10px] font-bold text-dark-blue-400" }, "Needs submission") : /* @__PURE__ */ React.createElement("span", { className: "flex shrink-0 items-center gap-1 rounded-full bg-mint-400/15 px-2.5 py-1 text-[10px] font-bold text-dark-blue-400" }, /* @__PURE__ */ React.createElement(IconCheck, { size: 11, stroke: 3, className: "text-mint-400" }), "Resolved"))), /* @__PURE__ */ React.createElement("p", { className: "mt-2.5 text-xs text-slate-600" }, comment.commentText), actionLabel && target.onClick && /* @__PURE__ */ React.createElement(
7313
+ return /* @__PURE__ */ React.createElement("div", { className: `rounded-2xl border bg-white p-4 ${needsAttention ? "border-gold-400/40" : "border-slate-200"}` }, /* @__PURE__ */ React.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-extrabold text-dark-blue-400" }, target.label), /* @__PURE__ */ React.createElement("div", { className: "mt-0.5 flex items-center gap-1.5 text-[11px] text-slate-400" }, comment.commenterName && /* @__PURE__ */ React.createElement("span", null, "Commenter: ", comment.commenterName), comment.commenterName && comment.createdAt && /* @__PURE__ */ React.createElement("span", null, "\xB7"), comment.createdAt && /* @__PURE__ */ React.createElement("span", null, formatDate(comment.createdAt)))), comment.requireValidation && (!comment.resolvedAt ? /* @__PURE__ */ React.createElement("span", { className: "shrink-0 rounded-full bg-gold-400/15 px-2.5 py-1 text-[10px] font-bold text-dark-blue-400" }, "Needs validation") : comment.needsSubmission ? /* @__PURE__ */ React.createElement("span", { className: "shrink-0 rounded-full bg-sky-blue-400/15 px-2.5 py-1 text-[10px] font-bold text-dark-blue-400" }, "Needs submission") : /* @__PURE__ */ React.createElement("span", { className: "flex shrink-0 items-center gap-1 rounded-full bg-mint-400/15 px-2.5 py-1 text-[10px] font-bold text-dark-blue-400" }, /* @__PURE__ */ React.createElement(IconCheck, { size: 11, stroke: 3, className: "text-mint-400" }), "Resolved"))), /* @__PURE__ */ React.createElement("p", { className: "mt-2.5 text-xs text-slate-600" }, comment.commentText), actionLabel && target.onClick && /* @__PURE__ */ React.createElement(
7312
7314
  "button",
7313
7315
  {
7314
7316
  type: "button",