@ai-stack/payloadcms
Version:
<p align="center"> <img alt="Payload AI Plugin" src="assets/payload-ai-intro.gif" width="100%" /> </p>
25 lines (24 loc) • 1.02 kB
JSX
import React from 'react';
import { FieldProvider } from '../../providers/FieldProvider/FieldProvider.js';
import { useInstructions } from '../../providers/InstructionsProvider/useInstructions.js';
import { Compose } from '../../ui/Compose/Compose.js';
export const ComposeFeatureComponent = (props) => {
const { id: instructionId, disabled, isConfigAllowed, } = useInstructions({
schemaPath: props?.clientProps?.schemaPath,
});
if (!instructionId || disabled) {
return null;
}
return (<FieldProvider context={{
field: props?.clientProps?.field,
path: props?.clientProps?.path,
schemaPath: props?.clientProps?.schemaPath,
}}>
<Compose descriptionProps={{
field: props?.clientProps?.field,
path: props?.clientProps?.path,
schemaPath: props?.clientProps?.schemaPath,
...props?.clientProps,
}} instructionId={instructionId} isConfigAllowed={isConfigAllowed}/>
</FieldProvider>);
};