import { cn } from '@/lib/utils'
interface DiffViewProps {
diff: string
}
export function DiffView({ diff }: DiffViewProps) {
if (!diff) {
return (
{lines.map((line, i) => {
let lineClass = 'text-secondary-foreground'
if (line.startsWith('+') && !line.startsWith('+++')) {
lineClass = 'bg-[rgba(76,175,80,0.12)] text-[#4caf50]'
} else if (line.startsWith('-') && !line.startsWith('---')) {
lineClass = 'bg-[rgba(244,67,54,0.12)] text-[#f44336]'
} else if (line.startsWith('@@')) {
lineClass = 'bg-[rgba(33,150,243,0.08)] text-primary italic'
} else if (line.startsWith('diff') || line.startsWith('index') || line.startsWith('---') || line.startsWith('+++') || line.startsWith('new file')) {
lineClass = 'bg-muted text-muted-foreground font-semibold'
}
return (
{i + 1}
{line || '\u00A0'}
)
})}
)
}