Align dashboard PR badges with live GitHub PR state colors. - Add a shared PR badge modifier helper for open, draft, merged, closed, and conflict states.\n- Apply the helper to single and multi-PR task card badges so live payload changes repaint correctly.\n- Add token-backed merged/conflict styling, regression coverage, and a patch changeset. Files changed:\n .changeset/fn-7177-pr-badge-status-color.md | 7 ++++\n packages/dashboard/app/components/GitHubBadge.tsx | 8 +++--\n packages/dashboard/app/components/TaskCard.tsx | 9 +++--\n .../app/components/__tests__/GitHubBadge.test.tsx | 1 +\n .../app/components/__tests__/TaskCard.test.tsx | 41 +++++++++++++++++++---\n packages/dashboard/app/styles.css | 15 ++++++--\n .../app/utils/__tests__/prBadgeClass.test.ts | 22 ++++++++++++\n packages/dashboard/app/utils/prBadgeClass.ts | 28 +++++++++++++++\n 8 files changed, 119 insertions(+), 12 deletions(-) Fusion-Task-Id: FN-7177 Fusion-Task-Lineage: 23954f1b-d184-49a6-9635-7d9c1d0aea11 Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import type { PrInfo } from "@fusion/core";
|
|
|
|
type PrBadgeClassInput = Pick<PrInfo, "status" | "isDraft" | "draft" | "mergeable">;
|
|
|
|
type PrBadgeModifierClass =
|
|
| "card-github-badge--conflicting"
|
|
| "card-github-badge--draft"
|
|
| "card-github-badge--open"
|
|
| "card-github-badge--merged"
|
|
| "card-github-badge--closed";
|
|
|
|
/**
|
|
* FNXC:PRBadgeStatusColor 2026-06-27-00:00:
|
|
* PR badges must use one status-color source of truth across TaskCard's multi-PR link and GitHubBadge's single-PR link. Match GitHub's live PR conventions: open=green, draft=gray, merged=purple, closed=red, and open conflicts/blocks=red-caution while checks stay in their separate sub-badge.
|
|
*/
|
|
export function getPrBadgeModifierClass(prInfo: PrBadgeClassInput): PrBadgeModifierClass {
|
|
if (prInfo.status === "open" && (prInfo.mergeable === "conflicting" || prInfo.mergeable === "blocked")) {
|
|
return "card-github-badge--conflicting";
|
|
}
|
|
|
|
if (prInfo.status === "draft" || (prInfo.status === "open" && (prInfo.draft ?? prInfo.isDraft))) {
|
|
return "card-github-badge--draft";
|
|
}
|
|
|
|
if (prInfo.status === "merged") return "card-github-badge--merged";
|
|
if (prInfo.status === "closed") return "card-github-badge--closed";
|
|
return "card-github-badge--open";
|
|
}
|