Files
twenty/packages/twenty-shared/scripts/remote-dom/generators/utils/generate-properties-config.ts
T
Raphaël Bosi 5c1c998b97 Front component rendering (#17482)
Render front components in a widget.



https://github.com/user-attachments/assets/1ae130a4-070d-498e-88f7-80cee847e2fa

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2026-01-28 16:52:10 +00:00

21 lines
556 B
TypeScript

import { type PropertySchema } from '../schemas';
import { schemaTypeToConstructor } from './schema-type-to-constructor';
export const generatePropertiesConfig = (
properties: Record<string, PropertySchema>,
): string => {
const entries = Object.entries(properties);
if (entries.length === 0) {
return '{}';
}
const props = entries
.map(([name, schema]) => {
const constructorType = schemaTypeToConstructor(schema.type);
return `'${name}': { type: ${constructorType} }`;
})
.join(', ');
return `{ ${props} }`;
};