Pinelab-studio/pinelab-vendure-plugins / .agents/skills
migrating-vendure-admin-ui-to-react-dashboard
VerifiedMigrates Vendure Admin UI extensions (legacy Angular-based) to the new React Dashboard.
| File | Kind | Size |
|---|---|---|
| 01-general.md | markdown | 6.0 KB |
| 01a-common-tasks.md | markdown | 1.1 KB |
| 01b-tsconfig-setup.md | markdown | 1.5 KB |
| 01c-common-pitfalls.md | markdown | 3.9 KB |
| 02-forms.md | markdown | 1.5 KB |
| 03-custom-field-inputs.md | markdown | 3.6 KB |
| 04-list-pages.md | markdown | 8.7 KB |
| 05-detail-pages.md | markdown | 10.5 KB |
| 06-adding-nav-menu-items.md | markdown | 1.1 KB |
| 07-action-bar-items.md | markdown | 983 B |
| 08-custom-detail-components.md | markdown | 2.2 KB |
| 09-page-tabs.md | markdown | 481 B |
| 10-widgets.md | markdown | 2.8 KB |
| SKILL.md | skill md | 1.0 KB |
03-custom-field-inputs.md
View on GitHub## Custom Field Inputs
### Old (Angular)
```ts title="src/plugins/common/ui/components/slider-form-input/slider-form-input.component.ts"
import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import {
IntCustomFieldConfig,
SharedModule,
FormInputComponent,
} from '@vendure/admin-ui/core';
@Component({
template: `
<input
type="range"
[min]="config.min || 0"
[max]="config.max || 100"
[formControl]="formControl"
/>
{{ formControl.value }}
`,
standalone: true,
imports: [SharedModule],
})
export class SliderControlComponent
implements FormInputComponent<IntCustomFieldConfig>
{
readonly: boolean;
config: IntCustomFieldConfig;
formControl: FormControl;
}
```
```ts title="src/plugins/common/ui/providers.ts"
import { registerFormInputComponent } from '@vendure/admin-ui/core';
import { SliderControlComponent } from './components/slider-form-input/slider-form-input.component';
export default [
registerFormInputComponent('slider-form-input', SliderControlComponent),
];
```
### New (React Dashboard)
```tsx title="src/plugins/my-plugin/dashboard/components/color-picker.tsx"
import {
Button,
Card,
CardContent,
cn,
DashboardFormComponent,
Input,
} from '@vendure/dashboard';
import { useState } from 'react';
import { useFormContext } from 'react-hook-form';
// By typing your component as DashboardFormComponent, the props will be correctly typed
export const ColorPickerComponent: DashboardFormComponent = ({
value,
onChange,
name,
}) => {
const [isOpen, setIsOpen] = useState(false);
const { getFieldState } = useFormContext();
const error = getFieldState(name).error;
const colors = [
'#FF6B6B',
'#4ECDC4',
'#45B7D1',
'#96CEB4',
'#FECA57',
'#FF9FF3',
'#54A0FF',
'#5F27CD',
];
return (
<div className="space-y-2">
<div className="flex items-center space-x-2">
<Button
type="button"
variant="outline"
size="icon"
className={cn(
'w-8 h-8 border-2 border-gray-300 p-0',
error && 'border-red-500'
)}
style={{
backgroundColor: error ? 'transparent' : value || '#ffffff',
}}
onClick={() => setIsOpen(!isOpen)}
/>
<Input
value={value || ''}
onChange={(e) => onChange(e.target.value)}
placeholder="#ffffff"
/>
</div>
{isOpen && (
<Card>
<CardContent className="grid grid-cols-4 gap-2 p-2">
{colors.map((color) => (
<Button
key={color}
type="button"
variant="outline"
size="icon"
className="w-8 h-8 border-2 border-gray-300 hover:border-gray-500 p-0"
style={{ backgroundColor: color }}
onClick={() => {
onChange(color);
setIsOpen(false);
}}
/>
))}
</CardContent>
</Card>
)}
</div>
);
};
```
```tsx title="src/plugins/my-plugin/dashboard/index.tsx"
import { defineDashboardExtension } from '@vendure/dashboard';
import { ColorPickerComponent } from './components/color-picker';
defineDashboardExtension({
customFormComponents: {
// Custom field components for custom fields
customFields: [
{
// The "id" is a global identifier for this custom component. We will
// reference it in the next step.
id: 'color-picker',
component: ColorPickerComponent,
},
],
},
// ... other extension properties
});
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |