import { Tooltip } from "antd";

type EllipsisCellProps = {
  value: unknown;
};

export default function EllipsisCell({ value }: EllipsisCellProps) {
  const text = value === null || value === undefined || value === "" ? "-" : String(value);
  const node = <span className="table-cell-ellipsis">{text}</span>;

  if (text === "-") {
    return node;
  }

  return (
    <Tooltip title={text} placement="topLeft" mouseEnterDelay={0.3}>
      {node}
    </Tooltip>
  );
}
