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: add reviews count to ProductTitle component #2655

Merged

Conversation

artursantiago
Copy link
Collaborator

@artursantiago artursantiago commented Jan 30, 2025

What's the purpose of this pull request?

Adds the number of reviews next to the Rating component in the ProductTitle. The review count, as well as the rating, should only be visible if the corresponding flag in the discovery.config is enabled in the code.

How it works?

The following props have been added to ProductTitle:

  • reviewsCount?: The amount of reviews for the product.
  • reviewsSectionId?: The ID of the reviews section to link to.
  • noReviewsText?: Default text for "No reviews yet."
  • reviewsCountText?: Default text for "X reviews."

The review count text should be a link to the reviews section, which will be located further down on the product page. This link will receive the section ID through the reviewsSectionId prop. The labels for the text can also be customized via props, but by default, they will be "No reviews yet" and "X reviews."

How to test it?

You can access the preview link and open any pdp. It already should be able to show the reviews count for the product.
If the count label don't appear you can run yarn cms-sync in the start.store branch

Starters Deploy Preview

Preview

References

JIRA TASK: SFS-2064

Figma

image
image

@artursantiago artursantiago added enhancement New feature or request depends on Depends on another PR - Please mention the PR labels Jan 30, 2025
Copy link

vercel bot commented Jan 30, 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 5:22pm

Copy link

codesandbox-ci bot commented Jan 30, 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.

@artursantiago artursantiago marked this pull request as ready for review January 30, 2025 17:42
@artursantiago artursantiago requested a review from a team as a code owner January 30, 2025 17:42
@artursantiago artursantiago requested review from hellofanny and pedromtec and removed request for a team January 30, 2025 17:42
@artursantiago artursantiago self-assigned this Feb 3, 2025
@Guilera Guilera mentioned this pull request Feb 6, 2025
2 tasks
@Guilera Guilera force-pushed the feat/add-rating-amount-product-title branch from 88b85e9 to 7518315 Compare February 14, 2025 15:19
@Guilera Guilera changed the base branch from feat/reviews-and-ratings to feat/basic-rating-display February 14, 2025 15:21
@Guilera Guilera changed the base branch from feat/basic-rating-display to feat/reviews-and-ratings February 14, 2025 15:22
@Guilera Guilera force-pushed the feat/reviews-and-ratings branch from 9c2cebb to 736e0f8 Compare February 18, 2025 19:49
@Guilera Guilera force-pushed the feat/add-rating-amount-product-title branch 2 times, most recently from 622b56f to 3ab33ce Compare February 18, 2025 20:22
@Guilera Guilera self-requested a review February 19, 2025 17:24
@Guilera Guilera force-pushed the feat/reviews-and-ratings branch from cc15cdd to 33db057 Compare February 19, 2025 17:34
@Guilera Guilera force-pushed the feat/add-rating-amount-product-title branch from 3ab33ce to 5999074 Compare February 19, 2025 17:36
Co-authored-by: Larícia Mota <laricia.mota@vtex.com.br>
@Guilera Guilera mentioned this pull request Feb 20, 2025
{ratingValue !== undefined && <Rating value={ratingValue} />}

{reviewsCount !== undefined && (
<a href="#reviews-and-ratings" data-fs-product-title-reviews>
Copy link
Contributor

Choose a reason for hiding this comment

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

just double checking that this is the fixed id, right?

@hellofanny hellofanny merged commit 68b05c9 into feat/reviews-and-ratings Feb 20, 2025
5 of 6 checks passed
@hellofanny hellofanny deleted the feat/add-rating-amount-product-title branch February 20, 2025 15:19
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants