"use client";

import { useUnits } from "@enode/core/use-units";

/**
 * A set as "<load> <UNIT> × <reps>": the unit symbol comes from the core unit
 * formatter (uppercase) and uses the same small muted style as the History
 * table's figures.
 */
export function LoadRepsLabel({ load, reps }: { load: number; reps: number }) {
  const units = useUnits();
  const formatted = units.format(load, "mass");
  return (
    <>
      {formatted.text ?? "—"}
      {formatted.text && formatted.unit && (
        <span className="stat-small ml-1 text-foreground-muted">{formatted.unit}</span>
      )}
      {` × ${reps}`}
    </>
  );
}
