mirror of
https://github.com/block/buzz.git
synced 2026-11-30 05:02:57 +00:00
feat(desktop): refine repository-aware project workspaces (#6003)
## Summary - Makes Projects repository-aware across browsing, branch and tag selection, local and remote source management, work items, commits, and contextual repository actions. - Refines project details into consistent single-column reading surfaces with a resizable, section-aware context pod, while keeping project conversations available in the attached chat panel. - Adds persistent sidebar project navigation, direct entity links, repository discussion channels, contributor identity matching, and consistent loading and activity presentation. - Keeps branch-specific controls on code-oriented sections while Tasks, Reviews, and Channels remain repository-scoped, reducing misleading context and actions. Replacement for #5981 with an identical final tree flattened into one signed-off commit because the required DCO check suite remained stalled. ### Related issue N/A ### Testing - [x] Desktop pre-push checks, TypeScript typecheck, and unit tests - [x] E2E production build with `pnpm build:e2e` - [x] Focused Playwright smoke coverage for project workspace, task, review, commit, sidebar, and contextual-panel behavior - [ ] Attach final before/after screenshots after design review --------- Signed-off-by: Thomas Petersen <thomasp@squareup.com> Signed-off-by: Wintermute <165f0c871dd2586bb18b6aa109eeaf57bb2132ff4d27b10120f4368a0f627022@buzz.block.builderlab.xyz> Co-authored-by: Wintermute <165f0c871dd2586bb18b6aa109eeaf57bb2132ff4d27b10120f4368a0f627022@buzz.block.builderlab.xyz>
This commit is contained in:
@@ -32,6 +32,7 @@ import type { UserProfileLookup } from "@/features/profile/lib/identity";
|
||||
import type { UserSearchResult } from "@/shared/api/types";
|
||||
import { cn } from "@/shared/lib/cn";
|
||||
import { normalizePubkey } from "@/shared/lib/pubkey";
|
||||
import { BuzzLoadingState } from "@/shared/ui/BuzzLoadingState";
|
||||
import { SyntaxHighlightedCode } from "@/shared/ui/markdown";
|
||||
import { UserAvatar } from "@/shared/ui/UserAvatar";
|
||||
import {
|
||||
@@ -150,7 +151,7 @@ function RepositoryCommitCell({
|
||||
if (!commit) return <span className="text-muted-foreground">—</span>;
|
||||
|
||||
return (
|
||||
<p className="truncate text-sm text-foreground">
|
||||
<p className="truncate text-xs text-foreground">
|
||||
{commit.subject}
|
||||
<span className="text-muted-foreground">
|
||||
{" "}
|
||||
@@ -423,9 +424,10 @@ function RepositoryEntryIcon({ entry }: { entry: RepositoryFileEntry }) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
"flex h-6 w-6 shrink-0 items-center justify-center",
|
||||
"flex h-6 w-6 shrink-0 items-center justify-center rounded-md",
|
||||
visual.containerClassName,
|
||||
)}
|
||||
data-testid="project-repository-entry-icon"
|
||||
>
|
||||
<Icon className={cn("h-4 w-4", visual.className)} />
|
||||
</span>
|
||||
@@ -555,7 +557,7 @@ function FileContentPanel({
|
||||
|
||||
return (
|
||||
<div className={PROJECT_DETAIL_PANEL_CLASS} data-project-detail-panel>
|
||||
<div className="flex min-h-14 items-center gap-1 border-border/50 border-b bg-muted/20 px-3 py-3">
|
||||
<div className="flex min-h-14 items-center gap-1 border-border/50 border-b bg-muted/20 px-4 py-3">
|
||||
<BreadcrumbButton onClick={() => onOpenPath("")}>
|
||||
Files
|
||||
</BreadcrumbButton>
|
||||
@@ -587,15 +589,15 @@ function FileContentPanel({
|
||||
Last changed {formatLastChangedAt(file.lastChangedAt)}
|
||||
</div>
|
||||
{file.previewContent ? (
|
||||
<pre className="max-h-[36rem] overflow-auto bg-background/60 p-4">
|
||||
<pre className="overflow-x-auto bg-background/60 p-4">
|
||||
{language ? (
|
||||
<SyntaxHighlightedCode
|
||||
className="text-xs leading-relaxed"
|
||||
className="whitespace-pre-wrap break-words text-xs leading-relaxed"
|
||||
code={file.previewContent}
|
||||
language={language}
|
||||
/>
|
||||
) : (
|
||||
<code className="block min-w-full whitespace-pre font-mono text-xs leading-relaxed text-foreground">
|
||||
<code className="block min-w-full whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-foreground">
|
||||
{file.previewContent}
|
||||
</code>
|
||||
)}
|
||||
@@ -617,6 +619,7 @@ export function RepositoryFilesPanel({
|
||||
error,
|
||||
profiles,
|
||||
fallbackAuthorPubkey,
|
||||
onContextChange,
|
||||
sourceControls,
|
||||
unavailableMessage,
|
||||
}: {
|
||||
@@ -626,6 +629,10 @@ export function RepositoryFilesPanel({
|
||||
error: unknown;
|
||||
profiles?: UserProfileLookup;
|
||||
fallbackAuthorPubkey?: string;
|
||||
onContextChange?: (context: {
|
||||
kind: "file" | "folder";
|
||||
path: string;
|
||||
}) => void;
|
||||
/** Branch picker + remote/local toggle rendered in the panel header. */
|
||||
sourceControls?: RepoSourceHeaderControls;
|
||||
unavailableMessage?: string;
|
||||
@@ -633,6 +640,12 @@ export function RepositoryFilesPanel({
|
||||
const [currentPath, setCurrentPath] = React.useState("");
|
||||
const [selectedFile, setSelectedFile] =
|
||||
React.useState<ProjectRepoFile | null>(null);
|
||||
React.useEffect(() => {
|
||||
onContextChange?.({
|
||||
kind: selectedFile ? "file" : "folder",
|
||||
path: selectedFile?.path ?? currentPath,
|
||||
});
|
||||
}, [currentPath, onContextChange, selectedFile]);
|
||||
const entries = React.useMemo(
|
||||
() => repositoryEntries(files, currentPath),
|
||||
[currentPath, files],
|
||||
@@ -683,15 +696,43 @@ export function RepositoryFilesPanel({
|
||||
|
||||
// Loading/error/empty states keep the header controls visible — the
|
||||
// remote/local toggle must stay reachable when one source fails to load.
|
||||
const stateMessage = isLoading
|
||||
? "Loading repository files…"
|
||||
: unavailableMessage
|
||||
? unavailableMessage
|
||||
: error
|
||||
? "Could not load the repository file tree."
|
||||
: files.length === 0
|
||||
? "No files have been pushed yet."
|
||||
: null;
|
||||
if (isLoading) {
|
||||
if (!sourceControls) {
|
||||
return <BuzzLoadingState label="Loading repository files" />;
|
||||
}
|
||||
return (
|
||||
<div className={PROJECT_DETAIL_PANEL_CLASS} data-project-detail-panel>
|
||||
<div className="flex min-h-14 min-w-0 items-center gap-1 border-border/50 border-b px-4 py-3">
|
||||
<RepoSourceDropdown controls={sourceControls} />
|
||||
<RepositoryBranchDropdown
|
||||
branch={sourceControls.branch}
|
||||
branchOptions={sourceControls.branchOptions}
|
||||
createBranchDisabled={sourceControls.createBranchDisabled}
|
||||
createBranchTitle={sourceControls.createBranchTitle}
|
||||
deleteBranchDisabled={sourceControls.deleteBranchDisabled}
|
||||
deleteBranchTitle={sourceControls.deleteBranchTitle}
|
||||
onBranchChange={sourceControls.onBranchChange}
|
||||
onCreateBranch={sourceControls.onCreateBranch}
|
||||
onDeleteBranch={sourceControls.onDeleteBranch}
|
||||
onTagChange={sourceControls.onTagChange}
|
||||
selectedTag={sourceControls.selectedTag}
|
||||
tagOptions={sourceControls.tagOptions}
|
||||
/>
|
||||
<div className="ml-auto flex shrink-0 items-center">
|
||||
<RepoSyncActionButton controls={sourceControls} />
|
||||
</div>
|
||||
</div>
|
||||
<BuzzLoadingState label="Loading repository files" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const stateMessage = unavailableMessage
|
||||
? unavailableMessage
|
||||
: error
|
||||
? "Could not load the repository file tree."
|
||||
: files.length === 0
|
||||
? "No files have been pushed yet."
|
||||
: null;
|
||||
if (stateMessage) {
|
||||
if (!sourceControls) {
|
||||
return (
|
||||
@@ -705,7 +746,7 @@ export function RepositoryFilesPanel({
|
||||
}
|
||||
return (
|
||||
<div className={PROJECT_DETAIL_PANEL_CLASS} data-project-detail-panel>
|
||||
<div className="flex min-h-14 min-w-0 items-center gap-1 border-border/50 border-b px-3 py-3">
|
||||
<div className="flex min-h-14 min-w-0 items-center gap-1 border-border/50 border-b px-4 py-3">
|
||||
<RepoSourceDropdown controls={sourceControls} />
|
||||
<RepositoryBranchDropdown
|
||||
branch={sourceControls.branch}
|
||||
@@ -745,7 +786,7 @@ export function RepositoryFilesPanel({
|
||||
return (
|
||||
<div className={PROJECT_DETAIL_PANEL_CLASS} data-project-detail-panel>
|
||||
{sourceControls || pathSegments.length > 0 ? (
|
||||
<div className="flex min-h-14 min-w-0 items-center gap-1 border-border/50 border-b px-3 py-3">
|
||||
<div className="flex min-h-14 min-w-0 items-center gap-1 border-border/50 border-b px-4 py-3">
|
||||
{sourceControls ? (
|
||||
<>
|
||||
<RepoSourceDropdown controls={sourceControls} />
|
||||
@@ -796,8 +837,8 @@ export function RepositoryFilesPanel({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full caption-bottom text-sm">
|
||||
<div className="overflow-x-auto px-2 pb-2">
|
||||
<table className="w-full border-separate border-spacing-y-0.5 caption-bottom text-sm">
|
||||
<thead>
|
||||
<tr className="border-border/50 border-b bg-muted/20">
|
||||
<th className="px-4 py-3 text-left font-normal" colSpan={3}>
|
||||
@@ -860,10 +901,7 @@ export function RepositoryFilesPanel({
|
||||
return (
|
||||
<tr
|
||||
aria-label={`Open ${entry.type} ${entry.name}`}
|
||||
className={cn(
|
||||
"cursor-pointer transition-colors hover:bg-muted/35 focus-visible:bg-muted/35 focus-visible:outline-hidden",
|
||||
!rowIsLast && "border-border/50 border-b",
|
||||
)}
|
||||
className="group/repository-entry cursor-pointer text-xs focus-visible:outline-hidden"
|
||||
key={`${entry.type}:${entry.path}`}
|
||||
onClick={openEntry}
|
||||
onKeyDown={(event) =>
|
||||
@@ -871,7 +909,12 @@ export function RepositoryFilesPanel({
|
||||
}
|
||||
tabIndex={0}
|
||||
>
|
||||
<td className="min-w-52 p-3 align-middle">
|
||||
<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",
|
||||
)}
|
||||
>
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<RepositoryEntryIcon entry={entry} />
|
||||
<span className="truncate font-medium text-foreground">
|
||||
@@ -879,13 +922,23 @@ export function RepositoryFilesPanel({
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className="max-w-96 p-3 align-middle">
|
||||
<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",
|
||||
)}
|
||||
>
|
||||
<RepositoryCommitCell
|
||||
commit={latestCommit}
|
||||
profiles={profiles}
|
||||
/>
|
||||
</td>
|
||||
<td className="w-36 whitespace-nowrap p-3 text-right align-middle text-muted-foreground">
|
||||
<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",
|
||||
)}
|
||||
>
|
||||
{latestCommit ? (
|
||||
<time
|
||||
dateTime={new Date(
|
||||
|
||||
Reference in New Issue
Block a user