Files
orca/src/renderer/src/components/native-chat/NativeChatDiffView.tsx
T
b916248294 Polish desktop native chat view (#6641)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: gsxdsm <gsxdsm@users.noreply.github.com>
2026-06-28 15:43:07 -07:00

28 lines
1.1 KiB
TypeScript

import { cn } from '@/lib/utils'
import type { DiffLine } from './native-chat-diff'
/** Inline coloured diff, used for Edit/Write tool calls and diff-style tool
* results. Adds/dels use the git-decoration tokens with a faint tinted ground,
* matching the terminal's diff palette (no invented colors). */
export function NativeChatDiffView({ lines }: { lines: DiffLine[] }): React.JSX.Element {
return (
<div className="overflow-hidden rounded bg-accent py-1 font-mono text-[11px] leading-relaxed">
{lines.map((line, i) => (
<div
key={i}
className={cn(
'whitespace-pre-wrap break-words px-2',
line.kind === 'add' && 'bg-emerald-500/10 text-[var(--git-decoration-added)]',
line.kind === 'del' && 'bg-rose-500/10 text-[var(--git-decoration-deleted)]',
line.kind === 'meta' && 'text-muted-foreground',
line.kind === 'context' && 'text-foreground/70'
)}
>
{line.kind === 'add' ? '+' : line.kind === 'del' ? '-' : ' '}
{line.text}
</div>
))}
</div>
)
}