con un clic
dokan-frontend-dev
// Add or modify Dokan frontend code (React, TypeScript, Vue, Tailwind). Use when creating components, hooks, stores, or modifying webpack configuration.
// Add or modify Dokan frontend code (React, TypeScript, Vue, Tailwind). Use when creating components, hooks, stores, or modifying webpack configuration.
Build, scaffold, and run the Dokan Lite/Pro Playwright suite. Use when the user asks to add tests for a feature, scaffold from test-cases.md, or run the automation suite (Lite Only / PR / Full). Knows the folderized format, tag system, Docker / wp-env preconditions, and the .env / license-key requirements for Pro runs.
Execute the Dokan Playwright test suite (E2E + API), locally or via GitHub Actions. Invoke when the user asks to run, kick off, trigger, re-run, debug, or inspect the automated test runs. Phrases such as "run the suite", "run e2e tests", "trigger CI", "execute the QA suite", or "check the failed run" should activate this skill.
Build new vendor dashboard DataViews list pages from scratch OR migrate legacy Filter/StatusFilter/DataViewTable components to the unified @wedevs/plugin-ui DataViews component. Covers fresh builds (types, hook, list, route, PHP nav) and legacy migration (Scenario A status tabs, Scenario B multi-list merge).
Review Dokan code changes and pull requests for coding standards, security, and architectural compliance. Use when reviewing PRs, performing code audits, or checking code quality.
Add or modify Dokan backend PHP code following project conventions. Use when creating new classes, methods, hooks, REST controllers, or modifying existing backend code. Invoke before writing PHP unit tests.
Run tests, linting, and quality checks for Dokan development. Use when running tests, fixing code style, building assets, or following the development workflow.
| name | dokan-frontend-dev |
| description | Add or modify Dokan frontend code (React, TypeScript, Vue, Tailwind). Use when creating components, hooks, stores, or modifying webpack configuration. |
This skill provides guidance for developing Dokan Lite frontend code.
| Technology | Usage | Files |
|---|---|---|
| React + TypeScript | New admin/dashboard components | .tsx files in src/ |
| Vue 2.7 | Legacy vendor dashboard & frontend | .vue files, main.js entry points |
| Tailwind CSS | Styling (with WordPress compat) | tailwind.config.js |
| Less | Legacy styles | assets/src/less/ |
| @wordpress/data | State management (Redux-like) | src/stores/ |
| Webpack 5 | Build system (80+ entry points) | webpack.config.js, webpack-entries.js |
Button.tsx, DokanModal.tsx@getdokan/dokan-ui components for project consistency:import { Button as DokanUIButton } from '@getdokan/dokan-ui';
import { twMerge } from 'tailwind-merge';
const DokanButton = ({ className = '', variant = 'primary', ...props }: DokanButtonProps) => {
const config = variantConfig[variant];
return (
<DokanUIButton
color={config.color}
className={twMerge(config.className, className)}
{...props}
/>
);
};
export default DokanButton;
Export from index.tsx in component directories:
// src/components/index.tsx
export { default as DokanButton } from './Button';
export { default as DokanModal } from './modals/DokanModal';
export { default as DataViews } from './dataviews/DataViewTable';
Components are exposed globally on window.dokan:
window.dokan.components — Shared React components (src/components/index.tsx)window.dokan.utilities — Utility functions (src/utilities/index.ts)window.dokan.reactHooks — Custom hooks (src/hooks/index.tsx)window.dokan.coreStore — Core data store (src/stores/core/store.ts)Located in src/hooks/, TypeScript, use prefix:
import { useSelect } from '@wordpress/data';
export const useCurrentUser = () => {
return useSelect((select) => {
return select('dokan/core').getCurrentUser();
}, []);
};
Available: useCategories, useCurrentUser, useCustomerById, useCustomerSearch, useMutationObserver, usePermission, useProducts, ViewportDimensions.
Uses @wordpress/data (Redux-like) stores in src/stores/:
src/stores/
├── core/ # dokan/core store
│ ├── actions.ts
│ ├── reducer.ts
│ ├── selectors.ts
│ ├── resolvers.ts
│ └── defaultState.ts
├── productCategories/
├── products/
└── vendors/
Store creation:
import { createReduxStore } from '@wordpress/data';
export const DOKAN_CORE_STORE = 'dokan/core';
const store = createReduxStore<CoreState, typeof actions, typeof selectors>(
DOKAN_CORE_STORE,
{ reducer, selectors, actions, resolvers }
);
Config: tailwind.config.js (extends base-tailwind.config.js)
preflight: false — Disabled to avoid conflicts with WordPress stylestwMerge() from tailwind-merge for conditional class compositionConfig: tsconfig.json
strict: true, noImplicitAny, strictNullChecks)@src/* → src/*frontend/* → src/frontend/*admin/* → src/admin/*reports/* → src/reports/*Config: webpack.config.js (extends @wordpress/scripts default config)
webpack-entries.js (80+ entries)assets/js/ (JS), assets/css/ (CSS via MiniCssExtractPlugin)../images/)jquery: 'jQuery', moment, WooCommerce packages as wc.*DependencyExtractionWebpackPlugin with custom requestToExternal mappingAdd to webpack-entries.js:
module.exports = {
// ...existing entries
'my-feature': './src/my-feature/index.tsx',
};
Library: @wordpress/i18n — WordPress's official i18n package.
import { __, _n, sprintf } from '@wordpress/i18n';
// Simple translation
const label = __( 'Save changes', 'dokan-lite' );
// With sprintf for dynamic content
const message = sprintf(
/* translators: %s: vendor name */
__( 'Welcome, %s!', 'dokan-lite' ),
vendorName
);
// Pluralization
const itemLabel = sprintf(
_n( '%d item', '%d items', count, 'dokan-lite' ),
count
);
// In JSX
<button>{ __( 'Submit', 'dokan-lite' ) }</button>
Always add /* translators: */ comments before sprintf() with placeholders — these are extracted into the POT file:
sprintf(
/* translators: 1: start date 2: end date */
__( 'From %1$s to %2$s', 'dokan-lite' ),
startDate,
endDate
)
Vue components use a translation mixin from src/utils/Mixin.js that wraps @wordpress/i18n:
<template>
<h2>{{ __( 'Dashboard', 'dokan-lite' ) }}</h2>
</template>
<script>
import Mixin from 'admin/utils/Mixin';
export default {
mixins: [ Mixin ],
};
</script>
Available mixin methods: __(), _x(), __n(), _nx(), sprintf().
When registering a new script, translations are auto-registered via wp_set_script_translations() in includes/Assets.php. For custom scripts:
wp_set_script_translations( 'my-script-handle', 'dokan-lite', plugin_dir_path( DOKAN_FILE ) . 'languages' );
Server-side data is passed to JS via wp_localize_script(). Access via window.dokan:
window.dokan.i18n_date_format — WordPress date formatwindow.dokan.i18n_time_format — WordPress time formatwindow.dokan.currency — WooCommerce currency settings (symbol, decimals, position)window.dokan.timepicker_locale — Localized AM/PM, hr/hrs/mins stringswindow.dokan.daterange_picker_local — Localized day/month names, labelsFilter hooks for extending: dokan_helper_localize_script, dokan_frontend_localize_script, dokan_admin_localize_script.
'dokan-lite' (not 'dokan')sprintf() with placeholders_n() for plurals — never use ternary with __()Older components use Vue 2.7 with .vue files. New development should use React unless modifying existing Vue code. Vue entry points typically use main.js.
webpack.config.js — Webpack configurationwebpack-entries.js — All entry pointstailwind.config.js / base-tailwind.config.js — Tailwind configtsconfig.json — TypeScript configurationpostcss.config.js — PostCSS configurationsrc/components/index.tsx — Component barrel exportssrc/hooks/index.tsx — Hooks barrel exportssrc/stores/core/index.ts — Core data store