import { useState } from "react"; import { PatchDiff } from "@pierre/diffs/react"; import { Copy, Check, Columns2, AlignJustify } from "lucide-react"; import { useTheme } from "../context/ThemeContext"; // Map app themes to @pierre/diffs themeType const THEME_MAP: Record = { dark: "dark", light: "light", tan: "light", cloud: "light", }; interface DiffCodeBlockProps { code: string; language: "diff" | "patch"; } export default function DiffCodeBlock({ code, language }: DiffCodeBlockProps) { const { theme } = useTheme(); const [viewMode, setViewMode] = useState<"split" | "unified">("unified"); const [copied, setCopied] = useState(false); // Get theme type for @pierre/diffs const themeType = THEME_MAP[theme] || "dark"; const handleCopy = async () => { await navigator.clipboard.writeText(code); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return (
{language}
); }