Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@MdAsifHossainNadim
Copy link
Contributor

@MdAsifHossainNadim MdAsifHossainNadim commented Oct 8, 2025

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

Related Pull Request(s)

  • Full PR Link

Closes

How to test the changes in this Pull Request:

  • Steps or issue link

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:

  • Code is not following code style guidelines
  • Bad naming: make sure you would understand your code if you read it a few months from now.
  • KISS: Keep it simple, Sweetie (not stupid!).
  • DRY: Don't Repeat Yourself.
  • Code that is not readable: too many nested 'if's are a bad sign.
  • Performance issues
  • Complicated constructions that need refactoring or comments: code should almost always be self-explanatory.
  • Grammar errors.

FOR PR REVIEWER ONLY:

As a reviewer, your feedback should be focused on the idea, not the person. Seek to understand, be respectful, and focus on constructive dialog.

As a contributor, your responsibility is to learn from suggestions and iterate your pull request should it be needed based on feedback. Seek to collaborate and produce the best possible contribution to the greater whole.

  • Correct — Does the change do what it’s supposed to? ie: code 100% fulfilling the requirements?
  • Secure — Would a nefarious party find some way to exploit this change? ie: everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities?
  • Readable — Will your future self be able to understand this change months down the road?
  • Elegant — Does the change fit aesthetically within the overall style and architecture?

Summary by CodeRabbit

  • New Features

    • New React-based admin header with logo, Lite/Pro badges, Upgrade CTA, help dropdown, and “What’s New” indicator.
  • Improvements

    • Header now appears consistently across main and Dashboard admin pages.
    • Updated spacing and padding for banners and admin pages for improved layout and responsiveness.
    • Icons/components accept styling props for easier customization.
  • Refactor

    • Removed legacy header template and its legacy styles in favor of the new header implementation.

@MdAsifHossainNadim MdAsifHossainNadim self-assigned this Oct 8, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Walkthrough

Replaces 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

Cohort / File(s) Summary
Header React feature
src/admin/header/*, src/admin/header/AdminBar.tsx, src/admin/header/index.tsx, src/admin/header/tailwind.scss, src/admin/header/header-tailwind.config.js
New AdminBar React component, bootstrap index.tsx that mounts into #dokan-admin-panel-header, Tailwind SASS and header-specific tailwind config added.
Webpack entry
webpack-entries.js
Added new entry dokan-admin-panel-header: './src/admin/header/index.tsx' to build the header bundle.
PHP integration & asset wiring
includes/Admin/Dashboard/Dashboard.php, includes/Admin/Menu.php
Added header_script_key, register/enqueue/localize header scripts/styles, include dokan-admin-panel-header in scripts/styles lists, and render <div id="dokan-admin-panel-header"></div> placeholder in admin output.
Legacy template removal
templates/admin-header.php
Removed the entire PHP-rendered admin header markup (logo, version tags, upgrade CTA, help dropdown and related SVGs).
Styles updated/removed
assets/src/less/global-admin.less, assets/src/less/admin.less
Extended global admin selectors to include dashboard variant and added #dokan-admin-panel-header rule; removed legacy dokan-admin-header styling from admin.less.
Admin UI tweaks
src/admin/banner/AdminSetupBanner.tsx, src/admin/banner/SetupGuideBanner.tsx, src/admin/dashboard/components/Layout.tsx, src/admin/dashboard/icons/CrownIcon.tsx
Layout/spacing adjustments: replaced Header with AdminSetupBanner in layout, adjusted padding/margins and padding classes, and updated CrownIcon to accept an optional className prop.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

Possibly related PRs

Suggested reviewers

  • mrabbani
  • Aunshon

Poem

I hop through commits with nimble cheer,
A header reborn where old code did steer.
React plants a bar with logo bright,
Help dots blink softly, crown gleams in light.
Hooray — the dashboard hops just right! 🐇

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The pull request also includes margin and padding adjustments to AdminSetupBanner and SetupGuideBanner components and replaces a content layout component that are unrelated to the full-width header objective, introducing out-of-scope changes beyond the linked issue’s focus. Isolate or remove the banner layout and padding changes and the unrelated layout component replacement into a separate pull request to keep this one focused solely on the header implementation.
Description Check ⚠️ Warning The description leaves key template sections empty, notably “Changes proposed in this Pull Request” and “How to test the changes,” and retains placeholder text for related PR links and developer documentation, preventing reviewers from understanding what was changed and how to verify it. Please populate the “Changes proposed” and “How to test” sections with clear summaries and concrete steps, replace placeholders with actual links or documentation references, and ensure any unchecked checklist items are addressed or intentionally omitted.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the primary change by highlighting the implementation of a full-width admin header component for all admin panel pages, matching the core objective of this pull request without extraneous details.
Linked Issues Check ✅ Passed The implemented changes fully address the linked issue by replacing the old PHP header, introducing a React-based full-width header component, updating CSS selectors for both Vue and React admin pages, and ensuring the header renders consistently across all admin panel variants.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enhance/admin-panel-header-full-layout-for-all-admin-pages

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b26ed4 and 2729410.

📒 Files selected for processing (1)
  • src/admin/header/AdminBar.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/admin/header/AdminBar.tsx (1)
dokan-class.php (1)
  • is_pro_exists (396-398)
🪛 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)
  • GitHub Check: e2e tests (3, 3)
  • GitHub Check: e2e tests (2, 3)
  • GitHub Check: e2e tests (1, 3)
  • GitHub Check: api tests (1, 1)

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MdAsifHossainNadim MdAsifHossainNadim changed the title enhance: Implement full-width admin header component for admin panel's all pages. enhance: Implement full-width admin header component for all admin panel pages. Oct 8, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 redundant mr-0 override on AdminSetupBanner
The component’s base styles no longer include any right‐margin classes—remove className="mr-0" from:

  • src/admin/dashboard/components/Layout.tsx line 9
  • src/admin/dashboard/components/Header.tsx line 128
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe18fba and 2882658.

📒 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 twMerge correctly 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, so dokan_get_container()->get('dashboard') would return null—using new 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 CrownIcon properly supports the className prop 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 with esc_html__ in includes/Admin/Dashboard/Dashboard.php, ensuring no XSS risk when rendered via dangerouslySetInnerHTML.

includes/Admin/Dashboard/Dashboard.php (8)

30-33: LGTM!

The new header_script_key property is correctly defined and will be used to manage header assets.


147-147: LGTM!

Adding has_new_version to 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_url has been changed from admin.php?page=dokan-dashboard to admin.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:

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 TypeError if dokanAdminPanelHeaderSettings is undefined, 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 Dashboard class 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 dokanAdminPanelHeaderSettings object 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2882658 and 707fb37.

📒 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 and Dashboard::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 on init (priority 10), triggering dokan_register_scriptsDashboard::register_admin_panel_header_scripts() before Menu::dashboard_script() runs on admin_enqueue_scripts.

…ted SCSS styling; integrate new admin panel header script handling
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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_SINCE placeholder 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_SINCE placeholder 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.0

Note: Replace 4.2.0 with the correct version number for this release.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 707fb37 and 399927a.

📒 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_url change aligns with the menu structure.
  • The has_new_version addition provides necessary information for the header component.

264-289: LGTM!

The additions of $this->header_script_key to both scripts() and styles() 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 echo statements 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
@MdAsifHossainNadim MdAsifHossainNadim added Needs: Testing This requires further testing Needs: Dev Review It requires a developer review and approval labels Oct 8, 2025
@MdAsifHossainNadim MdAsifHossainNadim changed the title enhance: Implement full-width admin header component for all admin panel pages. enhance: Implement full-width admin header component for admin panel pages. Oct 8, 2025
@mrabbani mrabbani added Dev Review Done and removed Needs: Dev Review It requires a developer review and approval labels Oct 14, 2025
@dev-shahed dev-shahed added 🎉 QA Approved This PR is approved by the QA team and removed Needs: Testing This requires further testing labels Oct 14, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 !important on #wpcontent is 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 container

Padding-left on .dokan-admin-page-body looks good. If you scope overflow from #wpcontent to this container (see prior comment), place spacing and overflow together here for cohesion.


373-376: Prefer margin-bottom over padding for header-body separation

Padding 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 duplication

Two 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 query

If 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

📥 Commits

Reviewing files that changed from the base of the PR and between f0eef5d and 8abaa4a.

📒 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)

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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_SINCE placeholder 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.0

Note: Replace 4.2.0 with 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8abaa4a and 4b26ed4.

📒 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-body class (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) using Helper::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 dokanAdminPanelHeaderSettings properly passes logo_url and header_info to the header script. The header_info is 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.

Comment on lines +30 to +37
/**
* Admin panel header script key.
*
* @since DOKAN_SINCE
*
* @var string
*/
protected string $header_script_key = 'dokan-admin-panel-header';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.0

Note: 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.

Suggested change
/**
* 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.

@Aunshon Aunshon merged commit 4bd7fbc into develop Oct 16, 2025
1 of 6 checks passed
@Aunshon Aunshon deleted the enhance/admin-panel-header-full-layout-for-all-admin-pages branch October 16, 2025 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants