Skip to content

refactor: dashboard optimization status#967

Merged
selul merged 3 commits into
developmentfrom
refactor/dashboard_status
Oct 7, 2025
Merged

refactor: dashboard optimization status#967
selul merged 3 commits into
developmentfrom
refactor/dashboard_status

Conversation

@RaduCristianPopescu

@RaduCristianPopescu RaduCristianPopescu commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

The user can now interact with the optimization status dashboard using:

  • Image Handling: Redirects to the settings page/enables the setting.
  • Smart Lazy-Loading, Image Scaling: Programmatically disable/enable from status.

Closes https://github.com/Codeinwp/optimole-service/issues/1490

Testing

  • If image handling is disabled, Lazy & Scaling are also disabled, along with the hidden button.
  • Scaling depends on Lazy; if Scaling is enabled but you disable Lazy, Scaling will also be disabled.
  • If Lazy is disabled, when enabling, it will not modify the Scaling.
2025-10-03_13-35-20.mp4

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?

@RaduCristianPopescu RaduCristianPopescu self-assigned this Sep 25, 2025
@pirate-bot

pirate-bot commented Sep 25, 2025

Copy link
Copy Markdown
Collaborator

Plugin build for 4cc2151 is ready 🛎️!

Copilot AI 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.

Pull Request Overview

This PR adds interactive functionality to the optimization status dashboard, allowing users to directly enable/disable features and navigate to settings. The changes introduce button controls for managing optimization features like image handling, smart lazy-loading, and image scaling.

  • Adds interactive buttons to optimization status items for direct feature control
  • Implements logic to handle feature dependencies and state management
  • Integrates navigation to settings page for image handling configuration

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
inc/admin.php Adds new localized strings for button labels (disable, enable, manage, block)
assets/src/dashboard/parts/connected/index.js Passes additional props to Sidebar component for state management
assets/src/dashboard/parts/connected/Sidebar.js Updates Sidebar to pass state management props to OptimizationStatus
assets/src/dashboard/parts/connected/OptimizationStatus.js Major refactor adding interactive buttons and feature toggle logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}

if ( 'scale' === status.settingType ) {
status.active = ! status.active;

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

Mutating the status.active property directly modifies the original array item, which can cause unexpected behavior in React. This mutation should be avoided as it modifies the state outside of React's state management system.

Suggested change
status.active = ! status.active;
// Do not mutate status.active directly; handled by directUpdate below.

Copilot uses AI. Check for mistakes.
Comment thread inc/admin.php
@@ -2126,6 +2126,10 @@ private function get_dashboard_strings() {
'statusSubTitle2' => __( 'Images load as visitors scroll', 'optimole-wp' ),
'statusTitle3' => __( 'Image Scalling', 'optimole-wp' ),

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The word 'Scalling' should be 'Scaling' (single 'l').

Suggested change
'statusTitle3' => __( 'Image Scalling', 'optimole-wp' ),
'statusTitle3' => __( 'Image Scaling', 'optimole-wp' ),

Copilot uses AI. Check for mistakes.
@Soare-Robert-Daniel

Copy link
Copy Markdown
Contributor

@ineagu, if the Image Handling is disabled, lazy loading and scaling are no longer available. How should the flow be in this case?

Currently, if Image Handling is not available, Radu has blocked the other two options. It is ok, or should it be shown as Disable for lazy and scaling, and if they are activated, the Image Handling would also be activated?

Snippet from the video
CleanShot 2025-09-26 at 10 37 59@2x

@ineagu

ineagu commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

In the UI you showed, I won't show Block there, but we can simply leave that part empty, it's clear from the x icon on the left that they are disabled and you can't do anything

@Soare-Robert-Daniel Soare-Robert-Daniel force-pushed the refactor/dashboard_status branch from 3533ae8 to 656aa93 Compare October 3, 2025 10:31
@selul selul merged commit 9458d04 into development Oct 7, 2025
11 checks passed
@selul selul deleted the refactor/dashboard_status branch October 7, 2025 09:23
@pirate-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 4.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants