import { GitPullRequest, CircleDot, CheckCircle2, XCircle, Clock } from "lucide-react"; import type { IssueInfo, PrInfo } from "@fusion/core"; import type { ToastType } from "../hooks/useToast"; interface GitHubBadgeProps { prInfo?: PrInfo; issueInfo?: IssueInfo; onIssueRefresh?: () => void; addToast?: (message: string, type?: ToastType) => void; } function getIssueModifierClass(state: string, stateReason?: string): string { if (state === "open") return "card-github-badge--open"; if (stateReason === "completed") return "card-github-badge--completed"; if (stateReason === "not_planned") return "card-github-badge--not-planned"; return "card-github-badge--closed"; } export function GitHubBadge({ prInfo, issueInfo, onIssueRefresh: _onIssueRefresh }: GitHubBadgeProps) { const prState = prInfo?.isDraft || prInfo?.status === "draft" ? "draft" : prInfo?.status; const checkRollup = prInfo?.checkRollup; const checkClass = checkRollup && checkRollup !== "none" ? `card-github-badge__check card-github-badge__check--${checkRollup}` : null; const checkTitle = checkRollup && checkRollup !== "none" ? ` — checks: ${checkRollup}` : ""; const prTitle = prInfo ? `PR #${prInfo.number}${prState === "draft" ? " (draft)" : ""}: ${prInfo.title}${checkTitle}` : ""; return ( <> {prInfo && ( #{prInfo.number} {checkClass && checkRollup === "success" && ( )} {checkClass && checkRollup === "failure" && ( )} {checkClass && checkRollup === "pending" && ( )} )} {issueInfo && ( #{issueInfo.number} )} ); }