feat: add pending badges for vendors and withdraw menu items#3313
feat: add pending badges for vendors and withdraw menu items#3313dev-shahed wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughVendors 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. ChangesAdmin menu pending-count badges
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
🧹 Nitpick comments (1)
includes/Admin/Dashboard/Pages/Vendors.php (1)
10-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winBadge HTML construction is duplicated with
Withdraw.php.The
sprintf+awaiting-modbadge markup at lines 14-20 is nearly identical toWithdraw.phplines 25-31. Consider extracting a shared helper (e.g., a protected method onAbstractPageor 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
📒 Files selected for processing (3)
assets/src/less/global-admin.lessincludes/Admin/Dashboard/Pages/Vendors.phpincludes/Admin/Dashboard/Pages/Withdraw.php
All Submissions:
Changes proposed in this Pull Request:
Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
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:
FOR PR REVIEWER ONLY:
Summary by CodeRabbit