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

Site Credit Block Structure #37012

Merged
merged 33 commits into from
Nov 11, 2019
Merged

Site Credit Block Structure #37012

merged 33 commits into from
Nov 11, 2019

Conversation

noahtallen
Copy link
Contributor

@noahtallen noahtallen commented Oct 24, 2019

For now, I'm looking for feedback on if this looks like the right direction for the block. We'll continue using the site option to store the data on dotcom, but the main changes we'll need (for the future) are adding integration points to override settings in a dotcom context (i.e. hooks for whether or not the block is enabled, messages to display prompting for an upgrade, etc)

To do for this PR:

  • Allow users to align the block left/right/center
  • Use the footercredit option for dynamic rendering in PHP.
  • Update Varia to not render a footer credit if FSE is enabled. (i.e. relying on the block instead)
  • (possibly for followup) Refactor some of the useSiteOptions code so it doesn't need to have so many duplicated props.

Changes proposed in this Pull Request

  • Create site credit block files and initial structure.
  • Register footercredit as a setting so we can access it from the API. This is the same option name used to store the data currently on .com, so we'll be able to integrate easily with the existing solution.

Current functionality:
2019-10-29 22 57 31

Note: rendering based on the selection isn't working yet. For now, test the block editor code.

Testing instructions

Resolves #37045.

@noahtallen noahtallen requested review from a team as code owners October 24, 2019 00:41
@matticbot
Copy link
Contributor

@noahtallen noahtallen changed the title Feature/site credit block Site Credit Block Structure Oct 24, 2019
@noahtallen noahtallen self-assigned this Oct 24, 2019
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@noahtallen noahtallen force-pushed the feature/site-credit-block branch from 26b284d to 5a0fc6b Compare October 30, 2019 04:14
@noahtallen noahtallen force-pushed the feature/site-credit-block branch from d6bca94 to 941570a Compare October 30, 2019 04:59
@noahtallen noahtallen requested a review from a team as a code owner October 30, 2019 05:57
@noahtallen
Copy link
Contributor Author

As a bonus feature, I added alignment options so it could fit with whatever design the user may want to have. Let me know if we want to keep this

2019-10-30 14 11 40

Copy link
Contributor

@mattwiebe mattwiebe left a comment

Choose a reason for hiding this comment

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

This looks generally good so far. I find the UX of picking a logo but only seeing it once the block loses focus a bit weird. Maybe the dropdown should be an extra line underneath, not directly in the same place as where the logo/text would go?

'<a href="%1$s" class="imprint">proudly powered by %2$s</a>.',
esc_url( __( 'https://wordpress.org/', 'varia' ) ),
'WordPress'
);
Copy link
Contributor

Choose a reason for hiding this comment

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

This whole area is a bit rough from a i18n perspective. It looks like you've lifted it directly from Varia, which would normally be a fine idea but they've made some mistakes there. I won't go too deeply into it since this is likely just placeholder stuff for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, you're right, I copied from Varia. :) This should be slightly updated now, but I didn't change much in this area. I need to come up with a more robust way to handle all of the possibilities.

@noahtallen
Copy link
Contributor Author

I updated to use the normal alignment buttons (not text align, block align) so that we can use the existing alignment classes on the front end. This seems to work pretty well, but some block editor interactions for right/left alignment are a bit ugly out of the box. I imagine this will improve with time.

@mattwiebe Hm, yeah that's a good point. I followed the existing design in Dotcom-roadmap/issues/50-gh, but I'm not sure if there should be a way to preview it as you select options? cc @shaunandrews

@Copons
Copy link
Contributor

Copons commented Nov 1, 2019

I think we should move the useSiteOptions refactor into its own PR, since it takes basically half of this one, and affects other FSE blocks.

@Addison-Stavlo
Copy link
Contributor

Addison-Stavlo commented Nov 1, 2019

The block structure is looking good!

However I am finding that the selected option gets reset when drag-and-drop is used into or out of a parent block. That is (as outlined in the gif below), if we select the logo option and then move the block to a different parent the option resets to the default text credit.

drag-drop-reset

On another note, I am curious if this left-most option on the toolbar is showing the correct icons. At first it is a WordPress logo with a dropdown arrow, but on mouse-over it turns into the clockwise double arrow without a dropdown arrow (which when clicked does initiate a dropdown menu). Is that intended? I am a bit lost on what either of those logos are supposed to represent here.

Screen Shot 2019-11-01 at 12 32 25 PM

Screen Shot 2019-11-01 at 12 32 39 PM

@noahtallen
Copy link
Contributor Author

the option resets to the default text credit.

@Addison-Stavlo Good catch, that's really weird! I'll take a look.

I am curious if this left-most option on the toolbar is showing the correct icons.

Yep, this is expected :) Gutenberg uses this to show the normal block icon, but then if you mouse over it, it shows the "transform" button. This is used to turn the block into a different block - for example, changing a heading to a paragraph block. In this case, if you chose "group" block, it should create a group block and then put the site credit block inside of it.

I think we should move the useSiteOptions refactor into its own PR

@Copons that's fair. I wanted to be able to use the new HOC here because it makes things so much easier, but probably good to review separately.

@noahtallen
Copy link
Contributor Author

noahtallen commented Nov 1, 2019

the option resets to the default text credit.

@Addison-Stavlo really good catch here! I was able to replicate it with existing blocks as well, so this is not related to changes here. It looks like the block resets when you drag it into the group, but the option hasn't been persisted to the database yet. I created an issue here: #37260

@noahtallen noahtallen changed the base branch from master to enhance/refactor-site-options November 2, 2019 00:02
@noahtallen
Copy link
Contributor Author

@Copons I have moved the site option changes to #37255 and have changed this PRs base to that branch so it can use the new function it introduces. (Should also make reviewing easier.) If that PR gets merged, I'll change the base of this branch back to master.

@noahtallen noahtallen changed the base branch from enhance/refactor-site-options to master November 5, 2019 22:24
@noahtallen
Copy link
Contributor Author

Tried to rebase, which turned out to have way to many conflicts, so a simple merge has gotten us back to master as the base branch.

Copy link
Contributor

@Addison-Stavlo Addison-Stavlo left a comment

Choose a reason for hiding this comment

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

Good Stuff!

I had a few questions about the code but nothing big or show stopping except the below noted testing issue.

I found an inconsistency between testing locally and on the dotcom sandbox. That is, if we go to update a wp_template_part (header or footer) and add the credit block, select the logo option, "update", and then "go back to page" we can see that:

  • in the case of local env the logo save is respected.
  • in the case of dotcom sandbox the block turns back to the default text setting.

It seems a bit different than the issue I noted earlier in the settings resetting when changing parent elements, something may not be right with the options saving on dotcom? 🤔

Local:
local-credit

Sandbox:
sandbox-credit

@noahtallen
Copy link
Contributor Author

in the case of dotcom sandbox the block turns back to the default text setting.

Hm, that is an odd isue, I'll have to look into that.

Copy link
Contributor

@shaunandrews shaunandrews left a comment

Choose a reason for hiding this comment

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

The Calypso.live link doesn't seem to be working for this PR (I think its a FSE thing unrelated to this specific PR), but based on the images/GIFs above this all looks fine to me.

I do question the need for the , (comma) between the site title and the credit — especially as we visually differentiate them already — but thats a very minor things that shouldn't block this from merging.

Copy link
Member

@vindl vindl left a comment

Choose a reason for hiding this comment

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

As discussed on Slack, I think it's fine to merge this now provided that we remove the block registration.

Making this on Dotcom will require prerequisite Core changes to land. Landing this PR now will make follow up work easier, since we won't have to spend time keeping it up to date and rebasing.

@vindl vindl added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FSE: create Footer Credit block for self-hosted sites
7 participants