import type { ReactElement } from 'react' import type { DocumentDiff } from './types' import { ArrowDown, ArrowUp, FilePlus, GitCompare } from 'lucide-react' import { Fragment } from 'react' import { statsParts } from './diffView' export interface DiffBarProps { diff: DocumentDiff /** 「只看改动」开着:连着没变的块折成一条 */ onlyChanges: boolean onToggleOnly: () => void /** 有没有改动可以跳(筛掉的不算) */ canMove: boolean /** 跳到上一处(-1)/ 下一处(1)改动 */ onMove: (step: 1 | -1) => void } /** * 筛选栏第二行(标差异时才有):对比基准(「对比:上一次提交」),改动统计(「新增 2 · 修改 3 · 删除 1」,各按改动色, * 没有的那种不写,都没有写「没有改动」),右边「只看改动」开关、上一处 / 下一处。基准里没有这个文件时只写基准,看横幅。 */ export function DiffBar({ diff, onlyChanges, onToggleOnly, canMove, onMove }: DiffBarProps): ReactElement { const parts = statsParts(diff.stats) return (