mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-07 05:45:39 +08:00
Refactor Settings, FileTree, GitPanel, Shell, and CodeEditor components (#402)
This commit is contained in:
55
src/components/git-panel/view/changes/FileChangeList.tsx
Normal file
55
src/components/git-panel/view/changes/FileChangeList.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import { FILE_STATUS_GROUPS } from '../../constants/constants';
|
||||
import type { FileStatusCode, GitDiffMap, GitStatusResponse } from '../../types/types';
|
||||
import FileChangeItem from './FileChangeItem';
|
||||
|
||||
type FileChangeListProps = {
|
||||
gitStatus: GitStatusResponse;
|
||||
gitDiff: GitDiffMap;
|
||||
expandedFiles: Set<string>;
|
||||
selectedFiles: Set<string>;
|
||||
isMobile: boolean;
|
||||
wrapText: boolean;
|
||||
onToggleSelected: (filePath: string) => void;
|
||||
onToggleExpanded: (filePath: string) => void;
|
||||
onOpenFile: (filePath: string) => void;
|
||||
onToggleWrapText: () => void;
|
||||
onRequestFileAction: (filePath: string, status: FileStatusCode) => void;
|
||||
};
|
||||
|
||||
export default function FileChangeList({
|
||||
gitStatus,
|
||||
gitDiff,
|
||||
expandedFiles,
|
||||
selectedFiles,
|
||||
isMobile,
|
||||
wrapText,
|
||||
onToggleSelected,
|
||||
onToggleExpanded,
|
||||
onOpenFile,
|
||||
onToggleWrapText,
|
||||
onRequestFileAction,
|
||||
}: FileChangeListProps) {
|
||||
return (
|
||||
<>
|
||||
{FILE_STATUS_GROUPS.map(({ key, status }) =>
|
||||
(gitStatus[key] || []).map((filePath) => (
|
||||
<FileChangeItem
|
||||
key={filePath}
|
||||
filePath={filePath}
|
||||
status={status}
|
||||
isMobile={isMobile}
|
||||
isExpanded={expandedFiles.has(filePath)}
|
||||
isSelected={selectedFiles.has(filePath)}
|
||||
diff={gitDiff[filePath]}
|
||||
wrapText={wrapText}
|
||||
onToggleSelected={onToggleSelected}
|
||||
onToggleExpanded={onToggleExpanded}
|
||||
onOpenFile={onOpenFile}
|
||||
onToggleWrapText={onToggleWrapText}
|
||||
onRequestFileAction={onRequestFileAction}
|
||||
/>
|
||||
)),
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user