Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: basic rating display #2653

Open
wants to merge 7 commits into
base: feat/reviews-and-ratings
Choose a base branch
from

Conversation

Guilera
Copy link
Collaborator

@Guilera Guilera commented Jan 29, 2025

⚠️ THIS PR DEPENDS ON PR#2648 ⚠️

What's the purpose of this pull request?

To add rating stars to existing components:

  • <ProductCardContent/>
  • <ProductTitle/>

How it works?

If the feature flag for reviews and ratings, defined at discovery.config, it's turned on, then everywhere a <ProductCard/> is used then it will display the product star rating

How to test it?

preview

References

JIRA TASK: SFS-2063
JIRA TASK: SFS-2065

image
image
image
image

Checklist

You may erase this after checking them all 😉

PR Description

  • Displays rating at Just Arrived
  • Displays rating at Most Wanted
  • Displays rating at Deals & Promotions
  • Displays rating at Product Details
  • Displays rating at Product Gallery

@Guilera Guilera requested a review from a team as a code owner January 29, 2025 21:35
Copy link

vercel bot commented Jan 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
faststore-site ✅ Ready (Inspect) Visit Preview Jan 30, 2025 3:04pm

Copy link

codesandbox-ci bot commented Jan 29, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

@lucasfp13 lucasfp13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +109 to +113
const enhancedSku = enhanceSku(sku, product)

enhancedSku.rating = rating

return enhancedSku
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Could we pass the rating directly here?

Suggested change
const enhancedSku = enhanceSku(sku, product)
enhancedSku.rating = rating
return enhancedSku
const enhancedSku = enhanceSku(sku, { ...product, rating })
return enhancedSku

@@ -128,7 +128,7 @@ const ProductCardContent = forwardRef<HTMLElement, ProductCardContentProps>(
{includeTaxes && (
<Label data-fs-product-card-taxes-label>{includeTaxesLabel}</Label>
)}
{ratingValue && (
{ratingValue != undefined && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): Since you restricted the value type here, is good to set default value on line 87 (ratingValue = undefined) just to make sure we won't have any different types here (null, for instance)

@Guilera Guilera mentioned this pull request Feb 6, 2025
2 tasks
@Guilera Guilera force-pushed the feat/basic-rating-display branch from 1d12420 to a561d49 Compare February 6, 2025 17:46
@Guilera Guilera force-pushed the feat/basic-rating-display branch from a561d49 to 160d8be Compare February 7, 2025 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depends on Depends on another PR - Please mention the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants