diff --git a/ui/desktop/src/components/RecipeEditor.tsx b/ui/desktop/src/components/RecipeEditor.tsx index 29c618a7..cb6915b3 100644 --- a/ui/desktop/src/components/RecipeEditor.tsx +++ b/ui/desktop/src/components/RecipeEditor.tsx @@ -120,6 +120,34 @@ export default function RecipeEditor({ config }: RecipeEditorProps) { return config; }; + const [errors, setErrors] = useState<{ title?: string; description?: string }>({}); + + const validateForm = () => { + const newErrors: { title?: string; description?: string } = {}; + if (!title.trim()) { + newErrors.title = 'Title is required'; + } + if (!description.trim()) { + newErrors.description = 'Description is required'; + } + setErrors(newErrors); + return Object.keys(newErrors).length === 0; + }; + + const handleOpenAgent = () => { + if (validateForm()) { + const updatedConfig = getCurrentConfig(); + window.electron.createChatWindow( + undefined, + undefined, + undefined, + undefined, + updatedConfig, + undefined + ); + } + }; + const deeplink = generateDeepLink(getCurrentConfig()); // Render expanded section content @@ -262,20 +290,38 @@ export default function RecipeEditor({ config }: RecipeEditorProps) { setTitle(e.target.value)} - className="w-full p-3 border border-borderSubtle rounded-lg bg-bgApp text-textStandard" - placeholder="Agent Name" + onChange={(e) => { + setTitle(e.target.value); + if (errors.title) { + setErrors({ ...errors, title: undefined }); + } + }} + className={`w-full p-3 border rounded-lg bg-bgApp text-textStandard ${ + errors.title ? 'border-red-500' : 'border-borderSubtle' + }`} + placeholder="Agent Name (required)" /> + {errors.title &&
{errors.title}
}
setDescription(e.target.value)} - className="w-full p-3 border border-borderSubtle rounded-lg bg-bgApp text-textStandard" - placeholder="Description" + onChange={(e) => { + setDescription(e.target.value); + if (errors.description) { + setErrors({ ...errors, description: undefined }); + } + }} + className={`w-full p-3 border rounded-lg bg-bgApp text-textStandard ${ + errors.description ? 'border-red-500' : 'border-borderSubtle' + }`} + placeholder="Description (required)" /> + {errors.description && ( +
{errors.description}
+ )}
{/* Section buttons */} @@ -329,18 +375,9 @@ export default function RecipeEditor({ config }: RecipeEditorProps) { {/* Action Buttons */}
diff --git a/ui/desktop/src/components/Splash.tsx b/ui/desktop/src/components/Splash.tsx index d761ecc0..529dc343 100644 --- a/ui/desktop/src/components/Splash.tsx +++ b/ui/desktop/src/components/Splash.tsx @@ -25,9 +25,7 @@ export default function Splash({ append, activities, title }: SplashProps) {
-
- -
+