Skip to content

feat: replace thumbs up/down with 5-star rating UI#9692

Open
bookwormsuf wants to merge 1 commit into
feat/admin-feedback-storefrom
feat/admin-feedback-stars
Open

feat: replace thumbs up/down with 5-star rating UI#9692
bookwormsuf wants to merge 1 commit into
feat/admin-feedback-storefrom
feat/admin-feedback-stars

Conversation

@bookwormsuf

Copy link
Copy Markdown
Contributor

Problem

Part 5 of admin satisfaction rating split (see #9683, #9684, #9688, #9689). Replaces the old thumbs up/down feedback modal with a 1-5 star rating and wires triggerSource/formId through to the API.

Solution

AdminFeedbackBox rewrite — deleted 4 sub-components and state machine (218 lines), replaced with a single 148-line component using the existing <Rating> component. Stars render inline, and clicking a star immediately creates/updates the feedback record. An adaptive comment label changes based on rating: "What went wrong?" (1-2), "What could we improve?" (3), "What did you enjoy most?" (4-5).

API wiringcreateAdminFeedback now accepts optional triggerSource and formId. updateAdminFeedback accepts { comment?, rating? } instead of just a comment string. The container captures trigger metadata from the zustand store via refs before reset clears it.

Joi tightening — create validation changed from min(0) to min(1). The old 0 value was the thumbs-down binary; the new star UI never sends 0.

Type cleanup — removed the deprecated AdminFeedbackRating enum, replaced with type AdminFeedbackRating = 1 | 2 | 3 | 4 | 5. AdminFeedbackBase.rating now uses this type instead of number.

Reviewer tip: review the new AdminFeedbackBox.tsx directly rather than following the diff. The old file was replaced entirely.

Breaking Changes

No - backwards compatible. The star UI is gated behind the 5star-admin-rating feature flag (PR 1).

Screenshots

Empty state 2 stars (low) 3 stars (mid) 5 stars (high)
empty 2-stars 3-stars 5-stars

Tests

TC1: Star rating renders and submits

  • Enable feature flag: window._growthbook.setForcedFeatures(new Map([['5star-admin-rating', true]]))
  • Trigger feedback (edit 5+ fields on a form)
  • Verify stars render instead of thumbs up/down
  • Click 3 stars, verify "What could we improve?" label appears
  • Type a comment and submit
  • Verify DB record has rating: 3, triggerSource: 'field-edit', formId set

TC2: Rating update works

  • Click 2 stars, then click 5 stars before submitting comment
  • Verify DB record has rating: 5 and ratingChanged: true

TC3: Adaptive labels

  • Click 1 or 2 stars, verify "What went wrong?"
  • Click 3 stars, verify "What could we improve?"
  • Click 4 or 5 stars, verify "What did you enjoy most?"

TC4: Close without rating

  • Open feedback modal, click X without selecting stars
  • Verify no feedback record created

🤖 Generated with Claude Code

Replace the old thumbs up/down feedback with a 1-5 star rating using the
existing Rating component. Single-screen flow with adaptive comment labels
based on rating (low/mid/high). Wire triggerSource and formId through to
the API. Tighten Joi create validation to min(1). Remove deprecated
AdminFeedbackRating enum.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bookwormsuf bookwormsuf requested a review from a team as a code owner July 1, 2026 02:56
@mergify

mergify Bot commented Jul 1, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant