@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.d.ts +2 -2
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1420,8 +1420,8 @@ type CommentsCardProps = {
|
|
|
1420
1420
|
/**
|
|
1421
1421
|
* My Profile's "Comments" summary card - a presentational sibling to PathwaysCard/BadgesCard.
|
|
1422
1422
|
* Gives a student a passive, at-a-glance view of what's been said about their own badges/lessons
|
|
1423
|
-
* without having to visit the standalone /comments page first: 3 status
|
|
1424
|
-
* Needs
|
|
1423
|
+
* without having to visit the standalone /comments page first: 3 status stats (Needs validation /
|
|
1424
|
+
* Needs submission / Resolved), then the most recent comments themselves, each with a hyperlink
|
|
1425
1425
|
* straight to the badge/lesson it concerns. "View All" is the same destination the sidebar's own
|
|
1426
1426
|
* Comments tab already points at - this card is a summary of that page, not a replacement for it.
|
|
1427
1427
|
* @param props
|
package/dist/index.js
CHANGED
|
@@ -6592,7 +6592,8 @@ const PathwayDetail = (props) => {
|
|
|
6592
6592
|
}
|
|
6593
6593
|
return depth;
|
|
6594
6594
|
};
|
|
6595
|
-
const
|
|
6595
|
+
const barCategoryIds = Object.keys(props.rawCriteria || {}).sort((a, b) => depthOf(a) - depthOf(b));
|
|
6596
|
+
const categoryIds = barCategoryIds.filter((id) => !rootCategoryIds.has(id));
|
|
6596
6597
|
const [catFilter, setCatFilter] = React__namespace.useState(null);
|
|
6597
6598
|
const [categoriesOpen, setCategoriesOpen] = React__namespace.useState(false);
|
|
6598
6599
|
const filteredBadges = catFilter ? badges.filter((b) => {
|
|
@@ -6608,7 +6609,7 @@ const PathwayDetail = (props) => {
|
|
|
6608
6609
|
},
|
|
6609
6610
|
/* @__PURE__ */ React__namespace.createElement(icons$1.IconCategory2, { size: 15, stroke: 2 }),
|
|
6610
6611
|
"View Pathway Structure"
|
|
6611
|
-
),
|
|
6612
|
+
), barCategoryIds.length > 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "mt-4 flex flex-col gap-3" }, barCategoryIds.map((id, i) => {
|
|
6612
6613
|
var _a2, _b, _c;
|
|
6613
6614
|
const accent = ACCENT_ORDER[i % ACCENT_ORDER.length];
|
|
6614
6615
|
const label = ((_a2 = props.categoryNames) == null ? void 0 : _a2[id]) || id;
|
|
@@ -6877,11 +6878,12 @@ const formatDate$1 = (value) => {
|
|
|
6877
6878
|
};
|
|
6878
6879
|
const CommentsCard = (props) => {
|
|
6879
6880
|
const comments = props.comments || [];
|
|
6880
|
-
const
|
|
6881
|
-
const
|
|
6881
|
+
const needsValidation = comments.filter((c) => c.requireValidation && !c.resolvedAt).length;
|
|
6882
|
+
const needsSubmission = comments.filter((c) => c.requireValidation && !!c.resolvedAt && c.needsSubmission).length;
|
|
6882
6883
|
const resolved = comments.filter((c) => !!c.resolvedAt && !c.needsSubmission).length;
|
|
6884
|
+
const open = needsValidation + needsSubmission;
|
|
6883
6885
|
const recent = [...comments].sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()).slice(0, RECENT_COUNT);
|
|
6884
|
-
return /* @__PURE__ */ React__namespace.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__namespace.createElement("div", { className: "h-1 bg-gradient-to-r from-mint-400 to-sky-blue-400" }), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-wrap items-center justify-between gap-3 border-b border-slate-100 px-4 py-3.5" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex h-9 w-9 items-center justify-center rounded-[10px] bg-mint-400/15" }, /* @__PURE__ */ React__namespace.createElement(icons$1.IconMessageCircle, { size: 18, stroke: 2, className: "text-mint-400" })), /* @__PURE__ */ React__namespace.createElement("div", { className: "text-sm font-bold text-dark-blue-400" }, "Comments"),
|
|
6886
|
+
return /* @__PURE__ */ React__namespace.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__namespace.createElement("div", { className: "h-1 bg-gradient-to-r from-mint-400 to-sky-blue-400" }), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-wrap items-center justify-between gap-3 border-b border-slate-100 px-4 py-3.5" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex h-9 w-9 items-center justify-center rounded-[10px] bg-mint-400/15" }, /* @__PURE__ */ React__namespace.createElement(icons$1.IconMessageCircle, { size: 18, stroke: 2, className: "text-mint-400" })), /* @__PURE__ */ React__namespace.createElement("div", { className: "text-sm font-bold text-dark-blue-400" }, "Comments"), open > 0 && /* @__PURE__ */ React__namespace.createElement(Pill, { label: `${open} open`, accent: "gold" })), props.onViewAll && /* @__PURE__ */ React__namespace.createElement(
|
|
6885
6887
|
"button",
|
|
6886
6888
|
{
|
|
6887
6889
|
type: "button",
|
|
@@ -6889,7 +6891,7 @@ const CommentsCard = (props) => {
|
|
|
6889
6891
|
className: "shrink-0 text-xs font-bold text-sky-blue-400 hover:underline"
|
|
6890
6892
|
},
|
|
6891
6893
|
"View All \u2192"
|
|
6892
|
-
)), /* @__PURE__ */ React__namespace.createElement("div", { className: "grid grid-cols-3 gap-2 border-b border-slate-100 px-4 py-3" }, /* @__PURE__ */ React__namespace.createElement(StatCell$1, { label: "
|
|
6894
|
+
)), /* @__PURE__ */ React__namespace.createElement("div", { className: "grid grid-cols-3 gap-2 border-b border-slate-100 px-4 py-3" }, /* @__PURE__ */ React__namespace.createElement(StatCell$1, { label: "Needs validation", value: needsValidation }), /* @__PURE__ */ React__namespace.createElement(StatCell$1, { label: "Needs submission", value: needsSubmission }), /* @__PURE__ */ React__namespace.createElement(StatCell$1, { label: "Resolved", value: resolved })), /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-1 p-4" }, /* @__PURE__ */ React__namespace.createElement(Loader, { isLoading: props.isLoading }, recent.length === 0 && /* @__PURE__ */ React__namespace.createElement("p", { className: "text-sm text-slate-400" }, "No comments yet."), recent.length > 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col gap-2.5" }, recent.map((c) => /* @__PURE__ */ React__namespace.createElement(
|
|
6893
6895
|
CommentRow,
|
|
6894
6896
|
{
|
|
6895
6897
|
key: c.commentId,
|
|
@@ -6903,8 +6905,8 @@ const StatCell$1 = (props) => /* @__PURE__ */ React__namespace.createElement("di
|
|
|
6903
6905
|
const CommentRow = (props) => {
|
|
6904
6906
|
const c = props.comment;
|
|
6905
6907
|
const resolved = !!c.resolvedAt;
|
|
6906
|
-
const materialLabel = c.
|
|
6907
|
-
const onClick = c.
|
|
6908
|
+
const materialLabel = c.lessonName || c.badgeName;
|
|
6909
|
+
const onClick = c.lessonId && props.onLessonClick ? () => props.onLessonClick(c.lessonId) : c.badgeId && props.onBadgeClick ? () => props.onBadgeClick(c.badgeId) : void 0;
|
|
6908
6910
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: "rounded-lg border border-slate-100 bg-slate-50 p-3" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-wrap items-center justify-between gap-2" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center gap-2" }, onClick ? /* @__PURE__ */ React__namespace.createElement(
|
|
6909
6911
|
"button",
|
|
6910
6912
|
{
|
|
@@ -6916,15 +6918,15 @@ const CommentRow = (props) => {
|
|
|
6916
6918
|
) : /* @__PURE__ */ React__namespace.createElement("span", { className: "text-xs font-bold text-dark-blue-400" }, materialLabel || "General"), (c.badgeId || c.lessonId) && /* @__PURE__ */ React__namespace.createElement(
|
|
6917
6919
|
"span",
|
|
6918
6920
|
{
|
|
6919
|
-
className: `rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide ${c.
|
|
6921
|
+
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"}`
|
|
6920
6922
|
},
|
|
6921
|
-
c.
|
|
6923
|
+
c.lessonId ? "Lesson" : "Badge"
|
|
6922
6924
|
)), /* @__PURE__ */ React__namespace.createElement("div", { className: "shrink-0 text-[10.5px] text-slate-400" }, formatDate$1(c.createdAt))), /* @__PURE__ */ React__namespace.createElement("p", { className: "mt-1.5 line-clamp-2 text-xs text-slate-600" }, c.commentText), c.requireValidation && /* @__PURE__ */ React__namespace.createElement(
|
|
6923
6925
|
"span",
|
|
6924
6926
|
{
|
|
6925
6927
|
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"}`
|
|
6926
6928
|
},
|
|
6927
|
-
!resolved ? "Needs
|
|
6929
|
+
!resolved ? "Needs validation" : c.needsSubmission ? "Needs submission" : "Resolved"
|
|
6928
6930
|
));
|
|
6929
6931
|
};
|
|
6930
6932
|
|
|
@@ -7317,18 +7319,18 @@ const formatDate = (iso) => {
|
|
|
7317
7319
|
};
|
|
7318
7320
|
const CommentCard = (props) => {
|
|
7319
7321
|
const { comment } = props;
|
|
7320
|
-
const target = comment.
|
|
7321
|
-
label: comment.badgeName || "Badge",
|
|
7322
|
-
kind: "badge",
|
|
7323
|
-
onClick: props.onBadgeClick ? () => props.onBadgeClick(comment.badgeId) : void 0
|
|
7324
|
-
} : comment.lessonId ? {
|
|
7322
|
+
const target = comment.lessonId ? {
|
|
7325
7323
|
label: comment.lessonName || "Lesson",
|
|
7326
7324
|
kind: "lesson",
|
|
7327
7325
|
onClick: props.onLessonClick ? () => props.onLessonClick(comment.lessonId) : void 0
|
|
7326
|
+
} : comment.badgeId ? {
|
|
7327
|
+
label: comment.badgeName || "Badge",
|
|
7328
|
+
kind: "badge",
|
|
7329
|
+
onClick: props.onBadgeClick ? () => props.onBadgeClick(comment.badgeId) : void 0
|
|
7328
7330
|
} : { label: "General", kind: "general", onClick: void 0 };
|
|
7329
7331
|
const needsAttention = comment.requireValidation && !comment.resolvedAt;
|
|
7330
7332
|
const actionLabel = needsAttention && target.kind === "badge" ? "Resubmit this badge" : target.kind === "badge" ? "View this badge" : target.kind === "lesson" ? "View this lesson" : void 0;
|
|
7331
|
-
return /* @__PURE__ */ React__namespace.createElement("div", { className: `rounded-2xl border bg-white p-4 ${needsAttention ? "border-gold-400/40" : "border-slate-200"}` }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "text-xs font-extrabold text-dark-blue-400" }, target.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "mt-0.5 flex items-center gap-1.5 text-[11px] text-slate-400" }, comment.commenterName && /* @__PURE__ */ React__namespace.createElement("span", null, "Commenter: ", comment.commenterName), comment.commenterName && comment.createdAt && /* @__PURE__ */ React__namespace.createElement("span", null, "\xB7"), comment.createdAt && /* @__PURE__ */ React__namespace.createElement("span", null, formatDate(comment.createdAt)))), comment.requireValidation && (!comment.resolvedAt ? /* @__PURE__ */ React__namespace.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
|
|
7333
|
+
return /* @__PURE__ */ React__namespace.createElement("div", { className: `rounded-2xl border bg-white p-4 ${needsAttention ? "border-gold-400/40" : "border-slate-200"}` }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "text-xs font-extrabold text-dark-blue-400" }, target.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "mt-0.5 flex items-center gap-1.5 text-[11px] text-slate-400" }, comment.commenterName && /* @__PURE__ */ React__namespace.createElement("span", null, "Commenter: ", comment.commenterName), comment.commenterName && comment.createdAt && /* @__PURE__ */ React__namespace.createElement("span", null, "\xB7"), comment.createdAt && /* @__PURE__ */ React__namespace.createElement("span", null, formatDate(comment.createdAt)))), comment.requireValidation && (!comment.resolvedAt ? /* @__PURE__ */ React__namespace.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__namespace.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__namespace.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__namespace.createElement(icons$1.IconCheck, { size: 11, stroke: 3, className: "text-mint-400" }), "Resolved"))), /* @__PURE__ */ React__namespace.createElement("p", { className: "mt-2.5 text-xs text-slate-600" }, comment.commentText), actionLabel && target.onClick && /* @__PURE__ */ React__namespace.createElement(
|
|
7332
7334
|
"button",
|
|
7333
7335
|
{
|
|
7334
7336
|
type: "button",
|