Skip to content

feat(my-account): apply Newspack UI styles to My Account w/ env constant#3951

Merged
dkoo merged 20 commits into
trunkfrom
feat/my-account-newspack-ui
May 13, 2025
Merged

feat(my-account): apply Newspack UI styles to My Account w/ env constant#3951
dkoo merged 20 commits into
trunkfrom
feat/my-account-newspack-ui

Conversation

@dkoo

@dkoo dkoo commented Apr 25, 2025

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

Reorganizes My Account files to support switching between multiple different versions of the UI with an environment constant. Establishes v0 (current UI) and v1 classes which enqueue different assets and have the ability to load different custom templates depending on which UI version is active.

This PR doesn't attempt to fully implement new My Account designs, templates, or custom UI components yet, it just applies CSS to get global content/layouts and individual components as close as possible without altering the templates.

Some notes:

  • Does the use of child "UI version" classes and version string comparisons make sense for this? I'm imagining we might eventually need to support even more than two different versions of the UI.
  • The styles are split between the My Account SCSS and a new _my-account.scss Newspack UI module. The latter is so that we can @extend important WooCommerce classes with Newspack UI styles without importing and duplicating Newspack UI CSS in the compiled My Account CSS.
  • The V1 class dequeues WooCommerce styles from the Newspack Theme. This is so we don't have to fight/override the theme styles as much and can start from more of a blank slate.
  • Moved the My Account front-end JS from the includes folder to src/my-account with some more modular organization:
    • JS is split into smaller modules by My Account section/feature
    • Top-level JS is enqueued and executed in all My Account pages, regardless of active UI version
    • JS and SCSS in v0 and v1 folders are compiled as separate files and enqueued/executed only when the matching UI version is active

How to test the changes in this Pull Request:

  1. Check out this branch.
  2. Log in as a verified reader with newsletters, subscriptions and/or donations.
  3. Smoke test the My Account pages—without adding an environment constant to wp-config.php, all pages should look and behave identically as in trunk.
  4. Add an environment constant to wp-config.php: define( 'NEWSPACK_MY_ACCOUNT_VERSION', '1.0.0' ); (this tells the plugin to load the v1 class)
  5. Hard-refresh the My Account pages and confirm that the page layouts and their components are using Newspack UI styles (make sure to test both mobile and non-mobile breakpoints). Behavior of features throughout all pages should remain identical to v0/trunk.
Screenshot 2025-04-25 at 11 46 06 AM Screenshot 2025-04-25 at 11 47 26 AM

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added [Status] Needs Review The issue or pull request needs to be reviewed My Account Redesign labels Apr 25, 2025
@dkoo dkoo self-assigned this Apr 25, 2025
@dkoo dkoo requested a review from a team as a code owner April 25, 2025 00:12
@dkoo dkoo requested a review from a team April 25, 2025 17:21
@dkoo

dkoo commented Apr 25, 2025

Copy link
Copy Markdown
Contributor Author

Tagging @Automattic/newspack-design for a design review. Keep in mind this PR is an incremental step toward the full redesign and the scope of changes here is limited to CSS only.

@miguelpeixe miguelpeixe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The structure is looking great! I didn't look too much into the implemented styles because I understand it's still partial. My main focus was on how we're getting this foundation started.

I really like the directory structure for both backend and frontend. The v0 and v1 separation is a great idea and is implemented in a way that is very straightforward to figure out and navigate. Just left a minor comment for the PHP part.

In my testing I had no issues navigating the dashboard in both versions.

Comment thread src/my-account/payment-methods.js Outdated
Comment thread src/my-account/v1/_navigation.scss
Comment thread includes/reader-revenue/woocommerce/my-account/class-my-account-ui-v1.php Outdated
Comment thread includes/reader-revenue/woocommerce/my-account/class-my-account-ui-v0.php Outdated
@dkoo dkoo requested a review from miguelpeixe May 9, 2025 22:48
@dkoo

dkoo commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, @miguelpeixe! I'm glad the _VX convention made sense to you. 😆 I think this is ready for another review.

@miguelpeixe miguelpeixe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the changes! Looks good and tests well!

@github-actions github-actions Bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels May 12, 2025
@dkoo dkoo requested a review from thomasguillot May 12, 2025 17:28
@dkoo

dkoo commented May 12, 2025

Copy link
Copy Markdown
Contributor Author

@thomasguillot d1bc651 also tweaks margins/spacing for the buttons inside tables:

mobile:
Screenshot 2025-05-12 at 12 01 03 PM

tablet/desktop:
Screenshot 2025-05-12 at 12 00 39 PM

@thomasguillot thomasguillot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are some vertical alignment issues but I'm not too concerned since this screen will eventually change.

@dkoo dkoo merged commit e4aa5a2 into trunk May 13, 2025
8 checks passed
@dkoo dkoo deleted the feat/my-account-newspack-ui branch May 13, 2025 15:44
@github-actions

Copy link
Copy Markdown

Hey @dkoo, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

@adekbadek adekbadek mentioned this pull request May 16, 2025
6 tasks
matticbot pushed a commit that referenced this pull request May 23, 2025
# [6.7.0-alpha.1](v6.6.2...v6.7.0-alpha.1) (2025-05-23)

### Bug Fixes

* **404-images:** use JS without modifying content ([#3963](#3963)) ([9f5646b](9f5646b))
* add missing namespace ([#3980](#3980)) ([6d58793](6d58793))
* **emails:** add missing HTML markup in the change-email-cancel template ([#3981](#3981)) ([040ae30](040ae30))
* **ga4:** fire login/registration activities via SSO ([#3965](#3965)) ([8c97515](8c97515))
* hide modal content gate when modal checkout is opened ([#3953](#3953)) ([a503973](a503973))
* **jetpack:** handle the related posts max age option ([#3964](#3964)) ([8aad2b8](8aad2b8))
* make sure fix duplcate fields apply filters ([#3971](#3971)) ([f361a4e](f361a4e))
* namespace Lite Site ([#3975](#3975)) ([e4665ae](e4665ae))
* sync correction status with parent post status ([#3978](#3978)) ([dcd5a12](dcd5a12))

### Features

* add compatibility to network in custom bylines ([#3972](#3972)) ([199a993](199a993))
* add icons repository and remove custom icons ([#3883](#3883)) ([e56d2e0](e56d2e0))
* **analytics:** "My Account" dashboard interactions ([#3949](#3949)) ([22e9590](22e9590))
* **donations:** update notice style and type ([#3962](#3962)) ([3f60ef3](3f60ef3))
* **email-change:** remove env constant requirement ([#3943](#3943)) ([4158bf1](4158bf1))
* **my-account:** apply Newspack UI styles to My Account w/ env constant ([#3951](#3951)) ([e4aa5a2](e4aa5a2))
* **my-account:** full-site takeover template and custom nav menu ([#3974](#3974)) ([5cf8403](5cf8403))
* **woocommerce:** log error notices ([#3952](#3952)) ([1654007](1654007))
@matticbot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 6.7.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Jun 2, 2025
# [6.7.0](v6.6.4...v6.7.0) (2025-06-02)

### Bug Fixes

* **404-images:** use JS without modifying content ([#3963](#3963)) ([9f5646b](9f5646b))
* add missing namespace ([#3980](#3980)) ([6d58793](6d58793))
* **emails:** add missing HTML markup in the change-email-cancel template ([#3981](#3981)) ([040ae30](040ae30))
* **ga4:** fire login/registration activities via SSO ([#3965](#3965)) ([8c97515](8c97515))
* hide modal content gate when modal checkout is opened ([#3953](#3953)) ([a503973](a503973))
* **jetpack:** handle the related posts max age option ([#3964](#3964)) ([8aad2b8](8aad2b8))
* make sure fix duplcate fields apply filters ([#3971](#3971)) ([f361a4e](f361a4e))
* namespace Lite Site ([#3975](#3975)) ([e4665ae](e4665ae))
* prevent auto-publishing corrections when scheduling posts ([#4006](#4006)) ([7531832](7531832))
* sync correction status with parent post status ([#3978](#3978)) ([dcd5a12](dcd5a12))

### Features

* add compatibility to network in custom bylines ([#3972](#3972)) ([199a993](199a993))
* add icons repository and remove custom icons ([#3883](#3883)) ([e56d2e0](e56d2e0))
* **analytics:** "My Account" dashboard interactions ([#3949](#3949)) ([22e9590](22e9590))
* **donations:** update notice style and type ([#3962](#3962)) ([3f60ef3](3f60ef3))
* **email-change:** remove env constant requirement ([#3943](#3943)) ([4158bf1](4158bf1))
* **my-account:** apply Newspack UI styles to My Account w/ env constant ([#3951](#3951)) ([e4aa5a2](e4aa5a2))
* **my-account:** full-site takeover template and custom nav menu ([#3974](#3974)) ([5cf8403](5cf8403))
* **woocommerce:** log error notices ([#3952](#3952)) ([1654007](1654007))
@matticbot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 6.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants