@optifye/dashboard-core 6.10.14 → 6.10.15

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.js CHANGED
@@ -59553,16 +59553,59 @@ var ImprovementCenterView = () => {
59553
59553
  const diffDays = Math.max(0, Math.floor((now2.getTime() - firstSeen.getTime()) / (1e3 * 60 * 60 * 24)));
59554
59554
  return Math.max(1, Math.ceil(diffDays / 7));
59555
59555
  };
59556
+ const toZonedDate = (value) => {
59557
+ if (!value) return void 0;
59558
+ const raw = new Date(value);
59559
+ if (Number.isNaN(raw.getTime())) return void 0;
59560
+ return new Date(raw.toLocaleString("en-US", { timeZone: timezone }));
59561
+ };
59562
+ const getDaySuffix = (day) => {
59563
+ const dayMod = day % 100;
59564
+ if (dayMod >= 11 && dayMod <= 13) return "th";
59565
+ if (day % 10 === 1) return "st";
59566
+ if (day % 10 === 2) return "nd";
59567
+ if (day % 10 === 3) return "rd";
59568
+ return "th";
59569
+ };
59556
59570
  const formatOpenedDate = (firstSeenAt) => {
59557
59571
  if (!firstSeenAt) return void 0;
59558
- const raw = new Date(firstSeenAt);
59559
- if (Number.isNaN(raw.getTime())) return void 0;
59560
- const zoned = new Date(raw.toLocaleString("en-US", { timeZone: timezone }));
59572
+ const zoned = toZonedDate(firstSeenAt);
59573
+ if (!zoned) return void 0;
59561
59574
  const day = zoned.getDate();
59562
59575
  const month = zoned.toLocaleString("en-US", { month: "short" });
59563
- const dayMod = day % 100;
59564
- const suffix = dayMod >= 11 && dayMod <= 13 ? "th" : day % 10 === 1 ? "st" : day % 10 === 2 ? "nd" : day % 10 === 3 ? "rd" : "th";
59565
- return `${day}${suffix} ${month}`;
59576
+ return `${day}${getDaySuffix(day)} ${month}`;
59577
+ };
59578
+ const formatMonthDay = (date) => {
59579
+ const month = date.toLocaleString("en-US", { month: "short" });
59580
+ return `${month} ${date.getDate()}`;
59581
+ };
59582
+ const formatDayMonth = (date, withSuffix = true) => {
59583
+ const day = date.getDate();
59584
+ const month = date.toLocaleString("en-US", { month: "short" });
59585
+ return withSuffix ? `${day}${getDaySuffix(day)} ${month}` : `${day} ${month}`;
59586
+ };
59587
+ const formatPeriodRange = (start, end) => {
59588
+ const startDate = toZonedDate(start);
59589
+ const endDate = toZonedDate(end);
59590
+ if (!startDate || !endDate) return void 0;
59591
+ return `${formatMonthDay(startDate)} - ${formatMonthDay(endDate)}`;
59592
+ };
59593
+ const stripPeriodFromDescription = (description, start, end) => {
59594
+ if (!description) return description;
59595
+ const startDate = toZonedDate(start);
59596
+ const endDate = toZonedDate(end);
59597
+ if (!startDate || !endDate) return description;
59598
+ const labels = [
59599
+ `${formatMonthDay(startDate)} - ${formatMonthDay(endDate)}`,
59600
+ `${formatDayMonth(startDate)} - ${formatDayMonth(endDate)}`,
59601
+ `${formatDayMonth(startDate, false)} - ${formatDayMonth(endDate, false)}`
59602
+ ];
59603
+ let cleaned = description;
59604
+ labels.forEach((label) => {
59605
+ cleaned = cleaned.replace(`(${label})`, "").replace(` (${label})`, "");
59606
+ });
59607
+ cleaned = cleaned.replace(/\s{2,}/g, " ").replace(/\s+([.,])/g, "$1").trim();
59608
+ return cleaned;
59566
59609
  };
59567
59610
  const configuredLines = React24.useMemo(() => {
59568
59611
  return entityConfig.lines || entityConfig.lineNames || {};
@@ -59772,7 +59815,7 @@ var ImprovementCenterView = () => {
59772
59815
  }
59773
59816
  if (selectedMemberId !== "all" && !(rec.assigned_user_ids?.includes(selectedMemberId) || rec.assigned_to_user_id === selectedMemberId)) return false;
59774
59817
  return true;
59775
- }).sort((a, b) => (b.weeks_open || 0) - (a.weeks_open || 0));
59818
+ }).sort((a, b) => (a.issue_number || 0) - (b.issue_number || 0));
59776
59819
  }, [recommendations, selectedLineId, selectedStatus, selectedShift, selectedWeeksRange, selectedMemberId]);
59777
59820
  const stats = React24.useMemo(() => {
59778
59821
  const baseFiltered = recommendations.filter((rec) => {
@@ -59995,6 +60038,8 @@ var ImprovementCenterView = () => {
59995
60038
  const weeksOpen = rec.weeks_open || 1;
59996
60039
  const openLabel = weeksOpen <= 1 ? "Opened this week" : `Opened for ${weeksOpen} weeks`;
59997
60040
  const openedOnLabel = formatOpenedDate(rec.first_seen_at);
60041
+ const periodLabel = formatPeriodRange(rec.period_start, rec.period_end);
60042
+ const description = stripPeriodFromDescription(rec.description, rec.period_start, rec.period_end);
59998
60043
  return /* @__PURE__ */ jsxRuntime.jsx(
59999
60044
  motion.div,
60000
60045
  {
@@ -60017,7 +60062,7 @@ var ImprovementCenterView = () => {
60017
60062
  /* @__PURE__ */ jsxRuntime.jsx(outline.ClockIcon, { className: "w-3.5 h-3.5" }),
60018
60063
  openLabel
60019
60064
  ] }),
60020
- openedOnLabel && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium text-gray-600 bg-gray-100 border border-gray-200", children: [
60065
+ openedOnLabel && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium border border-gray-200 text-gray-600 bg-gray-50", children: [
60021
60066
  "Opened on ",
60022
60067
  openedOnLabel
60023
60068
  ] }),
@@ -60047,14 +60092,22 @@ var ImprovementCenterView = () => {
60047
60092
  (rec.shift_label || rec.shift_id !== void 0) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
60048
60093
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u2022" }),
60049
60094
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "uppercase tracking-wide text-xs pt-0.5 text-gray-500 font-medium", children: rec.shift_label || `Shift ${rec.shift_id}` })
60095
+ ] }),
60096
+ periodLabel && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
60097
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u2022" }),
60098
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500 font-medium", children: periodLabel })
60050
60099
  ] })
60051
60100
  ] })
60052
60101
  ] })
60053
60102
  ] }) }),
60054
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose prose-sm text-gray-600", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: rec.description }) }),
60103
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose prose-sm text-gray-600", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: description }) }),
60055
60104
  rec.resolution_instructions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-blue-50 border border-blue-100 rounded-lg p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-blue-800 font-medium flex items-start gap-2", children: [
60056
60105
  /* @__PURE__ */ jsxRuntime.jsx(outline.CheckCircleIcon, { className: "w-5 h-5 flex-shrink-0" }),
60057
- rec.resolution_instructions
60106
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
60107
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Resolution Condition:" }),
60108
+ " ",
60109
+ rec.resolution_instructions
60110
+ ] })
60058
60111
  ] }) })
60059
60112
  ] }),
60060
60113
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full md:w-1/2 lg:w-5/12 bg-gray-50 rounded-lg p-4 border border-gray-100", children: Array.isArray(rec.evidence) && rec.evidence.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
package/dist/index.mjs CHANGED
@@ -59524,16 +59524,59 @@ var ImprovementCenterView = () => {
59524
59524
  const diffDays = Math.max(0, Math.floor((now2.getTime() - firstSeen.getTime()) / (1e3 * 60 * 60 * 24)));
59525
59525
  return Math.max(1, Math.ceil(diffDays / 7));
59526
59526
  };
59527
+ const toZonedDate = (value) => {
59528
+ if (!value) return void 0;
59529
+ const raw = new Date(value);
59530
+ if (Number.isNaN(raw.getTime())) return void 0;
59531
+ return new Date(raw.toLocaleString("en-US", { timeZone: timezone }));
59532
+ };
59533
+ const getDaySuffix = (day) => {
59534
+ const dayMod = day % 100;
59535
+ if (dayMod >= 11 && dayMod <= 13) return "th";
59536
+ if (day % 10 === 1) return "st";
59537
+ if (day % 10 === 2) return "nd";
59538
+ if (day % 10 === 3) return "rd";
59539
+ return "th";
59540
+ };
59527
59541
  const formatOpenedDate = (firstSeenAt) => {
59528
59542
  if (!firstSeenAt) return void 0;
59529
- const raw = new Date(firstSeenAt);
59530
- if (Number.isNaN(raw.getTime())) return void 0;
59531
- const zoned = new Date(raw.toLocaleString("en-US", { timeZone: timezone }));
59543
+ const zoned = toZonedDate(firstSeenAt);
59544
+ if (!zoned) return void 0;
59532
59545
  const day = zoned.getDate();
59533
59546
  const month = zoned.toLocaleString("en-US", { month: "short" });
59534
- const dayMod = day % 100;
59535
- const suffix = dayMod >= 11 && dayMod <= 13 ? "th" : day % 10 === 1 ? "st" : day % 10 === 2 ? "nd" : day % 10 === 3 ? "rd" : "th";
59536
- return `${day}${suffix} ${month}`;
59547
+ return `${day}${getDaySuffix(day)} ${month}`;
59548
+ };
59549
+ const formatMonthDay = (date) => {
59550
+ const month = date.toLocaleString("en-US", { month: "short" });
59551
+ return `${month} ${date.getDate()}`;
59552
+ };
59553
+ const formatDayMonth = (date, withSuffix = true) => {
59554
+ const day = date.getDate();
59555
+ const month = date.toLocaleString("en-US", { month: "short" });
59556
+ return withSuffix ? `${day}${getDaySuffix(day)} ${month}` : `${day} ${month}`;
59557
+ };
59558
+ const formatPeriodRange = (start, end) => {
59559
+ const startDate = toZonedDate(start);
59560
+ const endDate = toZonedDate(end);
59561
+ if (!startDate || !endDate) return void 0;
59562
+ return `${formatMonthDay(startDate)} - ${formatMonthDay(endDate)}`;
59563
+ };
59564
+ const stripPeriodFromDescription = (description, start, end) => {
59565
+ if (!description) return description;
59566
+ const startDate = toZonedDate(start);
59567
+ const endDate = toZonedDate(end);
59568
+ if (!startDate || !endDate) return description;
59569
+ const labels = [
59570
+ `${formatMonthDay(startDate)} - ${formatMonthDay(endDate)}`,
59571
+ `${formatDayMonth(startDate)} - ${formatDayMonth(endDate)}`,
59572
+ `${formatDayMonth(startDate, false)} - ${formatDayMonth(endDate, false)}`
59573
+ ];
59574
+ let cleaned = description;
59575
+ labels.forEach((label) => {
59576
+ cleaned = cleaned.replace(`(${label})`, "").replace(` (${label})`, "");
59577
+ });
59578
+ cleaned = cleaned.replace(/\s{2,}/g, " ").replace(/\s+([.,])/g, "$1").trim();
59579
+ return cleaned;
59537
59580
  };
59538
59581
  const configuredLines = useMemo(() => {
59539
59582
  return entityConfig.lines || entityConfig.lineNames || {};
@@ -59743,7 +59786,7 @@ var ImprovementCenterView = () => {
59743
59786
  }
59744
59787
  if (selectedMemberId !== "all" && !(rec.assigned_user_ids?.includes(selectedMemberId) || rec.assigned_to_user_id === selectedMemberId)) return false;
59745
59788
  return true;
59746
- }).sort((a, b) => (b.weeks_open || 0) - (a.weeks_open || 0));
59789
+ }).sort((a, b) => (a.issue_number || 0) - (b.issue_number || 0));
59747
59790
  }, [recommendations, selectedLineId, selectedStatus, selectedShift, selectedWeeksRange, selectedMemberId]);
59748
59791
  const stats = useMemo(() => {
59749
59792
  const baseFiltered = recommendations.filter((rec) => {
@@ -59966,6 +60009,8 @@ var ImprovementCenterView = () => {
59966
60009
  const weeksOpen = rec.weeks_open || 1;
59967
60010
  const openLabel = weeksOpen <= 1 ? "Opened this week" : `Opened for ${weeksOpen} weeks`;
59968
60011
  const openedOnLabel = formatOpenedDate(rec.first_seen_at);
60012
+ const periodLabel = formatPeriodRange(rec.period_start, rec.period_end);
60013
+ const description = stripPeriodFromDescription(rec.description, rec.period_start, rec.period_end);
59969
60014
  return /* @__PURE__ */ jsx(
59970
60015
  motion.div,
59971
60016
  {
@@ -59988,7 +60033,7 @@ var ImprovementCenterView = () => {
59988
60033
  /* @__PURE__ */ jsx(ClockIcon, { className: "w-3.5 h-3.5" }),
59989
60034
  openLabel
59990
60035
  ] }),
59991
- openedOnLabel && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium text-gray-600 bg-gray-100 border border-gray-200", children: [
60036
+ openedOnLabel && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium border border-gray-200 text-gray-600 bg-gray-50", children: [
59992
60037
  "Opened on ",
59993
60038
  openedOnLabel
59994
60039
  ] }),
@@ -60018,14 +60063,22 @@ var ImprovementCenterView = () => {
60018
60063
  (rec.shift_label || rec.shift_id !== void 0) && /* @__PURE__ */ jsxs(Fragment, { children: [
60019
60064
  /* @__PURE__ */ jsx("span", { children: "\u2022" }),
60020
60065
  /* @__PURE__ */ jsx("span", { className: "uppercase tracking-wide text-xs pt-0.5 text-gray-500 font-medium", children: rec.shift_label || `Shift ${rec.shift_id}` })
60066
+ ] }),
60067
+ periodLabel && /* @__PURE__ */ jsxs(Fragment, { children: [
60068
+ /* @__PURE__ */ jsx("span", { children: "\u2022" }),
60069
+ /* @__PURE__ */ jsx("span", { className: "text-gray-500 font-medium", children: periodLabel })
60021
60070
  ] })
60022
60071
  ] })
60023
60072
  ] })
60024
60073
  ] }) }),
60025
- /* @__PURE__ */ jsx("div", { className: "prose prose-sm text-gray-600", children: /* @__PURE__ */ jsx("p", { children: rec.description }) }),
60074
+ /* @__PURE__ */ jsx("div", { className: "prose prose-sm text-gray-600", children: /* @__PURE__ */ jsx("p", { children: description }) }),
60026
60075
  rec.resolution_instructions && /* @__PURE__ */ jsx("div", { className: "bg-blue-50 border border-blue-100 rounded-lg p-3", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-blue-800 font-medium flex items-start gap-2", children: [
60027
60076
  /* @__PURE__ */ jsx(CheckCircleIcon, { className: "w-5 h-5 flex-shrink-0" }),
60028
- rec.resolution_instructions
60077
+ /* @__PURE__ */ jsxs("span", { children: [
60078
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Resolution Condition:" }),
60079
+ " ",
60080
+ rec.resolution_instructions
60081
+ ] })
60029
60082
  ] }) })
60030
60083
  ] }),
60031
60084
  /* @__PURE__ */ jsx("div", { className: "w-full md:w-1/2 lg:w-5/12 bg-gray-50 rounded-lg p-4 border border-gray-100", children: Array.isArray(rec.evidence) && rec.evidence.length > 0 ? /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.10.14",
3
+ "version": "6.10.15",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",