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

Free Listings + Paid Ads: Add the paid ads previews to the boost product listings section #1650

Merged

Conversation

eason9487
Copy link
Member

@eason9487 eason9487 commented Aug 24, 2022

Changes proposed in this Pull Request:

This PR implements the ad previews part of 📌 Boost product listings section in #1610.

  • Dynamically compositing the ad previews with product and shop data.

  • 💡Please note that there is a very small white border in the fallback image of product cover. It's not a CSS style problem and I will check with the design team later.

Screenshots:

📷 Text ellipsis

2022-08-24 16 04 00

📷 Simulation of using product cover from merchant's DB

2022-08-24 17 11 07

📷 Simulation of using shop logo from merchant's website

2022-08-24 17 11 39

📹 All ad previews and blur animation

Kapture.2022-08-24.at.17.17.08.mp4

Detailed test instructions:

  1. Go to step 4 of the onboarding flow.
  2. Check if the visual result of the ad previews in the "Boost product listings with paid ads" section is close to the design in Figma.
  3. Change these values locally to see if the layouts of ad previews are still rendered properly.

@eason9487 eason9487 added the changelog: none Skip changelog entry for this PR label Aug 24, 2022
@eason9487 eason9487 requested a review from a team August 24, 2022 11:31
@eason9487 eason9487 self-assigned this Aug 24, 2022
@github-actions github-actions bot added changelog: add A new feature, function, or functionality was added. type: enhancement The issue is a request for an enhancement. labels Aug 24, 2022
…size since there is an unavoidable increase in this PR
@eason9487 eason9487 removed type: enhancement The issue is a request for an enhancement. changelog: add A new feature, function, or functionality was added. labels Aug 24, 2022
@@ -28,6 +28,7 @@ module.exports = {
'stylelint',
'@wordpress/stylelint-config',
'@pmmmwh/react-refresh-webpack-plugin',
'react-transition-group',
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Just curiosity. Not an issue. Why is needed to add this dependency here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR uses the same react-transition-group dependency as the one @woocommerce/components depends on, so react-transition-group is not listed in this repo's package.json file. Therefore, this change is to let eslint know it's one of the core modules and to prevent from the eslint error import/no-extraneous-dependencies.

Comment on lines 22 to 24
* @param {boolean} [props.thinnest] Whether to draw a thinnest placeholder.
* @param {boolean} [props.thinner] Whether to draw a thinner placeholder.
* @param {boolean} [props.thicker] Whether to draw a thicker placeholder.
Copy link
Contributor

Choose a reason for hiding this comment

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

💅 I see this just set the height of the placeholder??

Why not just type="thinnest|thinner|thicker" ? Or just do height={unit} and set up the height as we do with the width.

Copy link
Member Author

Choose a reason for hiding this comment

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

I forgot the original reason. I probably started with three different values of height and was inspired by the props of Button component (isPrimary, isSecondary, isLink, etc.). But when adding the color, it was not so ideal to use the same pattern, so I changed to using a single prop with different values.

And it's definitely better to have consistent props for this component. I changed them in c6908de.

P.S. I have double-checked the visual results again with Figma file when doing this change. And some prop values were different from their previous value in this commit since I found them are not the closest ones to the visual design. Not sure if Figma file was changed or if I set the wrong values in the beginning. 😅

Comment on lines 20 to 21
* @param {boolean} [props.smaller] Whether to draw a smaller text size.
* @param {boolean} [props.larger] Whether to draw a larger text size.
Copy link
Contributor

Choose a reason for hiding this comment

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

💅 Same as the case of thinner/ticker... Why not just set a type prop and add the class name modifier? Or do the inline style mdoification?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed in 631e8fe.

@puntope
Copy link
Contributor

puntope commented Aug 29, 2022

❓ Regarding google shopping logo (sorry somehow I don't know how to comment in the file)

Shall we check if that is still the Shopping logo we want? I just modified them recently with the new logo

* Data for compositing ad preview mockups.
*
* @typedef {Object} AdPreviewData
* @property {string} title Price of the product.
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Should this be "Title of the product"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for catching this. Fixed in 8e72981.

Comment on lines +61 to +79
const { second, callCount, startCountdown } = useCountdown();

// TODO: Fetch required data from API.
const product = fallbackProduct;

const moveBy = useCallback( ( step ) => {
setIndex( ( currentIndex ) => {
return ( currentIndex + step + mockups.length ) % mockups.length;
} );
}, [] );

useEffect( () => {
if ( second === 0 ) {
if ( callCount > 0 ) {
moveBy( 1 );
}
startCountdown( 5 );
}
}, [ second, callCount, startCountdown, moveBy ] );
Copy link
Contributor

Choose a reason for hiding this comment

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

💅 This maybe can be wrapped in some kind of useTimingIndex

Copy link
Member Author

Choose a reason for hiding this comment

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

Wrapping this to another custom hook sometimes also increases the complexity. In this case, the CampaignPreview component doesn't have much code, therefore, I think it ok to stay with the current implementation.

@puntope
Copy link
Contributor

puntope commented Aug 29, 2022

💅 Maybe some adjustments needed for resolutions between 500-700px

Screenshot 2022-08-29 at 17 36 50

Base automatically changed from add/1610-paid-ads-features-section to feature/1610-streamlined-onboarding August 30, 2022 03:18
@eason9487
Copy link
Member Author

@puntope, thanks for the review.

❓ Regarding google shopping logo (sorry somehow I don't know how to comment in the file)
Shall we check if that is still the Shopping logo we want? I just modified them recently with the new logo

I checked this with the design team, and it's confirmed that the logo is correct for this project. Because it's supposed to be a Google Shopping logo on the ad preview of Google Shopping.

💅 Maybe some adjustments needed for resolutions between 500-700px

Thanks for catching this. I added some CSS styles for this in 656aeb9.


I believe all comments were replied to or fixed. Could you help with another round of code reviews?

@eason9487 eason9487 requested a review from puntope August 30, 2022 05:19
Copy link
Contributor

@puntope puntope left a comment

Choose a reason for hiding this comment

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

✅ LGTM

💅 One thing I'm missing here and in this feature are the tests

@eason9487 eason9487 merged commit 722ca0a into feature/1610-streamlined-onboarding Aug 30, 2022
@eason9487 eason9487 deleted the add/1610-paid-ads-previews branch August 30, 2022 09:16
@eason9487 eason9487 added changelog: add A new feature, function, or functionality was added. and removed changelog: none Skip changelog entry for this PR labels Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: add A new feature, function, or functionality was added.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants