The implementation is complete. Here's a summary of the changes made: (#1871)
## Summary
I've implemented the GitHub PR status display on `WorkspaceSummary.tsx`. The changes include:
### Backend Changes
1. **`crates/db/src/models/merge.rs`** - Added a new method `get_latest_pr_status_for_workspaces()` that efficiently queries the latest PR status for all workspaces grouped by archived status.
2. **`crates/server/src/routes/task_attempts/workspace_summary.rs`** - Added `pr_status: Option<MergeStatus>` field to the `WorkspaceSummary` struct and included the PR status query in the summary endpoint.
### Frontend Changes
3. **`frontend/src/components/ui-new/hooks/useWorkspaces.ts`** - Added `prStatus` to the `SidebarWorkspace` interface and mapped it in `toSidebarWorkspace()`.
4. **`frontend/src/components/ui-new/primitives/WorkspaceSummary.tsx`** - Added:
- Import for `GitPullRequestIcon`
- `prStatus` prop to the component
- Display logic showing:
- **PR open**: `GitPullRequestIcon` with `text-brand` (orange) color
- **PR merged**: `GitPullRequestIcon` with `text-success` (green) color
- **No PR/closed/unknown**: No icon displayed
5. **`frontend/src/components/ui-new/views/WorkspacesSidebar.tsx`** - Passed the `prStatus` prop to both active and archived workspace summaries.
### Generated Types
6. **`shared/types.ts`** - Auto-generated to include the new `pr_status` field in `WorkspaceSummary`.
This commit is contained in:
committed by
GitHub
parent
b743f849f7
commit
af70dd9239
@@ -25,6 +25,7 @@ export interface SidebarWorkspace {
|
||||
hasUnseenActivity?: boolean;
|
||||
latestProcessCompletedAt?: string;
|
||||
latestProcessStatus?: 'running' | 'completed' | 'failed' | 'killed';
|
||||
prStatus?: 'open' | 'merged' | 'closed' | 'unknown';
|
||||
}
|
||||
|
||||
// Keep the old export name for backwards compatibility
|
||||
@@ -67,6 +68,7 @@ function toSidebarWorkspace(
|
||||
hasUnseenActivity: summary?.has_unseen_turns,
|
||||
latestProcessCompletedAt: summary?.latest_process_completed_at ?? undefined,
|
||||
latestProcessStatus: summary?.latest_process_status ?? undefined,
|
||||
prStatus: summary?.pr_status ?? undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
PlayIcon,
|
||||
FileIcon,
|
||||
CircleIcon,
|
||||
GitPullRequestIcon,
|
||||
} from '@phosphor-icons/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { cn } from '@/lib/utils';
|
||||
@@ -27,6 +28,7 @@ interface WorkspaceSummaryProps {
|
||||
hasUnseenActivity?: boolean;
|
||||
latestProcessCompletedAt?: string;
|
||||
latestProcessStatus?: 'running' | 'completed' | 'failed' | 'killed';
|
||||
prStatus?: 'open' | 'merged' | 'closed' | 'unknown';
|
||||
onClick?: () => void;
|
||||
className?: string;
|
||||
summary?: boolean;
|
||||
@@ -48,6 +50,7 @@ export function WorkspaceSummary({
|
||||
hasUnseenActivity = false,
|
||||
latestProcessCompletedAt,
|
||||
latestProcessStatus,
|
||||
prStatus,
|
||||
onClick,
|
||||
className,
|
||||
summary = false,
|
||||
@@ -120,6 +123,20 @@ export function WorkspaceSummary({
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* PR status icon */}
|
||||
{prStatus === 'open' && (
|
||||
<GitPullRequestIcon
|
||||
className="size-icon-xs text-brand shrink-0"
|
||||
weight="fill"
|
||||
/>
|
||||
)}
|
||||
{prStatus === 'merged' && (
|
||||
<GitPullRequestIcon
|
||||
className="size-icon-xs text-success shrink-0"
|
||||
weight="fill"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Pin icon */}
|
||||
{isPinned && (
|
||||
<PushPinIcon
|
||||
|
||||
@@ -97,6 +97,7 @@ export function WorkspacesSidebar({
|
||||
hasUnseenActivity={workspace.hasUnseenActivity}
|
||||
latestProcessCompletedAt={workspace.latestProcessCompletedAt}
|
||||
latestProcessStatus={workspace.latestProcessStatus}
|
||||
prStatus={workspace.prStatus}
|
||||
onClick={() => onSelectWorkspace(workspace.id)}
|
||||
/>
|
||||
))}
|
||||
@@ -124,6 +125,7 @@ export function WorkspacesSidebar({
|
||||
hasUnseenActivity={workspace.hasUnseenActivity}
|
||||
latestProcessCompletedAt={workspace.latestProcessCompletedAt}
|
||||
latestProcessStatus={workspace.latestProcessStatus}
|
||||
prStatus={workspace.prStatus}
|
||||
onClick={() => onSelectWorkspace(workspace.id)}
|
||||
/>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user