@local-civics/hub-ui 0.1.255 → 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 +16 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -15
- 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
|
@@ -6878,11 +6878,12 @@ const formatDate$1 = (value) => {
|
|
|
6878
6878
|
};
|
|
6879
6879
|
const CommentsCard = (props) => {
|
|
6880
6880
|
const comments = props.comments || [];
|
|
6881
|
-
const
|
|
6882
|
-
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;
|
|
6883
6883
|
const resolved = comments.filter((c) => !!c.resolvedAt && !c.needsSubmission).length;
|
|
6884
|
+
const open = needsValidation + needsSubmission;
|
|
6884
6885
|
const recent = [...comments].sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()).slice(0, RECENT_COUNT);
|
|
6885
|
-
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(
|
|
6886
6887
|
"button",
|
|
6887
6888
|
{
|
|
6888
6889
|
type: "button",
|
|
@@ -6890,7 +6891,7 @@ const CommentsCard = (props) => {
|
|
|
6890
6891
|
className: "shrink-0 text-xs font-bold text-sky-blue-400 hover:underline"
|
|
6891
6892
|
},
|
|
6892
6893
|
"View All \u2192"
|
|
6893
|
-
)), /* @__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(
|
|
6894
6895
|
CommentRow,
|
|
6895
6896
|
{
|
|
6896
6897
|
key: c.commentId,
|
|
@@ -6904,8 +6905,8 @@ const StatCell$1 = (props) => /* @__PURE__ */ React__namespace.createElement("di
|
|
|
6904
6905
|
const CommentRow = (props) => {
|
|
6905
6906
|
const c = props.comment;
|
|
6906
6907
|
const resolved = !!c.resolvedAt;
|
|
6907
|
-
const materialLabel = c.
|
|
6908
|
-
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;
|
|
6909
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(
|
|
6910
6911
|
"button",
|
|
6911
6912
|
{
|
|
@@ -6917,15 +6918,15 @@ const CommentRow = (props) => {
|
|
|
6917
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(
|
|
6918
6919
|
"span",
|
|
6919
6920
|
{
|
|
6920
|
-
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"}`
|
|
6921
6922
|
},
|
|
6922
|
-
c.
|
|
6923
|
+
c.lessonId ? "Lesson" : "Badge"
|
|
6923
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(
|
|
6924
6925
|
"span",
|
|
6925
6926
|
{
|
|
6926
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"}`
|
|
6927
6928
|
},
|
|
6928
|
-
!resolved ? "Needs
|
|
6929
|
+
!resolved ? "Needs validation" : c.needsSubmission ? "Needs submission" : "Resolved"
|
|
6929
6930
|
));
|
|
6930
6931
|
};
|
|
6931
6932
|
|
|
@@ -7318,18 +7319,18 @@ const formatDate = (iso) => {
|
|
|
7318
7319
|
};
|
|
7319
7320
|
const CommentCard = (props) => {
|
|
7320
7321
|
const { comment } = props;
|
|
7321
|
-
const target = comment.
|
|
7322
|
-
label: comment.badgeName || "Badge",
|
|
7323
|
-
kind: "badge",
|
|
7324
|
-
onClick: props.onBadgeClick ? () => props.onBadgeClick(comment.badgeId) : void 0
|
|
7325
|
-
} : comment.lessonId ? {
|
|
7322
|
+
const target = comment.lessonId ? {
|
|
7326
7323
|
label: comment.lessonName || "Lesson",
|
|
7327
7324
|
kind: "lesson",
|
|
7328
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
|
|
7329
7330
|
} : { label: "General", kind: "general", onClick: void 0 };
|
|
7330
7331
|
const needsAttention = comment.requireValidation && !comment.resolvedAt;
|
|
7331
7332
|
const actionLabel = needsAttention && target.kind === "badge" ? "Resubmit this badge" : target.kind === "badge" ? "View this badge" : target.kind === "lesson" ? "View this lesson" : void 0;
|
|
7332
|
-
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(
|
|
7333
7334
|
"button",
|
|
7334
7335
|
{
|
|
7335
7336
|
type: "button",
|