Skip to content

feat: create product thumbnail - #2700

Merged
hellofanny merged 28 commits into
feat/reviews-and-ratingsfrom
feat/create-product-thumbnail
Mar 14, 2025
Merged

hellofanny merged 28 commits into
feat/reviews-and-ratingsfrom
feat/create-product-thumbnail

Conversation

@artursantiago

@artursantiago artursantiago commented Feb 21, 2025 •

Copy link
Copy Markdown
Contributor

⚠️ THIS PR DEPENDS ON: ⚠️

What's the purpose of this pull request?

This PR introduces a new component called ProductThumbnail to the UI package. The component is designed to display product information (image and name) in a compact format, specifically for use within the AddReviewModal.

Starters Deploy Preview

Preview

References

FEATURE BRANCH
Figma
SFS-2168

image

@codesandbox-ci

codesandbox-ci Bot commented Feb 21, 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 February 21, 2025 19:02
@artursantiago
artursantiago requested a review from a team as a code owner February 21, 2025 19:02
@artursantiago
artursantiago requested review from eduardoformiga and hellofanny and removed request for a team February 21, 2025 19:02
@artursantiago
artursantiago force-pushed the feat/create-product-thumbnail branch 2 times, most recently from c697ba3 to 84d8cd4 Compare March 12, 2025 17:07

@hellofanny hellofanny left a comment

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.

Niceee!

I'm suggesting some changes to the naming and styles to simplify things. Let me know what you think!

Mobile Desktop
image image

@hellofanny

Copy link
Copy Markdown
Contributor

btw, just to confirm since I saw this image in the PR description:

I think the last use cases won't happen (no product image available) since it's a required prop (?), right?
415786911-62f15930-94df-4322-9850-d832568d9f97

@artursantiago

Copy link
Copy Markdown
Contributor Author

btw, just to confirm since I saw this image in the PR description:

I think the last use cases won't happen (no product image available) since it's a required prop (?), right? 415786911-62f15930-94df-4322-9850-d832568d9f97

Yes, it won't happen anymore. This image was made in the previous implementation.
I just updated with the new one.

@lucasfp13 lucasfp13 left a comment

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.

LGTM after the changes

@artursantiago
artursantiago force-pushed the feat/create-product-thumbnail branch from 1519e69 to 8bc28e3 Compare March 14, 2025 13:21
@hellofanny
hellofanny merged commit 992c24f into feat/reviews-and-ratings Mar 14, 2025
@hellofanny
hellofanny deleted the feat/create-product-thumbnail branch March 14, 2025 15:22
artursantiago added a commit that referenced this pull request Mar 24, 2025
>⚠️ THIS PR DEPENDS ON:  ⚠️
> - #2707
> - #2695
> - #2700

## What's the purpose of this pull request?

This PR implements the "Add Review" form functionality within the core
package.

> [!NOTE]
> I also made some adjustments to global components (Rating, Textarea,
CheckboxField, InputField). I've included them in this PR for
efficiency, but can move them to separate PRs targeting main if
preferred.

## How it works?

- Review Modal Form:

- Adjust AddReviewModal.tsx in the core package with form handling,
validation, success states, and error management
Integrated 
    - Couldn't focus on checkbox field so I add a scrollIntoView for it
-
![image](https://github.com/user-attachments/assets/2d711653-40c0-4668-92b3-ffae2192b6bb)

  - Add new cms configuration in `sections.json`

- GraphQL Integration:

- Added CreateProductReview mutation to handle the submission of review
data
- Defined appropriate types and integrated mutation documents in GraphQL
schema
- Developed a useAddReview hook that leverages useLazyQuery for handling
review submission

- Global Component Enhancements:

- Rating: Added type="button" attribute so that it doesn't trigger
submit inside form
- CheckboxField: Implemented checkboxRef prop for better form control
and adjusted label sizing
  - Textarea: Adjust label sizing
- InputField: Fixed label positioning when error messages are present by
updating positioning calculation
-
![image](https://github.com/user-attachments/assets/fc20b766-14c0-430e-9e22-ebd63a42a892)


## How to test it?

- Navigate to any product page and click on "Write a Review"
- Test form validation by submitting without required fields
- Verify rating selection works properly
- Submit a complete review and confirm success state appears
- Check error handling:
  - Not logged in
  - Duplicate review

### Starters Deploy Preview


[Preview](https://starter-git-feat-add-review-modal-form-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

[FEATURE BRANCH](#2676)

[Figma](https://www.figma.com/design/YXU6IX2htN2yg7udpCumZv/Reviews-%26-Ratings?node-id=128-22351&t=zALRZSwDWuF6UrjH-4)
[SFS-2082](https://vtex-dev.atlassian.net/browse/SFS-2082)
[SFS-2169](https://vtex-dev.atlassian.net/browse/SFS-2169)


![image](https://github.com/user-attachments/assets/bf0d9a2b-1f87-4c4f-857c-6cc897c8a989)


[SFS-2082]:
https://vtex-dev.atlassian.net/browse/SFS-2082?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
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.

3 participants