import type { TextBlock as TextBlockData } from "@/lib/chat/types";

/** Plain text only — `\n` becomes a line break, markup is shown literally. */
export default function TextBlock({ block }: { block: TextBlockData }) {
  if (typeof block.text !== "string" || !block.text.trim()) return null;
  return (
    <div className="w-fit max-w-full whitespace-pre-line break-words rounded-2xl rounded-tl-sm bg-white px-3 py-2 text-xs leading-relaxed text-gray-700 shadow-sm">
      {block.text}
    </div>
  );
}
