| 1 | import { FileDiffs } from "@/components/diffs/file-diffs"; |
| 2 | |
| 3 | import type { DiffViewProps |
| 4 | |
| 5 | export function DiffView({ |
| 6 | from, |
| 7 | to, |
| 8 | files, |
| 9 | patchUrl, |
| 10 | annotations, |
| 11 | onLineComment, |
| 12 | }: DiffViewProps) |
| 13 | const additions = |
| 14 | const deletions = |
| 15 | |
| 16 | return ( |
| 17 | <div className="flex flex-col gap-4 |
| 18 | <div className="flex items-center gap-3 rounded-lg border px-4 py-2.5 text-sm |
| 19 | <span className="font-medium |
| 20 | {files.length} changed file{ |
| 21 | </span> |
| 22 | <span className="font-mono text-xs tabular-nums |
| 23 | <span className="text-emerald-500 |
| 24 | <span className="text-red-500 |
| 25 | </span> |
| 26 | <span className="ml-auto font-mono text-xs text-muted-foreground |
| 27 | {from.slice(0 |
| 28 | </span> |
| 29 | </div> |
| 30 | |
| 31 | {files.length === |
| 32 | <p className="rounded-lg border border-dashed py-16 text-center text-sm text-muted-foreground |
| 33 | This branch changes nothing against the base. |
| 34 | </p> |
| 35 | ) : ( |
| 36 | <FileDiffs |
| 37 | patchUrl={patchUrl} |
| 38 | files={files} |
| 39 | annotations={annotations} |
| 40 | onLineComment={onLineComment} |
| 41 | /> |
| 42 | )} |
| 43 | </div> |
| 44 | ); |
| 45 | } |