import { Text, Tooltip } from "@mantine/core";

interface NotesCellProps {
  value?: string | null;
  maw?: number;
}

/** Notes are free text and often long — show a compact one-line preview and
 *  keep the full note on hover so the row height stays stable. */
export function NotesCell({ value, maw = 200 }: NotesCellProps) {
  if (!value) return <Text size="sm" c="dimmed">-</Text>;

  return (
    <Tooltip label={value} multiline w={300} withArrow position="top-start" openDelay={200}>
      <Text size="sm" c="dimmed" truncate maw={maw} style={{ cursor: "default" }}>
        {value}
      </Text>
    </Tooltip>
  );
}
