Upd. React. Refactoring #16. - #726
Open
Glomberg wants to merge 26 commits into
Open
Conversation
…removed-VI' into Upd-React-Refactoring-#16-VI
…removed-VI' into Upd-React-Refactoring-#16-VI # Conflicts: # inc/spbc-admin.php
…removed-VI' into Upd-React-Refactoring-#16-VI # Conflicts: # inc/spbc-admin.php
…act-Refactoring-#16-VI # Conflicts: # js/public/spbct-react-bundle.js
…act-Refactoring-#16-VI # Conflicts: # js/src/react/components/TabContent/TabScanner/TabScanner.js
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new React Scanner UI introduces hardcoded environment-specific URLs and some missing localization/fallback handling that can break production behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors the Scanner tab to move “last/next scan info” and scan progress UI responsibilities into React, while introducing a backend view layer and AJAX endpoint that provide raw scan metadata to the frontend.
Changes:
- Added backend
Scanner\View\Viewto provide React tab data and raw last/next scan info data via AJAX. - Updated scanner status endpoint to include per-stage
totalandpercentprogress details for React rendering. - Removed legacy PHP-rendered Scanner header/progress markup and legacy JS “reload scan info” hook in favor of the new React components.
File summaries
| File | Description |
|---|---|
| lib/CleantalkSP/SpbctWP/SpbcEnqueue.php | Removes a localized string no longer used by legacy scan-info refresh logic. |
| lib/CleantalkSP/SpbctWP/Scanner/View/View.php | New backend view that returns Scanner React data and raw last/next scan info payload. |
| lib/CleantalkSP/SpbctWP/Scanner/View/index.php | Adds directory index guard. |
| lib/CleantalkSP/SpbctWP/Scanner/ScannerAjaxEndpoints.php | Adds AJAX handler to return raw last/next scan info data for React. |
| lib/CleantalkSP/SpbctWP/RemoteCalls.php | Minor formatting/indentation adjustment in background scan remote call response. |
| js/src/spbc-settings.js | Removes legacy spbcScannerReloadScanInfo() implementation. |
| js/src/spbc-scanner-plugin.js | Removes legacy call to reload last-scan info after accordion reload. |
| js/src/react/components/TabContent/TabScanner/TabScanner.js | Adds React polling/progress state and integrates new ScannerInfo block plus live log refresh. |
| js/src/react/components/TabContent/TabScanner/styles.css | Adds indeterminate progress-bar styling for stages without a computable percent. |
| js/src/react/components/TabContent/TabScanner/ScannerInfo/ScannerInfo.js | New React UI for scanner header/actions and last/next scan sentence built from raw backend data. |
| js/src/react/components/TabContent/TabScanner/ScannerInfo/ScanButton.js | New React scan button with “starting” state and spinner. |
| js/src/react/components/TabContent/TabContent.js | Stops using legacy HTML fetch path for the scanner tab (now served by React data endpoint). |
| js/public/spbct-react-bundle.js | Rebuilt bundle reflecting the new React scanner implementation. |
| inc/spbc-settings.php | Removes legacy PHP-rendered Scanner header/progress markup and removes obsolete AJAX string-returning helper. |
| inc/spbc-scanner.php | Adds AJAX wrapper for starting scan and extends status payload with per-stage progress metrics. |
| inc/spbc-admin.php | Wires new AJAX handlers and returns new Scanner React data via spbct_get_tab_data. |
Review details
Suppressed comments (1)
js/src/react/components/TabContent/TabScanner/ScannerInfo/ScannerInfo.js:289
- This warning text is now hardcoded in English; previously it was localized in PHP. Wrap it with
__()so it remains translatable.
<p className='spbc_hint spbc_hint_warning spbc_hint_warning__outdated' style={{display: 'none', textAlign: 'center', marginTop: '5px'}}>
Found outdated plugins or themes. Please, update to latest versions.
</p>
- Files reviewed: 14/16 changed files
- Comments generated: 6
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| {buttonText} | ||
| </button> | ||
| {(isStarting || scannerStatus === 'in_progress') && ( | ||
| <img className='spbc_preloader' src='http://wordpress-security.test/wp-content/plugins/security-malware-firewall/images/preloader.gif' style={{display: 'inline-block'}}/> |
Comment on lines
+264
to
+266
| <a target='blank' href={logsLinkUrl}> | ||
| {__('View all scan results for this website', 'security-malware-firewall')}<i className='spbc-icon-link-ext'></i> | ||
| </a>, |
| </> | ||
| )} | ||
| | ||
| <a href='http://wordpress-security.test/wp-admin/options-general.php?page=spbc&spbc_tab=backups'> |
Comment on lines
+146
to
149
| } catch (error) { | ||
| console.error('Error fetching content:', error); | ||
| setSectionDataLegacyFetched(true); | ||
| } |
| //flags | ||
| $data['flags'] = []; | ||
| //objects | ||
| $data['objects']['scanner']['last_scan'] = $spbc->data['scanner']['last_scan']; |
Comment on lines
+284
to
+286
| <p className='spbc_hint spbc_hint_warning spbc_hint_warning__long_scan' style={{display: 'none', textAlign: 'center', marginTop: '5px'}}> | ||
| A lot of files were found, so it will take time to scan | ||
| </p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://app.doboard.com/1/task/54850