import { useQuery } from '@tanstack/react-query' import { X } from 'lucide-react' import { configHistoryApi } from '@/lib/api' interface DiffViewerProps { tenantId: string deviceId: string snapshotId: string onClose: () => void } function classifyLine(line: string): string { if (line.startsWith('@@')) return 'bg-blue-900/20 text-blue-300' if (line.startsWith('+++') || line.startsWith('---')) return 'text-text-muted' if (line.startsWith('+')) return 'bg-green-900/30 text-green-300' if (line.startsWith('-')) return 'bg-red-900/30 text-red-300' return 'text-text-primary' } export function DiffViewer({ tenantId, deviceId, snapshotId, onClose }: DiffViewerProps) { const { data: diff, isLoading, isError } = useQuery({ queryKey: ['config-diff', tenantId, deviceId, snapshotId], queryFn: () => configHistoryApi.getDiff(tenantId, deviceId, snapshotId), }) return (