|
| 1 | +import React from 'react'; |
| 2 | +import { ExternalLink } from 'lucide-react'; |
| 3 | +import type { Bounty } from '../../types/bounty'; |
| 4 | +import { useBountyReviews } from '../../hooks/useReviews'; |
| 5 | + |
| 6 | +const qualityStyle = { |
| 7 | + strong: 'text-emerald bg-emerald-bg border-emerald/30', |
| 8 | + good: 'text-status-info bg-status-info/10 border-status-info/30', |
| 9 | + 'needs-work': 'text-status-warning bg-status-warning/10 border-status-warning/30', |
| 10 | +}; |
| 11 | + |
| 12 | +export function BountyReviewResults({ bounty }: { bounty: Bounty }) { |
| 13 | + const { data } = useBountyReviews(bounty.id); |
| 14 | + const items = data?.items ?? []; |
| 15 | + |
| 16 | + if (!items.length) return null; |
| 17 | + |
| 18 | + return ( |
| 19 | + <div className="rounded-xl border border-border bg-forge-900 p-6"> |
| 20 | + <div className="flex items-center justify-between mb-4"> |
| 21 | + <h2 className="font-sans text-lg font-semibold text-text-primary">LLM Review Results</h2> |
| 22 | + <span className="text-xs text-text-muted font-mono">auto-refresh 30s</span> |
| 23 | + </div> |
| 24 | + |
| 25 | + <div className="grid grid-cols-1 sm:grid-cols-3 gap-3 mb-4"> |
| 26 | + {items.map((r) => ( |
| 27 | + <div key={r.model} className="rounded-lg border border-border bg-forge-850 p-4"> |
| 28 | + <p className="text-sm font-semibold text-text-primary mb-2">{r.model}</p> |
| 29 | + <p className="font-mono text-2xl text-emerald mb-2">{r.score.toFixed(1)} / 10</p> |
| 30 | + <p className="text-xs text-text-muted mb-2">Confidence: {r.confidence}%</p> |
| 31 | + <span className={`inline-flex items-center px-2 py-0.5 text-xs rounded-full border ${qualityStyle[r.quality]}`}> |
| 32 | + {r.quality} |
| 33 | + </span> |
| 34 | + </div> |
| 35 | + ))} |
| 36 | + </div> |
| 37 | + |
| 38 | + <div className="space-y-2"> |
| 39 | + {items.map((r) => ( |
| 40 | + <div key={`${r.model}-summary`} className="text-sm text-text-secondary"> |
| 41 | + <span className="font-medium text-text-primary">{r.model}:</span> {r.summary}{' '} |
| 42 | + {r.detail_url && ( |
| 43 | + <a href={r.detail_url} target="_blank" rel="noreferrer" className="inline-flex items-center gap-1 text-emerald hover:text-emerald-light"> |
| 44 | + full reasoning <ExternalLink className="w-3 h-3" /> |
| 45 | + </a> |
| 46 | + )} |
| 47 | + </div> |
| 48 | + ))} |
| 49 | + </div> |
| 50 | + </div> |
| 51 | + ); |
| 52 | +} |
0 commit comments