Skip to content

Conversation

RaduCristianPopescu
Copy link

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.
Recording.8.mp4

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

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

Plugin build for 3533ae8 is ready 🛎️!

Copy link
Contributor

@Copilot 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

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;
Copy link
Preview

Copilot AI Sep 25, 2025

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.

'statusSubTitle1' => __( 'All images are optimized automatically', 'optimole-wp' ),
'statusTitle2' => __( 'Smart Lazy-Loading', 'optimole-wp' ),
'statusSubTitle2' => __( 'Images load as visitors scroll', 'optimole-wp' ),
'statusTitle3' => __( 'Image Scalling', 'optimole-wp' ),
Copy link
Preview

Copilot AI Sep 25, 2025

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

ineagu commented Sep 26, 2025

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

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.

4 participants