-
Notifications
You must be signed in to change notification settings - Fork 216
enhance: Implement full-width admin header component for admin panel pages. #2931
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
enhance: Implement full-width admin header component for admin panel pages. #2931
Conversation
WalkthroughReplaces the PHP-rendered admin header with a React-based AdminBar, adds a webpack entry and Tailwind setup for the header, enqueues and localizes header assets from PHP, mounts a header container node in admin pages, removes legacy header template and styles, and adjusts dashboard layout/components and global admin selectors. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as WP Admin User
participant WP as WordPress (PHP)
participant Dashboard as Dokan Dashboard (PHP)
participant Browser as Browser
participant React as AdminBar (React)
User->>WP: Open Dokan admin page
WP->>Dashboard: Render dashboard & register assets
Dashboard->>WP: Register/enqueue/localize `dokan-admin-panel-header`
WP-->>Browser: Serve HTML (includes `<div id="dokan-admin-panel-header">`) + JS/CSS
Browser->>Browser: DOM ready
Browser->>React: createRoot('#dokan-admin-panel-header') (webpack bundle)
React->>React: Render AdminBar with localized settings (logo_url, header_info, help_menu_items)
User-->>React: Interact (hover/click Help menu) — dropdown toggles
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)src/admin/header/AdminBar.tsx (1)
🪛 Biome (2.1.2)src/admin/header/AdminBar.tsx[error] 11-11: Unsafe usage of optional chaining. If it short-circuits with 'undefined' the evaluation will throw TypeError here: (lint/correctness/noUnsafeOptionalChaining) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Nitpick comments (2)
src/admin/banner/tailwind.scss (1)
5-7: Remove empty CSS rule block.This empty rule block serves no purpose and should be removed unless you plan to add styles here.
Apply this diff to remove the dead code:
- -#setup-guide-banner-root { - -}src/admin/dashboard/components/Layout.tsx (1)
9-9: Remove redundantmr-0override onAdminSetupBanner
The component’s base styles no longer include any right‐margin classes—removeclassName="mr-0"from:
src/admin/dashboard/components/Layout.tsxline 9src/admin/dashboard/components/Header.tsxline 128
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
assets/src/less/global-admin.less(1 hunks)includes/Admin/Dashboard/Dashboard.php(8 hunks)includes/Admin/Menu.php(3 hunks)includes/Analytics/Reports/Orders/Stats/DataStore.php(1 hunks)src/admin/banner/AdminSetupBanner.tsx(1 hunks)src/admin/banner/SetupGuideBanner.tsx(1 hunks)src/admin/banner/tailwind.scss(1 hunks)src/admin/dashboard/components/Layout.tsx(1 hunks)src/admin/dashboard/icons/CrownIcon.tsx(1 hunks)src/admin/header/Header.tsx(1 hunks)src/admin/header/header-tailwind.config.js(1 hunks)src/admin/header/index.tsx(1 hunks)src/admin/header/tailwind.scss(1 hunks)webpack-entries.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
src/admin/header/header-tailwind.config.js (1)
base-tailwind.config.js (1)
baseConfig(9-291)
src/admin/header/index.tsx (1)
src/vendor-dashboard/reports/index.js (1)
root(31-31)
includes/Admin/Dashboard/Dashboard.php (3)
dokan.php (1)
dokan(90-92)dokan-class.php (1)
is_pro_exists(396-398)includes/Admin/Notices/Helper.php (1)
dokan_has_new_version(137-139)
src/admin/header/Header.tsx (1)
dokan-class.php (1)
is_pro_exists(396-398)
includes/Admin/Menu.php (1)
includes/Admin/Dashboard/Dashboard.php (2)
Dashboard(13-595)enqueue_header_scripts(489-492)
🪛 ast-grep (0.39.5)
src/admin/header/Header.tsx
[warning] 128-128: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html
(react-unsafe-html-injection)
🪛 Biome (2.1.2)
src/admin/header/Header.tsx
[error] 11-11: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
[error] 129-129: Avoid passing content using the dangerouslySetInnerHTML prop.
Setting content using code can expose users to cross-site scripting (XSS) attacks
(lint/security/noDangerouslySetInnerHtml)
🪛 GitHub Check: Run PHPCS inspection
includes/Admin/Menu.php
[failure] 119-119:
Line indented incorrectly; expected at least 2 tabs, found 0
[failure] 118-118:
Line indented incorrectly; expected at least 2 tabs, found 0
[failure] 117-117:
Line indented incorrectly; expected at least 2 tabs, found 0
[failure] 116-116:
Line indented incorrectly; expected at least 2 tabs, found 0
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: e2e tests (3, 3)
- GitHub Check: e2e tests (2, 3)
- GitHub Check: e2e tests (1, 3)
- GitHub Check: api tests (1, 1)
🔇 Additional comments (20)
src/admin/banner/SetupGuideBanner.tsx (1)
11-14: LGTM!The responsive padding classes are properly applied for different breakpoints, ensuring consistent spacing across screen sizes.
src/admin/header/header-tailwind.config.js (1)
1-9: LGTM!The Tailwind configuration correctly extends the base config and appropriately scopes the content paths to header-specific files, ensuring optimal build performance.
assets/src/less/global-admin.less (1)
361-362: LGTM!The expanded selectors correctly cover both the Dokan top-level page and the Dashboard page variant, ensuring consistent styling across both contexts. The comma-separated selector approach is appropriate for LESS.
Also applies to: 368-369, 377-378, 385-386, 389-390
src/admin/dashboard/icons/CrownIcon.tsx (1)
1-18: LGTM!The className prop enhancement follows React best practices, enabling flexible styling while maintaining backward compatibility with the default empty string.
src/admin/header/tailwind.scss (1)
1-2: LGTM!The Tailwind setup correctly imports the base utilities and applies the header-specific configuration, establishing proper styling isolation for the header component.
src/admin/banner/AdminSetupBanner.tsx (1)
32-37: LGTM!Removing the hard-coded responsive right margins and allowing override via props provides better flexibility for different layout contexts. The use of
twMergecorrectly handles className conflicts.src/admin/header/index.tsx (1)
1-14: LGTM!The entry point correctly uses WordPress domReady and React 18's createRoot API to render the header component. The conditional rendering pattern (checking if headerRoot exists) prevents errors if the mount point is missing.
webpack-entries.js (1)
6-6: LGTM!The new webpack entry point for the admin header is correctly configured and will generate the necessary bundle.
includes/Admin/Menu.php (2)
140-140: LGTM!The header container div is correctly placed and will serve as the mount point for the React header component.
121-123: Keep direct instantiation or bind Dashboard to the container: no global container binding for Dashboard exists, sodokan_get_container()->get('dashboard')would return null—usingnew Dashboard()is appropriate unless you first register it.Likely an incorrect or invalid review comment.
src/admin/header/Header.tsx (2)
39-39: LGTM!Good that
CrownIconproperly supports theclassNameprop for custom styling (line 64).Also applies to: 64-64
128-132: Sanitization verified for help menu item titles
All help menu item titles are escaped withesc_html__inincludes/Admin/Dashboard/Dashboard.php, ensuring no XSS risk when rendered viadangerouslySetInnerHTML.includes/Admin/Dashboard/Dashboard.php (8)
30-33: LGTM!The new
header_script_keyproperty is correctly defined and will be used to manage header assets.
147-147: LGTM!Adding
has_new_versionto the header info enables the visual indicator in the header UI.
264-264: LGTM!The header script key is correctly added to both the scripts and styles arrays, ensuring proper asset registration.
Also applies to: 281-281
298-299: LGTM!The call to
register_admin_panel_header_scripts()is properly placed in the registration flow.
357-404: Overall structure of header script registration looks good.The registration method properly handles dependencies, versioning, translations, and localization following WordPress best practices.
482-492: LGTM!The
enqueue_header_scripts()method provides a clean API for enqueuing header assets from other parts of the codebase.
129-131: LGTM!The header container is correctly rendered before the main dashboard container, establishing the proper DOM structure for the React components.
142-142: Verify the dashboard URL change doesn't break existing functionality.The
dashboard_urlhas been changed fromadmin.php?page=dokan-dashboardtoadmin.php?page=dokan. Ensure this change is intentional and that all existing references, bookmarks, and links pointing to the old URL are handled appropriately (redirects, updates, etc.).Run the following script to find other references to the old URL pattern:
… header to React component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
♻️ Duplicate comments (1)
src/admin/header/Header.tsx (1)
10-11: Fix unsafe optional chaining to prevent runtime errors.The destructuring assignment will throw a
TypeErrorifdokanAdminPanelHeaderSettingsisundefined, even with the optional chaining operator. The destructuring requires an object on the right-hand side.Apply this diff to safely handle the undefined case:
const [ showDropdown, setShowDropdown ] = useState( false ); const { is_pro_exists, lite_version, help_menu_items, has_new_version } = - dokanAdminPanelHeaderSettings?.header_info; + dokanAdminPanelHeaderSettings?.header_info || {};
🧹 Nitpick comments (2)
includes/Admin/Menu.php (1)
5-5: Remove unused import.The
Dashboardclass is imported but never used in this file. The header script enqueuing on lines 116-117 uses WordPress functions directly rather than calling methods on the Dashboard class.Apply this diff to remove the unused import:
-use WeDevs\Dokan\Admin\Dashboard\Dashboard; use WeDevs\Dokan\Admin\Notices\Helper;src/admin/header/Header.tsx (1)
8-146: Add TypeScript interface for dokanAdminPanelHeaderSettings global.The component relies on the global
dokanAdminPanelHeaderSettingsobject without TypeScript type definitions, making it harder to catch errors and reducing IDE support.Create a TypeScript declaration file (e.g.,
types/global.d.ts) with the interface:interface DokanAdminPanelHeaderSettings { logo_url: string; header_info: { is_pro_exists: boolean; lite_version: string; pro_version?: string; license_plan?: string; help_menu_items: Array<{ id: string; title: string; url: string; icon: string; external: boolean; active?: boolean; }>; has_new_version: boolean; }; } declare global { const dokanAdminPanelHeaderSettings: DokanAdminPanelHeaderSettings | undefined; } export {};Then update the component to use proper type guards or default values based on this interface.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
includes/Admin/Dashboard/Dashboard.php(8 hunks)includes/Admin/Menu.php(3 hunks)src/admin/header/Header.tsx(1 hunks)src/admin/header/header-tailwind.config.js(1 hunks)templates/admin-header.php(0 hunks)
💤 Files with no reviewable changes (1)
- templates/admin-header.php
🚧 Files skipped from review as they are similar to previous changes (2)
- src/admin/header/header-tailwind.config.js
- includes/Admin/Dashboard/Dashboard.php
🧰 Additional context used
🧬 Code graph analysis (2)
src/admin/header/Header.tsx (1)
dokan-class.php (1)
is_pro_exists(396-398)
includes/Admin/Menu.php (1)
includes/Admin/Dashboard/Dashboard.php (1)
Dashboard(13-595)
🪛 ast-grep (0.39.5)
src/admin/header/Header.tsx
[warning] 128-128: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html
(react-unsafe-html-injection)
🪛 Biome (2.1.2)
src/admin/header/Header.tsx
[error] 11-11: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
[error] 129-129: Avoid passing content using the dangerouslySetInnerHTML prop.
Setting content using code can expose users to cross-site scripting (XSS) attacks
(lint/security/noDangerouslySetInnerHtml)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: e2e tests (3, 3)
- GitHub Check: e2e tests (2, 3)
- GitHub Check: api tests (1, 1)
- GitHub Check: e2e tests (1, 3)
🔇 Additional comments (2)
includes/Admin/Menu.php (2)
134-134: No duplicate header rendering
The two<div id="dokan-admin-panel-header">echoes occur in separate page callbacks—Menu::dashboard()for the top-level “Dokan” menu andDashboard::render_dashboard_page()for its “Dashboard” submenu—so they never both run on the same admin page.Likely an incorrect or invalid review comment.
115-117: Header assets registration timing is correct:Assets::register_all_scripts()is hooked oninit(priority 10), triggeringdokan_register_scripts→Dashboard::register_admin_panel_header_scripts()beforeMenu::dashboard_script()runs onadmin_enqueue_scripts.
…ted SCSS styling; integrate new admin panel header script handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (3)
includes/Admin/Dashboard/Dashboard.php (3)
361-367: @SInCE placeholder already flagged.The
@since DOKAN_SINCEplaceholder issue at line 364 has already been flagged in a previous review comment.
383-388: CSS path issue already flagged.The CSS path issue at line 385 (using
/js/directory instead of/css/) has already been flagged as a critical issue in a previous review comment.
30-37: Replace the placeholder @SInCE tag.The
@since DOKAN_SINCEplaceholder at line 33 needs to be replaced with the actual version number where this property is being introduced.Apply this diff to use the appropriate version:
- * @since DOKAN_SINCE + * @since 4.2.0Note: Replace
4.2.0with the correct version number for this release.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
assets/src/less/admin.less(0 hunks)includes/Admin/Dashboard/Dashboard.php(7 hunks)includes/Admin/Menu.php(3 hunks)
💤 Files with no reviewable changes (1)
- assets/src/less/admin.less
🚧 Files skipped from review as they are similar to previous changes (1)
- includes/Admin/Menu.php
🧰 Additional context used
🧬 Code graph analysis (1)
includes/Admin/Dashboard/Dashboard.php (3)
dokan.php (1)
dokan(90-92)dokan-class.php (1)
is_pro_exists(396-398)includes/Admin/Notices/Helper.php (1)
dokan_has_new_version(137-139)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: api tests (1, 1)
- GitHub Check: e2e tests (1, 3)
- GitHub Check: e2e tests (2, 3)
- GitHub Check: e2e tests (3, 3)
🔇 Additional comments (4)
includes/Admin/Dashboard/Dashboard.php (4)
146-151: LGTM!The settings updates are correct:
- The
dashboard_urlchange aligns with the menu structure.- The
has_new_versionaddition provides necessary information for the header component.
264-289: LGTM!The additions of
$this->header_script_keyto bothscripts()andstyles()methods correctly ensure the header assets are included in the asset loading pipeline.
298-311: LGTM!The call to
register_admin_panel_header_scripts()is correctly placed in the registration flow and follows the existing pattern used for other asset registrations.
132-135: Fix incorrect output buffering pattern.The output buffering logic is broken. The
echostatements at lines 133-134 output directly to the client, bypassing the output buffer started at line 132. As a result,ob_get_clean()returns an empty string, making the buffering pointless.Apply this diff to remove the unnecessary buffering:
- ob_start(); - echo '<div id="dokan-admin-panel-header" class="dokan-layout"></div>'; - echo '<div class="wrap"><div id="dokan-admin-dashboard" class="dokan-layout dokan-admin-page-body">' . esc_html__( 'Loading...', 'dokan-lite' ) . '</div></div>'; - echo ob_get_clean(); + echo '<div id="dokan-admin-panel-header" class="dokan-layout"></div>'; + echo '<div class="wrap"><div id="dokan-admin-dashboard" class="dokan-layout dokan-admin-page-body">' . esc_html__( 'Loading...', 'dokan-lite' ) . '</div></div>';Likely an incorrect or invalid review comment.
…nt; update references and enhance type safety
…info` in admin panel header settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
assets/src/less/global-admin.less (5)
361-366: Reduce overflow scope; avoid forcing with !important
overflow-x: hidden !importanton#wpcontentis broad and hard to override; it risks clipping horizontally scrollable widgets/tables.Suggested change (less invasive):
-.toplevel_page_dokan #wpcontent, -.dokan_page_dokan-dashboard #wpcontent { - padding: 0; - overflow-x: hidden !important; - min-height: calc(100vh - 32px); -} +.toplevel_page_dokan #wpcontent, +.dokan_page_dokan-dashboard #wpcontent { + padding: 0; + overflow-x: hidden; + min-height: calc(100vh - 32px); +}Alternatively, scope overflow only to the page body:
.toplevel_page_dokan #wpcontent, .dokan_page_dokan-dashboard #wpcontent { padding: 0; - overflow-x: hidden; min-height: calc(100vh - 32px); } @@ .toplevel_page_dokan #wpcontent .dokan-admin-page-body, .dokan_page_dokan-dashboard #wpcontent .dokan-admin-page-body { + overflow-x: hidden; padding-left: 20px; }Please verify no horizontal content (reports/grids/code blocks) is clipped on Dokan admin pages after this change.
368-371: Spacing is fine; consider housing layout spacing in the body containerPadding-left on
.dokan-admin-page-bodylooks good. If you scope overflow from#wpcontentto this container (see prior comment), place spacing and overflow together here for cohesion.
373-376: Prefer margin-bottom over padding for header-body separationPadding expands the header’s hit/paint area; margin expresses external spacing and avoids enlarging clickable/header background.
-#dokan-admin-panel-header { - padding-bottom: 10px; -} +#dokan-admin-panel-header { + margin-bottom: 10px; +}If the header has a background that should visually extend into the gap, keep padding; otherwise margin is cleaner. Please confirm intended visual behavior.
381-384: Unify breakpoints to WordPress’ 782px to reduce duplicationTwo very close max-width queries (783px and 782px) maintain nearly identical rules. Consolidate to 782px to match WP core and reduce overlap.
-@media(max-width:783px) { - .toplevel_page_dokan #wpbody-content { - padding-left: 0 - } - .toplevel_page_dokan #wpcontent .dokan-admin-page-body, - .dokan_page_dokan-dashboard #wpcontent .dokan-admin-page-body { - padding-left: 10px; - } -} +/* Align with WP admin bar breakpoint */ +@media (max-width: 782px) { + .toplevel_page_dokan #wpbody-content { + padding-left: 0; + } + .toplevel_page_dokan #wpcontent .dokan-admin-page-body, + .dokan_page_dokan-dashboard #wpcontent .dokan-admin-page-body { + padding-left: 10px; + } +}
387-397: Guard min-height against admin bar presence; consolidate with the 782px queryIf a user disables the admin bar, subtracting 46px can underfill the viewport. Also, combine with the previous 782px block to avoid split definitions.
Option A (combine and guard with
.admin-bar):-@media(max-width:782px) { - .toplevel_page_dokan #wpbody-content, - .toplevel_page_dokan #wpcontent, - .dokan_page_dokan-dashboard #wpcontent { - min-height: calc(100vh - 46px) - } - .toplevel_page_dokan #wpcontent .dokan-admin-page-body, - .dokan_page_dokan-dashboard #wpcontent .dokan-admin-page-body { - padding-left: 10px; - } -} +@media (max-width: 782px) { + .admin-bar .toplevel_page_dokan #wpcontent, + .admin-bar .dokan_page_dokan-dashboard #wpcontent { + min-height: calc(100vh - 46px); + } + .toplevel_page_dokan #wpcontent .dokan-admin-page-body, + .dokan_page_dokan-dashboard #wpcontent .dokan-admin-page-body { + padding-left: 10px; + } +}Please verify layout on:
- Small screens with admin bar hidden vs shown.
- Pages embedding wide tables/code editors for horizontal overflow behavior after changes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
assets/src/less/global-admin.less(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: e2e tests (2, 3)
- GitHub Check: api tests (1, 1)
- GitHub Check: e2e tests (3, 3)
- GitHub Check: e2e tests (1, 3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
includes/Admin/Dashboard/Dashboard.php (2)
363-369: Replace the @SInCE placeholder with the actual version number.The
@since DOKAN_SINCEplaceholder at line 366 needs to be replaced with the actual version number where this method is being introduced.This issue was previously flagged. Apply this diff:
- * @since DOKAN_SINCE + * @since 4.2.0Note: Replace
4.2.0with the correct version number for this release.
385-390: Use correct CSS directory in style registration.The CSS file path at line 387 uses the
/js/directory, but webpack extracts CSS into the/css/folder.This issue was previously flagged. Apply this diff:
wp_register_style( $this->header_script_key, - DOKAN_PLUGIN_ASSEST . '/js/dokan-admin-panel-header.css', + DOKAN_PLUGIN_ASSEST . '/css/dokan-admin-panel-header.css', [], $version );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
includes/Admin/Dashboard/Dashboard.php(7 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
includes/Admin/Dashboard/Dashboard.php (2)
dokan.php (1)
dokan(90-92)includes/Admin/Notices/Helper.php (1)
dokan_has_new_version(137-139)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: e2e tests (3, 3)
- GitHub Check: api tests (1, 1)
- GitHub Check: e2e tests (1, 3)
- GitHub Check: e2e tests (2, 3)
🔇 Additional comments (6)
includes/Admin/Dashboard/Dashboard.php (6)
131-136: LGTM! Header container and layout structure are correct.The new header container div (line 133) provides the mount point for the React-based AdminBar component, and the
dokan-admin-page-bodyclass (line 134) enables proper styling for the full-width header layout. This aligns well with the PR objective.
145-153: LGTM! Settings changes are appropriate.The addition of
has_new_version(line 153) usingHelper::dokan_has_new_version()is correct and consistent with its usage elsewhere in the settings (line 162). The explanatory comments (lines 146-148) provide helpful context about the legacy dashboard compatibility approach.
266-273: LGTM! Header script properly included.The addition of
$this->header_script_key(line 270) ensures the admin panel header script is included in the scripts list for enqueuing. This is the correct approach.
283-290: LGTM! Header styles properly included.The addition of
$this->header_script_key(line 287) ensures the admin panel header styles are included in the styles list for enqueuing. This is the correct approach.
300-314: LGTM! Header script registration properly integrated.The call to
register_admin_panel_header_scripts()(lines 304-305) correctly integrates the header script registration into the main registration flow, following the same pattern as other script registrations in this method.
397-409: LGTM! Script localization is correct.The localization of
dokanAdminPanelHeaderSettingsproperly passeslogo_urlandheader_infoto the header script. Theheader_infois correctly used without redundant filtering (line 406), as it was already filtered when building the settings array (line 225). This addresses the previous review feedback.
| /** | ||
| * Admin panel header script key. | ||
| * | ||
| * @since DOKAN_SINCE | ||
| * | ||
| * @var string | ||
| */ | ||
| protected string $header_script_key = 'dokan-admin-panel-header'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the @SInCE placeholder with the actual version number.
The @since DOKAN_SINCE placeholder at line 33 needs to be replaced with the actual version number where this property is being introduced (e.g., @since 4.2.0 or the correct release version).
Apply this diff:
- * @since DOKAN_SINCE
+ * @since 4.2.0Note: Replace 4.2.0 with the correct version number for this release.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * Admin panel header script key. | |
| * | |
| * @since DOKAN_SINCE | |
| * | |
| * @var string | |
| */ | |
| protected string $header_script_key = 'dokan-admin-panel-header'; | |
| /** | |
| * Admin panel header script key. | |
| * | |
| * @since 4.2.0 | |
| * | |
| * @var string | |
| */ | |
| protected string $header_script_key = 'dokan-admin-panel-header'; |
🤖 Prompt for AI Agents
In includes/Admin/Dashboard/Dashboard.php around lines 30 to 37, the docblock
uses the placeholder "@since DOKAN_SINCE"; replace that placeholder with the
actual release version where this property was introduced (for example "@since
4.2.0" or the correct release number for this branch). Update only the @since
line in the docblock to the correct semantic version string and save.
All Submissions:
Changes proposed in this Pull Request:
Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
Changelog entry
enhance: Update admin dashboard header UI for new React frontend.
Detailed Description of the pull request. What was previous behaviour
and what will be changed in this PR.
Before Changes
Describe the issue before changes with screenshots(s).
After Changes
Describe the issue after changes with screenshot(s).
Feature Video (optional)
Link of detailed video if this PR is for a feature.
PR Self Review Checklist:
FOR PR REVIEWER ONLY:
Summary by CodeRabbit
New Features
Improvements
Refactor