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

Add domain picker to FSE #42951

Merged
merged 3 commits into from
Jun 25, 2020
Merged

Add domain picker to FSE #42951

merged 3 commits into from
Jun 25, 2020

Conversation

alshakero
Copy link
Member

@alshakero alshakero commented Jun 3, 2020

Depends on #43045.

Changes

The PR is the first step towards Domain Picker in FSE. Currently the domain picker:

  1. Has a working search feature.
  2. Perfectly styled.
  3. Categories are intact.
  4. All Confirm/close buttons work

What's left

Reading
  1. I'm using a global (_currentSiteId) and Sites store to get the site title to initiate the domain search. Feels hacky.
  2. I'm constructing the currentDomain by processing site.URL. Feels hacky too and doesn't contain all the domain info (is free, relevance, category, etc..)
Writing

When users set a domain (or a plan) we need to use wpcom.cart to store that information. There is a good example here. Something like this:

const cart: Cart = await wpcom.getCart( newSite.site_slug );
await wpcom.setCart( newSite.blogid, {
	...cart,
	products: [ ...cart.products, planProduct, domainProduct ],
} );

What's unclear to me is whether this will add two domains to the cart or the backened will remove one of them automatically when you add a new domain product. This will need some investigation.

Also, I'm not sure how to access wpcom library in wp-admin, since I think it's part of client folder.

Testing

  1. In root, run yarn start to run Calypso
  2. In apps/full-site-editing, run yarn dev --sync to run the app and sync it with your sandbox.
  3. Create and sandbox a simple site.
  4. Define a A8C_FSE_DOMAIN_PICKER_ENABLE flag and set it to true in PHP.
  5. When you land in the editor page, a working domain picker button should be visible.

@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

Caution: This PR affects files in the FSE Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D44355-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing in the FSE Plugin for more info: PCYsg-ly5-p2

@matticbot
Copy link
Contributor

matticbot commented Jun 3, 2020

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~22 bytes added 📈 [gzipped])

name                 parsed_size           gzip_size
entry-gutenboarding        +18 B  (+0.0%)      +22 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@razvanpapadopol
Copy link

This PR is superseding #42834, right?

@alshakero
Copy link
Member Author

This PR is superseding #42834, right?

Sadly I totally forgot about that one. Luckily, there is a little overlap at this point so I can steal Yan's work into mine :D

@alshakero alshakero changed the base branch from master to update/domain-picker-better-encapsulation June 6, 2020 15:04
@alshakero alshakero marked this pull request as ready for review June 6, 2020 15:05
@alshakero alshakero requested review from a team June 6, 2020 15:05
@alshakero alshakero added [Goal] New Onboarding previously called Gutenboarding [Goal] Full Site Editing [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 6, 2020
"@wordpress/api-fetch": "*",
"@wordpress/base-styles": "1.9.0",
Copy link
Member

Choose a reason for hiding this comment

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

Likely needs ^

Copy link
Member

Choose a reason for hiding this comment

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

PRed #43058 since there seems to be NPM config problem.

@alshakero alshakero force-pushed the update/domain-picker-better-encapsulation branch from a1561d8 to bbfd0bf Compare June 8, 2020 18:02
Base automatically changed from update/domain-picker-better-encapsulation to master June 10, 2020 05:10
@simison simison requested a review from a team June 23, 2020 08:33
@yansern yansern self-assigned this Jun 25, 2020
@yansern yansern merged commit fbd7a89 into master Jun 25, 2020
@yansern yansern deleted the add/domain-picker-to-fse branch June 25, 2020 16:24
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants