Repository navigation
feat(reviews): store reviews, verified-purchase reviews and the post-order prompt - #71
Merged
Merged
Conversation
…order prompt
- Store reviews: rating summary and distribution, the viewer's own review with
delete, sortable reviews with photos and "Verified purchase", pagination, and
a footer that offers "Write a review" or explains why not (sign in, no
completed order, already reviewed).
- Write a review: stars with a word for each rating, text with a counter, up to
four photos, eligibility checked first, posting and thank-you states.
- Entry points: the store page rating links to reviews; a delivered or collected
order asks "How was {store}?" and opens the review with that rating.
- src/commerce/reviews.ts with tests; StarInput in src/ui; reviews.list and
reviews.write screen ids.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This implements reviews from the redesign prototype. It's stacked on
feat/services-bookingand uses the verified-reviews API from fleetbase/storefront#115.Store reviews (
reviews.list, routeStoreReviews)reviews/count.is_mine) is pinned at the top with Delete and a confirmation sheet.options.reviews_enabled === false).Write a review (
reviews.write, routeWriteReview)After an order
On a delivered or collected order, tracking asks "How was {store}?" with tappable stars. Tapping one opens the review form pre-filled with that rating and the order. If the order was already reviewed, it shows "You reviewed this order · View".
Shared code
src/commerce/reviews.ts: list, counts, eligibility, create and delete, plus the rating summary and relative times. Times fall back to a plain date whereIntl.RelativeTimeFormatis missing.useReviewRequestsends review calls as the signed-in customer (sois_mineand eligibility are about them) and anonymously otherwise.StarInputinsrc/ui.reviews.listandreviews.write. Routes are added to the Network stacks (with astores/:storeId/reviewsdeep link), the order stack and the single-store home stack.Not included
Backend change in #115
Public review payloads included each reviewer's full name, email and phone number. #115 now returns "first name and last initial" (for example "Ada B.") and no contact details on public routes.
Testing
__tests__/commerce/reviews.test.ts.yarn jest: 172 tests pass.yarn typecheck:strictis clean.yarn lint:stricthas 0 errors, and now also covers the review screens.