diff --git a/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx b/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx index cd4c7a4dc4..f4e392dd09 100644 --- a/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx +++ b/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx @@ -93,6 +93,65 @@ const TreeNode: FC = ({ node, parentPath, currentFile, setCurrentFile ); }; +type FileChangeTypeIconProps = { + changeType: string; +}; + +const FileChangeTypeIcon: FC = ({ changeType }) => { + const [t] = useTranslation("repos"); + if (changeType === "ADD") { + return ( + + plus + + ); + } + if (changeType === "MODIFY") { + return ( + + slash + + ); + } + if (changeType === "DELETE") { + return ( + + minus + + ); + } + if (changeType === "RENAME") { + return ( + + slash + + ); + } + if (changeType === "COPY") { + return ( + + plus + + ); + } + return null; +}; + type FileProps = { changeType: string; path: string; @@ -125,51 +184,7 @@ const TreeFile: FC = ({ changeType, path, parentPath, currentFile, se )}
{path}
- {changeType === "ADD" && ( - - plus - - )} - {changeType === "MODIFY" && ( - - slash - - )} - {changeType === "DELETE" && ( - - minus - - )} - {changeType === "RENAME" && ( - - slash - - )} - {changeType === "COPY" && ( - - plus - - )} + ); };