Remove needs response PR badge (#3921)
This commit is contained in:
parent
c89da2c513
commit
4f035f4bff
|
|
@ -40,11 +40,6 @@ import type {
|
|||
} from '../../../../shared/hosted-review'
|
||||
import { getHostedReviewCacheKey, refreshHostedReviewCard } from '@/store/slices/hosted-review'
|
||||
import { toast } from 'sonner'
|
||||
import {
|
||||
classifyHostedReview,
|
||||
type HostedReviewClassificationOptions
|
||||
} from '../../../../shared/hosted-review-queue'
|
||||
import { hostedReviewSummaryFromGitHubPRInfo } from '../../../../shared/hosted-review-github'
|
||||
import {
|
||||
checksPanelAsyncResultKey,
|
||||
checksPanelHostedReviewAsyncResultKey,
|
||||
|
|
@ -1689,60 +1684,6 @@ export default function ChecksPanel(): React.JSX.Element {
|
|||
]
|
||||
)
|
||||
|
||||
const activeReviewClassification = React.useMemo(() => {
|
||||
if (!pr || !repo) {
|
||||
return null
|
||||
}
|
||||
let host = 'github.com'
|
||||
let owner = 'unknown'
|
||||
let repoName = 'unknown'
|
||||
try {
|
||||
const parsed = new URL(pr.url)
|
||||
host = parsed.host || host
|
||||
const segments = parsed.pathname.split('/').filter(Boolean)
|
||||
if (segments.length >= 2) {
|
||||
owner = segments[0]
|
||||
repoName = segments[1]
|
||||
}
|
||||
} catch {
|
||||
// Why: malformed URLs should not block queue-state classification.
|
||||
}
|
||||
|
||||
// Why: unresolved thread data is paginated and fetched separately. Until
|
||||
// comments have loaded for this PR, do not let queue badges imply a clean review.
|
||||
const commentsForClassification =
|
||||
commentsFetchedAt !== undefined && !commentsLoading ? comments : undefined
|
||||
const summary = hostedReviewSummaryFromGitHubPRInfo({
|
||||
pr,
|
||||
owner,
|
||||
repo: repoName,
|
||||
host,
|
||||
comments: commentsForClassification,
|
||||
checks
|
||||
})
|
||||
const options: HostedReviewClassificationOptions = {
|
||||
agentAuthorLogins: [],
|
||||
viewer: null
|
||||
}
|
||||
return classifyHostedReview(summary, options)
|
||||
}, [pr, repo, comments, commentsFetchedAt, commentsLoading, checks])
|
||||
|
||||
const queueBadges = React.useMemo(() => {
|
||||
if (!activeReviewClassification) {
|
||||
return [] as string[]
|
||||
}
|
||||
const badges: string[] = []
|
||||
if (activeReviewClassification.needsResponse) {
|
||||
badges.push('Needs response')
|
||||
}
|
||||
// Why: viewer/author/requestedReviewer signals are not wired into the
|
||||
// ChecksPanel call site yet, so `state` and `requested` would mis-classify
|
||||
// every PR (collapsing to 'teammate'). Suppress those badges until the
|
||||
// inputs are available; needs-response works from PR metadata alone and
|
||||
// remains accurate.
|
||||
return badges
|
||||
}, [activeReviewClassification])
|
||||
|
||||
// ── Empty state ──
|
||||
if (!activeWorktree) {
|
||||
return (
|
||||
|
|
@ -1962,19 +1903,6 @@ export default function ChecksPanel(): React.JSX.Element {
|
|||
</div>
|
||||
)}
|
||||
|
||||
{queueBadges.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{queueBadges.map((badge) => (
|
||||
<span
|
||||
key={badge}
|
||||
className="rounded border border-border bg-accent/30 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-muted-foreground"
|
||||
>
|
||||
{badge}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Merge / Delete Workspace actions */}
|
||||
{pr && activeWorktree && repo && (
|
||||
<PRActions pr={pr} repo={repo} worktree={activeWorktree} onRefreshPR={handleRefreshPR} />
|
||||
|
|
|
|||
Loading…
Reference in New Issue