-
Notifications
You must be signed in to change notification settings - Fork 297
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
[9962] Post level RRM settings #10246
base: develop
Are you sure you want to change the base?
Conversation
Build files for b8d40f7 are ready:
|
Size Change: +49.9 kB (+2.47%) Total Size: 2.07 MB
ℹ️ View Unchanged
|
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 @ankitrox, this is looking good, but could use a few amendments. Please see my comments for details.
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.
There's no styling here, and this is how the dropdown label looks on my install (running WP 6.6.1):
The label should not be all-caps, and the text should should wrap to the next line as needed.
Let's also move the SCSS file to blocks/reader-revenue-manager/block-editor-plugin/editor-styles.scss
as discussed below.
|
||
export default function SettingPanel() { | ||
return ( | ||
<Fragment> |
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 Fragment
is redundant and can be removed.
} | ||
|
||
return ( | ||
<Fragment> |
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 Fragment
can also be removed.
registerStore( Data ); | ||
|
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.
It's a bit odd having this file exporting a function to register the plugin on demand, but at the same time having the unconditional call to registerStore( Data )
.
Let's move the call to registerStore
to index.js
where the exported function is called. Then, in the test for this file, call registerStore( Data )
in the test setup to ensure the tests still work.
dispatch( CORE_MODULES ).receiveGetModules( [ | ||
{ | ||
slug: 'reader-revenue-manager', | ||
active: true, | ||
connected: true, | ||
shareable: true, | ||
recoverable: true, | ||
internal: 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.
Let's use provideModules()
here, with a similar call to how it's used elsewhere for RRM:
dispatch( CORE_MODULES ).receiveGetModules( [ | |
{ | |
slug: 'reader-revenue-manager', | |
active: true, | |
connected: true, | |
shareable: true, | |
recoverable: true, | |
internal: false, | |
}, | |
] ); | |
provideModules( Data, [ | |
{ | |
slug: 'reader-revenue-manager', | |
active: true, | |
connected: 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.
Taking a look at what's coming in #10247, I'd suggest a reorganisation of the files under blocks
as follows:
blocks/reader-revenue-manager
├── block-editor-plugin
│ ├── editor-styles.scss
│ ├── index.js
│ ├── plugin-registration.js
│ ├── plugin-registration.test.js
│ ├── SettingPanel.js
│ └── SettingsForm.js
└── common
└── constants.js
import { MODULES_READER_REVENUE_MANAGER } from '../../../assets/js/modules/reader-revenue-manager/datastore/constants'; | ||
|
||
const { select, dispatch } = Data; | ||
const CORE_EDITOR = 'core/editor'; |
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.
Let's extract this constant to blocks/reader-revenue-manager/common/constants.js
, in line with the changes that are coming in https://github.com/google/site-kit-wp/pull/10247/files#diff-eebc7bb1047fb0c0e7a220332932857840c7bfdba8549a67ab518a829497024f.
array( | ||
'src' => $base_url . 'js/blocks/googlesitekit-reader-revenue-manager-block-editor.js', | ||
'src' => $this->context->url( 'dist/assets/js/blocks/reader-revenue-manager/index.js' ), |
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.
Let's stick with using $base_url
for consistency:
'src' => $this->context->url( 'dist/assets/js/blocks/reader-revenue-manager/index.js' ), | |
'src' => $base_url . 'js/blocks/reader-revenue-manager/index.js', |
'reader-revenue-manager/index': | ||
'./blocks/reader-revenue-manager/index.js', |
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.
Again, taking future changes into account let's update this:
'reader-revenue-manager/index': | |
'./blocks/reader-revenue-manager/index.js', | |
'reader-revenue-manager/block-editor-plugin/index': | |
'./blocks/reader-revenue-manager/block-editor-plugin/index.js', |
@@ -35,6 +35,7 @@ module.exports = ( mode ) => ( { | |||
'googlesitekit-wp-dashboard-css': './assets/sass/wpdashboard.scss', | |||
'googlesitekit-authorize-application-css': | |||
'./assets/sass/authorize-application.scss', | |||
'googlesitekit-block-editor-css': './assets/sass/block-editor.scss', |
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.
Summary
Addresses issue:
Relevant technical choices
PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist