Skip to content

feat: add pending badges for vendors and withdraw menu items#3313

Open
dev-shahed wants to merge 1 commit into
developfrom
feat/admin-menu-pending-badges
Open

feat: add pending badges for vendors and withdraw menu items#3313
dev-shahed wants to merge 1 commit into
developfrom
feat/admin-menu-pending-badges

Conversation

@dev-shahed

@dev-shahed dev-shahed commented Jul 9, 2026

Copy link
Copy Markdown
Member

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)

Closes

  • Closes #

How to test the changes in this Pull Request:

  • Steps or issue link

Changelog entry

Title

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
    • Admin menus now show live count badges for pending items, making it easier to spot outstanding vendor and withdrawal requests at a glance.
  • Style
    • Improved badge readability in the Dokan admin menu, including consistent colors across hover, focus, and active states.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Vendors and Withdraw admin menu items now display dynamic menu titles with a pending-count badge computed from seller/withdraw status counts, falling back to plain titles when no pending items exist. A LESS rule styles the badge's background and text color across menu link states.

Changes

Admin menu pending-count badges

Layer / File(s) Summary
Vendors menu badge
includes/Admin/Dashboard/Pages/Vendors.php
Computes seller status counts, derives inactive/pending count, and conditionally sets menu_title to a badge-containing translated string or the plain "Vendors" label.
Withdraw menu badge
includes/Admin/Dashboard/Pages/Withdraw.php
Computes pending withdraw request count via dokan_get_withdraw_count() and conditionally sets menu_title to a badge-containing translated string or the plain "Withdraw" label.
Badge styling
assets/src/less/global-admin.less
Adds a selector block styling the awaiting-mod badge with a blue background and white text across default, hover, focus, and current menu states.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: Type: Enhancement

Suggested reviewers: mrabbani, MdAsifHossainNadim

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description mostly repeats the template and leaves key sections like changes, testing, changelog, and screenshots empty. Fill in the actual change summary, testing steps, changelog entry, and before/after details; remove placeholder text where not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: adding pending badges for vendor and withdraw admin menu items.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/admin-menu-pending-badges

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.

@dev-shahed dev-shahed added Needs: Testing This requires further testing Needs: Dev Review It requires a developer review and approval labels Jul 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
includes/Admin/Dashboard/Pages/Vendors.php (1)

10-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Badge HTML construction is duplicated with Withdraw.php.

The sprintf + awaiting-mod badge markup at lines 14-20 is nearly identical to Withdraw.php lines 25-31. Consider extracting a shared helper (e.g., a protected method on AbstractPage or a utility function) that accepts a label and count and returns the formatted menu title. This keeps badge markup in one place if styling or structure changes.

♻️ Suggested helper extraction
// On AbstractPage or a utility trait:
protected function build_badge_menu_title( string $label, int $pending_count ): string {
    if ( ! $pending_count ) {
        return __( $label, 'dokan-lite' );
    }

    return sprintf(
        /* translators: %s: Pending count badge */
        __( $label . ' %s', 'dokan-lite' ),
        '<span class="awaiting-mod count-1"><span class="pending-count">'
        . number_format_i18n( $pending_count )
        . '</span></span>'
    );
}

Then in Vendors::menu():

-        $menu_title = $pending_count ? sprintf(
-            /* translators: %s: Inactive vendor count badge */
-            __( 'Vendors %s', 'dokan-lite' ),
-            '<span class="awaiting-mod count-1"><span class="pending-count">'
-            . number_format_i18n( $pending_count )
-            . '</span></span>'
-        ) : __( 'Vendors', 'dokan-lite' );
+        $menu_title = $this->build_badge_menu_title( 'Vendors', $pending_count );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@includes/Admin/Dashboard/Pages/Vendors.php` around lines 10 - 29, The Vendors
menu title currently duplicates the same pending-count badge HTML used in
Withdraw, so extract that formatting into a shared helper on AbstractPage or a
common utility/trait and call it from Vendors::menu(). Make the helper accept
the base label and count, return the plain localized label when count is zero,
and otherwise build the existing awaiting-mod badge markup so both Vendors and
Withdraw share one source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@includes/Admin/Dashboard/Pages/Vendors.php`:
- Around line 10-29: The Vendors menu title currently duplicates the same
pending-count badge HTML used in Withdraw, so extract that formatting into a
shared helper on AbstractPage or a common utility/trait and call it from
Vendors::menu(). Make the helper accept the base label and count, return the
plain localized label when count is zero, and otherwise build the existing
awaiting-mod badge markup so both Vendors and Withdraw share one source of
truth.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c0f1ba8-20ab-452c-a489-9cfb323249a5

📥 Commits

Reviewing files that changed from the base of the PR and between 4338fe1 and dcbb606.

📒 Files selected for processing (3)
  • assets/src/less/global-admin.less
  • includes/Admin/Dashboard/Pages/Vendors.php
  • includes/Admin/Dashboard/Pages/Withdraw.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Dev Review It requires a developer review and approval Needs: Testing This requires further testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant