@local-civics/hub-ui 0.1.249 → 0.1.251

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
@@ -3966,7 +3966,7 @@ const MonthSelection = (props) => {
3966
3966
  const month = props.month;
3967
3967
  const previousMonth = () => props.setMonth(new Date(month.getFullYear(), month.getMonth() - 1, 1));
3968
3968
  const nextMonth = () => props.setMonth(new Date(month.getFullYear(), month.getMonth() + 1, 1));
3969
- return /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React__default.createElement("div", { className: "grow" }, /* @__PURE__ */ React__default.createElement("span", { className: "font-semibold text-md text-slate-300" }, formatDate$1(month, { month: "long" })), /* @__PURE__ */ React__default.createElement("span", { className: "text-md ml-1 text-slate-300" }, formatDate$1(month, { year: "numeric" }))), /* @__PURE__ */ React__default.createElement("div", { onClick: previousMonth, className: "cursor-pointer w-3 h-3 min-w-3 text-slate-300 hover:text-slate-500" }, /* @__PURE__ */ React__default.createElement(Icon$1, { name: "leftArrow" })), /* @__PURE__ */ React__default.createElement("div", { onClick: nextMonth, className: "cursor-pointer ml-2 w-3 h-3 min-w-3 text-slate-300 hover:text-slate-500" }, /* @__PURE__ */ React__default.createElement(Icon$1, { name: "rightArrow" })));
3969
+ return /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React__default.createElement("div", { className: "grow" }, /* @__PURE__ */ React__default.createElement("span", { className: "font-semibold text-md text-slate-300" }, formatDate$2(month, { month: "long" })), /* @__PURE__ */ React__default.createElement("span", { className: "text-md ml-1 text-slate-300" }, formatDate$2(month, { year: "numeric" }))), /* @__PURE__ */ React__default.createElement("div", { onClick: previousMonth, className: "cursor-pointer w-3 h-3 min-w-3 text-slate-300 hover:text-slate-500" }, /* @__PURE__ */ React__default.createElement(Icon$1, { name: "leftArrow" })), /* @__PURE__ */ React__default.createElement("div", { onClick: nextMonth, className: "cursor-pointer ml-2 w-3 h-3 min-w-3 text-slate-300 hover:text-slate-500" }, /* @__PURE__ */ React__default.createElement(Icon$1, { name: "rightArrow" })));
3970
3970
  };
3971
3971
  const DaySelection = (props) => {
3972
3972
  const today = new Date();
@@ -4011,7 +4011,7 @@ const calend = (date) => {
4011
4011
  const isSameDate = (left, right) => {
4012
4012
  return left === right || !!(left && right) && left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth() && left.getDate() === right.getDate();
4013
4013
  };
4014
- const formatDate$1 = (date, options) => {
4014
+ const formatDate$2 = (date, options) => {
4015
4015
  return Intl.DateTimeFormat("en-US", options).format(date);
4016
4016
  };
4017
4017
  const nextDate$1 = (date) => {
@@ -4058,9 +4058,9 @@ const EventList = (props) => {
4058
4058
  return /* @__PURE__ */ React__default.createElement(Widget, null, /* @__PURE__ */ React__default.createElement(WidgetHeader, { divide: true }, /* @__PURE__ */ React__default.createElement(WidgetTitle, null, /* @__PURE__ */ React__default.createElement(DateTitle, null, date)), /* @__PURE__ */ React__default.createElement(WidgetHeaderLink, { onClick: () => props.onSetDate(previousDate(date)), display: !!props.date }, /* @__PURE__ */ React__default.createElement(Icon$1, { name: "leftArrow" })), /* @__PURE__ */ React__default.createElement(WidgetHeaderLink, { onClick: () => props.onSetDate(nextDate(date)), display: !!props.date }, /* @__PURE__ */ React__default.createElement(Icon$1, { name: "rightArrow" }))), /* @__PURE__ */ React__default.createElement(WidgetBody, null, /* @__PURE__ */ React__default.createElement(Loader, { isLoading: props.isLoading }, hasChildren && /* @__PURE__ */ React__default.createElement("div", { className: "grid grid-cols-1 max-h-[30rem] overflow-auto gap-2" }, props.children), !hasChildren && /* @__PURE__ */ React__default.createElement("div", { className: "grid justify-items-center content-center h-[16rem] lg:h-[22rem]" }, /* @__PURE__ */ React__default.createElement("p", { className: "text-sm text-center align-middle leading-6 font-semibold text-slate-300" }, "No events for the day.")))));
4059
4059
  };
4060
4060
  const DateTitle = (props) => {
4061
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: "font-semibold text-3xl text-slate-600" }, formatDate(props.children, { month: "long" })), /* @__PURE__ */ React__default.createElement("span", { className: "font-semibold ml-2 text-3xl text-slate-600" }, ordNumber(props.children.getDate())), /* @__PURE__ */ React__default.createElement("span", { className: "text-3xl ml-2 text-slate-600" }, formatDate(props.children, { year: "numeric" })));
4061
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: "font-semibold text-3xl text-slate-600" }, formatDate$1(props.children, { month: "long" })), /* @__PURE__ */ React__default.createElement("span", { className: "font-semibold ml-2 text-3xl text-slate-600" }, ordNumber(props.children.getDate())), /* @__PURE__ */ React__default.createElement("span", { className: "text-3xl ml-2 text-slate-600" }, formatDate$1(props.children, { year: "numeric" })));
4062
4062
  };
4063
- const formatDate = (date, options) => {
4063
+ const formatDate$1 = (date, options) => {
4064
4064
  return Intl.DateTimeFormat("en-US", options).format(date);
4065
4065
  };
4066
4066
  const previousDate = (date) => {
@@ -7236,6 +7236,12 @@ const Comments = (props) => {
7236
7236
  }
7237
7237
  ))));
7238
7238
  };
7239
+ const formatDate = (iso) => {
7240
+ const d = new Date(iso);
7241
+ if (isNaN(d.getTime()))
7242
+ return "";
7243
+ return d.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
7244
+ };
7239
7245
  const CommentCard = (props) => {
7240
7246
  const { comment } = props;
7241
7247
  const target = comment.badgeId ? {
@@ -7249,7 +7255,7 @@ const CommentCard = (props) => {
7249
7255
  } : { label: "General", kind: "general", onClick: void 0 };
7250
7256
  const needsAttention = comment.requireValidation && !comment.resolvedAt;
7251
7257
  const actionLabel = needsAttention && target.kind === "badge" ? "Resubmit this badge" : target.kind === "badge" ? "View this badge" : target.kind === "lesson" ? "View this lesson" : void 0;
7252
- 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), comment.authorName && /* @__PURE__ */ React.createElement("div", { className: "mt-0.5 text-[11px] text-slate-400" }, "from ", comment.authorName)), comment.requireValidation && (comment.resolvedAt ? /* @__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("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"))), /* @__PURE__ */ React.createElement("p", { className: "mt-2.5 text-xs text-slate-600" }, comment.commentText), actionLabel && target.onClick && /* @__PURE__ */ React.createElement(
7258
+ 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(
7253
7259
  "button",
7254
7260
  {
7255
7261
  type: "button",