fix(desktop): polish Projects navigation and detail presentation

Make sidebar and repository navigation behave predictably while clarifying review metadata, activity hierarchy, and file-detail presentation.

Signed-off-by: Thomas Petersen <thomasp@squareup.com>
This commit is contained in:
Thomas Petersen
2026-08-17 15:13:59 -04:00
parent 3c228b1082
commit 278d175db3
13 changed files with 218 additions and 60 deletions

View File

@@ -617,6 +617,7 @@ export function RepositoryFilesPanel({
profiles,
fallbackAuthorPubkey,
onContextChange,
onOpenCommit,
sourceControls,
unavailableMessage,
}: {
@@ -631,6 +632,7 @@ export function RepositoryFilesPanel({
kind: "file" | "folder";
path: string;
}) => void;
onOpenCommit?: (commitHash: string) => void;
/** Branch picker + remote/local toggle rendered in the panel header. */
sourceControls?: RepoSourceHeaderControls;
unavailableMessage?: string;
@@ -850,9 +852,36 @@ export function RepositoryFilesPanel({
) : null}
<div className="overflow-x-auto px-2 pb-2">
<table className="w-full border-separate border-spacing-y-0.5 caption-bottom text-sm">
<table className="w-full border-collapse caption-bottom text-sm">
<thead>
<tr className="border-border/50 border-b bg-muted/20">
<tr
aria-label={
latestCommit
? `Open commit ${latestCommit.shortHash}`
: undefined
}
className={cn(
"bg-muted/20",
latestCommit &&
onOpenCommit &&
"cursor-pointer transition-colors hover:bg-muted/35 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
)}
data-testid="project-repository-latest-commit"
onClick={
latestCommit && onOpenCommit
? () => onOpenCommit(latestCommit.hash)
: undefined
}
onKeyDown={
latestCommit && onOpenCommit
? (event) =>
handleRepositoryEntryKeyDown(event, () =>
onOpenCommit(latestCommit.hash),
)
: undefined
}
tabIndex={latestCommit && onOpenCommit ? 0 : undefined}
>
<th className="px-4 py-3 text-left font-normal" colSpan={3}>
{latestCommit ? (
<div className="flex min-w-0 items-center justify-between gap-3 text-sm">
@@ -904,9 +933,8 @@ export function RepositoryFilesPanel({
</tr>
</thead>
<tbody>
{visibleEntries.map((entry, index) => {
{visibleEntries.map((entry) => {
const latestCommit = entry.latestCommit;
const rowIsLast = index === visibleEntries.length - 1;
const openEntry = () =>
openRepositoryEntry(entry, openPath, setSelectedFile);
@@ -914,6 +942,7 @@ export function RepositoryFilesPanel({
<tr
aria-label={`Open ${entry.type} ${entry.name}`}
className="group/repository-entry cursor-pointer text-xs focus-visible:outline-hidden"
data-testid="project-repository-entry-row"
key={`${entry.type}:${entry.path}`}
onClick={openEntry}
onKeyDown={(event) =>
@@ -921,12 +950,7 @@ export function RepositoryFilesPanel({
}
tabIndex={0}
>
<td
className={cn(
"min-w-52 rounded-l-md px-3 py-2 align-middle transition-colors group-hover/repository-entry:bg-muted/35 group-focus-visible/repository-entry:bg-muted/35",
!rowIsLast && "border-border/50 border-b",
)}
>
<td className="min-w-52 px-3 py-2 align-middle transition-colors group-hover/repository-entry:bg-muted/35 group-focus-visible/repository-entry:bg-muted/35">
<div className="flex min-w-0 items-center gap-2">
<RepositoryEntryIcon entry={entry} />
<span className="truncate font-medium text-foreground">
@@ -934,23 +958,13 @@ export function RepositoryFilesPanel({
</span>
</div>
</td>
<td
className={cn(
"max-w-96 p-2 align-middle transition-colors group-hover/repository-entry:bg-muted/35 group-focus-visible/repository-entry:bg-muted/35",
!rowIsLast && "border-border/50 border-b",
)}
>
<td className="max-w-96 p-2 align-middle transition-colors group-hover/repository-entry:bg-muted/35 group-focus-visible/repository-entry:bg-muted/35">
<RepositoryCommitCell
commit={latestCommit}
profiles={profiles}
/>
</td>
<td
className={cn(
"w-36 whitespace-nowrap rounded-r-md p-2 text-right align-middle text-muted-foreground transition-colors group-hover/repository-entry:bg-muted/35 group-focus-visible/repository-entry:bg-muted/35",
!rowIsLast && "border-border/50 border-b",
)}
>
<td className="w-36 whitespace-nowrap p-2 text-right align-middle text-muted-foreground transition-colors group-hover/repository-entry:bg-muted/35 group-focus-visible/repository-entry:bg-muted/35">
{latestCommit ? (
<time
dateTime={new Date(