@bitcobblers/wod-wiki-lang 0.59.2246 → 0.60.2250

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/react.cjs CHANGED
@@ -816,10 +816,27 @@ function computeLabel(metric, _surface) {
816
816
  }
817
817
  return base;
818
818
  }
819
+ function formatTooltipValue(metric) {
820
+ if (isTimeLikeMetric(metric.type) && typeof metric.value === "number") {
821
+ return formatDurationSmart(metric.value);
822
+ }
823
+ const val = metric.value;
824
+ if (val !== null && typeof val === "object") {
825
+ if (metric.image) return metric.image;
826
+ const obj = val;
827
+ if ("amount" in obj && "units" in obj) {
828
+ return obj.amount !== void 0 ? `${obj.amount} ${obj.units}` : String(obj.units);
829
+ }
830
+ if ("text" in obj) return String(obj.text);
831
+ if ("current" in obj) return `Round ${obj.current}`;
832
+ return JSON.stringify(val);
833
+ }
834
+ return String(val);
835
+ }
819
836
  function buildTooltip(metric) {
820
837
  const parts = [];
821
838
  parts.push(`Type: ${metric.type}`);
822
- if (metric.value !== void 0) parts.push(`Value: ${metric.value}`);
839
+ if (metric.value !== void 0) parts.push(`Value: ${formatTooltipValue(metric)}`);
823
840
  if (metric.origin) parts.push(`Origin: ${metric.origin}`);
824
841
  if (metric.sourceBlockKey) parts.push(`Block: ${metric.sourceBlockKey}`);
825
842
  if (metric.timestamp) {