From e9bd8cdc141631aa70722a5a045d9baada2ac56a Mon Sep 17 00:00:00 2001 From: Thomas Petersen Date: Wed, 19 Aug 2026 19:28:05 -0400 Subject: [PATCH] refactor(desktop): extract the latest repository commit row Keep ProjectRepositoryPanel below the 1,000-line ceiling after the latest main changes by moving the interactive latest-commit row shell into a focused component. Click and Enter/Space behavior remain unchanged. Signed-off-by: Thomas Petersen --- .../ui/ProjectRepositoryLatestCommitRow.tsx | 41 +++++++++++++++++++ .../projects/ui/ProjectRepositoryPanel.tsx | 29 +++---------- 2 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 desktop/src/features/projects/ui/ProjectRepositoryLatestCommitRow.tsx 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({

)}