"use client";

type DashCellProps = {
  value?: string | number | null;
  mono?: boolean;
  className?: string;
};

export function SettlementDashCell({
  value,
  mono = false,
  className,
}: DashCellProps): React.ReactElement {
  const text =
    value === null || value === undefined || String(value).trim() === ""
      ? "—"
      : String(value);

  return (
    <span className={[mono ? "font-mono text-xs" : "", className].filter(Boolean).join(" ") || undefined}>
      {text}
    </span>
  );
}

export function formatPlatformPartyLabel(
  label: string | null | undefined,
  t: (key: string, opts?: { defaultValue?: string }) => string,
): string {
  if (label === "platform") {
    return t("agents:settlementBills.platform", { defaultValue: "平台" });
  }

  return label?.trim() || "—";
}
