@bitcobblers/wod-wiki-ui 0.6.32 → 0.6.36

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.
@@ -1682,14 +1682,8 @@ var cursorFocusExtension = [
1682
1682
  cursorFocusInternal
1683
1683
  ];
1684
1684
  function formatRunHeader(run) {
1685
- const end = run.result.data.endTime ?? run.result.createdAt;
1686
- const date = new Date(end).toLocaleDateString(void 0, { month: "short", day: "numeric" });
1687
- const durationMs = run.result.data.duration;
1688
- if (!durationMs) return date;
1689
- const totalSeconds = Math.round(durationMs / 1e3);
1690
- const minutes = Math.floor(totalSeconds / 60);
1691
- const seconds = String(totalSeconds % 60).padStart(2, "0");
1692
- return `${date} \u2014 ${minutes}:${seconds}`;
1685
+ const date = new Date(run.timestamp).toLocaleDateString(void 0, { month: "short", day: "numeric" });
1686
+ return date;
1693
1687
  }
1694
1688
  function PlainSegmentList({ segments }) {
1695
1689
  if (segments.length === 0) {
@@ -1717,10 +1711,14 @@ function RowsTable({
1717
1711
  renderSegments
1718
1712
  }) {
1719
1713
  const runs = React.useMemo(
1720
- () => result.runs.map((run) => ({
1721
- run,
1722
- segments: wodWikiLang.getAnalyticsFromLogs(run.logs, run.result.data.startTime).segments
1723
- })),
1714
+ () => result.runs.map((run) => {
1715
+ const statements = run.events;
1716
+ const startTime = run.events[0]?.timeSpan?.started ?? run.timestamp;
1717
+ return {
1718
+ run,
1719
+ segments: wodWikiLang.getAnalyticsFromLogs(statements, startTime).segments
1720
+ };
1721
+ }),
1724
1722
  [result]
1725
1723
  );
1726
1724
  if (runs.length === 0) {
@@ -1732,12 +1730,12 @@ function RowsTable({
1732
1730
  renderRunHeaderExtra?.(run)
1733
1731
  ] }),
1734
1732
  renderSegments ? renderSegments(segments, run) : /* @__PURE__ */ jsxRuntime.jsx(PlainSegmentList, { segments })
1735
- ] }, run.result.id)) });
1733
+ ] }, run.resultId)) });
1736
1734
  }
1737
1735
  var RPE_SCALE = Array.from({ length: 10 }, (_, i) => i + 1);
1738
- function readSessionRpe(logs) {
1739
- if (!logs) return void 0;
1740
- for (const statement of logs) {
1736
+ function readSessionRpe(events) {
1737
+ if (!events) return void 0;
1738
+ for (const statement of events) {
1741
1739
  for (const metric of statement.metrics) {
1742
1740
  if (metric.type === wodWikiCore.MetricType.SessionRPE || metric.type === "session_rpe") {
1743
1741
  if (typeof metric.value === "number") return metric.value;
@@ -1748,11 +1746,11 @@ function readSessionRpe(logs) {
1748
1746
  }
1749
1747
  function RpeChip({
1750
1748
  resultId,
1751
- logs,
1749
+ events,
1752
1750
  readOnly,
1753
1751
  onCapture
1754
1752
  }) {
1755
- const value = readSessionRpe(logs);
1753
+ const value = readSessionRpe(events);
1756
1754
  const [open, setOpen] = React.useState(false);
1757
1755
  const [pending, setPending] = React.useState(false);
1758
1756
  if (readOnly) {
@@ -1816,7 +1814,7 @@ function RowsResultsChrome({
1816
1814
  const [widened, setWidened] = React.useState(false);
1817
1815
  const [wideResult, setWideResult] = React.useState(void 0);
1818
1816
  const sessionRun = sessionResult.runs[0];
1819
- const blockContentId2 = sessionRun?.result.blockContentId;
1817
+ const blockContentId2 = sessionRun?.events[0]?.blockContentId;
1820
1818
  const handleCapture = React.useCallback(
1821
1819
  async (rpe) => {
1822
1820
  if (onCaptureRpe) {
@@ -1884,7 +1882,7 @@ function RowsResultsChrome({
1884
1882
  RpeChip,
1885
1883
  {
1886
1884
  resultId,
1887
- logs: sessionRun?.logs,
1885
+ events: sessionRun?.events,
1888
1886
  onCapture: handleCapture
1889
1887
  }
1890
1888
  ) })
@@ -1894,7 +1892,7 @@ function RowsResultsChrome({
1894
1892
  {
1895
1893
  result: displayedResult,
1896
1894
  renderSegments,
1897
- renderRunHeaderExtra: (run) => run.result.id === resultId ? /* @__PURE__ */ jsxRuntime.jsx(RpeChip, { resultId, logs: run.logs, onCapture: handleCapture }) : /* @__PURE__ */ jsxRuntime.jsx(RpeChip, { resultId: run.result.id, logs: run.logs, readOnly: true, onCapture: handleCapture })
1895
+ renderRunHeaderExtra: (run) => run.resultId === resultId ? /* @__PURE__ */ jsxRuntime.jsx(RpeChip, { resultId, events: run.events, onCapture: handleCapture }) : /* @__PURE__ */ jsxRuntime.jsx(RpeChip, { resultId: run.resultId, events: run.events, readOnly: true, onCapture: handleCapture })
1898
1896
  }
1899
1897
  )
1900
1898
  ] });