From 914a50b9a2bd68ee24c68d8305a76e51c28b1d81 Mon Sep 17 00:00:00 2001 From: Johannes Batzill Date: Fri, 1 Sep 2023 19:15:54 +0000 Subject: [PATCH] [UI] Ensure consistency of `Commit` element across screens (#392) --- web/src/components/CommitInfo/CommitInfo.tsx | 21 +++++++------------ .../components/LatestCommit/LatestCommit.tsx | 4 ++-- .../BranchesContent/BranchesContent.tsx | 18 ++++++++++++++++ 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/web/src/components/CommitInfo/CommitInfo.tsx b/web/src/components/CommitInfo/CommitInfo.tsx index 19bd13573..ae9ad62e9 100644 --- a/web/src/components/CommitInfo/CommitInfo.tsx +++ b/web/src/components/CommitInfo/CommitInfo.tsx @@ -4,7 +4,6 @@ import { FlexExpander, Layout, Text, - StringSubstitute, ButtonSize, ButtonVariation, Avatar @@ -16,6 +15,7 @@ import { useGet } from 'restful-react' import { useAppContext } from 'AppContext' import { useStrings } from 'framework/strings' import type { TypesCommit, TypesRepository, TypesSignature } from 'services/code' +import { CommitActions } from 'components/CommitActions/CommitActions' import { LIST_FETCHING_LIMIT, formatDate } from 'utils/Utils' import css from './CommitInfo.module.scss' @@ -33,6 +33,11 @@ const CommitInfo = (props: { repoMetadata: TypesRepository; commitRef: string }) lazy: !repoMetadata }) + const commitURL = routes.toCODECommit({ + repoPath: repoMetadata.path as string, + commitRef: commitRef + }) + const commitData = useMemo(() => { return commits?.commits?.filter(commit => commit.sha === commitRef) }, [commitRef, commits?.commits]) @@ -81,19 +86,7 @@ const CommitInfo = (props: { repoMetadata: TypesRepository; commitRef: string }) })} - - {` ${commitRef.substring(0, 6)}`} - ) - }} - /> - + diff --git a/web/src/components/LatestCommit/LatestCommit.tsx b/web/src/components/LatestCommit/LatestCommit.tsx index d3d8817e4..c4854e7dd 100644 --- a/web/src/components/LatestCommit/LatestCommit.tsx +++ b/web/src/components/LatestCommit/LatestCommit.tsx @@ -40,7 +40,7 @@ export function LatestCommitForFolder({ repoMetadata, latestCommit, standaloneSt - + @@ -86,7 +86,7 @@ export function LatestCommitForFile({ repoMetadata, latestCommit, standaloneStyl )} - + diff --git a/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx b/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx index 28d94b802..f038632b4 100644 --- a/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx +++ b/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx @@ -14,6 +14,7 @@ import type { RepoCommitDivergence, TypesRepository } from 'services/code' +import { CommitActions } from 'components/CommitActions/CommitActions' import { formatDate, getErrorMessage } from 'utils/Utils' import { useConfirmAction } from 'hooks/useConfirmAction' import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton' @@ -98,6 +99,23 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel ) } }, + { + Header: getString('commit'), + Id: 'commit', + width: '15%', + Cell: ({ row }: CellProps) => { + return ( + + ) + } + }, { Header: getString('updated'), width: '200px',