-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix: Filtered plans comparison grid features #75424
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~179 bytes added 📈 [gzipped])
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 (~15 bytes added 📈 [gzipped])
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. Generated by performance advisor bot at iscalypsofastyet.com. |
]; | ||
const { planProperties } = this.props; | ||
const plansToShow = planProperties | ||
.filter( ( { isVisible } ) => isVisible ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to add the .filter( ( { isVisible } ) => isVisible )
to each location to make it more visible where the filtration is happening.
This causes some indentation changes, so you might want to use Hide whitespaces
to see the actually changes.
if ( | ||
isWooExpressMediumPlan( planName ) && | ||
! isWooExpressMediumPlan( currentSitePlanSlug ) | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes were made here, it just got autoformatted by the linter.
let isVisible = visiblePlans.indexOf( plan ) !== -1; | ||
|
||
if ( hideFreePlan && plan === PLAN_FREE ) { | ||
isVisible = false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the hideFreePlan
here so that all visibility computation is in one place.
const displayedPlansProperties = useMemo( | ||
() => | ||
( planProperties ?? [] ).filter( | ||
( { planName } ) => ! ( planName === PLAN_ENTERPRISE_GRID_WPCOM ) | ||
( { planName, isVisible } ) => isVisible && ! ( planName === PLAN_ENTERPRISE_GRID_WPCOM ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
displayedPlansProperties
is used to determine what plans to show in the comparison table on smaller screens and it gets changed each time swap plans by clicking on the name (or cycle between screen sizes).
This works fine when hiding only the free plan, but on What's wrong is that some features are still said not to be included even though they are on the Business and above 😢 This is what A quick and dirty way to test the new pricing grid on |
@zaguiini Thanks for catching that! This is caused by the I pushed a fix to move the plan filtration for the 2023 pricing grid from By setting |
Related to #1464
Proposed Changes
The features for each plan in the Comparison grid found in the Onboarding Flows and the Plans pages are constructed by appending to the previous plan features. If a lower-tier plan is filtered-out, then its features never get inherited by the other plans.
Testing Instructions
Checkout and run this branch locally
Go to
/start/plans
and/plans/{SITE_ID}
Try out multiple screen widths
The plans grid and comparison table below should be unchanged
Go to this line and manipulate the
visiblePlans
array to show fewer plans (ex.visiblePlans.splice( 0, 1 )
)The plans grid and comparison table below should only show the remaining plans
Make sure the correct features are shown in the comparison table
Pre-merge Checklist