// TicketComments - Component for displaying ticket comments
import React from 'react';

function TicketComments({ ticket }) {
  if (!ticket || !ticket.comments?.length) return null;

  return (
    <div>
      <div className="text-xs font-medium text-gray-500 mb-2">Comments</div>
      <div className="space-y-2">
        {ticket.comments.map(comment => (
          <div key={comment.id} className="rounded-lg border border-gray-200 bg-white p-3">
            <div className="flex items-center justify-between gap-2 text-xs text-gray-400">
              <span className="font-medium text-gray-700">{comment.author || "user"}</span>
              <span>{formatTimestamp(comment.created_at)}</span>
            </div>
            <p className="mt-2 text-sm text-gray-700 whitespace-pre-wrap">{comment.content}</p>
          </div>
        ))}
      </div>
    </div>
  );
}

export default TicketComments;
