AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(builder): Block menu redesign - part 3 (#10864)
Abhimanyu Yadav3bbce7167808
diff --git a/autogpt_platform/frontend/orval.config.ts b/autogpt_platform/frontend/orval.config.tsindex a0c69f24f2..b80fc3733b 100644--- a/autogpt_platform/frontend/orval.config.ts+++ b/autogpt_platform/frontend/orval.config.ts@@ -41,6 +41,26 @@ export default defineConfig({useInfiniteQueryParam: "page",},},+ "getV2Get builder blocks": {+ query: {+ useInfinite: true,+ useInfiniteQueryParam: "page",+ useQuery: true,+ },+ },+ "getV2Get builder integration providers": {+ query: {+ useInfinite: true,+ useInfiniteQueryParam: "page",+ },+ },+ "getV2List store agents": {+ query: {+ useInfinite: true,+ useInfiniteQueryParam: "page",+ useQuery: true,+ },+ },},},},diff --git a/autogpt_platform/frontend/public/integrations/aiml_api.png b/autogpt_platform/frontend/public/integrations/aiml_api.pngnew file mode 100644index 0000000000..9be36e827aBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/aiml_api.png differdiff --git a/autogpt_platform/frontend/public/integrations/airtable.png b/autogpt_platform/frontend/public/integrations/airtable.pngnew file mode 100644index 0000000000..c2faa257adBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/airtable.png differdiff --git a/autogpt_platform/frontend/public/integrations/anthropic.png b/autogpt_platform/frontend/public/integrations/anthropic.pngnew file mode 100644index 0000000000..23cc3ddb9dBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/anthropic.png differdiff --git a/autogpt_platform/frontend/public/integrations/apollo.png b/autogpt_platform/frontend/public/integrations/apollo.pngnew file mode 100644index 0000000000..cb3750356bBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/apollo.png differdiff --git a/autogpt_platform/frontend/public/integrations/baas.png b/autogpt_platform/frontend/public/integrations/baas.pngnew file mode 100644index 0000000000..a5d4a9e6c3Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/baas.png differdiff --git a/autogpt_platform/frontend/public/integrations/bannerbear.png b/autogpt_platform/frontend/public/integrations/bannerbear.pngnew file mode 100644index 0000000000..869b3dd189Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/bannerbear.png differdiff --git a/autogpt_platform/frontend/public/integrations/d-id.png b/autogpt_platform/frontend/public/integrations/d-id.pngindex 17ebf2ddb4..977cd679ce 100644Binary files a/autogpt_platform/frontend/public/integrations/d-id.png and b/autogpt_platform/frontend/public/integrations/d-id.png differdiff --git a/autogpt_platform/frontend/public/integrations/d_id.png b/autogpt_platform/frontend/public/integrations/d_id.pngnew file mode 100644index 0000000000..5a41621838Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/d_id.png differdiff --git a/autogpt_platform/frontend/public/integrations/dataforseo.png b/autogpt_platform/frontend/public/integrations/dataforseo.pngnew file mode 100644index 0000000000..cb1c8dd6fcBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/dataforseo.png differdiff --git a/autogpt_platform/frontend/public/integrations/discord.png b/autogpt_platform/frontend/public/integrations/discord.pngindex 4e4ed4662d..e440b11672 100644Binary files a/autogpt_platform/frontend/public/integrations/discord.png and b/autogpt_platform/frontend/public/integrations/discord.png differdiff --git a/autogpt_platform/frontend/public/integrations/e2b.png b/autogpt_platform/frontend/public/integrations/e2b.pngnew file mode 100644index 0000000000..986e7cc60eBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/e2b.png differdiff --git a/autogpt_platform/frontend/public/integrations/enrichlayer.png b/autogpt_platform/frontend/public/integrations/enrichlayer.pngnew file mode 100644index 0000000000..6b9d5a737bBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/enrichlayer.png differdiff --git a/autogpt_platform/frontend/public/integrations/exa.png b/autogpt_platform/frontend/public/integrations/exa.pngnew file mode 100644index 0000000000..35b25b48f8Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/exa.png differdiff --git a/autogpt_platform/frontend/public/integrations/fal.png b/autogpt_platform/frontend/public/integrations/fal.pngnew file mode 100644index 0000000000..95ae1079e5Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/fal.png differdiff --git a/autogpt_platform/frontend/public/integrations/firecrawl.png b/autogpt_platform/frontend/public/integrations/firecrawl.pngnew file mode 100644index 0000000000..6daaacd364Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/firecrawl.png differdiff --git a/autogpt_platform/frontend/public/integrations/github.png b/autogpt_platform/frontend/public/integrations/github.pngindex 5e07787328..1b4e596936 100644Binary files a/autogpt_platform/frontend/public/integrations/github.png and b/autogpt_platform/frontend/public/integrations/github.png differdiff --git a/autogpt_platform/frontend/public/integrations/google.png b/autogpt_platform/frontend/public/integrations/google.pngindex 49cc06b980..5b8b6e658c 100644Binary files a/autogpt_platform/frontend/public/integrations/google.png and b/autogpt_platform/frontend/public/integrations/google.png differdiff --git a/autogpt_platform/frontend/public/integrations/google_maps.png b/autogpt_platform/frontend/public/integrations/google_maps.pngnew file mode 100644index 0000000000..928c5a5585Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/google_maps.png differdiff --git a/autogpt_platform/frontend/public/integrations/groq.png b/autogpt_platform/frontend/public/integrations/groq.pngnew file mode 100644index 0000000000..4953c67a35Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/groq.png differdiff --git a/autogpt_platform/frontend/public/integrations/http.png b/autogpt_platform/frontend/public/integrations/http.pngnew file mode 100644index 0000000000..f6a93eaaaaBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/http.png differdiff --git a/autogpt_platform/frontend/public/integrations/hubspot.png b/autogpt_platform/frontend/public/integrations/hubspot.pngindex de4fb1dbe9..5f25ce0a3d 100644Binary files a/autogpt_platform/frontend/public/integrations/hubspot.png and b/autogpt_platform/frontend/public/integrations/hubspot.png differdiff --git a/autogpt_platform/frontend/public/integrations/ideogram.png b/autogpt_platform/frontend/public/integrations/ideogram.pngnew file mode 100644index 0000000000..049cee4b28Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/ideogram.png differdiff --git a/autogpt_platform/frontend/public/integrations/jina.png b/autogpt_platform/frontend/public/integrations/jina.pngnew file mode 100644index 0000000000..aec9577329Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/jina.png differdiff --git a/autogpt_platform/frontend/public/integrations/linear.png b/autogpt_platform/frontend/public/integrations/linear.pngindex 5e3a0ccfe1..fe64191e6d 100644Binary files a/autogpt_platform/frontend/public/integrations/linear.png and b/autogpt_platform/frontend/public/integrations/linear.png differdiff --git a/autogpt_platform/frontend/public/integrations/llama_api.png b/autogpt_platform/frontend/public/integrations/llama_api.pngnew file mode 100644index 0000000000..5d48d62c19Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/llama_api.png differdiff --git a/autogpt_platform/frontend/public/integrations/maps.png b/autogpt_platform/frontend/public/integrations/maps.pngindex 70a707dcd9..8bc9fddcb7 100644Binary files a/autogpt_platform/frontend/public/integrations/maps.png and b/autogpt_platform/frontend/public/integrations/maps.png differdiff --git a/autogpt_platform/frontend/public/integrations/medium.png b/autogpt_platform/frontend/public/integrations/medium.pngindex 41228fcdce..c0eec340d5 100644Binary files a/autogpt_platform/frontend/public/integrations/medium.png and b/autogpt_platform/frontend/public/integrations/medium.png differdiff --git a/autogpt_platform/frontend/public/integrations/mem0.png b/autogpt_platform/frontend/public/integrations/mem0.pngindex 953ae47f3d..21ba2452c5 100644Binary files a/autogpt_platform/frontend/public/integrations/mem0.png and b/autogpt_platform/frontend/public/integrations/mem0.png differdiff --git a/autogpt_platform/frontend/public/integrations/notion.png b/autogpt_platform/frontend/public/integrations/notion.pngindex 9b95380a93..a1e535fe0c 100644Binary files a/autogpt_platform/frontend/public/integrations/notion.png and b/autogpt_platform/frontend/public/integrations/notion.png differdiff --git a/autogpt_platform/frontend/public/integrations/nvidia.jpg b/autogpt_platform/frontend/public/integrations/nvidia.jpgindex 46956b6de3..77513386f4 100644Binary files a/autogpt_platform/frontend/public/integrations/nvidia.jpg and b/autogpt_platform/frontend/public/integrations/nvidia.jpg differdiff --git a/autogpt_platform/frontend/public/integrations/nvidia.png b/autogpt_platform/frontend/public/integrations/nvidia.pngnew file mode 100644index 0000000000..c5bf936fd3Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/nvidia.png differdiff --git a/autogpt_platform/frontend/public/integrations/ollama.png b/autogpt_platform/frontend/public/integrations/ollama.pngnew file mode 100644index 0000000000..7c5f003b49Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/ollama.png differdiff --git a/autogpt_platform/frontend/public/integrations/open_router.png b/autogpt_platform/frontend/public/integrations/open_router.pngnew file mode 100644index 0000000000..62fe667528Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/open_router.png differdiff --git a/autogpt_platform/frontend/public/integrations/openai.png b/autogpt_platform/frontend/public/integrations/openai.pngnew file mode 100644index 0000000000..6f16d37ea0Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/openai.png differdiff --git a/autogpt_platform/frontend/public/integrations/openweathermap.png b/autogpt_platform/frontend/public/integrations/openweathermap.pngindex ae4e47b8bf..80ae46e053 100644Binary files a/autogpt_platform/frontend/public/integrations/openweathermap.png and b/autogpt_platform/frontend/public/integrations/openweathermap.png differdiff --git a/autogpt_platform/frontend/public/integrations/pinecone.png b/autogpt_platform/frontend/public/integrations/pinecone.pngindex ec25827f7a..1378c65222 100644Binary files a/autogpt_platform/frontend/public/integrations/pinecone.png and b/autogpt_platform/frontend/public/integrations/pinecone.png differdiff --git a/autogpt_platform/frontend/public/integrations/reddit.png b/autogpt_platform/frontend/public/integrations/reddit.pngindex 6f5777a789..976a157866 100644Binary files a/autogpt_platform/frontend/public/integrations/reddit.png and b/autogpt_platform/frontend/public/integrations/reddit.png differdiff --git a/autogpt_platform/frontend/public/integrations/replicate.png b/autogpt_platform/frontend/public/integrations/replicate.pngnew file mode 100644index 0000000000..8e70d93c8aBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/replicate.png differdiff --git a/autogpt_platform/frontend/public/integrations/revid.png b/autogpt_platform/frontend/public/integrations/revid.pngnew file mode 100644index 0000000000..a49151b22fBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/revid.png differdiff --git a/autogpt_platform/frontend/public/integrations/screenshotone.png b/autogpt_platform/frontend/public/integrations/screenshotone.pngnew file mode 100644index 0000000000..c3c1f99307Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/screenshotone.png differdiff --git a/autogpt_platform/frontend/public/integrations/slant3d.jpeg b/autogpt_platform/frontend/public/integrations/slant3d.jpegindex 8071a6a0b9..43b3ef88d0 100644Binary files a/autogpt_platform/frontend/public/integrations/slant3d.jpeg and b/autogpt_platform/frontend/public/integrations/slant3d.jpeg differdiff --git a/autogpt_platform/frontend/public/integrations/slant3d.png b/autogpt_platform/frontend/public/integrations/slant3d.pngnew file mode 100644index 0000000000..958a30d4f4Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/slant3d.png differdiff --git a/autogpt_platform/frontend/public/integrations/smartlead.png b/autogpt_platform/frontend/public/integrations/smartlead.pngnew file mode 100644index 0000000000..30ea5d5b6fBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/smartlead.png differdiff --git a/autogpt_platform/frontend/public/integrations/smtp.png b/autogpt_platform/frontend/public/integrations/smtp.pngindex 1e7c5dd4f0..eea99b046e 100644Binary files a/autogpt_platform/frontend/public/integrations/smtp.png and b/autogpt_platform/frontend/public/integrations/smtp.png differdiff --git a/autogpt_platform/frontend/public/integrations/stagehand.png b/autogpt_platform/frontend/public/integrations/stagehand.pngnew file mode 100644index 0000000000..6128b29f75Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/stagehand.png differdiff --git a/autogpt_platform/frontend/public/integrations/todoist.png b/autogpt_platform/frontend/public/integrations/todoist.pngindex 70cc564a11..40aa9480d1 100644Binary files a/autogpt_platform/frontend/public/integrations/todoist.png and b/autogpt_platform/frontend/public/integrations/todoist.png differdiff --git a/autogpt_platform/frontend/public/integrations/twitter.png b/autogpt_platform/frontend/public/integrations/twitter.pngnew file mode 100644index 0000000000..8262c4b9ccBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/twitter.png differdiff --git a/autogpt_platform/frontend/public/integrations/unreal_speech.png b/autogpt_platform/frontend/public/integrations/unreal_speech.pngnew file mode 100644index 0000000000..1446eac432Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/unreal_speech.png differdiff --git a/autogpt_platform/frontend/public/integrations/v0.png b/autogpt_platform/frontend/public/integrations/v0.pngnew file mode 100644index 0000000000..c22db3bce1Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/v0.png differdiff --git a/autogpt_platform/frontend/public/integrations/wolfram.png b/autogpt_platform/frontend/public/integrations/wolfram.pngnew file mode 100644index 0000000000..ed92a44d15Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/wolfram.png differdiff --git a/autogpt_platform/frontend/public/integrations/x.png b/autogpt_platform/frontend/public/integrations/x.pngindex 25bbe2c058..8262c4b9cc 100644Binary files a/autogpt_platform/frontend/public/integrations/x.png and b/autogpt_platform/frontend/public/integrations/x.png differdiff --git a/autogpt_platform/frontend/public/integrations/zerobounce.png b/autogpt_platform/frontend/public/integrations/zerobounce.pngnew file mode 100644index 0000000000..78168a853aBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/zerobounce.png differdiff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AiBlock.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AiBlock.tsxindex 530adac5bc..8b43f28306 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AiBlock.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AiBlock.tsx@@ -60,4 +60,4 @@ export const AiBlock: React.FC<Props> = ({</div></Button>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AllBlocksContent/AllBlocksContent.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AllBlocksContent/AllBlocksContent.tsxnew file mode 100644index 0000000000..9951b0b608--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AllBlocksContent/AllBlocksContent.tsx@@ -0,0 +1,112 @@+import React, { Fragment } from "react";+import { Block } from "../Block";+import { Button } from "@/components/ui/button";+import { Separator } from "@/components/ui/separator";+import { beautifyString } from "@/lib/utils";+import { useAllBlockContent } from "./useAllBlockContent";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { blockMenuContainerStyle } from "../style";++export const AllBlocksContent = () => {+ const {+ data,+ isLoading,+ isError,+ error,+ handleRefetchBlocks,+ isLoadingMore,+ isErrorOnLoadingMore,+ } = useAllBlockContent();++ if (isLoading) {+ return (+ <div className={blockMenuContainerStyle}>+ {[0, 1, 2, 3, 4].map((skeletonIndex) => (+ <Block.Skeleton key={`skeleton-${skeletonIndex}`} />+ ))}+ </div>+ );+ }++ if (isError) {+ return (+ <div className="h-full p-4">+ <ErrorCard+ isSuccess={false}+ responseError={error || undefined}+ httpError={{+ status: data?.status,+ statusText: "Request failed",+ message: (error?.detail as string) || "An error occurred",+ }}+ context="block menu"+ onRetry={() => window.location.reload()}+ />+ </div>+ );+ }++ const categories = data?.categories;++ return (+ <div className={blockMenuContainerStyle}>+ {categories?.map((category, index) => (+ <Fragment key={category.name}>+ {index > 0 && <Separator className="h-[1px] w-full text-zinc-300" />}++ {/* Category Section */}+ <div className="space-y-2.5">+ <div className="flex items-center justify-between">+ <p className="font-sans text-sm font-medium leading-[1.375rem] text-zinc-800">+ {category.name && beautifyString(category.name)}+ </p>+ <span className="rounded-full bg-zinc-100 px-[0.375rem] font-sans text-sm leading-[1.375rem] text-zinc-600">+ {category.total_blocks}+ </span>+ </div>++ <div className="space-y-2">+ {category.blocks.map((block) => (+ <Block+ key={`${category.name}-${block.id}`}+ title={block.name as string}+ description={block.name as string}+ />+ ))}++ {isLoadingMore(category.name) && (+ <>+ {[0, 1, 2].map((skeletonIndex) => (+ <Block.Skeleton+ key={`skeleton-${category.name}-${skeletonIndex}`}+ />+ ))}+ </>+ )}++ {!isErrorOnLoadingMore && (+ <ErrorCard+ isSuccess={false}+ responseError={{ message: "Error loading blocks" }}+ context="blocks"+ onRetry={() => handleRefetchBlocks(category.name)}+ />+ )}++ {category.total_blocks > category.blocks.length && (+ <Button+ variant={"link"}+ className="px-0 font-sans text-sm leading-[1.375rem] text-zinc-600 underline hover:text-zinc-800"+ disabled={isLoadingMore(category.name)}+ onClick={() => handleRefetchBlocks(category.name)}+ >+ see all+ </Button>+ )}+ </div>+ </div>+ </Fragment>+ ))}+ </div>+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AllBlocksContent/useAllBlockContent.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AllBlocksContent/useAllBlockContent.tsxnew file mode 100644index 0000000000..88d2dc963e--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/AllBlocksContent/useAllBlockContent.tsx@@ -0,0 +1,105 @@+import {+ getGetV2GetBuilderBlockCategoriesQueryKey,+ getV2GetBuilderBlocks,+ useGetV2GetBuilderBlockCategories,+} from "@/app/api/__generated__/endpoints/default/default";+import { BlockCategoryResponse } from "@/app/api/__generated__/models/blockCategoryResponse";+import { BlockResponse } from "@/app/api/__generated__/models/blockResponse";+import * as Sentry from "@sentry/nextjs";+import { getQueryClient } from "@/lib/react-query/queryClient";+import { useState } from "react";+import { useToast } from "@/components/molecules/Toast/use-toast";++export const useAllBlockContent = () => {+ const { toast } = useToast();+ const [loadingCategories, setLoadingCategories] = useState<Set<string>>(+ new Set(),+ );+ const [errorLoadingCategories, setErrorLoadingCategories] = useState<+ Set<string>+ >(new Set());++ const { data, isLoading, isError, error } = useGetV2GetBuilderBlockCategories(+ undefined,+ {+ query: {+ select: (x) => {+ return {+ categories: x.data as BlockCategoryResponse[],+ status: x.status,+ };+ },+ },+ },+ );++ const handleRefetchBlocks = async (targetCategory: string) => {+ try {+ setLoadingCategories((prev) => new Set(prev).add(targetCategory));++ // Clear any previous error for this category+ setErrorLoadingCategories((prev) => {+ const newSet = new Set(prev);+ newSet.delete(targetCategory);+ return newSet;+ });+ const response = await getV2GetBuilderBlocks({+ category: targetCategory,+ });++ const result = response.data as BlockResponse;+ if (result.blocks) {+ const categoriesQueryKey = getGetV2GetBuilderBlockCategoriesQueryKey();++ const queryClient = getQueryClient();+ queryClient.setQueryData(categoriesQueryKey, (old: any) => {+ if (!old?.data) return old;+ const categories = old.data as BlockCategoryResponse[];++ const updatedCategories = categories.map((old_cat) => {+ if (old_cat.name === targetCategory) {+ return {+ ...old_cat,+ blocks: result.blocks,+ };+ }+ return old_cat;+ });+ return {+ ...old,+ data: updatedCategories,+ };+ });+ }+ } catch (error) {+ Sentry.captureException(error);+ setErrorLoadingCategories((prev) => new Set(prev).add(targetCategory));+ toast({+ title: "Error loading blocks",+ description: "Please try again later",+ variant: "destructive",+ });+ } finally {+ setLoadingCategories((prev) => {+ const newSet = new Set(prev);+ newSet.delete(targetCategory);+ return newSet;+ });+ }+ };++ const isLoadingMore = (categoryName: string) =>+ loadingCategories.has(categoryName);+ const isErrorOnLoadingMore = (categoryName: string) =>+ errorLoadingCategories.has(categoryName);++ return {+ data,+ isLoading,+ isError,+ error,+ handleRefetchBlocks,+ isLoadingMore,+ isErrorOnLoadingMore,+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/Block.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/Block.tsxindex c05efc6dae..ad401cb9b7 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/Block.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/Block.tsx@@ -1,10 +1,9 @@import { Button } from "@/components/ui/button";import { Skeleton } from "@/components/ui/skeleton";import { beautifyString, cn } from "@/lib/utils";-import { Plus } from "lucide-react";-import React, { ButtonHTMLAttributes } from "react";import { highlightText } from "./helpers";-;-+import React, { ButtonHTMLAttributes } from "react";+import { highlightText } from "./helpers";+import { PlusIcon } from "@phosphor-icons/react";interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {title?: string;description?: string;@@ -56,7 +55,7 @@ export const Block: BlockComponent = ({"flex h-7 w-7 items-center justify-center rounded-[0.5rem] bg-zinc-700 group-disabled:bg-zinc-400",)}>- <Plus className="h-5 w-5 text-zinc-50" strokeWidth={2} />+ <PlusIcon className="h-5 w-5 text-zinc-50" /></div></Button>);@@ -74,4 +73,4 @@ const BlockSkeleton = () => {);};-Block.Skeleton = BlockSkeleton;\ No newline at end of file+Block.Skeleton = BlockSkeleton;diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockList/BlockList.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockList/BlockList.tsxnew file mode 100644index 0000000000..12ad298d6c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockList/BlockList.tsx@@ -0,0 +1,35 @@+import React from "react";+import { Block } from "../Block";+import { blockMenuContainerStyle } from "../style";++export interface BlockType {+ id: string;+ name: string;+ description: string;+ category?: string;+ type?: string;+ provider?: string;+}++interface BlocksListProps {+ blocks: BlockType[];+ loading?: boolean;+}++export const BlocksList: React.FC<BlocksListProps> = ({+ blocks,+ loading = false,+}) => {+ if (loading) {+ return (+ <div className={blockMenuContainerStyle}>+ {Array.from({ length: 7 }).map((_, index) => (+ <Block.Skeleton key={index} />+ ))}+ </div>+ );+ }+ return blocks.map((block) => (+ <Block key={block.id} title={block.name} description={block.description} />+ ));+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenu/BlockMenu.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenu/BlockMenu.tsxindex 0b18cf09e2..5059a45bea 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenu/BlockMenu.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenu/BlockMenu.tsx@@ -4,11 +4,11 @@ import {PopoverContent,PopoverTrigger,} from "@/components/ui/popover";-import { ToyBrick } from "lucide-react";import { BlockMenuContent } from "../BlockMenuContent/BlockMenuContent";import { ControlPanelButton } from "../ControlPanelButton";import { useBlockMenu } from "./useBlockMenu";import { BlockMenuStateProvider } from "../block-menu-provider";+import { LegoIcon } from "@phosphor-icons/react";interface BlockMenuProps {pinBlocksPopover: boolean;@@ -23,7 +23,10 @@ export const BlockMenu: React.FC<BlockMenuProps> = ({blockMenuSelected,setBlockMenuSelected,}) => {- const {open, onOpen} = useBlockMenu({pinBlocksPopover, setBlockMenuSelected});+ const { open, onOpen } = useBlockMenu({+ pinBlocksPopover,+ setBlockMenuSelected,+ });return (<Popover open={pinBlocksPopover ? true : open} onOpenChange={onOpen}><PopoverTrigger className="hover:cursor-pointer">@@ -33,8 +36,8 @@ export const BlockMenu: React.FC<BlockMenuProps> = ({selected={blockMenuSelected === "block"}className="rounded-none">- {/* Need to find phosphor icon alternative for this lucide icon */}- <ToyBrick className="h-5 w-6" strokeWidth={2} />+ {/* Need to find phosphor icon alternative for this lucide icon */}+ <LegoIcon className="h-6 w-6" /></ControlPanelButton></PopoverTrigger>@@ -42,14 +45,13 @@ export const BlockMenu: React.FC<BlockMenuProps> = ({side="right"align="start"sideOffset={16}- className="absolute h-[75vh] w-[46.625rem] overflow-hidden rounded-[1rem] border-none p-0 shadow-[0_2px_6px_0_rgba(0,0,0,0.05)]"+ className="absolute h-[80vh] w-[46.625rem] overflow-hidden rounded-[1rem] border-none p-0 shadow-[0_2px_6px_0_rgba(0,0,0,0.05)]"data-id="blocks-control-popover-content">- <BlockMenuStateProvider>- <BlockMenuContent />- </BlockMenuStateProvider>-+ <BlockMenuStateProvider>+ <BlockMenuContent />+ </BlockMenuStateProvider></PopoverContent></Popover>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenu/useBlockMenu.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenu/useBlockMenu.tsindex 08bac925d8..6ddd442e5b 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenu/useBlockMenu.ts+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenu/useBlockMenu.ts@@ -1,23 +1,26 @@import { useState } from "react";interface useBlockMenuProps {- pinBlocksPopover: boolean;- setBlockMenuSelected: React.Dispatch<+ pinBlocksPopover: boolean;+ setBlockMenuSelected: React.Dispatch<React.SetStateAction<"" | "save" | "block" | "search">>;}-export const useBlockMenu = ({pinBlocksPopover, setBlockMenuSelected}: useBlockMenuProps) => {- const [open, setOpen] = useState(false);- const onOpen = (newOpen: boolean) => {- if (!pinBlocksPopover) {- setOpen(newOpen);- setBlockMenuSelected(newOpen ? "block" : "");- }- };+export const useBlockMenu = ({+ pinBlocksPopover,+ setBlockMenuSelected,+}: useBlockMenuProps) => {+ const [open, setOpen] = useState(false);+ const onOpen = (newOpen: boolean) => {+ if (!pinBlocksPopover) {+ setOpen(newOpen);+ setBlockMenuSelected(newOpen ? "block" : "");+ }+ };- return {- open,- onOpen,- };-};\ No newline at end of file+ return {+ open,+ onOpen,+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuDefault/BlockMenuDefault.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuDefault/BlockMenuDefault.tsxindex c2e0092db0..570e125c23 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuDefault/BlockMenuDefault.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuDefault/BlockMenuDefault.tsx@@ -12,4 +12,4 @@ export const BlockMenuDefault = () => {<BlockMenuDefaultContent /></div>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuDefaultContent/BlockMenuDefaultContent.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuDefaultContent/BlockMenuDefaultContent.tsxindex 78e8af8b06..65b6e13f0c 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuDefaultContent/BlockMenuDefaultContent.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuDefaultContent/BlockMenuDefaultContent.tsx@@ -1,14 +1,33 @@-import { Text } from "@/components/atoms/Text/Text";import React from "react";+import { DefaultStateType, useBlockMenuContext } from "../block-menu-provider";+import { AllBlocksContent } from "../AllBlocksContent/AllBlocksContent";+import { PaginatedBlocksContent } from "../PaginatedBlocksContent/PaginatedBlocksContent";+import { IntegrationsContent } from "../IntegrationsContent/IntegrationsContent";+import { MarketplaceAgentsContent } from "../MarketplaceAgentsContent/MarketplaceAgentsContent";+import { MyAgentsContent } from "../MyAgentsContent/MyAgentsContent";+import { SuggestionContent } from "../SuggestionContent/SuggestionContent";export const BlockMenuDefaultContent = () => {+ const { defaultState } = useBlockMenuContext();return (- <div className="h-full flex-1 overflow-hidden flex items-center justify-center">- {/* I have added temporary content here, will fillup it in follow up prs */}- <Text variant="body" className="text-green-300">- This is the block menu default content- </Text>+ <div className="h-full flex-1 overflow-hidden">+ {defaultState == DefaultStateType.SUGGESTION && <SuggestionContent />}+ {defaultState == DefaultStateType.ALL_BLOCKS && <AllBlocksContent />}+ {defaultState == DefaultStateType.INPUT_BLOCKS && (+ <PaginatedBlocksContent type="input" />+ )}+ {defaultState == DefaultStateType.ACTION_BLOCKS && (+ <PaginatedBlocksContent type="action" />+ )}+ {defaultState == DefaultStateType.OUTPUT_BLOCKS && (+ <PaginatedBlocksContent type="output" />+ )}+ {defaultState == DefaultStateType.INTEGRATIONS && <IntegrationsContent />}+ {defaultState == DefaultStateType.MARKETPLACE_AGENTS && (+ <MarketplaceAgentsContent />+ )}+ {defaultState == DefaultStateType.MY_AGENTS && <MyAgentsContent />}</div>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearch/BlockMenuSearch.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearch/BlockMenuSearch.tsxindex 6b1bb61210..fb766fa28c 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearch/BlockMenuSearch.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearch/BlockMenuSearch.tsx@@ -3,10 +3,10 @@ import { Text } from "@/components/atoms/Text/Text";export const BlockMenuSearch = () => {return (// This is just a temporary text, will content inside in it [in follow-up prs]- <div className="flex items-center justify-center h-full w-full">+ <div className="flex h-full w-full items-center justify-center"><Text variant="h3" className="text-green-300">This is the block menu search</Text></div>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearchBar/BlockMenuSearchBar.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearchBar/BlockMenuSearchBar.tsxindex 89b1337c78..f98b41d521 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearchBar/BlockMenuSearchBar.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearchBar/BlockMenuSearchBar.tsx@@ -12,7 +12,13 @@ interface BlockMenuSearchBarProps {export const BlockMenuSearchBar: React.FC<BlockMenuSearchBarProps> = ({className = "",}) => {- const { handleClear, inputRef, localQuery, setLocalQuery, debouncedSetSearchQuery } = useBlockMenuSearchBar();+ const {+ handleClear,+ inputRef,+ localQuery,+ setLocalQuery,+ debouncedSetSearchQuery,+ } = useBlockMenuSearchBar();return (<div@@ -22,7 +28,10 @@ export const BlockMenuSearchBar: React.FC<BlockMenuSearchBarProps> = ({)}><div className="flex h-6 w-6 items-center justify-center">- <MagnifyingGlassIcon className="h-6 w-6 text-zinc-700" strokeWidth={2} />+ <MagnifyingGlassIcon+ className="h-6 w-6 text-zinc-700"+ strokeWidth={2}+ /></div><Inputref={inputRef}@@ -50,4 +59,4 @@ export const BlockMenuSearchBar: React.FC<BlockMenuSearchBarProps> = ({)}</div>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearchBar/useBlockMenuSearchBar.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearchBar/useBlockMenuSearchBar.tsindex 3ac7b6d03e..fe27b22d30 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearchBar/useBlockMenuSearchBar.ts+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSearchBar/useBlockMenuSearchBar.ts@@ -1,46 +1,49 @@import { debounce } from "lodash";-import { useEffect, useRef, useState } from "react";+import { useCallback, useEffect, useRef, useState } from "react";import { useBlockMenuContext } from "../block-menu-provider";const SEARCH_DEBOUNCE_MS = 300;export const useBlockMenuSearchBar = () => {- const inputRef = useRef<HTMLInputElement>(null);- const [localQuery, setLocalQuery] = useState("");- const { setSearchQuery, setSearchId, searchId } = useBlockMenuContext();-- const searchIdRef = useRef(searchId);- useEffect(() => {- searchIdRef.current = searchId;- }, [searchId]);+ const inputRef = useRef<HTMLInputElement>(null);+ const [localQuery, setLocalQuery] = useState("");+ const { setSearchQuery, setSearchId, searchId } = useBlockMenuContext();- const debouncedSetSearchQuery = debounce((value: string) => {- setSearchQuery(value);- if (value.length === 0) {- setSearchId(undefined);- } else if (!searchIdRef.current) {- setSearchId(crypto.randomUUID());- }- }, SEARCH_DEBOUNCE_MS);-- useEffect(() => {- return () => {- debouncedSetSearchQuery.cancel();- };- }, [debouncedSetSearchQuery]);-- const handleClear = () => {- setLocalQuery("");- setSearchQuery("");- setSearchId(undefined);+ const searchIdRef = useRef(searchId);+ useEffect(() => {+ searchIdRef.current = searchId;+ }, [searchId]);++ const debouncedSetSearchQuery = useCallback(+ debounce((value: string) => {+ setSearchQuery(value);+ if (value.length === 0) {+ setSearchId(undefined);+ } else if (!searchIdRef.current) {+ setSearchId(crypto.randomUUID());+ }+ }, SEARCH_DEBOUNCE_MS),+ [setSearchQuery, setSearchId],+ );++ useEffect(() => {+ return () => {debouncedSetSearchQuery.cancel();};+ }, [debouncedSetSearchQuery]);++ const handleClear = () => {+ setLocalQuery("");+ setSearchQuery("");+ setSearchId(undefined);+ debouncedSetSearchQuery.cancel();+ };- return {- handleClear,- inputRef,- localQuery,- setLocalQuery,- debouncedSetSearchQuery,- }-};\ No newline at end of file+ return {+ handleClear,+ inputRef,+ localQuery,+ setLocalQuery,+ debouncedSetSearchQuery,+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSidebar/BlockMenuSidebar.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSidebar/BlockMenuSidebar.tsxindex 90c6bbd8df..58ae44c501 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSidebar/BlockMenuSidebar.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSidebar/BlockMenuSidebar.tsx@@ -1,13 +1,14 @@import React from "react";import { MenuItem } from "../MenuItem";-import { DefaultStateType } from "../block-menu-provider";+import { DefaultStateType, useBlockMenuContext } from "../block-menu-provider";import { useBlockMenuSidebar } from "./useBlockMenuSidebar";import { Skeleton } from "@/components/ui/skeleton";import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";export const BlockMenuSidebar = () => {- const { blockCounts, setDefaultState, defaultState, isLoading, isError, error } = useBlockMenuSidebar();-+ const { data, setDefaultState, defaultState, isLoading, isError, error } =+ useBlockMenuSidebar();+ const { setIntegration } = useBlockMenuContext();if (isLoading) {return (<div className="w-fit space-y-2 px-4 pt-4">@@ -21,11 +22,25 @@ export const BlockMenuSidebar = () => {);}if (isError) {- return <div className="w-fit space-y-2 px-4 pt-4">- <ErrorCard className="w-[12.875rem]" httpError={{status: 500, statusText: "Internal Server Error", message: error?.detail || 'An error occurred'}} />+ return (+ <div className="w-fit space-y-2 px-4 pt-4">+ <ErrorCard+ className="w-[12.875rem]"+ isSuccess={false}+ responseError={error || undefined}+ context="block menu"+ httpError={{+ status: data?.status,+ statusText: "Internal Server Error",+ message: (error?.detail as string) || "An error occurred",+ }}+ /></div>+ );}+ const blockCounts = data?.blockCounts;+const topLevelMenuItems = [{name: "Suggestion",@@ -62,7 +77,8 @@ export const BlockMenuSidebar = () => {type: "integrations",number: blockCounts?.integrations,onClick: () => {- setDefaultState("integrations");+ setDefaultState(DefaultStateType.INTEGRATIONS);+ setIntegration(undefined);},},{@@ -114,4 +130,4 @@ export const BlockMenuSidebar = () => {))}</div>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSidebar/useBlockMenuSidebar.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSidebar/useBlockMenuSidebar.tsindex 7e2885d41c..d1640412e4 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSidebar/useBlockMenuSidebar.ts+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/BlockMenuSidebar/useBlockMenuSidebar.ts@@ -5,20 +5,23 @@ import { CountResponse } from "@/app/api/__generated__/models/countResponse";export const useBlockMenuSidebar = () => {const { defaultState, setDefaultState } = useBlockMenuContext();- const { data: blockCounts, isLoading, isError, error} = useGetV2GetBuilderItemCounts({- query : {- select : (x) =>{- return x.data as CountResponse- }- }+ const { data, isLoading, isError, error } = useGetV2GetBuilderItemCounts({+ query: {+ select: (x) => {+ return {+ blockCounts: x.data as CountResponse,+ status: x.status,+ };+ },+ },});return {- blockCounts,+ data,setDefaultState,defaultState,isLoading,isError,error,- }-};\ No newline at end of file+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/ControlPanelButton.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/ControlPanelButton.tsxindex 523bad0142..99715c5df3 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/ControlPanelButton.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/ControlPanelButton.tsx@@ -32,4 +32,4 @@ export const ControlPanelButton: React.FC<Props> = ({{children}</div>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/FilterChip.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/FilterChip.tsxindex 9099ec9c94..214e5e8b25 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/FilterChip.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/FilterChip.tsx@@ -51,4 +51,4 @@ export const FilterChip: React.FC<Props> = ({)}</Button>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/Integration.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/Integration.tsxindex 0ace646ecf..6082df97c8 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/Integration.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/Integration.tsx@@ -85,4 +85,4 @@ const IntegrationSkeleton: React.FC<{ className?: string }> = ({);};-Integration.Skeleton = IntegrationSkeleton;\ No newline at end of file+Integration.Skeleton = IntegrationSkeleton;diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationBlocks/IntegrationBlocks.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationBlocks/IntegrationBlocks.tsxnew file mode 100644index 0000000000..efa07df63f--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationBlocks/IntegrationBlocks.tsx@@ -0,0 +1,101 @@+import { Button } from "@/components/ui/button";+import React, { Fragment } from "react";+import { IntegrationBlock } from "../IntergrationBlock";+import { useBlockMenuContext } from "../block-menu-provider";+import { Skeleton } from "@/components/ui/skeleton";+import { useIntegrationBlocks } from "./useIntegrationBlocks";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { InfiniteScroll } from "@/components/contextual/InfiniteScroll/InfiniteScroll";++export const IntegrationBlocks = () => {+ const { integration, setIntegration } = useBlockMenuContext();+ const {+ allBlocks,+ status,+ totalBlocks,+ blocksLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ error,+ refetch,+ } = useIntegrationBlocks();++ if (blocksLoading) {+ return (+ <div className="w-full space-y-3 p-4">+ {Array.from({ length: 3 }).map((_, blockIndex) => (+ <Fragment key={blockIndex}>+ {blockIndex > 0 && (+ <Skeleton className="my-4 h-[1px] w-full text-zinc-100" />+ )}+ {[0, 1, 2].map((index) => (+ <IntegrationBlock.Skeleton key={`${blockIndex}-${index}`} />+ ))}+ </Fragment>+ ))}+ </div>+ );+ }++ if (error) {+ return (+ <div className="h-full p-4">+ <ErrorCard+ isSuccess={false}+ responseError={error || undefined}+ httpError={{+ status: status,+ statusText: "Request failed",+ message: (error?.detail as string) || "An error occurred",+ }}+ context="block menu"+ onRetry={() => refetch()}+ />+ </div>+ );+ }++ return (+ <InfiniteScroll+ isFetchingNextPage={isFetchingNextPage}+ fetchNextPage={fetchNextPage}+ hasNextPage={hasNextPage}+ >+ <div className="space-y-2.5">+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-1">+ <Button+ variant={"link"}+ className="p-0 font-sans text-sm font-medium leading-[1.375rem] text-zinc-800"+ onClick={() => {+ setIntegration(undefined);+ }}+ >+ Integrations+ </Button>+ <p className="font-sans text-sm font-medium leading-[1.375rem] text-zinc-800">+ /+ </p>+ <p className="font-sans text-sm font-medium leading-[1.375rem] text-zinc-800">+ {integration}+ </p>+ </div>+ <span className="flex h-[1.375rem] w-[1.6875rem] items-center justify-center rounded-[1.25rem] bg-[#f0f0f0] p-1.5 font-sans text-sm leading-[1.375rem] text-zinc-500 group-disabled:text-zinc-400">+ {totalBlocks}+ </span>+ </div>+ <div className="space-y-3">+ {allBlocks.map((block) => (+ <IntegrationBlock+ key={block.id}+ title={block.name}+ description={block.description}+ icon_url={`/integrations/${integration}.png`}+ />+ ))}+ </div>+ </div>+ </InfiniteScroll>+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationBlocks/useIntegrationBlocks.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationBlocks/useIntegrationBlocks.tsnew file mode 100644index 0000000000..6577d41b31--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationBlocks/useIntegrationBlocks.ts@@ -0,0 +1,61 @@+import { useGetV2GetBuilderBlocksInfinite } from "@/app/api/__generated__/endpoints/default/default";+import { BlockResponse } from "@/app/api/__generated__/models/blockResponse";+import { useBlockMenuContext } from "../block-menu-provider";++const PAGE_SIZE = 10;++export const useIntegrationBlocks = () => {+ const { integration } = useBlockMenuContext();++ const {+ data: blocks,+ fetchNextPage,+ hasNextPage,+ isFetchingNextPage,+ isLoading: blocksLoading,+ error,+ refetch,+ } = useGetV2GetBuilderBlocksInfinite(+ {+ page: 1,+ page_size: PAGE_SIZE,+ provider: integration,+ },+ {+ query: {+ getNextPageParam: (lastPage) => {+ const pagination = (lastPage.data as BlockResponse).pagination;+ const isMore =+ pagination.current_page * pagination.page_size <+ pagination.total_items;++ return isMore ? pagination.current_page + 1 : undefined;+ },+ },+ },+ );++ const allBlocks =+ blocks?.pages?.flatMap((page) => {+ const response = page.data as BlockResponse;+ return response.blocks;+ }) ?? [];++ const totalBlocks = blocks?.pages[0]+ ? (blocks.pages[0].data as BlockResponse).pagination.total_items+ : 0;++ const status = blocks?.pages[0]?.status;++ return {+ allBlocks,+ totalBlocks,+ status,+ blocksLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ error,+ refetch,+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationChip.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationChip.tsxindex 2a1caeb56b..611e283bdb 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationChip.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationChip.tsx@@ -57,4 +57,4 @@ const IntegrationChipSkeleton: React.FC = () => {);};-IntegrationChip.Skeleton = IntegrationChipSkeleton;\ No newline at end of file+IntegrationChip.Skeleton = IntegrationChipSkeleton;diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationsContent/IntegrationsContent.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationsContent/IntegrationsContent.tsxnew file mode 100644index 0000000000..0df799f895--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntegrationsContent/IntegrationsContent.tsx@@ -0,0 +1,27 @@+import React from "react";+import { useBlockMenuContext } from "../block-menu-provider";+import { scrollbarStyles } from "@/components/styles/scrollbars";+import { IntegrationBlocks } from "../IntegrationBlocks/IntegrationBlocks";+import { PaginatedIntegrationList } from "../PaginatedIntegrationList/PaginatedIntegrationList";+import { cn } from "@/lib/utils";++export const IntegrationsContent = () => {+ const { integration } = useBlockMenuContext();++ if (!integration) {+ return <PaginatedIntegrationList />;+ }++ return (+ <div+ className={cn(+ scrollbarStyles,+ "h-full overflow-y-auto pt-4 transition-all duration-200",+ )}+ >+ <div className="w-full px-4 pb-4">+ <IntegrationBlocks />+ </div>+ </div>+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntergrationBlock.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntergrationBlock.tsxindex 9b38bf2a35..6071f65eff 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntergrationBlock.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/IntergrationBlock.tsx@@ -1,10 +1,10 @@-import { Button } from "@/components/ui/button";import { Skeleton } from "@/components/ui/skeleton";import { beautifyString, cn } from "@/lib/utils";import { Plus } from "lucide-react";import Image from "next/image";import React, { ButtonHTMLAttributes } from "react";import { highlightText } from "./helpers";+import { Button } from "@/components/atoms/Button/Button";interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {title?: string;@@ -17,8 +17,6 @@ interface IntegrationBlockComponent extends React.FC<Props> {Skeleton: React.FC<{ className?: string }>;}--export const IntegrationBlock: IntegrationBlockComponent = ({title,icon_url,@@ -29,6 +27,7 @@ export const IntegrationBlock: IntegrationBlockComponent = ({}) => {return (<Button+ variant={"ghost"}className={cn("group flex h-16 w-full min-w-[7.5rem] items-center justify-start gap-3 whitespace-normal rounded-[0.75rem] bg-zinc-50 px-[0.875rem] py-[0.625rem] text-start shadow-none","hover:cursor-default hover:bg-zinc-100 focus:ring-0 active:bg-zinc-100 active:ring-1 active:ring-zinc-300 disabled:cursor-not-allowed",@@ -96,4 +95,4 @@ const IntegrationBlockSkeleton = ({ className }: { className?: string }) => {);};-IntegrationBlock.Skeleton = IntegrationBlockSkeleton;\ No newline at end of file+IntegrationBlock.Skeleton = IntegrationBlockSkeleton;diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentBlock.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentBlock.tsxindex 3358a8b08d..23ec4bb28d 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentBlock.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentBlock.tsx@@ -1,11 +1,15 @@import { Button } from "@/components/ui/button";import { Skeleton } from "@/components/ui/skeleton";import { cn } from "@/lib/utils";-import { ExternalLink, Loader2, Plus } from "lucide-react";import Image from "next/image";import React, { ButtonHTMLAttributes } from "react";import Link from "next/link";import { highlightText } from "./helpers";+import {+ ArrowSquareOutIcon,+ CircleNotchIcon,+ PlusIcon,+} from "@phosphor-icons/react";interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {title?: string;@@ -89,7 +93,10 @@ export const MarketplaceAgentBlock: MarketplaceAgentBlockComponent = ({<span className="font-sans text-xs leading-5 text-blue-700 underline">Agent page</span>- <ExternalLink className="h-4 w-4 text-blue-700" strokeWidth={1} />+ <ArrowSquareOutIcon+ className="h-4 w-4 text-blue-700"+ strokeWidth={1}+ /></Link></div></div>@@ -99,9 +106,9 @@ export const MarketplaceAgentBlock: MarketplaceAgentBlockComponent = ({)}>{!loading ? (- <Plus className="h-5 w-5 text-zinc-50" strokeWidth={2} />+ <PlusIcon className="h-5 w-5 text-zinc-50" strokeWidth={2} />) : (- <Loader2 className="h-5 w-5 animate-spin" />+ <CircleNotchIcon className="h-5 w-5 animate-spin" />)}</div></Button>@@ -132,4 +139,4 @@ const MarketplaceAgentBlockSkeleton: React.FC<{ className?: string }> = ({);};-MarketplaceAgentBlock.Skeleton = MarketplaceAgentBlockSkeleton;\ No newline at end of file+MarketplaceAgentBlock.Skeleton = MarketplaceAgentBlockSkeleton;diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentsContent/MarketplaceAgentsContent.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentsContent/MarketplaceAgentsContent.tsxnew file mode 100644index 0000000000..35d2f9f703--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentsContent/MarketplaceAgentsContent.tsx@@ -0,0 +1,88 @@+import React from "react";+import { MarketplaceAgentBlock } from "../MarketplaceAgentBlock";+import { useMarketplaceAgentsContent } from "./useMarketplaceAgentsContent";+import { scrollbarStyles } from "@/components/styles/scrollbars";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { cn } from "@/lib/utils";+import { InfiniteScroll } from "@/components/contextual/InfiniteScroll/InfiniteScroll";+import { blockMenuContainerStyle } from "../style";++export const MarketplaceAgentsContent = () => {+ const {+ handleAddStoreAgent,+ addingAgent,+ isListStoreAgentsLoading,+ isListStoreAgentsError,+ listStoreAgentsError,+ listStoreAgents,+ refetchListStoreAgents,+ fetchNextPage,+ hasNextPage,+ isFetchingNextPage,+ status,+ } = useMarketplaceAgentsContent();++ if (isListStoreAgentsLoading) {+ return (+ <div+ className={cn(+ scrollbarStyles,+ "h-full overflow-y-auto pt-4 transition-all duration-200",+ )}+ >+ <div className="w-full space-y-3 px-4 pb-4">+ {Array.from({ length: 5 }).map((_, index) => (+ <MarketplaceAgentBlock.Skeleton key={index} />+ ))}+ </div>+ </div>+ );+ }++ if (isListStoreAgentsError) {+ return (+ <div className="h-full p-4">+ <ErrorCard+ isSuccess={false}+ context="block menu"+ httpError={{+ status: status,+ statusText: "Request failed",+ message:+ (listStoreAgentsError?.detail as unknown as string) ||+ "An error occurred",+ }}+ responseError={listStoreAgentsError || undefined}+ onRetry={() => refetchListStoreAgents()}+ />+ </div>+ );+ }++ return (+ <InfiniteScroll+ isFetchingNextPage={isFetchingNextPage}+ fetchNextPage={fetchNextPage}+ hasNextPage={hasNextPage}+ className={blockMenuContainerStyle}+ >+ {listStoreAgents?.map((agent, index) => (+ <MarketplaceAgentBlock+ key={agent.slug + index}+ slug={agent.slug}+ title={agent.agent_name}+ image_url={agent.agent_image}+ creator_name={agent.creator}+ number_of_runs={agent.runs}+ loading={addingAgent === agent.slug}+ onClick={() =>+ handleAddStoreAgent({+ creator_name: agent.creator,+ slug: agent.slug,+ })+ }+ />+ ))}+ </InfiniteScroll>+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentsContent/useMarketplaceAgentsContent.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentsContent/useMarketplaceAgentsContent.tsnew file mode 100644index 0000000000..402f40a374--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MarketplaceAgentsContent/useMarketplaceAgentsContent.ts@@ -0,0 +1,121 @@+import { getGetV2GetBuilderItemCountsQueryKey } from "@/app/api/__generated__/endpoints/default/default";+import {+ getGetV2ListLibraryAgentsQueryKey,+ usePostV2AddMarketplaceAgent,+} from "@/app/api/__generated__/endpoints/library/library";+import {+ getV2GetSpecificAgent,+ useGetV2ListStoreAgentsInfinite,+} from "@/app/api/__generated__/endpoints/store/store";+import { useToast } from "@/components/molecules/Toast/use-toast";+import { StoreAgentsResponse } from "@/lib/autogpt-server-api";+import { getQueryClient } from "@/lib/react-query/queryClient";+import * as Sentry from "@sentry/nextjs";+import { useState } from "react";++export const useMarketplaceAgentsContent = () => {+ const { toast } = useToast();+ const [addingAgent, setAddingAgent] = useState<string | null>(null);++ const {+ data: listStoreAgents,+ fetchNextPage,+ hasNextPage,+ isFetchingNextPage,+ isLoading: isListStoreAgentsLoading,+ isError: isListStoreAgentsError,+ error: listStoreAgentsError,+ refetch: refetchListStoreAgents,+ } = useGetV2ListStoreAgentsInfinite(+ {+ page: 1,+ page_size: 10,+ },+ {+ query: {+ getNextPageParam: (lastPage) => {+ const pagination = (lastPage.data as StoreAgentsResponse).pagination;+ const isMore =+ pagination.current_page * pagination.page_size <+ pagination.total_items;++ return isMore ? pagination.current_page + 1 : undefined;+ },+ },+ },+ );++ const allAgents =+ listStoreAgents?.pages?.flatMap((page) => {+ const response = page.data as StoreAgentsResponse;+ return response.agents;+ }) ?? [];++ const status = listStoreAgents?.pages[0]?.status;++ const { mutate: addMarketplaceAgent } = usePostV2AddMarketplaceAgent({+ mutation: {+ onSuccess: () => {+ const queryClient = getQueryClient();+ queryClient.invalidateQueries({+ queryKey: getGetV2ListLibraryAgentsQueryKey(),+ });++ queryClient.refetchQueries({+ queryKey: getGetV2GetBuilderItemCountsQueryKey(),+ });+ },+ },+ });++ const handleAddStoreAgent = async ({+ creator_name,+ slug,+ }: {+ creator_name: string;+ slug: string;+ }) => {+ try {+ setAddingAgent(slug);+ const { data: agent, status } = await getV2GetSpecificAgent(+ creator_name,+ slug,+ );+ if (status !== 200) {+ Sentry.captureException("Store listing version not found");+ throw new Error("Store listing version not found");+ }++ addMarketplaceAgent({+ data: {+ store_listing_version_id: agent?.store_listing_version_id,+ },+ });++ // Need a way to convert the library agent into block+ // then add the block in builder+ } catch (error) {+ Sentry.captureException(error);+ toast({+ title: "Error",+ description: "Failed to add agent to library",+ });+ } finally {+ setAddingAgent(null);+ }+ };++ return {+ handleAddStoreAgent,+ listStoreAgents: allAgents,+ status,+ addingAgent,+ isListStoreAgentsLoading,+ isListStoreAgentsError,+ listStoreAgentsError,+ refetchListStoreAgents,+ fetchNextPage,+ hasNextPage,+ isFetchingNextPage,+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MenuItem.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MenuItem.tsxindex b52f7296f3..5b088239fd 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MenuItem.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MenuItem.tsx@@ -30,11 +30,11 @@ export const MenuItem: React.FC<Props> = ({<span className="truncate font-sans text-sm font-medium leading-[1.375rem] text-zinc-800">{name}</span>- {number && (+ {number !== undefined && (<span className="font-sans text-sm font-normal leading-[1.375rem] text-zinc-600">{number > 100 ? "100+" : number}</span>)}</Button>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MyAgentsContent/MyAgentsContent.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MyAgentsContent/MyAgentsContent.tsxnew file mode 100644index 0000000000..89500c7f9d--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MyAgentsContent/MyAgentsContent.tsx@@ -0,0 +1,67 @@+import React from "react";+import { UGCAgentBlock } from "../UGCAgentBlock";+import { useMyAgentsContent } from "./useMyAgentsContent";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { InfiniteScroll } from "@/components/contextual/InfiniteScroll/InfiniteScroll";+import { blockMenuContainerStyle } from "../style";++export const MyAgentsContent = () => {+ const {+ allAgents,+ agentLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ isError,+ error,+ status,+ refetch,+ } = useMyAgentsContent();++ if (agentLoading) {+ return (+ <div className={blockMenuContainerStyle}>+ {Array.from({ length: 5 }).map((_, index) => (+ <UGCAgentBlock.Skeleton key={index} />+ ))}+ </div>+ );+ }++ if (isError) {+ return (+ <div className="h-full p-4">+ <ErrorCard+ isSuccess={false}+ context="block menu"+ responseError={error || undefined}+ httpError={{+ status: status,+ statusText: "Request failed",+ message: (error?.detail as string) || "An error occurred",+ }}+ onRetry={() => refetch()}+ />+ </div>+ );+ }++ return (+ <InfiniteScroll+ isFetchingNextPage={isFetchingNextPage}+ fetchNextPage={fetchNextPage}+ hasNextPage={hasNextPage}+ className={blockMenuContainerStyle}+ >+ {allAgents.map((agent) => (+ <UGCAgentBlock+ key={agent.id}+ title={agent.name}+ edited_time={agent.updated_at}+ version={agent.graph_version}+ image_url={agent.image_url}+ />+ ))}+ </InfiniteScroll>+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MyAgentsContent/useMyAgentsContent.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MyAgentsContent/useMyAgentsContent.tsnew file mode 100644index 0000000000..e285036492--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/MyAgentsContent/useMyAgentsContent.ts@@ -0,0 +1,52 @@+import { useGetV2ListLibraryAgentsInfinite } from "@/app/api/__generated__/endpoints/library/library";+import { LibraryAgentResponse } from "@/app/api/__generated__/models/libraryAgentResponse";++export const useMyAgentsContent = () => {+ const {+ data: agents,+ fetchNextPage,+ hasNextPage,+ isFetchingNextPage,+ isError,+ isLoading: agentLoading,+ refetch,+ error,+ } = useGetV2ListLibraryAgentsInfinite(+ {+ page: 1,+ page_size: 10,+ },+ {+ query: {+ getNextPageParam: (lastPage) => {+ const pagination = (lastPage.data as LibraryAgentResponse).pagination;+ const isMore =+ pagination.current_page * pagination.page_size <+ pagination.total_items;++ return isMore ? pagination.current_page + 1 : undefined;+ },+ },+ },+ );++ const allAgents =+ agents?.pages?.flatMap((page) => {+ const response = page.data as LibraryAgentResponse;+ return response.agents;+ }) ?? [];++ const status = agents?.pages[0]?.status;++ return {+ allAgents,+ agentLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ isError,+ refetch,+ error,+ status,+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NewControlPanel/NewControlPanel.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NewControlPanel/NewControlPanel.tsxindex e260ece39d..15694aa38f 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NewControlPanel/NewControlPanel.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NewControlPanel/NewControlPanel.tsx@@ -41,7 +41,7 @@ export const NewControlPanel = ({className,}: ControlPanelProps) => {const isGraphSearchEnabled = useGetFlag(Flag.GRAPH_SEARCH);-+const {blockMenuSelected,setBlockMenuSelected,@@ -71,14 +71,14 @@ export const NewControlPanel = ({disabled: !history.canRedo(),},],- []+ [],);return (<sectionclassName={cn("absolute left-4 top-24 z-10 w-[4.25rem] overflow-hidden rounded-[1rem] border-none bg-white p-0 shadow-[0_1px_5px_0_rgba(0,0,0,0.1)]",- className+ className,)}><div className="flex flex-col items-center justify-center rounded-[1rem] p-0">diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NewControlPanel/useNewControlPanel.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NewControlPanel/useNewControlPanel.tsindex 50691c3527..90a5f3dfeb 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NewControlPanel/useNewControlPanel.ts+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NewControlPanel/useNewControlPanel.ts@@ -4,11 +4,14 @@ import { useSearchParams } from "next/navigation";import { useState } from "react";export interface NewControlPanelProps {- flowExecutionID: GraphExecutionID | undefined;- visualizeBeads: "no" | "static" | "animate";+ flowExecutionID: GraphExecutionID | undefined;+ visualizeBeads: "no" | "static" | "animate";}-export const useNewControlPanel = ({flowExecutionID, visualizeBeads}: NewControlPanelProps) => {+export const useNewControlPanel = ({+ flowExecutionID,+ visualizeBeads,+}: NewControlPanelProps) => {const [blockMenuSelected, setBlockMenuSelected] = useState<"save" | "block" | "search" | "">("");@@ -16,8 +19,23 @@ export const useNewControlPanel = ({flowExecutionID, visualizeBeads}: NewControlconst _graphVersion = query.get("flowVersion");const graphVersion = _graphVersion ? parseInt(_graphVersion) : undefined;- const flowID = query.get("flowID") as GraphID | null ?? undefined;- const {agentDescription, setAgentDescription, saveAgent, agentName, setAgentName, savedAgent, isSaving, isRunning, isStopping} = useAgentGraph(flowID, graphVersion, flowExecutionID, visualizeBeads !== "no")+ const flowID = (query.get("flowID") as GraphID | null) ?? undefined;+ const {+ agentDescription,+ setAgentDescription,+ saveAgent,+ agentName,+ setAgentName,+ savedAgent,+ isSaving,+ isRunning,+ isStopping,+ } = useAgentGraph(+ flowID,+ graphVersion,+ flowExecutionID,+ visualizeBeads !== "no",+ );return {blockMenuSelected,@@ -31,5 +49,5 @@ export const useNewControlPanel = ({flowExecutionID, visualizeBeads}: NewControlisSaving,isRunning,isStopping,- }-};\ No newline at end of file+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NoSearchResult.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NoSearchResult.tsxindex a6e14a9b85..ec69e89c20 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NoSearchResult.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/NoSearchResult.tsx@@ -14,4 +14,4 @@ export const NoSearchResult = () => {</div></div>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedBlocksContent/PaginatedBlocksContent.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedBlocksContent/PaginatedBlocksContent.tsxnew file mode 100644index 0000000000..e66e81799b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedBlocksContent/PaginatedBlocksContent.tsx@@ -0,0 +1,56 @@+import React from "react";+import { BlocksList } from "../BlockList/BlockList";+import { InfiniteScroll } from "@/components/contextual/InfiniteScroll/InfiniteScroll";+import { usePaginatedBlocks } from "./usePaginatedBlocks";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { blockMenuContainerStyle } from "../style";++interface PaginatedBlocksContentProps {+ type?: "all" | "input" | "action" | "output" | null;+}++export const PaginatedBlocksContent: React.FC<PaginatedBlocksContentProps> = ({+ type,+}) => {+ const {+ allBlocks: blocks,+ status,+ blocksLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ error,+ refetch,+ } = usePaginatedBlocks({+ type,+ });++ if (error) {+ return (+ <div className="h-full px-4">+ <ErrorCard+ isSuccess={false}+ httpError={{+ status: status,+ statusText: "Request failed",+ message: (error?.detail as string) || "An error occurred",+ }}+ responseError={error || undefined}+ context="block menu"+ onRetry={() => refetch()}+ />+ </div>+ );+ }++ return (+ <InfiniteScroll+ isFetchingNextPage={isFetchingNextPage}+ fetchNextPage={fetchNextPage}+ hasNextPage={hasNextPage}+ className={blockMenuContainerStyle}+ >+ <BlocksList blocks={blocks} loading={blocksLoading} />+ </InfiniteScroll>+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedBlocksContent/usePaginatedBlocks.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedBlocksContent/usePaginatedBlocks.tsnew file mode 100644index 0000000000..5348998021--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedBlocksContent/usePaginatedBlocks.ts@@ -0,0 +1,56 @@+import { useGetV2GetBuilderBlocksInfinite } from "@/app/api/__generated__/endpoints/default/default";+import { BlockResponse } from "@/app/api/__generated__/models/blockResponse";++interface UsePaginatedBlocksProps {+ type?: "all" | "input" | "action" | "output" | null;+}++const PAGE_SIZE = 10;+export const usePaginatedBlocks = ({ type }: UsePaginatedBlocksProps) => {+ const {+ data: blocks,+ fetchNextPage,+ hasNextPage,+ isFetchingNextPage,+ isLoading: blocksLoading,+ error,+ refetch,+ } = useGetV2GetBuilderBlocksInfinite(+ {+ page: 1,+ page_size: PAGE_SIZE,+ type,+ },+ {+ query: {+ getNextPageParam: (lastPage) => {+ const pagination = (lastPage.data as BlockResponse).pagination;+ const isMore =+ pagination.current_page * pagination.page_size <+ pagination.total_items;++ return isMore ? pagination.current_page + 1 : undefined;+ },+ },+ },+ );++ const allBlocks =+ blocks?.pages?.flatMap((page) => {+ const response = page.data as BlockResponse;+ return response.blocks;+ }) ?? [];++ const status = blocks?.pages[0]?.status;++ return {+ allBlocks,+ status,+ blocksLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ error,+ refetch,+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedIntegrationList/PaginatedIntegrationList.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedIntegrationList/PaginatedIntegrationList.tsxnew file mode 100644index 0000000000..4f634ab54c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedIntegrationList/PaginatedIntegrationList.tsx@@ -0,0 +1,68 @@+import React from "react";+import { Integration } from "../Integration";+import { useBlockMenuContext } from "../block-menu-provider";+import { InfiniteScroll } from "@/components/contextual/InfiniteScroll/InfiniteScroll";+import { usePaginatedIntegrationList } from "./usePaginatedIntegrationList";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { blockMenuContainerStyle } from "../style";++export const PaginatedIntegrationList = () => {+ const { setIntegration } = useBlockMenuContext();+ const {+ allProviders: providers,+ providersLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ error,+ status,+ refetch,+ } = usePaginatedIntegrationList();++ if (error) {+ return (+ <div className="h-full px-4">+ <ErrorCard+ isSuccess={false}+ responseError={error || undefined}+ context="block menu"+ httpError={{+ status: status,+ statusText: "Request failed",+ message: (error?.detail as string) || "An error occurred",+ }}+ onRetry={() => refetch()}+ />+ </div>+ );+ }+ if (providersLoading && providers.length === 0) {+ return (+ <div className={blockMenuContainerStyle}>+ {Array.from({ length: 6 }).map((_, integrationIndex) => (+ <Integration.Skeleton key={integrationIndex} />+ ))}+ </div>+ );+ }++ return (+ <InfiniteScroll+ isFetchingNextPage={isFetchingNextPage}+ fetchNextPage={fetchNextPage}+ hasNextPage={hasNextPage}+ className={blockMenuContainerStyle}+ >+ {providers.map((integration, index) => (+ <Integration+ key={integration.name + index}+ title={integration.name}+ icon_url={`/integrations/${integration.name}.png`}+ description={integration.description}+ number_of_blocks={integration.integration_count}+ onClick={() => setIntegration(integration.name)}+ />+ ))}+ </InfiniteScroll>+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedIntegrationList/usePaginatedIntegrationList.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedIntegrationList/usePaginatedIntegrationList.tsnew file mode 100644index 0000000000..cf84ed94eb--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/PaginatedIntegrationList/usePaginatedIntegrationList.ts@@ -0,0 +1,52 @@+import { useGetV2GetBuilderIntegrationProvidersInfinite } from "@/app/api/__generated__/endpoints/default/default";+import { ProviderResponse } from "@/app/api/__generated__/models/providerResponse";++const PAGE_SIZE = 10;++export const usePaginatedIntegrationList = () => {+ const {+ data: providers,+ fetchNextPage,+ hasNextPage,+ isFetchingNextPage,+ isLoading: providersLoading,+ error,+ refetch,+ } = useGetV2GetBuilderIntegrationProvidersInfinite(+ {+ page: 1,+ page_size: PAGE_SIZE,+ },+ {+ query: {+ getNextPageParam: (lastPage: any) => {+ const pagination = (lastPage.data as ProviderResponse).pagination;+ const isMore =+ pagination.current_page * pagination.page_size <+ pagination.total_items;++ return isMore ? pagination.current_page + 1 : undefined;+ },+ },+ },+ );++ const allProviders =+ providers?.pages?.flatMap((page: any) => {+ const response = page.data as ProviderResponse;+ return response.providers;+ }) ?? [];++ const status = providers?.pages[0]?.status;++ return {+ allProviders,+ providersLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ error,+ refetch,+ status,+ };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SaveControl/NewSaveControl.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SaveControl/NewSaveControl.tsxindex a7dfaa5a45..17eef8f0e2 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SaveControl/NewSaveControl.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SaveControl/NewSaveControl.tsx@@ -41,7 +41,6 @@ export const NewSaveControl = ({setBlockMenuSelected,pinSavePopover,}: SaveControlProps) => {-const handleSave = useCallback(() => {onSave();}, [onSave]);@@ -51,8 +50,8 @@ export const NewSaveControl = ({useEffect(() => {const handleKeyDown = (event: KeyboardEvent) => {if ((event.ctrlKey || event.metaKey) && event.key === "s") {- event.preventDefault();- handleSave();+ event.preventDefault();+ handleSave();toast({duration: 2000,title: "All changes saved successfully!",@@ -155,4 +154,4 @@ export const NewSaveControl = ({</PopoverContent></Popover>);-};\ No newline at end of file+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SearchHistoryChip.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SearchHistoryChip.tsxindex 8ad4888748..77cad6443a 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SearchHistoryChip.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SearchHistoryChip.tsx@@ -44,4 +44,4 @@ const SearchHistoryChipSkeleton: React.FC<{ className?: string }> = ({);};-SearchHistoryChip.Skeleton = SearchHistoryChipSkeleton;\ No newline at end of file+SearchHistoryChip.Skeleton = SearchHistoryChipSkeleton;diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SuggestionContent/SuggestionContent.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SuggestionContent/SuggestionContent.tsxnew file mode 100644index 0000000000..6e5b462554--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SuggestionContent/SuggestionContent.tsx@@ -0,0 +1,88 @@+import React from "react";+import { IntegrationChip } from "../IntegrationChip";+import { Block } from "../Block";+import { DefaultStateType, useBlockMenuContext } from "../block-menu-provider";+import { useSuggestionContent } from "./useSuggestionContent";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { blockMenuContainerStyle } from "../style";++export const SuggestionContent = () => {+ const { setIntegration, setDefaultState } = useBlockMenuContext();+ const { data, isLoading, isError, error, refetch } = useSuggestionContent();++ if (isError) {+ return (+ <div className="h-full p-4">+ <ErrorCard+ isSuccess={false}+ responseError={error || undefined}+ httpError={{+ status: data?.status,+ statusText: "Request failed",+ message: (error?.detail as string) || "An error occurred",+ }}+ context="block menu"+ onRetry={() => refetch()}+ />+ </div>+ );+ }++ const suggestions = data?.suggestions;++ return (+ <div className={blockMenuContainerStyle}>+ <div className="w-full space-y-6 pb-4">+ {/* Integrations */}+ <div className="space-y-2.5 px-4">+ <p className="font-sans text-sm font-medium leading-[1.375rem] text-zinc-800">+ Integrations+ </p>+ <div className="grid grid-cols-3 grid-rows-2 gap-2">+ {!isLoading && suggestions+ ? suggestions.providers.map((provider, index) => (+ <IntegrationChip+ key={`integration-${index}`}+ icon_url={`/integrations/${provider}.png`}+ name={provider}+ onClick={() => {+ setDefaultState(DefaultStateType.INTEGRATIONS);+ setIntegration(provider);+ }}+ />+ ))+ : Array(6)+ .fill(0)+ .map((_, index) => (+ <IntegrationChip.Skeleton+ key={`integration-skeleton-${index}`}+ />+ ))}+ </div>+ </div>++ {/* Top blocks */}+ <div className="space-y-2.5 px-4">+ <p className="font-sans text-sm font-medium leading-[1.375rem] text-zinc-800">+ Top blocks+ </p>+ <div className="space-y-2">+ {!isLoading && suggestions+ ? suggestions.top_blocks.map((block, index) => (+ <Block+ key={`block-${index}`}+ title={block.name}+ description={block.description}+ />+ ))+ : Array(3)+ .fill(0)+ .map((_, index) => (+ <Block.Skeleton key={`block-skeleton-${index}`} />+ ))}+ </div>+ </div>+ </div>+ </div>+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SuggestionContent/useSuggestionContent.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SuggestionContent/useSuggestionContent.tsnew file mode 100644index 0000000000..ec9e82626a--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/SuggestionContent/useSuggestionContent.ts@@ -0,0 +1,18 @@+import { useGetV2GetBuilderSuggestions } from "@/app/api/__generated__/endpoints/default/default";+import { SuggestionsResponse } from "@/app/api/__generated__/models/suggestionsResponse";++export const useSuggestionContent = () => {+ const { data, isLoading, isError, error, refetch } =+ useGetV2GetBuilderSuggestions({+ query: {+ select: (x) => {+ return {+ suggestions: x.data as SuggestionsResponse,+ status: x.status,+ };+ },+ },+ });++ return { data, isLoading, isError, error, refetch };+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/UGCAgentBlock.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/UGCAgentBlock.tsxindex 2dd3296a11..96f6519a1e 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/UGCAgentBlock.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/UGCAgentBlock.tsx@@ -11,7 +11,7 @@ interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {title?: string;edited_time?: Date;version?: number;- image_url?: string;+ image_url: string | null;highlightedText?: string;}@@ -114,4 +114,4 @@ const UGCAgentBlockSkeleton: React.FC<{ className?: string }> = ({);};-UGCAgentBlock.Skeleton = UGCAgentBlockSkeleton;\ No newline at end of file+UGCAgentBlock.Skeleton = UGCAgentBlockSkeleton;diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/block-menu-provider.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/block-menu-provider.tsxindex 469a788930..7d31707c11 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/block-menu-provider.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/block-menu-provider.tsx@@ -2,16 +2,16 @@import { createContext, ReactNode, useContext, useState } from "react";-export type DefaultStateType =- | "suggestion"- | "all_blocks"- | "input_blocks"- | "action_blocks"- | "output_blocks"- | "integrations"- | "marketplace_agents"- | "my_agents";-+export enum DefaultStateType {+ SUGGESTION = "suggestion",+ ALL_BLOCKS = "all_blocks",+ INPUT_BLOCKS = "input_blocks",+ ACTION_BLOCKS = "action_blocks",+ OUTPUT_BLOCKS = "output_blocks",+ INTEGRATIONS = "integrations",+ MARKETPLACE_AGENTS = "marketplace_agents",+ MY_AGENTS = "my_agents",+}interface BlockMenuContextType {searchQuery: string;@@ -20,7 +20,9 @@ interface BlockMenuContextType {setSearchId: React.Dispatch<React.SetStateAction<string | undefined>>;defaultState: DefaultStateType;setDefaultState: React.Dispatch<React.SetStateAction<DefaultStateType>>;-}+ integration: string | undefined;+ setIntegration: React.Dispatch<React.SetStateAction<string | undefined>>;+}export const BlockMenuContext = createContext<BlockMenuContextType>({} as BlockMenuContextType,@@ -35,7 +37,10 @@ export function BlockMenuStateProvider({}: BlockMenuStateProviderProps) {const [searchQuery, setSearchQuery] = useState("");const [searchId, setSearchId] = useState<string | undefined>(undefined);- const [defaultState, setDefaultState] = useState<DefaultStateType>("suggestion");+ const [defaultState, setDefaultState] = useState<DefaultStateType>(+ DefaultStateType.SUGGESTION,+ );+ const [integration, setIntegration] = useState<string | undefined>(undefined);return (<BlockMenuContext.Provider@@ -46,6 +51,8 @@ export function BlockMenuStateProvider({setSearchId,defaultState,setDefaultState,+ integration,+ setIntegration,}}>{children}@@ -61,4 +68,4 @@ export function useBlockMenuContext(): BlockMenuContextType {);}return context;-}\ No newline at end of file+}diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/helpers.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/helpers.tsxindex 8643b4650a..1124c881c7 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/helpers.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/helpers.tsx@@ -1,22 +1,22 @@export const highlightText = (- text: string | undefined,- highlight: string | undefined,- ) => {- if (!text || !highlight) return text;-- function escapeRegExp(s: string) {- return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");- }-- const escaped = escapeRegExp(highlight);- const parts = text.split(new RegExp(`(${escaped})`, "gi"));- return parts.map((part, i) =>- part.toLowerCase() === highlight?.toLowerCase() ? (- <mark key={i} className="bg-transparent font-bold">- {part}- </mark>- ) : (- part- ),- );- };\ No newline at end of file+ text: string | undefined,+ highlight: string | undefined,+) => {+ if (!text || !highlight) return text;++ function escapeRegExp(s: string) {+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");+ }++ const escaped = escapeRegExp(highlight);+ const parts = text.split(new RegExp(`(${escaped})`, "gi"));+ return parts.map((part, i) =>+ part.toLowerCase() === highlight?.toLowerCase() ? (+ <mark key={i} className="bg-transparent font-bold">+ {part}+ </mark>+ ) : (+ part+ ),+ );+};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/style.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/style.tsnew file mode 100644index 0000000000..ecac86337b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/NewBlockMenu/style.ts@@ -0,0 +1,2 @@+export const blockMenuContainerStyle =+ "scrollbar-thin scrollbar-thumb-zinc-300 scrollbar-track-transparent w-full px-4 pb-4 space-y-3 h-full overflow-y-auto pt-4 transition-all duration-200";