Skip to content

enhance: migrate admin Withdraw table to Plugin UI DataViews#3193

Open
MdAsifHossainNadim wants to merge 3 commits into
enhance/update-admin-dashboard-list-tables-using-plugin-uifrom
enhance/update-admin-dashboard-withdraw-list-tables
Open

enhance: migrate admin Withdraw table to Plugin UI DataViews#3193
MdAsifHossainNadim wants to merge 3 commits into
enhance/update-admin-dashboard-list-tables-using-plugin-uifrom
enhance/update-admin-dashboard-withdraw-list-tables

Conversation

@MdAsifHossainNadim

Copy link
Copy Markdown
Contributor

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:

Migrates the admin Withdraw list table (dokan/src/admin/dashboard/pages/withdraw/index.tsx) from the legacy AdminDataViews wrapper to the unified DataViews component re-exported from @dokan/components.

  • Drops the AdminDataViews as DataViews alias in favour of the existing DataViews import.
  • Moves the activeTab mirror state into view.status; deletes the duplicate effect.
  • Reshapes the tabs prop: { tabs: [{ name, title, icon: <span>(count)</span> }] }{ items: [{ value, label, count }] } (counts are now a clean field).
  • Moves the Export button (PayPal mass payment file) and the export-progress polling out of tabs.additionalComponents and into tabs.headerContent. Polling logic and pollExportStatus stay verbatim.
  • Wraps each row + bulk action label with the shared getActionLabel helper so the icon keeps rendering inside the dropdown menu and the desktop bulk-action button (the underlying @wordpress/dataviews MenuItemTrigger / ActionTrigger only render action.label).
  • Preserves the per-tab eligibility for "Download PayPal mass payment file" — isEligible: ( item ) => 'paypal' === item?.method keeps the action hidden for non-PayPal rows in Approved.
  • Wraps <DataViews> in <div className="dokan-admin-dashboard-datatable"> so existing SCSS keeps applying.

Wrapper-component swap, not a redesign — every existing feature is preserved (status counts, filter, search, pagination, sorting, Export polling, all 6 row + bulk actions with icons).

Related Pull Request(s)

Closes

How to test the changes in this Pull Request:

  1. Build assets: npm run build.
  2. WP Admin → Dokan → Withdraw.
  3. Switch tabs (Pending / Approved / Cancelled): URL syncs, counts refresh.
  4. Filter by date / vendor / payment method — filter chips render, Reset clears.
  5. Open the row action menu — Approve, Cancel, Delete, Note actions all show their icons + labels.
  6. Bulk-select rows — bulk-action bar shows Approve / Cancel / Delete with icons + borders.
  7. On the Approved tab, click "Download PayPal mass payment file" (PayPal-method rows only) and confirm export polling kicks in and the file downloads.
  8. Resize to mobile width — table collapses to list view.
  9. Confirm tabs + filter + table all share a single white card.

Changelog entry

Migrate admin Withdraw table to Plugin UI DataViews

Replaces the legacy AdminDataViews wrapper on the admin Withdraw page with the unified DataViews component already used by the vendor dashboard. Tab counts move into the clean count field, status state lives in view.status, and the PayPal mass-payment Export button + polling moves to tabs.headerContent. Row + bulk action icons are preserved through the shared getActionLabel helper. No behavioural changes — every existing feature (filters, search, pagination, polling, all 6 actions, per-tab action eligibility) carries over.

Before Changes

Withdraw used the in-house AdminDataViews wrapper. Tabs rendered counts inside an icon JSX hack. Export button lived in tabs.additionalComponents. Action icons were buried inside the label callback.

After Changes

Withdraw uses DataViews from @wedevs/plugin-ui. Tabs use the clean count field. Export button sits in tabs.headerContent. Row + bulk action icons render via getActionLabel inside the label callback so @wordpress/dataviews keeps showing them in the dropdown menu and the desktop bulk-action button.

Feature Video (optional)

n/a

PR Self Review Checklist:

  • Code follows WPCS / project conventions.
  • Naming matches existing patterns (getActionLabel, view.status).
  • KISS: per-page diff is concentrated in the tabs reshape + action label wrapping; everything else is mechanical.
  • DRY: shared getActionLabel from the parent PR avoids duplicating icon-wrapping logic.

FOR PR REVIEWER ONLY:

  • Correct — tabs, filter, search, pagination, Export polling, per-row actions, bulk actions all still work; per-tab action eligibility (PayPal-only) preserved.
  • Secure — no new escaping concerns; reuses the existing withdraw REST endpoint and export job.
  • Readable — diff is concentrated in the tabs and actions blocks.
  • Elegant — fits cleanly into the parent branch with no shared helper duplication.

MdAsifHossainNadim and others added 2 commits May 8, 2026 12:04
Switch withdraw/index.tsx from the legacy AdminDataViews wrapper to the
unified DataViews component already exported from @dokan/components.

- Reshape tabs prop: tabs.tabs (icon JSX with count baked in) → tabs.items
  with {value,label,count}; preserves Pending / Approved / Cancelled / All
- Move action icons (Eye/Check/XCircle/MessageSquare/Trash/Download) from
  the getActionLabel JSX-label helper and the duplicate icon-callback hack
  into the dedicated icon prop on each action; replace the wildcard
  LucideIcons import with explicit named imports
- Move the Export button from additionalComponents to tabs.headerContent
  while keeping the existing tabsAdditionalContents array unchanged
- Tab selection clears current selection (parity with the wrapper)
- Wrap migrated DataViews in <div className="dokan-admin-dashboard-datatable">
  so existing scoped admin table styles continue to apply
- Preserve all 6 actions (View / Approve / Cancel / Add Note / Delete /
  PayPal mass payment), the insufficient-balance pre-check on Approve,
  the 4 modals (approve/cancel/add-note/delete) and the View modal flow

Refs getdokan/plugin-internal-tasks#1847

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d73b0d7f-ff67-442e-bcf2-f21f56e37c83

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch enhance/update-admin-dashboard-withdraw-list-tables

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.

…-plugin-ui' to bring in shared getActionLabel helper and DataViews CSS overrides
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants