-
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
Pressable: show proper my-plan page #8847
Conversation
FAQEDIT: @artpi - I moved the questions here from the thread main post:
I've been discussing this a bit with @p3ob7o. No promises, but we may be able to enable domain management for these sites. In practice most users will not have a domain credit because automated-transfer will be limited to users with a custom domain. But it's possible for a business site to have a custom domain and still have an available domain credit, so we still need to work this out.
Yes. These are dotcom business site users who have made use of the custom theme/plugin functionality. Jetpack is an implementation detail that isn't relevant to the user.
Yes, that is the plan. See the spreadsheet which links back to the master thread for that effort.
It should, yes. There's work involved there too though. |
selectedSite={ selectedSite } | ||
hasDomainCredit={ hasDomainCredit } | ||
/> | ||
<CustomDomainPurchaseDetail { ...pick( props, [ 'selectedSite', 'hasDomainCredit', 'isPressableSite' ] ) } /> |
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 actually think the former is more readable but ¯_(ツ)_/¯
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.
Me too. I think we should pass all the props (with picking/omitting some) only if they are passed to a native component like div
or button
. Those component can accept various different props so it's better to simply pass down everything instead of listing the possible props.
However, in this case, we are passing down only three props so it's unnecessary to use this pattern IMO. :)
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.
For each of these props it was repeating each prop name ( selectedSite
for example) 3 times just to pass it down.
Each of these repeats compounds the likelihood of making an error when adding/removing/modfing passed prop.
I refactored it not because of readability, but because of DRY
return null; | ||
} | ||
|
||
return site.options.pressable; |
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.
👍 Thanks for adding this. Let's check in with @peterbutler as work starts on this.
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 checked in with Peter and he is completely ok with that. Looks like pressable plan will be just a regular business plan.
I think this can be a good selector to make work on this easier.
Worse case scenario, we can remove it later, but even having something to grep can be a good start
83e53fb
to
6ac97f6
Compare
const originalSite = state[ action.siteId ]; | ||
if ( originalSite ) { | ||
return Object.assign( {}, state, { | ||
[ action.siteId ]: merge( {}, originalSite, { jetpack: true, options: { pressable: true } } ) |
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.
This is a good start, but we'll probably also want to mark when a site is in the process of transferring.
<PurchaseDetail | ||
); | ||
} else if ( ! hasDomainCredit && hasCustomDomain( selectedSite ) ) { | ||
const actionButton = {}; |
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.
The name here makes it sound like this is a component instead of a grouping of props. Perhaps we should refactor PurchaseDetail a bit.
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.
A ternary might be a better fit, though the usage is still a bit odd.
const purchaseDetailButtonProps = isPressableSite ? {} : {
buttonText: translate( 'Manage my domains' ),
href: `/domains/manage/${ selectedSite.slug }`
};
return renderHasCustomDomain(); | ||
} | ||
|
||
{ ...actionButton } |
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'm thinking it might make sense to update purchase detail to accept child components, and remove the PurchaseButton wrapper. (which only adds a class to button and is unnecessary ).
If this feels out of scope, lets mark this for another janitorial
@@ -75,6 +75,15 @@ export function items( state = {}, action ) { | |||
} | |||
return state; | |||
|
|||
case 'PRESSABLE_TEST': |
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.
The name of this would more likely be something closer to PRESSIBLE_TRANSFER_START
. Do you mind adding a new action type, even though we might rename this later.
I left a few notes, but I think we can merge this in after creating a proper action type. |
After @gwwar pointers, I:
|
Introduce 2 selectors ( isPressableSite and isPressableSiteInTransfer ) to easily detect the state of pressable transfer and if site is in fact on pressable Also hide "manage domain" button * Add groundwork for marking site pressable * Pass on pressable site status * Introduce review pointers * Make constants ssr-ready so test pass
This is a part of #8836.
state.sites.ID.options.pressable
option in sites redux treeisPressableSite
selectorPRESSABLE_TRANSFER_SUCCESS
action to test pressable internalsTesting
{ type: 'PRESSABLE_TRANSFER_SUCCESS', siteId: ID }
CC @rralian @gwwar @lamosty @retrofox @adambbecker