Skip to content

Commit 7f60fe1

Browse files
committed
feat: add visible comment feedback badges
1 parent 021afe2 commit 7f60fe1

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

TODO.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ This roadmap is derived from deep research into Greptile's public docs, blog, MC
8787

8888
## 6. Review UX and Workflow Integration
8989

90-
51. [ ] Add visible accepted/rejected/dismissed badges to comments throughout the UI, not just icon state.
90+
51. [x] Add visible accepted/rejected/dismissed badges to comments throughout the UI, not just icon state.
9191
52. [ ] Add comment grouping by unresolved, fixed, stale, and informational sections in `ReviewView`.
9292
53. [x] Add a "show only blockers" mode for large reviews.
9393
54. [ ] Add keyboard actions for thumbs, resolve, and jump-to-next-finding workflows.
@@ -164,4 +164,5 @@ This roadmap is derived from deep research into Greptile's public docs, blog, MC
164164
- [x] Surface unresolved blocker counts in repo and PR GitHub discovery views.
165165
- [x] Add a blocker-only review mode that narrows large reviews to open Error and Warning findings.
166166
- [x] Add file-level readiness summaries to the review diff sidebar.
167+
- [x] Add visible feedback badges on comments so accepted and rejected states are not icon-only.
167168
- [ ] Commit and push each validated checkpoint before moving to the next epic.

web/src/components/CommentCard.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ const lifecycleBadge: Record<string, string> = {
1616
Dismissed: 'bg-text-muted/10 text-text-muted border border-border',
1717
}
1818

19+
const feedbackBadge: Record<'accept' | 'reject', { label: string; className: string }> = {
20+
accept: {
21+
label: 'Accepted',
22+
className: 'bg-sev-suggestion/10 text-sev-suggestion border border-sev-suggestion/20',
23+
},
24+
reject: {
25+
label: 'Rejected',
26+
className: 'bg-sev-error/10 text-sev-error border border-sev-error/20',
27+
},
28+
}
29+
1930
interface Props {
2031
comment: Comment
2132
variant?: 'card' | 'inline'
@@ -29,6 +40,7 @@ export function CommentCard({ comment, variant = 'card', onFeedback, onLifecycle
2940
const accepted = comment.feedback === 'accept'
3041
const rejected = comment.feedback === 'reject'
3142
const lifecycle = comment.status ?? 'Open'
43+
const feedbackState = comment.feedback ? feedbackBadge[comment.feedback] : null
3244

3345
const copyCode = () => {
3446
if (comment.code_suggestion?.suggested_code) {
@@ -55,6 +67,11 @@ export function CommentCard({ comment, variant = 'card', onFeedback, onLifecycle
5567
<span className={`text-[10px] px-1.5 py-0.5 rounded font-medium ${lifecycleBadge[lifecycle] ?? lifecycleBadge.Open}`}>
5668
{lifecycle}
5769
</span>
70+
{feedbackState && (
71+
<span className={`text-[10px] px-1.5 py-0.5 rounded font-medium ${feedbackState.className}`}>
72+
{feedbackState.label}
73+
</span>
74+
)}
5875

5976
<div className="ml-auto flex items-center gap-1">
6077
{comment.fix_effort && (

web/src/components/__tests__/CommentCard.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ describe('CommentCard', () => {
5757
expect(screen.getByText('High')).toBeInTheDocument()
5858
})
5959

60+
it('renders a visible accepted badge when feedback is positive', () => {
61+
render(<CommentCard comment={makeComment({ feedback: 'accept' })} />)
62+
expect(screen.getByText('Accepted')).toBeInTheDocument()
63+
})
64+
65+
it('renders a visible rejected badge when feedback is negative', () => {
66+
render(<CommentCard comment={makeComment({ feedback: 'reject' })} />)
67+
expect(screen.getByText('Rejected')).toBeInTheDocument()
68+
})
69+
70+
it('renders a visible dismissed badge from lifecycle state', () => {
71+
render(<CommentCard comment={makeComment({ status: 'Dismissed' })} />)
72+
expect(screen.getByText('Dismissed')).toBeInTheDocument()
73+
})
74+
6075
it('shows "Suggested fix" toggle when code_suggestion is present', () => {
6176
const comment = makeComment({
6277
code_suggestion: {

0 commit comments

Comments
 (0)