Skip to content

Newsletters: modernize Page / footer / header styles#47399

Open
simison wants to merge 5 commits intotrunkfrom
update/newsletter-page
Open

Newsletters: modernize Page / footer / header styles#47399
simison wants to merge 5 commits intotrunkfrom
update/newsletter-page

Conversation

@simison
Copy link
Member

@simison simison commented Feb 28, 2026

Part of JETPACK-1358

Modernize Newsletters dashboard layout by using Page component from Gutenberg admin-ui package.

Somewhat experiment to se how a shared component for Jetpack pages might look like; fine to merge as-is here but in next steps we'd abstract it out from Newsletter package and use in other pages as well.

Depends visually on sections update merging first:

Proposed changes:

Before

image

After

image

With the Hello Dolly plugin:

Screenshot 2026-03-02 at 10 22 31

With announcement on top:

Screenshot 2026-03-02 at 10 39 27

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Enable new dashboard with add_filter( 'jetpack_wp_admin_newsletter_settings_enabled', '__return_true' );
  • See Jetpack → Newsletters
  • Test different screen widths and browsers
  • Test with Hello Dolly plugin enabled
  • Test with JITM or notices visible. You can e.g. start building Gutenberg locally and you'll see a notice while it's building.

Changelog

  • Generate changelog entries for this PR (using AI).

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the update/newsletter-page branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/newsletter-page
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/newsletter-page

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Feb 28, 2026
@jp-launch-control
Copy link

jp-launch-control bot commented Feb 28, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/newsletter/src/class-settings.php 0/159 (0.00%) 0.00% 8 💔

Full summary · PHP report · JS report

Coverage check overridden by I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. .

@simison simison added [Status] Needs Review This PR is ready for review. I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels Mar 2, 2026
@simison simison marked this pull request as ready for review March 2, 2026 09:40
Copilot AI review requested due to automatic review settings March 2, 2026 09:40
Comment on lines +295 to +302
<style>
/* Admin menu indicators */
ul#adminmenu a.wp-has-current-submenu::after,
ul#adminmenu > li.current > a.current::after {
border-right-color: #fff;
}
body { background: #fff; }
</style>
Copy link
Member Author

Choose a reason for hiding this comment

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

WP Boot package applies these (and more) styles in similar manner, so this is future-compatible.

It basically applies white background so that loading state and notice-banners on top look better (otherwise they have grey background).

It also changes menu indicator triangle to be white insteead of grey to match page background.

@simison simison force-pushed the update/newsletter-page branch from e3c468c to 295079a Compare March 2, 2026 09:45
}
// Hello Dolly compatibility fix
.jetpack_page_jetpack-newsletter #dolly {
background: gb.$white;
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Modernizes the Jetpack → Newsletters wp-admin settings screen by switching to the @wordpress/admin-ui Page layout and updating section UIs to use WordPress Card components and related styles.

Changes:

  • Replace the custom header/container layout with @wordpress/admin-ui Page and Jetpack footer/notices.
  • Restyle settings sections using Card / CardHeader / CardBody / CardFooter, and update SCSS to pull in admin-ui/theme tokens.
  • Update the PHP render root element id and add required JS dependencies for the new layout packages.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
projects/packages/newsletter/webpack.config.js Bundling tweaks for @wordpress/admin-ui (and its CSS) in the build pipeline.
projects/packages/newsletter/src/settings/style.scss Switches styling to admin-ui/theme tokens and adds new page/container layout CSS.
projects/packages/newsletter/src/settings/index.tsx Replaces prior AdminPage/Header layout with Page + Stack-based layout and new root element id.
projects/packages/newsletter/src/settings/sections/newsletter-section.tsx Converts “Newsletter” section markup to Card layout.
projects/packages/newsletter/src/settings/sections/subscriptions-section.tsx Converts “Subscriptions” section markup to Card layout and moves save action to CardFooter.
projects/packages/newsletter/src/settings/sections/paid-newsletter-section.tsx Converts “Paid newsletter” section markup to Card layout.
projects/packages/newsletter/src/settings/sections/newsletter-categories-section.tsx Converts section to Card layout and adjusts field label/description presentation.
projects/packages/newsletter/src/settings/sections/email-content-section.tsx Converts “Email content” section markup to Card layout.
projects/packages/newsletter/src/settings/sections/email-byline-section.tsx Converts “Email byline” section markup to Card layout.
projects/packages/newsletter/src/settings/sections/email-sender-settings-section.tsx Converts “Sender settings” section markup to Card layout and moves save action to CardFooter.
projects/packages/newsletter/src/settings/sections/email-reply-to-settings-section.tsx Converts “Reply-to settings” section markup to Card layout.
projects/packages/newsletter/src/settings/sections/welcome-email-section.tsx Converts “Welcome email message” section markup to Card layout and moves save action to CardFooter.
projects/packages/newsletter/src/settings/components/header.tsx Removes the old custom header component.
projects/packages/newsletter/src/settings/components/header.scss Removes the old custom header styling.
projects/packages/newsletter/src/class-settings.php Updates the root mount element id and injects some page-level CSS.
projects/packages/newsletter/package.json Adds dependencies required for admin-ui Page/theme/ui usage.
projects/packages/newsletter/changelog/update-newsletter-page Adds changelog entry for the layout/style update.
pnpm-lock.yaml Locks new WordPress package dependencies.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 121 to 125
requestMap: {
// Bundle the package with our assets until WP core exposes wp-admin-ui.
'@wordpress/admin-ui': { external: false },
'@wordpress/admin-ui/build-style/style.css': { external: false },
},
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

@wordpress/admin-ui/build-style/style.css is imported (via src/settings/style.scss), but this webpack config does not add a resolve.alias for that subpath. In this repo, other bundles that import that CSS (e.g. Forms dashboard) alias it to the physical file under node_modules/@wordpress/admin-ui/build-style/style.css to avoid resolution failures caused by package exports. Please add the same alias here (or change the import to a supported entrypoint) so the build doesn’t break.

Copilot uses AI. Check for mistakes.
Comment on lines +389 to 392
<NewsletterPage>
<Stack gap="md" direction="column" className="jetpack-newsletter-settings">
{ ! isSimpleSite() && <NewsletterSection data={ data } onChange={ handleAutoSave } /> }

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

NewsletterPage already wraps its children in a <Stack ... className="jetpack-newsletter-settings">, but NewsletterSettingsApp adds another nested Stack with the same class. This likely doubles up layout spacing/max-width/margins and makes future layout changes harder. Consider keeping the layout wrapper in one place (either remove the inner Stack here, or remove it from NewsletterPage).

Copilot uses AI. Check for mistakes.
Comment on lines +296 to +301
/* Admin menu indicators */
ul#adminmenu a.wp-has-current-submenu::after,
ul#adminmenu > li.current > a.current::after {
border-right-color: #fff;
}
body { background: #fff; }
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The inline <style> block includes global selectors (body, ul#adminmenu ...) which makes the page styling harder to maintain and can have unintended side effects if this markup is ever reused/embedded. Prefer moving these rules into the existing bundled stylesheet and scoping them to the newsletter admin page (e.g., body.jetpack_page_jetpack-newsletter ... or #jetpack-newsletter-wp-admin-app ...).

Suggested change
/* Admin menu indicators */
ul#adminmenu a.wp-has-current-submenu::after,
ul#adminmenu > li.current > a.current::after {
border-right-color: #fff;
}
body { background: #fff; }
/* Admin menu indicators scoped to the newsletter admin page */
body.jetpack_page_jetpack-newsletter ul#adminmenu a.wp-has-current-submenu::after,
body.jetpack_page_jetpack-newsletter ul#adminmenu > li.current > a.current::after {
border-right-color: #fff;
}
body.jetpack_page_jetpack-newsletter { background: #fff; }

Copilot uses AI. Check for mistakes.
gravatar={ newsletterScriptData.gravatar }
displayName={ getScriptData()?.user.current_user?.display_name ?? '' }
dateExample={ newsletterScriptData.dateExample }
<Card>
Copy link
Member Author

Choose a reason for hiding this comment

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

These section changes could easily be done in a separate PR to simplify.

Comment on lines +100 to +102
label: __( 'Newsletter categories', 'jetpack-newsletter' ),
description: __(
'Which categories will you use for newsletter subscribers? Select all that apply.',
Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like the field type array doesn't support description like other field types do, but the label was horrendous being so long. Could move to a separate PR.

@simison simison requested review from a team March 2, 2026 10:09
@simison simison changed the title Newsletters: modernize layout Newsletters: modernize Page / footer / header styles Mar 2, 2026
Copilot AI review requested due to automatic review settings March 2, 2026 11:39
@simison simison force-pushed the update/newsletter-page branch from 75b8167 to 6328cef Compare March 2, 2026 11:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

$content-max-width: 1040px;

.jetpack-page-container {
margin-left: -20px;
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

.jetpack-page-container uses a physical margin-left: -20px;, which won’t behave correctly in RTL layouts. The surrounding styles already use logical properties (e.g., inset-inline-start/end), so consider switching this to a logical margin (e.g., margin-inline-start) to keep the layout RTL-safe.

Suggested change
margin-left: -20px;
margin-inline-start: -20px;

Copilot uses AI. Check for mistakes.
Comment on lines +1 to 4
@use "@automattic/jetpack-base-styles/gutenberg-base-styles" as gb;
@import "@wordpress/theme/design-tokens.css";
@import "@wordpress/admin-ui/build-style/style.css";
@import "@wordpress/dataviews/build-style/style.css";
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

@wordpress/admin-ui/build-style/style.css is imported here, but newsletter’s webpack config does not define a resolve.alias for that path. In this repo, the Forms dashboard build adds an explicit alias for this exact file (e.g., projects/packages/forms/tools/webpack.config.dashboard.js) to avoid resolution failures due to package export maps. Consider adding the same alias in projects/packages/newsletter/webpack.config.js (or importing via an exported entrypoint) so this stylesheet can be resolved reliably during bundling.

Copilot uses AI. Check for mistakes.
Comment on lines +295 to +302
<style>
/* Admin menu indicators */
ul#adminmenu a.wp-has-current-submenu::after,
ul#adminmenu > li.current > a.current::after {
border-right-color: #fff;
}
body { background: #fff; }
</style>
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

This inline <style> block makes global admin CSS changes (body background and #adminmenu indicators) directly in the render output. Since the React app already bundles/enqueues style.scss, consider moving these rules into that stylesheet (scoped to the newsletter admin page body class, e.g. body.jetpack_page_jetpack-newsletter) to keep styling versioned/cached and avoid accumulating inline styles in PHP output.

Suggested change
<style>
/* Admin menu indicators */
ul#adminmenu a.wp-has-current-submenu::after,
ul#adminmenu > li.current > a.current::after {
border-right-color: #fff;
}
body { background: #fff; }
</style>

Copilot uses AI. Check for mistakes.
dsas
dsas previously approved these changes Mar 2, 2026
Copy link
Contributor

@dsas dsas left a comment

Choose a reason for hiding this comment

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

Tests nicely - it even fixes an issue with horizontal scrolling at certain screen resolutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. [Package] Newsletter [Status] In Progress [Status] Needs Review This PR is ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants