-
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
Plans: add main plan component — PlanFeatures #6002
Conversation
7f8b8e1
to
df44f61
Compare
obj.plans.indexOf( planName ) !== -1 | ||
); | ||
|
||
return sortBy( planFeatures, 'order' ); |
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 understand what you're doing here, but this may be somewhat difficult to maintain in the future. Maybe add a list of feature references to the plan object instead?
e.g.
[ PLAN_FREE ]: {
getFeatures: () => [ FEATURE_3GB_STORAGE, FEATURE_WP_SUBDOMAIN, ... ]
getTitle: () => i18n.translate( 'Free' ),
getPriceTitle: () => i18n.translate( 'Free for life' ),
getProductId: () => 1,
getDescription: () => i18n.translate( 'Get a free blog and be on your way to publishing your first post in less than five minutes.' )
},
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.
Hmm, I thought we don't want to duplicate the references (as they are currently made from the opposite direction). But I'll implement this as I think it's a better solution. We also don't need the order
prop in features because we can just order them in the array.
👍 Looking good so far. #6046 should fix the visual oddities with price. Let me know if you need help with new selectors. |
db4e8f4
to
b3a6452
Compare
|
||
[ FEATURE_WP_SUBDOMAIN ]: { | ||
getTitle: () => i18n.translate( 'WordPress.com subdomain' ), | ||
plans: [ PLAN_FREE ] |
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.
Hmm this could get out of sync too. If we need the reverse lookup maybe lets remove this, and add in helper function like:
getPlansForFeature( feature )
We could also memoize the results if this is called frequently
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.
Good point. Do we want to do it in this PR? I don't need the getPlansForFeature
helper fn here, that's why I'm asking. I think it's better suited for a standalone PR.
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.
We can leave this for a future PR
Looking good! I left a few notes, but when you're ready, this is good to 🚢 |
22e953b
to
a0ec357
Compare
@gwwar I've rebased this PR on top of master but I'm getting errors now (screenshots below) which I wasn't getting before. I started rebasing this on Friday (so the first rebase includes your #6046). After the first rebase, I think I got no new errors. However, I then pulled in new code in The first part about state validation failed is a bit unknown to me (I only know that we store state to localForage and on loading it back we validate it — but I don't know what I should do with this error). The second part refers to billingTimeFrame: getPlan( state, planProductId ).bill_period_label However, initially when there are no plans data, it probably fails because |
37a15ab
to
4c12470
Compare
This component is dumb (ie receives props only) and will be rendered in PlanFeaturesList which will be a smart component.
+ some other minor modifications
... and remove partial components (ie PlanFeaturesHeader)
Fixes problems with translations being outside the render loop. Props @gwwar for the idea.
In case we want to change header banner height, the top margin of the popular plan is recalculated automatically.
This way, we drop dependency on legacy `lib/sites-list` and `/sites/$site/plans` endpoint.
4c12470
to
fa0633b
Compare
aba65d5
to
375f0ff
Compare
|
Add
PlanFeatures
component as a part of bigger plans-redesign started in #5715.Example usage
Testing
PlanFeatures
was added to devdocs into App Components;Screenshots
Note: In the second screenshot, the Business plan has a strange price. This is probably related to the recent PR #6001 by @gwwar but she's already working on a better solution here: #6046. That's why I've left it as it is.
If it is not related to that, I'll fix it.
Although this is still work in progress, I think I've arrived to a presentable code so please review. :)
cc @gwwar @rralian @mtias @artpi @retrofox
Test live: https://calypso.live/?branch=add/plan-features-plan