enhance: migrate admin Vendors table to Plugin UI DataViews#3195
Open
MdAsifHossainNadim wants to merge 2 commits into
Conversation
Switch vendors.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 All / Approved / Pending tabs
- Move action icons (Pencil/Box/ShoppingBag/ArrowLeftRight/Check/Ban) 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 external SearchInput from additionalComponents to tabs.headerContent
with a stable key and drop the redundant search={true} prop (the page's
own debounced search state stays the source of truth)
- Tab selection clears current selection (parity with the wrapper)
- Drop isDestructive on disable-selling — the action already opens a
custom confirmation modal, and the new wrapper would double-confirm
- Wrap migrated DataViews in <div className="dokan-admin-dashboard-datatable">
so existing scoped admin table styles continue to apply
- Preserve the four critical applyFilters hooks PRO depends on
(dokan_admin_vendors_list_filters, dokan_admin_vendors_before_request,
dokan-admin-vendors-list-column-fields, dokan-admin-vendors-list-view),
the two slot fills around the Add Vendor button, and the page-level
PluginArea
- Drop the now-unused DokanLink import
Refs getdokan/plugin-internal-tasks#1849
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Migrates the admin Vendors list table (
dokan/src/admin/dashboard/pages/vendors.tsx) from the legacyAdminDataViewswrapper to the unifiedDataViewscomponent re-exported from@dokan/components.AdminDataViews as DataViewsalias in favour of the directDataViewsimport.view.status; deletes theactiveTabmirror effect.{ tabs: [{ name, title, icon }] }→{ items: [{ value, label, count }] }(counts move into the cleancountfield).getActionLabelhelper (6 actions: Edit, Approve, Disable, Delete, View Store, Switch To Vendor) so icons keep rendering in the dropdown menu and the desktop bulk-action toolbar.actions[].supportsBulk: true.applyFilterscallsites the page emits — Pro hooks into them, so timing must not change.<DataViews>in<div className="dokan-admin-dashboard-datatable">so existing SCSS keeps applying.Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
npm run build.applyFilters(e.g. extra columns / actions) still render.Changelog entry
Migrate admin Vendors table to Plugin UI DataViews
Replaces the legacy
AdminDataViewswrapper on the admin Vendors page with the unifiedDataViewscomponent already used by the vendor dashboard. Tab counts move into the cleancountfield, status lives inview.status, and all 6 row + bulk actions keep their icons via the sharedgetActionLabelhelper. Inline approve/disable modals and the 4 Pro-extensionapplyFilterscallsites are preserved unchanged.Before Changes
Vendors used the in-house
AdminDataViewswrapper. Tab counts were rendered inside an icon JSX hack. Action icons were buried inside thelabelcallback.After Changes
Vendors uses
DataViewsfrom@wedevs/plugin-ui. Counts use the cleancountfield. Row + bulk action icons render viagetActionLabelinside the label callback so@wordpress/dataviewskeeps showing them in the dropdown menu and bulk-action toolbar.Feature Video (optional)
n/a
PR Self Review Checklist:
tabsreshape + action label wrapping.getActionLabelfrom parent branch.FOR PR REVIEWER ONLY:
tabs,actions, and the wrapper class.