Skip to content

Feat/client optimizations #905

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

Merged
merged 22 commits into from
Apr 8, 2025
Merged

Feat/client optimizations #905

merged 22 commits into from
Apr 8, 2025

Conversation

selul added 2 commits March 27, 2025 15:42
- Added new classes for page profiling and storage management.
- Introduced functionality to store above-the-fold image data and background selectors for different device types.
- Enhanced lazy loading and preloading mechanisms for images.
- Updated REST API to handle optimization data submissions.
- Integrated new profiling features into existing components for improved performance tracking.
- Added support for time and HMAC parameters in optimization data submissions.
- Improved validation for optimization requests in the REST API.
- Updated the optimizer script to include new parameters for better tracking.
- Refactored code for clarity and consistency across various components.
- Enhanced lazy loading and preloading mechanisms for improved performance.
@pirate-bot
Copy link
Collaborator

pirate-bot commented Mar 27, 2025

Plugin build for 509e734 is ready 🛎️!

selul added 2 commits April 2, 2025 15:30
- Updated the version of the optimole-sdk to v1.2.2 in composer.lock.
- Added new CSS variables for improved styling in the dashboard.
- Introduced a new radio control for lazy loading behavior options.
- Enhanced the settings for retina images and lazy loading configurations.
- Refactored code to improve clarity and maintainability across various components.
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 refactors several dashboard settings components to support client optimizations. Key changes include updates to the Resize component to conditionally show scale options based on lazyload, a new lazyload behavior radio control in the Lazyload component, and reordered/updated toggles in the Compression component.

Reviewed Changes

Copilot reviewed 16 out of 32 changed files in this pull request and generated 1 comment.

File Description
assets/src/dashboard/parts/connected/settings/Resize.js Introduces lazyload‐based conditional rendering and a new scale toggle
assets/src/dashboard/parts/connected/settings/Lazyload.js Adds a lazyload behavior radio control and removes the separate exclude-first control
assets/src/dashboard/parts/connected/settings/Compression.js Reorders toggle controls and replaces the GIF replacement toggle with retina and CDN toggles
assets/src/dashboard/parts/connected/settings/CloudLibrary.js Wraps the cloud library button in a conditional render based on isCloudLibraryEnabled
Files not reviewed (16)
  • assets/src/dashboard/style.scss: Language not supported
  • composer.json: Language not supported
  • inc/admin.php: Language not supported
  • inc/app_replacer.php: Language not supported
  • inc/dam.php: Language not supported
  • inc/lazyload_replacer.php: Language not supported
  • inc/manager.php: Language not supported
  • inc/media_offload.php: Language not supported
  • inc/rest.php: Language not supported
  • inc/settings.php: Language not supported
  • inc/tag_replacer.php: Language not supported
  • inc/traits/normalizer.php: Language not supported
  • inc/url_replacer.php: Language not supported
  • inc/v2/BgOptimizer/Lazyload.php: Language not supported
  • inc/v2/PageProfiler/Profile.php: Language not supported
  • inc/v2/PageProfiler/Storage/Base.php: Language not supported
Comments suppressed due to low confidence (3)

assets/src/dashboard/parts/connected/settings/Resize.js:42

  • [nitpick] The naming and logic for isScaleEnabled (using an inverted comparison) might be unclear at first glance; consider renaming the variable or adding a comment to clarify its intended behavior.
const isScaleEnabled = 'disabled' === settings.scale;

assets/src/dashboard/parts/connected/settings/Compression.js:137

  • The toggle control now updates the 'retina_images' setting in Compression, replacing the original network optimization control; please verify that this change aligns with the intended functionality in the compression settings.
label={ optimoleDashboardApp.strings.options_strings.enable_retina_title }

assets/src/dashboard/parts/connected/settings/Compression.js:165

  • Ensure that swapping the control for GIF replacement with a CDN toggle is intentional and that the backend processing correctly handles the updated 'cdn' setting.
label={ optimoleDashboardApp.strings.options_strings.toggle_cdn }

selul and others added 14 commits April 3, 2025 19:05
- Replaced `get_image_count` with `move_images` in the media offload process for better clarity.
- Updated the rollback process to use `move_images` instead of `get_image_count`.
- Introduced a new REST API endpoint for moving images, allowing for offloading and rollback actions.
- Enhanced the admin interface by adding scripts and styles for the media management screen.
- Improved action handling for image processing, ensuring better performance and user experience.
- Removed redundant image handling from the ConnectedLayout and OffloadMedia components.
- Simplified the callSync function by eliminating unnecessary image parameters.
- Enhanced clarity and maintainability of the codebase by reducing complexity in state management and effect hooks.
- Added a new toggle group control for selecting compression modes: Speed Optimized, Quality Optimized, and Custom.
- Updated the Compression component to handle the new compression mode logic and state management.
- Enhanced the admin settings to include compression mode options and their descriptions.
- Updated styles for the toggle group control to improve UI consistency.
- Removed the updateCompressionMode function to streamline state management.
- Moved the logic for setting compression mode directly into the existing update function.
- Ensured that the canSave state is updated appropriately when changing compression modes.
Add Image editor to prevent errors with offloaded images
- Added 'autoquality' option to the compression settings.
- Updated logic to handle 'autoquality' in various compression modes.
- Ensured compatibility with existing settings for improved user experience.
Implement compression mode settings in the dashboard
Refactor media offload functionality and enhance REST API integration
Copy link
Contributor

@abaicus abaicus left a comment

Choose a reason for hiding this comment

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

Looks great! 🚀

@@ -119,6 +122,7 @@ public static function get_background_lazyload_selectors() {
'.elementor-section[data-settings*="background_background"]',
'.elementor-section > .elementor-background-overlay',
'[class*="wp-block-cover"][style*="background-image"]',
'[style*="background-image:url("]', '[style*="background-image: url("]',
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we maybe also consider only the background css property? As it can also have an URL as value

@selul selul merged commit 78160a3 into development Apr 8, 2025
10 of 11 checks passed
@selul selul deleted the feat/client-optimizations branch April 8, 2025 10:23
@pirate-bot
Copy link
Collaborator

🎉 This PR is included in version 4.0.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 Apr 14, 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.

3 participants