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

[9962] Post level RRM settings #10246

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

ankitrox
Copy link
Collaborator

Summary

Addresses issue:

Relevant technical choices

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

Copy link

github-actions bot commented Feb 18, 2025

Build files for b8d40f7 are ready:

Copy link

github-actions bot commented Feb 18, 2025

Size Change: +49.9 kB (+2.47%)

Total Size: 2.07 MB

Filename Size Change
./dist/assets/js/blocks/googlesitekit-reader-revenue-manager-block-editor.js 0 B -478 B (removed) 🏆
./dist/assets/js/blocks/sign-in-with-google/editor-styles.js 492 B +2 B (+0.41%)
./dist/assets/js/blocks/sign-in-with-google/index.js 18.1 kB +13 B (+0.07%)
./dist/assets/css/googlesitekit-block-editor-css-********************.min.css 21 B +21 B (new file) 🆕
./dist/assets/js/blocks/reader-revenue-manager/index.js 50.3 kB +50.3 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
./dist/assets/css/googlesitekit-admin-css-********************.min.css 63 kB
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.8 kB
./dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 846 B
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 8.48 kB
./dist/assets/js/33-********************.js 2.76 kB
./dist/assets/js/34-********************.js 2.25 kB
./dist/assets/js/35-********************.js 3.64 kB
./dist/assets/js/36-********************.js 935 B
./dist/assets/js/37-********************.js 892 B
./dist/assets/js/38-********************.js 1.61 kB
./dist/assets/js/39-********************.js 1.57 kB
./dist/assets/js/40-********************.js 1.61 kB
./dist/assets/js/41-********************.js 1.59 kB
./dist/assets/js/42-********************.js 1.83 kB
./dist/assets/js/43-********************.js 3.12 kB
./dist/assets/js/analytics-advanced-tracking-********************.js 901 B
./dist/assets/js/blocks/sign-in-with-google/editor-styles.css 75 B
./dist/assets/js/googlesitekit-activation-********************.js 23.8 kB
./dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 54.4 kB
./dist/assets/js/googlesitekit-adminbar-********************.js 34.9 kB
./dist/assets/js/googlesitekit-api-********************.js 10.1 kB
./dist/assets/js/googlesitekit-components-gm2-********************.js 6.46 kB
./dist/assets/js/googlesitekit-components-gm3-********************.js 10.1 kB
./dist/assets/js/googlesitekit-consent-mode-********************.js 25.6 kB
./dist/assets/js/googlesitekit-data-********************.js 2.38 kB
./dist/assets/js/googlesitekit-datastore-forms-********************.js 8.96 kB
./dist/assets/js/googlesitekit-datastore-location-********************.js 2.08 kB
./dist/assets/js/googlesitekit-datastore-site-********************.js 20.5 kB
./dist/assets/js/googlesitekit-datastore-ui-********************.js 10 kB
./dist/assets/js/googlesitekit-datastore-user-********************.js 28.4 kB
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 84.9 kB
./dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 646 B
./dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 624 B
./dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 630 B
./dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 712 B
./dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 675 B
./dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 634 B
./dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 657 B
./dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 633 B
./dist/assets/js/googlesitekit-i18n-********************.js 3.93 kB
./dist/assets/js/googlesitekit-main-dashboard-********************.js 165 kB
./dist/assets/js/googlesitekit-metric-selection-********************.js 52.2 kB
./dist/assets/js/googlesitekit-modules-********************.js 22.4 kB
./dist/assets/js/googlesitekit-modules-ads-********************.js 35.1 kB
./dist/assets/js/googlesitekit-modules-adsense-********************.js 117 kB
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 192 kB
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 22.8 kB
./dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 44.7 kB
./dist/assets/js/googlesitekit-modules-search-console-********************.js 69.6 kB
./dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 32.7 kB
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 32.3 kB
./dist/assets/js/googlesitekit-notifications-********************.js 43.6 kB
./dist/assets/js/googlesitekit-polyfills-********************.js 378 B
./dist/assets/js/googlesitekit-settings-********************.js 129 kB
./dist/assets/js/googlesitekit-splash-********************.js 69 kB
./dist/assets/js/googlesitekit-user-input-********************.js 44 kB
./dist/assets/js/googlesitekit-vendor-********************.js 325 kB
./dist/assets/js/googlesitekit-widgets-********************.js 104 kB
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 63.3 kB
./dist/assets/js/runtime-********************.js 1.4 kB

compressed-size-action

@ankitrox ankitrox changed the title Enhancement/9962 post level rrm settings [9962] Post level RRM settings Feb 21, 2025
Copy link
Collaborator

@techanvil techanvil left a 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.

Copy link
Collaborator

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):

image

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>
Copy link
Collaborator

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>
Copy link
Collaborator

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.

Comment on lines +36 to +37
registerStore( Data );

Copy link
Collaborator

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.

Comment on lines +56 to +65
dispatch( CORE_MODULES ).receiveGetModules( [
{
slug: 'reader-revenue-manager',
active: true,
connected: true,
shareable: true,
recoverable: true,
internal: false,
},
] );
Copy link
Collaborator

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:

Suggested change
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,
},
] );

Copy link
Collaborator

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';
Copy link
Collaborator

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' ),
Copy link
Collaborator

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:

Suggested change
'src' => $this->context->url( 'dist/assets/js/blocks/reader-revenue-manager/index.js' ),
'src' => $base_url . 'js/blocks/reader-revenue-manager/index.js',

Comment on lines +44 to +45
'reader-revenue-manager/index':
'./blocks/reader-revenue-manager/index.js',
Copy link
Collaborator

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:

Suggested change
'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',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's move this to webpack/gutenbergBlocks.config.js similar to the approach taken in #10247 and #10191.

Let's also move the SCSS file to blocks/reader-revenue-manager/block-editor-plugin/editor-styles.scss.

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.

2 participants