feat: show open PR badge in each command center cell#2292
Merged
Conversation
Each populated cell in the command center now shows a small colored PR badge next to the status/environment/repo badges, mirroring the same resolution rules used by the task header (cloud pr_url for cloud tasks, linked-branch lookup → local getPrStatus fallback for local tasks, gated by usePrDetails state). Clicking the badge opens the PR on GitHub in a new tab. Generated-By: PostHog Code Task-Id: 4706ea08-92b3-4063-a175-13b30a7c7c17
Member
Author
|
Note 🤖 Automated comment by QA Swarm — not written by a human Multi-perspective review (degraded: only security-audit reviewer was available in this environment). Verdict: ✅ APPROVESmall UI-only change adding a read-only PR-badge component. No new sinks, no privileged paths, no new data flows beyond the existing Reviewer summaries
Automated by QA Swarm — not a human review |
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/renderer/features/command-center/components/CommandCenterPrButton.tsx:63-65
The icon-component derivation (`merged ? GitMerge : GitPullRequest`) duplicates logic already inside `getPrVisualConfig`, which returns an icon React element for exactly the same cases. The only reason it can't be reused is that `getPrVisualConfig` hard-codes `size={12}` inside the element. Consider exporting the icon component type separately or accepting a size parameter in the utility so the badge doesn't have to re-implement the same `merged`-based branch.
```suggestion
const config = getPrVisualConfig(state, merged, draft);
const prNumber = parsePrNumber(prUrl);
// config.icon is sized for the task-detail panel (12px); derive the
// component type here so we can render it at 10px for the badge.
const Icon = merged ? GitMerge : GitPullRequest;
```
### Issue 2 of 2
apps/code/src/renderer/features/command-center/components/CommandCenterPrButton.tsx:33-44
`useWorkspace(taskId)` is called twice per render: once directly here (to get `worktreePath`/`folderPath` for the focus-path logic), and again inside `useLinkedBranchPrUrl(taskId)`, which calls the same hook internally. If `useWorkspace` reads from a store this is harmless, but it's still a redundant call — extracting the `linkedBranch` / `folderPath` needed by the linked-URL lookup from the workspace already in scope would keep things DRY.
Reviews (1): Last reviewed commit: "feat: show open PR badge in each command..." | Re-trigger Greptile |
Pull the existing PR badge anchor out of `TaskActionsMenu`'s `PrBadgeControl` into a shared `PRBadgeLink` component, and rewrite `CommandCenterPRButton` (renamed from `CommandCenterPrButton` — PR is an acronym) to render that same component instead of a hand-rolled colored anchor with its own color-class map. Resolution logic is unchanged; the command center still mirrors the task page's source chain (cloud `pr_url` → linked branch → local `getPrStatus`) and gates on `usePrDetails` returning a non-null state. Generated-By: PostHog Code Task-Id: 4706ea08-92b3-4063-a175-13b30a7c7c17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
so much real estate we could put a PR button in and save me a click
Problem
The command center grid shows each task's status, environment, and repo, but it does not surface whether the task has an open PR — even on a wide screen with plenty of room. To check or jump to a PR from the command center you have to expand the task first.
Changes
Add a small colored PR badge to each populated cell's header (next to the status / environment / repo badges). Clicking it opens the PR on GitHub in a new tab.
Resolution mirrors the rules used by the task page (
TaskActionsMenu):useCloudPrUrl(run output / SSE).git.getPrStatusfallback against the focused repo path.usePrDetailsreturning a non-nullstate, and colored viagetPrVisualConfig(green / gray / red / purple for open / draft / closed / merged), so the badge only appears when there's a real PR.The badge matches the existing cell-header badge sizing (
text-[9px], 10px icon), withbg/text-(--{color}-3/-11)so it picks up the active Radix theme.How did you test this?
pnpm install+pnpm buildfor the workspace.pnpm exec tsc -p tsconfig.web.json --noEmitfor the renderer — clean.pnpm exec biome checkon the two touched files — no warnings.Publish to changelog?
no
Created with PostHog Code