import { Check, Edit, Loader2, X, Diff } from 'lucide-react' import { PropsWithChildren, useState } from 'react' import { useDarkModeContext } from '../../contexts/DarkModeContext' import { ApplyStatus, ToolArgs } from '../../types/apply' import { MemoizedSyntaxHighlighterWrapper } from './SyntaxHighlighterWrapper' export default function MarkdownApplyDiffBlock({ mode, applyStatus, onApply, path, diff, finish, }: PropsWithChildren<{ mode: string applyStatus: ApplyStatus onApply: (args: ToolArgs) => void path: string diff: string finish: boolean }>) { const [applying, setApplying] = useState(false) const { isDarkMode } = useDarkModeContext() const handleApply = async () => { if (applyStatus !== ApplyStatus.Idle) { return } setApplying(true) onApply({ type: "apply_diff", filepath: path, diff, finish, }) } return (
{path && (
{mode}: {path}
)}
{diff}
) }