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/new email comparison card props #58632

Merged
merged 7 commits into from
Dec 6, 2021

Conversation

AllTerrainDeveloper
Copy link
Contributor

@AllTerrainDeveloper AllTerrainDeveloper commented Nov 30, 2021

Changes proposed in this Pull Request

Create a new component "EmailProvidersComparisonStacked" placeholder to wire things up.

Modify EmailPromoCard to match Saygun's design

  • Add a new property to inject a header component (in addition to the old title string)

Modify Price component to add a new property "additional information"

Create a new EmailProviderStackedCard to provide the Saygun's modifications (features inside of the card, logo at the end of it)

Work in progress

image

Testing instructions

  1. Go to a site with domains without email subscription
  2. Click on 'Add email' for the desired site
  3. Once you are in the comparison page, add at the end the following flag: ?flags=emails/new-email-comparison (it is only

Remarks: visible through the path /email/{domain}/purchase/{site}?flags=emails/new-email-comparison

You should see the beginning of a new component being developed.

Related to 1200182182542585-as-1201414571816235

Subsequent PR

@AllTerrainDeveloper AllTerrainDeveloper requested a review from a team November 30, 2021 09:04
@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 Nov 30, 2021
@github-actions
Copy link

github-actions bot commented Nov 30, 2021

const badge = <img src={ poweredByTitanLogo } alt={ translate( 'Powered by Titan' ) } />;
const getTitanFeatures = () => {
return [
translate( 'Inbox, calendars, and contacts' ),
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 20 times:
translate( 'Email, calendars, and contacts' ) ES Score: 6

Copy link
Contributor

@daledupreez daledupreez left a comment

Choose a reason for hiding this comment

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

I have a bunch of comments from inspection. I'll loop back to test later this evening.

{ titleComponent && (
<>
{ titleComponent }
{ badge && <Badge className="promo-card__title-badge">{ badge }</Badge> }
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: it may be worth defining the badge wrapper once rather than repeating it.

const badgeComponent = badge ? <Badge className="promo-card__title-badge">{ badge }</Badge> : null;

and then refer to this component in the later code.

Comment on lines +23 to +27
title?: string | TranslateResult;
titleComponent?: ReactElement;
isPrimary?: boolean;
badge?: string;
badge?: string | ReactElement;
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like some of these types are imported via import instead of import type.

@@ -1,14 +1,19 @@
import classnames from 'classnames';
import { useTranslate, TranslateResult } from 'i18n-calypso';
import { FunctionComponent } from 'react';
import { FunctionComponent, ReactElement } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you only import the ReactElement type?

Suggested change
import { FunctionComponent, ReactElement } from 'react';
import { FunctionComponent } from 'react';
import type { ReactElement } from 'react';

Comment on lines 2 to 4
import { TranslateResult, useTranslate } from 'i18n-calypso';
import { FunctionComponent } from 'react';
import { preventWidows } from 'calypso/lib/formatting';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can you import only the TranslateResult type?

Suggested change
import { TranslateResult, useTranslate } from 'i18n-calypso';
import { FunctionComponent } from 'react';
import { preventWidows } from 'calypso/lib/formatting';
import { useTranslate } from 'i18n-calypso';
import { FunctionComponent } from 'react';
import { preventWidows } from 'calypso/lib/formatting';
import type { TranslateResult } from `i18-calypso';

);
};

export interface EmailProviderStackedFeatureProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I prefer having the prop types defined before they get used, otherwise I need to scan down to find them.

productsList: getProductsList( state ),
requestingSiteDomains: isRequestingSiteDomains( state, domainName ),
selectedSite,
titanMailProduct: getProductBySlug( state, TITAN_MAIL_MONTHLY_SLUG ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe call this titanMailMonthlyProduct to prep for the annual product?

domain,
domainName,
domainsWithForwards: getDomainsWithForwards( state, domains ),
gSuiteProduct: getProductBySlug( state, GOOGLE_WORKSPACE_BUSINESS_STARTER_YEARLY ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe call this gSuiteAnnualProduct to prep for the monthly product?

import React from 'react';
import poweredByTitanLogo from 'calypso/assets/images/email-providers/titan/powered-by-titan.svg';
import { getTitanProductName } from 'calypso/lib/titan';
import { ProviderCard } from 'calypso/my-sites/email/email-providers-stacked-comparison';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we import this as a type?

Suggested change
import { ProviderCard } from 'calypso/my-sites/email/email-providers-stacked-comparison';
import type { ProviderCard } from 'calypso/my-sites/email/email-providers-stacked-comparison';

Comment on lines +25 to +26
formFields: <form> Placeholder </form>,
formattedPrice: '3.5$',
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if these props should come from here, as they need to be computed dynamically based on the user's currency and need to wait for the query responses from the server.

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, all those price tags has been addressed in the next pull request. Those were only placeholders :)

formFields: <form> Placeholder </form>,
formattedPrice: '3.5$',
onExpandedChange: noop,
providerKey: '',
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 not be 'titan'?

Copy link
Contributor

@daledupreez daledupreez left a comment

Choose a reason for hiding this comment

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

I've just tested and things look reasonable, especially if there are some hard-coding items that we're cleaning up in a follow-up PR (mainly the price values).

I think we do need to address the translation items and type imports in this PR, mainly because we want to get the correct strings queued up for translation.

@matticbot
Copy link
Contributor

matticbot commented Nov 30, 2021

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

Sections (~1391 bytes added 📈 [gzipped])

name            parsed_size           gzip_size
email               +5374 B  (+1.0%)    +1316 B  (+0.9%)
domains              +877 B  (+0.1%)     +137 B  (+0.0%)
scan                  +63 B  (+0.0%)      +26 B  (+0.0%)
jetpack-search        +63 B  (+0.0%)      +26 B  (+0.0%)
earn                  +63 B  (+0.0%)      +23 B  (+0.0%)
backup                +63 B  (+0.0%)      +26 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 (~25 bytes added 📈 [gzipped])

name                          parsed_size           gzip_size
async-load-design-playground        +63 B  (+0.0%)      +25 B  (+0.0%)
async-load-design                   +63 B  (+0.0%)      +25 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.

Copy link
Contributor

@olaseni olaseni left a comment

Choose a reason for hiding this comment

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

Looks almost ready. There's a comment on absolute positioning that needs to be responded to.

Copy link
Contributor

@olaseni olaseni left a comment

Choose a reason for hiding this comment

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

Look good at this stage.

@AllTerrainDeveloper AllTerrainDeveloper merged commit 0ab6ae2 into trunk Dec 6, 2021
@AllTerrainDeveloper AllTerrainDeveloper deleted the add/new-email-comparison-card-props branch December 6, 2021 12:50
@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 Dec 6, 2021
@a8ci18n
Copy link

a8ci18n commented Dec 6, 2021

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

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

nelsonec87 pushed a commit that referenced this pull request Dec 9, 2021
@a8ci18n
Copy link

a8ci18n commented Dec 17, 2021

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants