Skip to content

Commit 1fb9c8c

Browse files
aarushik93Swiftyos
andauthored
fix(store): Display error toast messaging on creator popup (Significant-Gravitas#9078)
When the agent submission was filled out incorrectly, there was no error pop up. It just did nothing. ### Changes 🏗️ Created an array to track which fields are missing If this array is not empty, a toast is displayed to show which fields are missing. ### Checklist 📋 #### For code changes: - [ ] I have clearly listed my changes in the PR description - [ ] I have made a test plan - [ ] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [ ] ... <details> <summary>Example test plan</summary> - [ ] Create from scratch and execute an agent with at least 3 blocks - [ ] Import an agent from file upload, and confirm it executes correctly - [ ] Upload agent to marketplace - [ ] Import an agent from marketplace and confirm it executes correctly - [ ] Edit an agent from monitor, and confirm it executes correctly </details> #### For configuration changes: - [ ] `.env.example` is updated or already compatible with my changes - [ ] `docker-compose.yml` is updated or already compatible with my changes - [ ] I have included a list of my configuration changes in the PR description (under **Changes**) <details> <summary>Examples of configuration changes</summary> - Changing ports - Adding new services that need to communicate with each other - Secrets or environment variable changes - New or infrastructure changes such as databases </details> --------- Co-authored-by: Swifty <craigswift13@gmail.com>
1 parent 71310a1 commit 1fb9c8c

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

autogpt_platform/frontend/src/components/agptui/composite/PublishAgentPopout.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from "@/lib/autogpt-server-api";
1818
import { useRouter } from "next/navigation";
1919
import { useBackendAPI } from "@/lib/autogpt-server-api/context";
20+
import { useToast } from "@/components/ui/use-toast";
2021
interface PublishAgentPopoutProps {
2122
trigger?: React.ReactNode;
2223
openPopout?: boolean;
@@ -69,6 +70,8 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
6970
const router = useRouter();
7071
const api = useBackendAPI();
7172

73+
const { toast } = useToast();
74+
7275
React.useEffect(() => {
7376
console.log("PublishAgentPopout Effect");
7477
setOpen(openPopout);
@@ -145,14 +148,20 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
145148
videoUrl: string,
146149
categories: string[],
147150
) => {
148-
if (
149-
!name ||
150-
!subHeading ||
151-
!description ||
152-
!imageUrls.length ||
153-
!categories.length
154-
) {
155-
console.error("Missing required fields");
151+
const missingFields: string[] = [];
152+
153+
if (!name) missingFields.push("Name");
154+
if (!subHeading) missingFields.push("Sub-heading");
155+
if (!description) missingFields.push("Description");
156+
if (!imageUrls.length) missingFields.push("Image");
157+
if (!categories.length) missingFields.push("Categories");
158+
159+
if (missingFields.length > 0) {
160+
toast({
161+
title: "Missing Required Fields",
162+
description: `Please fill in: ${missingFields.join(", ")}`,
163+
duration: 3000,
164+
});
156165
return;
157166
}
158167

0 commit comments

Comments
 (0)