Skip to content

Commit

Permalink
display error toast messaging on creator popup
Browse files Browse the repository at this point in the history
  • Loading branch information
aarushik93 committed Dec 19, 2024
1 parent ed7c937 commit ab90f50
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from "@/lib/autogpt-server-api";
import { useRouter } from "next/navigation";
import { useBackendAPI } from "@/lib/autogpt-server-api/context";
import { useToast } from "@/components/ui/use-toast";
interface PublishAgentPopoutProps {
trigger?: React.ReactNode;
openPopout?: boolean;
Expand Down Expand Up @@ -58,6 +59,8 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
const router = useRouter();
const api = useBackendAPI();

const { toast } = useToast();

React.useEffect(() => {
console.log("PublishAgentPopout Effect");
setOpen(openPopout);
Expand Down Expand Up @@ -116,14 +119,20 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
videoUrl: string,
categories: string[],
) => {
if (
!name ||
!subHeading ||
!description ||
!imageUrls.length ||
!categories.length
) {
console.error("Missing required fields");
const missingFields: string[] = [];

if (!name) missingFields.push("Name");
if (!subHeading) missingFields.push("Sub-heading");
if (!description) missingFields.push("Description");
if (!imageUrls.length) missingFields.push("Image");
if (!categories.length) missingFields.push("Categories");

if (missingFields.length > 0) {
toast({
title: "Missing Required Fields",
description: `Please fill in: ${missingFields.join(", ")}`,
duration: 3000,
});
return;
}

Expand Down
6 changes: 3 additions & 3 deletions autogpt_platform/frontend/src/components/flow.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* flow.css or index.css */

body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
"Helvetica Neue", sans-serif;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
}

code {
Expand Down

0 comments on commit ab90f50

Please sign in to comment.