diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Kurs.Platform.DbMigrator/Seeds/LanguagesData.json index bfc06491..c2d645e1 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/LanguagesData.json @@ -10657,6 +10657,12 @@ "en": "Dependencies", "tr": "Bağımlılıklar" }, + { + "resourceName": "Platform", + "key": "App.DeveloperKit.ComponentEditor.Code", + "en": "Code", + "tr": "Kod" + }, { "resourceName": "Platform", "key": "App.DeveloperKit.ComponentEditor.Description", diff --git a/ui/src/components/developerKit/ComponentEditor.tsx b/ui/src/components/developerKit/ComponentEditor.tsx index 59714746..fd450256 100644 --- a/ui/src/components/developerKit/ComponentEditor.tsx +++ b/ui/src/components/developerKit/ComponentEditor.tsx @@ -113,6 +113,24 @@ const ComponentEditor: React.FC = () => { } }, [id, isEditing, getComponent, isLoaded, parseAndUpdateComponents]) + // Generate component template based on name + const generateComponentTemplate = (componentName: string): string => { + if (!componentName.trim()) return '' + + // Convert component name to PascalCase if not already + const pascalCaseName = componentName.charAt(0).toUpperCase() + componentName.slice(1) + + return `const ${pascalCaseName}Component = ({ + title = "${pascalCaseName}" +}) => { + return ( + {title} + ); +}; + +export default ${pascalCaseName}Component;` + } + const handleSubmit = async (values: typeof initialValues, { setSubmitting }: any) => { if (!values.name.trim()) { alert('Please enter a component name') @@ -239,9 +257,9 @@ const ComponentEditor: React.FC = () => {