Skip to content

feat: add reviews count to ProductTitle component - #2655

Merged
hellofanny merged 13 commits into
feat/reviews-and-ratingsfrom
feat/add-rating-amount-product-title
Feb 20, 2025
Merged

hellofanny merged 13 commits into
feat/reviews-and-ratingsfrom
feat/add-rating-amount-product-title

Conversation

@artursantiago

@artursantiago artursantiago commented Jan 30, 2025 •

Copy link
Copy Markdown
Contributor

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
@vercel

vercel Bot commented Jan 30, 2025 •

Copy link
Copy Markdown

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

@codesandbox-ci

codesandbox-ci Bot commented Jan 30, 2025 •

Copy link
Copy Markdown

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 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
@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
Copy Markdown
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
@hellofanny
hellofanny deleted the feat/add-rating-amount-product-title branch February 20, 2025 15:19
pedromtec pushed a commit that referenced this pull request Mar 11, 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](https://github.com/vtex-sites/starter.store/pull/685)

<!--- Describe the steps with bullet points. Is there any external link
that can be used to better test it or an example? --->

### Starters Deploy Preview


[Preview](https://starter-git-feat-preview-product-title-count-vtex.vercel.app/)

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

[JIRA TASK: SFS-2064](https://vtex-dev.atlassian.net/browse/SFS-2064)


[Figma](https://www.figma.com/design/YXU6IX2htN2yg7udpCumZv/Reviews-%26-Ratings?node-id=130-32961&t=sKkz60J8JEjxL8m4-4)


![image](https://github.com/user-attachments/assets/b3828116-34ee-49fe-abf4-d7478c18b725)

![image](https://github.com/user-attachments/assets/3d6b3c4a-11db-4b40-911e-171f076b676a)

---------

Co-authored-by: gutchenzo <[email protected]>
Co-authored-by: Larícia Mota <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
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