MCPcopy Create free account
hub / github.com/agent-tower/core / CommitDiffViewer

Function CommitDiffViewer

packages/web/src/components/workspace/HistoryView.tsx:62–79  ·  view source on GitHub ↗
({ workingDir, hash, filePath })

Source from the content-addressed store, hash-verified

60 const files = data?.files || []
61 if (files.length === 0) return <div className="pl-7 py-1 text-xs text-muted-foreground">{t('No files changed')}</div>
62 return (
63 <div className="pl-7 pb-1 space-y-0.5">
64 {files.map((f: GitChangeEntry) => {
65 const dir = dirname(f.path)
66 return (
67 <button
68 key={f.path}
69 type="button"
70 onClick={(e) => { e.stopPropagation(); onSelectFile(f.path) }}
71 className={cn(
72 'flex items-center gap-2 px-1.5 py-1 rounded-sm cursor-pointer w-full text-left',
73 selectedPath === f.path ? 'bg-muted' : 'hover:bg-muted/60'
74 )}
75 >
76 <FileStatusBadge status={f.status} />
77 <span className="min-w-0 text-xs text-foreground truncate">{basename(f.path)}</span>
78 {/* 目录只占剩余空间,先于文件名截断;rtl 让它从左侧截断,内层 ltr 隔离(同 FileRow) */}
79 {dir && (
80 <span className="min-w-0 flex-1 truncate text-right font-mono text-[11px] text-muted-foreground [direction:rtl]">
81 <span dir="ltr">{dir}</span>
82 </span>

Callers

nothing calls this directly

Calls 3

useI18nFunction · 0.90
useGitCommitDiffFunction · 0.90
trimMethod · 0.80

Tested by

no test coverage detected