diff --git a/desktop/src/features/projects/ui/ProjectRepositoryLatestCommitRow.tsx b/desktop/src/features/projects/ui/ProjectRepositoryLatestCommitRow.tsx new file mode 100644 index 0000000000..36e379058e --- /dev/null +++ b/desktop/src/features/projects/ui/ProjectRepositoryLatestCommitRow.tsx @@ -0,0 +1,41 @@ +import type * as React from "react"; + +import { cn } from "@/shared/lib/cn"; + +/** Interactive table-header row that opens the repository's latest commit. */ +export function ProjectRepositoryLatestCommitRow({ + children, + commitShortHash, + onOpen, +}: { + children: React.ReactNode; + commitShortHash?: string; + onOpen?: () => void; +}) { + return ( + { + if (event.key !== "Enter" && event.key !== " ") return; + event.preventDefault(); + onOpen(); + } + : undefined + } + tabIndex={onOpen ? 0 : undefined} + > + {children} + + ); +} diff --git a/desktop/src/features/projects/ui/ProjectRepositoryPanel.tsx b/desktop/src/features/projects/ui/ProjectRepositoryPanel.tsx index 24e06801c8..09ac04dd7a 100644 --- a/desktop/src/features/projects/ui/ProjectRepositoryPanel.tsx +++ b/desktop/src/features/projects/ui/ProjectRepositoryPanel.tsx @@ -46,6 +46,7 @@ import { PROJECT_DETAIL_PANEL_CLASS, PROJECT_DETAIL_PANEL_MESSAGE_CLASS, } from "./projectPanelStyles"; +import { ProjectRepositoryLatestCommitRow } from "./ProjectRepositoryLatestCommitRow"; import { type RepoSourceHeaderControls, RepoSourceDropdown, @@ -854,33 +855,13 @@ export function RepositoryFilesPanel({
- onOpenCommit(latestCommit.hash) : undefined } - onKeyDown={ - latestCommit && onOpenCommit - ? (event) => - handleRepositoryEntryKeyDown(event, () => - onOpenCommit(latestCommit.hash), - ) - : undefined - } - tabIndex={latestCommit && onOpenCommit ? 0 : undefined} > - + {visibleEntries.map((entry) => {
{latestCommit ? ( @@ -933,7 +914,7 @@ export function RepositoryFilesPanel({

)}