"use client"; import { Button } from "@kandev/ui/button"; import { IconTrash, IconEdit, IconMessage, IconPlayerPlay } from "@tabler/icons-react"; import type { DiffComment } from "@/lib/diff/types"; import { formatLineRange } from "@/lib/diff"; import { useTranslation } from "react-i18next"; interface CommentDisplayProps { /** The comment to display */ comment: DiffComment; /** Callback to delete the comment */ onDelete?: () => void; /** Callback to edit the comment */ onEdit?: () => void; /** Callback to run/send the comment to the agent immediately */ onRun?: () => void; /** Whether to show the code content */ showCode?: boolean; /** Compact mode for inline display */ compact?: boolean; } type ActionButtonsProps = { onRun?: () => void; onEdit?: () => void; onDelete?: () => void; size: "compact" | "normal"; stopPropagation?: boolean; }; function CommentActionButtons({ onRun, onEdit, onDelete, size, stopPropagation, }: ActionButtonsProps) { const { t } = useTranslation(); const btnClass = size === "compact" ? "h-4 w-4 p-0" : "h-5 w-5 p-0"; const wrap = (fn?: () => void) => stopPropagation ? (e: React.MouseEvent) => { e.stopPropagation(); fn?.(); } : fn; return ( <> {onRun && ( )} {onEdit && ( )} {onDelete && ( )} ); } export function CommentDisplay({ comment, onDelete, onEdit, onRun, showCode = false, compact = false, }: CommentDisplayProps) { const { t } = useTranslation(); const lineRange = formatLineRange(comment.startLine, comment.endLine); if (compact) { return (
{lineRange} ยท {comment.text}
); } return (
{lineRange} ({comment.side === "additions" ? t("diff:new") : t("diff:old")})
{showCode && comment.codeContent && (
          {comment.codeContent}
        
)}

{comment.text}

); }