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

Help Center: Connect chat pages #63242

Merged
merged 17 commits into from May 5, 2022
Merged

Conversation

escapemanuele
Copy link
Contributor

@escapemanuele escapemanuele commented May 3, 2022

Changes proposed in this Pull Request

It is now possible to navigate between help center pages.

Screen.Capture.on.2022-05-04.at.19-45-41.mp4

If user is eligible for chat, but chat is not available

image

Changes:

  • Moved ContactForm to HelpCenter package

Testing instructions

TBD

Related to #

@escapemanuele escapemanuele self-assigned this May 3, 2022
@matticbot
Copy link
Contributor

matticbot commented May 3, 2022

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

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

name                   parsed_size           gzip_size
entry-gutenboarding         -911 B  (-0.0%)     -142 B  (-0.0%)
entry-stepper               -900 B  (-0.0%)     -137 B  (-0.0%)
entry-main                  -544 B  (-0.0%)      -40 B  (-0.0%)
entry-domains-landing        -78 B  (-0.0%)      -30 B  (-0.0%)
entry-browsehappy            -78 B  (-0.1%)      -30 B  (-0.1%)
entry-login                  +11 B  (+0.0%)      -14 B  (-0.0%)

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

Sections (~19 bytes removed 📉 [gzipped])

name              parsed_size           gzip_size
reader                 -148 B  (-0.0%)     -412 B  (-0.3%)
site-purchases          +11 B  (+0.0%)     +104 B  (+0.0%)
purchases               +11 B  (+0.0%)     +104 B  (+0.0%)
gutenberg-editor        +11 B  (+0.0%)      +62 B  (+0.0%)
checkout                +11 B  (+0.0%)      +49 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~5931 bytes added 📈 [gzipped])

name                                                     parsed_size            gzip_size
async-load-calypso-layout-masterbar-checkout-tsx            +49432 B   (+8.9%)   +13397 B   (+8.3%)
async-load-calypso-layout-masterbar-checkout                +49432 B  (+11.5%)   +13412 B  (+10.7%)
async-load-calypso-my-sites-checkout-modal                  +13872 B   (+1.1%)    +3803 B   (+1.1%)
async-load-calypso-blocks-support-article-dialog-dialog       -159 B   (-0.1%)     -542 B   (-1.5%)
async-load-calypso-blocks-support-article-dialog               -71 B   (-1.7%)      -11 B   (-0.7%)
async-load-design-wordpress-components-gallery                 -13 B   (-0.0%)      -23 B   (-0.0%)
async-load-signup-steps-design-picker                          +11 B   (+0.0%)       +7 B   (+0.0%)
async-load-design-blocks                                       +11 B   (+0.0%)      +10 B   (+0.0%)
async-load-calypso-components-web-preview-component            +11 B   (+0.0%)      +10 B   (+0.0%)
async-load-block-editor                                        +11 B   (+0.0%)     +210 B   (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

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.

@matticbot
Copy link
Contributor

This PR modifies the release build for editing-toolkit

To test your changes on WordPress.com, run install-plugin.sh editing-toolkit update/help-center-connect-pages on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-mMA-p2

@escapemanuele escapemanuele force-pushed the update/help-center-connect-pages branch from c6e90f6 to 921bdfb Compare May 4, 2022 09:07
@escapemanuele escapemanuele added the [Feature] Help Center The new integrated Help Center in Calypso that provides support tools on all screens. label May 4, 2022
@escapemanuele escapemanuele added this to In progress in Vertex Team Board via automation May 4, 2022
@escapemanuele escapemanuele moved this from In progress to Needs review in Vertex Team Board May 4, 2022
@escapemanuele escapemanuele requested a review from a team May 4, 2022 19:49
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 4, 2022
@escapemanuele escapemanuele requested a review from a team May 5, 2022 11:00
Copy link
Member

@alshakero alshakero left a comment

Choose a reason for hiding this comment

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

It's all coming together baby 🚀 Beautiful work!

const { data: dataChat, isLoading: isLoadingChat } = useSupportAvailability( 'CHAT' );
const { data: dataEmail, isLoading: isLoadingEmail } = useSupportAvailability( 'EMAIL' );

useEffect( () => {
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit unclear. Deserves a comment.

Suggested change
useEffect( () => {
// open the contact form automatically if the user has one option.
useEffect( () => {

const { __ } = useI18n();
const [ chatAvailable, setChatAvailable ] = useState( false );
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this needs to be a state.

<div className={ classnames( 'inline-help__contact-box', 'chat' ) }>
<div
className={ classnames( 'inline-help__contact-boxes', {
'is-reversed': ! chatAvailable,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'is-reversed': ! chatAvailable,
'is-reversed': ! dataChat.isClosed ,

>
<div
className={ classnames( 'inline-help__contact-box', 'chat', {
'is-disabled': ! chatAvailable,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'is-disabled': ! chatAvailable,
'is-disabled': dataChat.isClosed ,

Comment on lines 116 to 141
contactForm ? (
<ContactForm
mode={ contactForm }
onBackClick={ () => {
setOpenInContactPage( true );
setContactForm( null );
} }
/>
) : (
<InlineHelpCenterContent
selectedArticle={ selectedArticle }
setSelectedArticle={ setSelectedArticle }
setHelpCenterFooter={ setFooterContent }
setContactFormOpen={ setContactForm }
openInContactPage={ openInContactPage }
/>
)
Copy link
Member

Choose a reason for hiding this comment

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

Eventually we'll have to make a react router (maybe hash router) at one point for sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I was thinking about that indeed. Not right now, but this may become way too complicated 👍

@escapemanuele escapemanuele force-pushed the update/help-center-connect-pages branch from a6cbc59 to 54411ee Compare May 5, 2022 13:28
const secondaryViewRef = useRef();

//prefetch the values
useSupportAvailability( 'CHAT' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid magic strings, we should have constants for these 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @klimeryk, thanks for your suggestion! I was already focused on deployment, so I lost your message, but I'll address that as soon as possible.

Copy link
Member

@alshakero alshakero May 6, 2022

Choose a reason for hiding this comment

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

Hey Igor! This is not a magic string thanks to TypeScript, this function only accepts CHAT or EMAIL.

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL! But a constant has additional benefits that this approach seems to be missing (happy to be proven wrong, I'm a TypeScript newbie!):

  • Defined in one place - easy to change the underlying value without searching for a possibly generic string like EMAIL.
  • Easier to search for these "constants" - if it's a named constant defined somewhere, most IDEs will be able to figure out all the references to it. And even simple search would work better than for a string.
  • In some cases you need to reference those outside of just calling the function, like here: https://github.com/Automattic/wp-calypso/pull/63242/files#diff-ac4b8e65c1a3ef7336ecca35fe4c1be3628a73a08e045b237ad373f2366d8d9bR155. It becomes a magic string at that point and is completely decoupled from the definition of the function (OK, not completely, but you get the idea).

@escapemanuele escapemanuele merged commit f680f47 into trunk May 5, 2022
Vertex Team Board automation moved this from Needs review to Done May 5, 2022
@escapemanuele escapemanuele deleted the update/help-center-connect-pages branch May 5, 2022 17:11
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 5, 2022
@a8ci18n
Copy link

a8ci18n commented May 6, 2022

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7294022

Thank you @escapemanuele for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented May 11, 2022

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7294022

Thank you @escapemanuele for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented Jun 2, 2022

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Help Center The new integrated Help Center in Calypso that provides support tools on all screens.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants