From fa049d29e239484295d10e7424590c1b9d445aa2 Mon Sep 17 00:00:00 2001 From: LukasBisz Date: Fri, 14 Mar 2025 00:26:55 +0100 Subject: [PATCH] Add file status indicator via icon stacking --- .../add-status-icon-in-file-tree.yaml | 2 +- .../src/repos/diff/DiffFileTree.tsx | 75 +++++++++++++++---- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/gradle/changelog/add-status-icon-in-file-tree.yaml b/gradle/changelog/add-status-icon-in-file-tree.yaml index dd98fc3598..2697ea0f5f 100644 --- a/gradle/changelog/add-status-icon-in-file-tree.yaml +++ b/gradle/changelog/add-status-icon-in-file-tree.yaml @@ -1,2 +1,2 @@ - type: added - description: Colored status icons in file tree + description: Colored status icons in file tree using icon stacking diff --git a/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx b/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx index f4e392dd09..b7c2b71ec2 100644 --- a/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx +++ b/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx @@ -101,7 +101,12 @@ const FileChangeTypeIcon: FC = ({ changeType }) => { const [t] = useTranslation("repos"); if (changeType === "ADD") { return ( - + plus ); @@ -110,11 +115,11 @@ const FileChangeTypeIcon: FC = ({ changeType }) => { return ( - slash + circle ); } @@ -122,7 +127,7 @@ const FileChangeTypeIcon: FC = ({ changeType }) => { return ( @@ -134,17 +139,22 @@ const FileChangeTypeIcon: FC = ({ changeType }) => { return ( - slash + circle ); } if (changeType === "COPY") { return ( - + plus ); @@ -152,6 +162,23 @@ const FileChangeTypeIcon: FC = ({ changeType }) => { return null; }; +const getChangeTypeClassName = (changetype: string) => { + switch (changetype) { + case "ADD": + return "has-text-success"; + case "MODIFY": + return "has-text-info"; + case "DELETE": + return "has-text-danger"; + case "RENAME": + return "has-text-info"; + case "COPY": + return "has-text-info"; + default: + return ""; + } +}; + type FileProps = { changeType: string; path: string; @@ -175,16 +202,36 @@ const TreeFile: FC = ({ changeType, path, parentPath, currentFile, se return ( setCurrentFile(completePath)}> {isCurrentFile() ? ( - - file - + + + file + + + + + ) : ( - - file - + + + file + + + + + )}
{path}
-
); };