feat: initialize React admin build pipeline (F2.1-F2.6)
- Add package.json with @wordpress/scripts and React dependencies - Configure webpack for admin bundle output - Create src/admin directory structure (api, components, pages) - Implement API client with nonce handling (ajaxRequest, apiRequest) - Add API methods for orders, customers, products, forms, coupons, licenses - Create React App component with page routing - Add placeholder page components for all admin sections - Create ReactAdmin PHP class to manage asset enqueuing - Register ReactAdmin singleton in main plugin file - Bump version to 2.0.0 Build: Run 'npm install && npm run build' to generate assets
This commit is contained in:
39
src/admin/components/App.js
Normal file
39
src/admin/components/App.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* App Component - Main admin application shell
|
||||
*/
|
||||
|
||||
import OrdersPage from '../pages/Orders';
|
||||
import CustomersPage from '../pages/Customers';
|
||||
import ProductsPage from '../pages/Products';
|
||||
import FormsPage from '../pages/Forms';
|
||||
import CouponsPage from '../pages/Coupons';
|
||||
import AccessPage from '../pages/Access';
|
||||
import LicensesPage from '../pages/Licenses';
|
||||
|
||||
const pageComponents = {
|
||||
orders: OrdersPage,
|
||||
customers: CustomersPage,
|
||||
products: ProductsPage,
|
||||
forms: FormsPage,
|
||||
coupons: CouponsPage,
|
||||
access: AccessPage,
|
||||
licenses: LicensesPage,
|
||||
};
|
||||
|
||||
export default function App({ page, initialData }) {
|
||||
const PageComponent = pageComponents[page];
|
||||
|
||||
if (!PageComponent) {
|
||||
return (
|
||||
<div className="formipay-error">
|
||||
<p>Unknown page: {page}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="formipay-admin-wrap">
|
||||
<PageComponent initialData={initialData} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user