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

[RNMobile] Block title in unsupported block #18268

Merged
merged 29 commits into from Nov 8, 2019

Conversation

hypest
Copy link
Contributor

@hypest hypest commented Nov 4, 2019

(this is a follow up from #17943 and will copy and amend its description here. Recreated that PR so we merge it while @illusaen is temporarily away)

Description

  • Changed text on Unsupported block to show original block name.
  • Added a help icon that shows additional information when the block is clicked.
  • Append "Unsupported" to the title of all unsupported blocks

How has this been tested?

  • Tested on simulator and on Android device.
  • Wrote unit tests for component change.
  • Component change affects all types of blocks that were defaulting to the 'Missing' block (aka UnsupportedBlockEdit)

Screenshots

unsupported

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@hypest hypest added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Nov 4, 2019
@hypest hypest added this to the Gutenberg 6.9 milestone Nov 4, 2019
Copy link
Contributor

@maxme maxme left a comment

Choose a reason for hiding this comment

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

Current implementation is off with dark mode for iOS, there are some changes needed in the style sheet and the block implementation (see review comments).

Simulator Screen Shot - iPhone 11 - 2019-11-04 at 16 48 15

text-align: center;
}

.infoTitle {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we must create a infoTitleDark class and update the color.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed with 5a9e429.

color: $gray-dark;
}

.infoDescription {
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 for infoTitle, we should create a infoDescriptionDark class and update the color.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed with 5a9e429.

>
<View style={ styles.infoContainer } >
<Icon icon="editor-help" style={ styles.infoIcon } size={ styles.infoIcon.size } />
<Text style={ [ styles.infoText, styles.infoTitle ] }>
Copy link
Contributor

Choose a reason for hiding this comment

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

We should call getStylesFromColorScheme on there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed with 5a9e429.

<View style={ styles.infoContainer } >
<Icon icon="editor-help" style={ styles.infoIcon } size={ styles.infoIcon.size } />
<Text style={ [ styles.infoText, styles.infoTitle ] }>
{ __( '\'' + title + '\' isn\'t yet supported on WordPress for ' + platformText ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

You can't compose strings inside __(), you need to use sprintf instead and add a placeholder for the title. For the platform, I think it's safer to have one string for iOS and one for Android, since it's more obvious for translators.

Copy link
Contributor Author

@hypest hypest Nov 5, 2019

Choose a reason for hiding this comment

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

Addressed with 4c2b904, 6815b3c.

}

renderSheet( title ) {
return <BottomSheet
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised that it's not caught by the lint job, but I noticed a different JSX style in this file than the rest of the code: we normally wrap the returned JSX in parentheses and jump to a new line:

return (
    <BottomSheet
        isVisible={ this.state.showHelp }
 	hideHeader
        onClose={ this.toggleSheet.bind( this ) }
    >
        { /* ... */ }
    </BottomSheet>
);

I can't find it mentioned in any coding style guide, but that's the style I've seen and written everywhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f7c8582.

@hypest
Copy link
Contributor Author

hypest commented Nov 5, 2019

👋 @maxme and @koke , thanks for the review! I've addressed your comments and this is ready for another pass.

I've also removed the "Close" button from the bottom sheet as we don't have such a dismiss button in other bottom sheets anyway. cc @iamthomasbishop, there was a relevant question in the original PR and I went with a "No" here... let me know if you think we should reinstate the Close button.

}

renderHelpIcon() {
return <TouchableWithoutFeedback
Copy link
Contributor

Choose a reason for hiding this comment

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

There are also parentheses missing here. Also FYI, suggested this as a lint rule in #18302

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed with e863087.


// translators: %s: Name of the block
const titleFormat = Platform.OS === 'android' ? __( '\'%s\' isn\'t yet supported on WordPress for Android' ) :
__( '\'%s\' isn\'t yet supported on WordPress for iOS' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Not an issue for this PR, but noting for the future: I just realized this might be used in other apps, so we should find a way to inject the app name from the apps instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!

@hypest
Copy link
Contributor Author

hypest commented Nov 6, 2019

Addressed the additional feedback @koke , ready for another pass.

Copy link
Contributor

@maxme maxme left a comment

Choose a reason for hiding this comment

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

I can't find color definition on the original issue (wordpress-mobile/gutenberg-mobile#479) or on the other PR (#17943). Anyway, the end results looks good to me. If the color scheme have to be changed, it can be done in a follow up PR.

:shipit:

Simulator Screen Shot - iPhone 11 - 2019-11-06 at 18 04 11

@iamthomasbishop
Copy link

iamthomasbishop commented Nov 6, 2019

@maxme Looks good – the only color change I'd request is to change the (?) icons on the sheet and on the block itself to gray 20 (in dark mode).

@hypest
Copy link
Contributor Author

hypest commented Nov 7, 2019

the only color change I'd request is to change the (?) icons on the sheet and on the block itself to gray 20 (in dark mode).

Addressed with 92d7e71.

I set the light-mode icon color to gray-darken-20. Can you verify @iamthomasbishop that that's the light-mode color we want? Thanks!

Screenshots:

Light-mode list Dark-mode list Light-mode popup Dark-mode popup
Simulator Screen Shot - iPhone X - 2019-11-07 at 10 31 21 Simulator Screen Shot - iPhone X - 2019-11-07 at 10 31 03 Simulator Screen Shot - iPhone X - 2019-11-07 at 10 31 18 Simulator Screen Shot - iPhone X - 2019-11-07 at 10 31 07

@hypest
Copy link
Contributor Author

hypest commented Nov 7, 2019

This PR already has a 👍 and checked in with @koke too and he's fine with the PR state. The colors should be OK now @iamthomasbishop, but if they're not we can open a new PR really quickly, no problem. I'll merge this one as soon as the gutenberg-mobile side PR also gets the 👍.

Copy link
Contributor

@SergioEstevao SergioEstevao left a comment

Choose a reason for hiding this comment

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

Working great on iOS (dark and light) and Android.

@iamthomasbishop
Copy link

@hypest Oops, I meant that gray 20 should be applied only to dark mode. I realize now my comment wasn't the clearest, so apologies for that 😄 That initial "old gray" is fine on light mode.

@hypest
Copy link
Contributor Author

hypest commented Nov 7, 2019

Sorry for the confusion @iamthomasbishop , apparently I should have restarted the app inbetween mode switching for the proper colors to appear. Without changing the code, here are new screenshots taken:

Light-mode list Dark-mode list Light-mode popup Dark-mode popup
Simulator Screen Shot - iPhone X - 2019-11-07 at 17 47 19 Simulator Screen Shot - iPhone X - 2019-11-07 at 17 48 23 Simulator Screen Shot - iPhone X - 2019-11-07 at 17 47 27 Simulator Screen Shot - iPhone X - 2019-11-07 at 17 48 27

@hypest
Copy link
Contributor Author

hypest commented Nov 7, 2019

After chatting with @iamthomasbishop over Slack, revised the light-mode color of the icon on the sheet to be gray. Screenshots:

Light-mode list Dark-mode list Light-mode popup Dark-mode popup
Simulator Screen Shot - iPhone X - 2019-11-07 at 18 08 16 Simulator Screen Shot - iPhone X - 2019-11-07 at 18 09 44 Simulator Screen Shot - iPhone X - 2019-11-07 at 18 08 32 Simulator Screen Shot - iPhone X - 2019-11-07 at 18 09 48

@hypest
Copy link
Contributor Author

hypest commented Nov 7, 2019

👋 @SergioEstevao , I know you've already 👍 'd the PR but, I added 0569a38 to fix the mobile tests (were failing on the gutenberg-mobile PR after e26a61b landed) and 973c2f8 to remove the hardcoded platform set and enable testing both platform so, can you have another pass please? Thanks!

@SergioEstevao
Copy link
Contributor

@SergioEstevao I had another look and all still looking good!

@hypest hypest merged commit 79636ce into master Nov 8, 2019
@hypest hypest deleted the rnmobile/block-title-in-unsupported-block branch November 8, 2019 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants