* updated admin docs * re-add navigation and parameters sections * update injection zones * update cli scripts docs * added list of injection zones * add details about widget props * restructure admin injection zones
54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
export const metadata = {
|
||
title: `${pageNumber} Admin Customizations`,
|
||
}
|
||
|
||
# {metadata.title}
|
||
|
||
In this chapter, you’ll learn how to customize the Medusa Admin dashboard.
|
||
|
||
## Overview
|
||
|
||
The Medusa Admin is an admin dashboard that merchants use to manage their store's data.
|
||
|
||
You can extend the Medusa Admin to add widgets and new pages. Your customizations interact with API routes to provide merchants with custom functionalities.
|
||
|
||
The Medusa Admin is installed in your Medusa application and runs at the path `/app` when you start the Medusa application.
|
||
|
||
---
|
||
|
||
## Example: Create a Widget
|
||
|
||
A widget is a React component that can be injected into an existing page in the admin dashboard.
|
||
|
||
For example, create the file `src/admin/widgets/product-widget.tsx` with the following content:
|
||
|
||
```tsx title="src/admin/widgets/product-widget.tsx"
|
||
import { defineWidgetConfig } from "@medusajs/admin-shared"
|
||
|
||
const ProductWidget = () => {
|
||
return (
|
||
<div>
|
||
<h2>Product Widget</h2>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
export const config = defineWidgetConfig({
|
||
zone: "product.details.after",
|
||
})
|
||
|
||
export default ProductWidget
|
||
```
|
||
|
||
This inserts a widget with the text “Product Widget” at the end of a product’s details page.
|
||
|
||
### Test the Widget
|
||
|
||
To test out the widget, start the Medusa application:
|
||
|
||
```bash npm2yarn
|
||
npm run dev
|
||
```
|
||
|
||
Then, open a product’s details page. You’ll find your custom widget at the bottom of the page.
|