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.
fix(frontend): publish agent modal refactor + improvements (#10479)
Ubbef542995a15ac
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTable/AgentTable.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTable/AgentTable.tsxindex 81d3896f49..bef83c53ab 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTable/AgentTable.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTable/AgentTable.tsx@@ -3,7 +3,6 @@import * as React from "react";import { AgentTableCard } from "../AgentTableCard/AgentTableCard";import { StoreSubmissionRequest } from "@/app/api/__generated__/models/storeSubmissionRequest";-import { useAgentTable } from "./useAgentTable";import {AgentTableRow,AgentTableRowProps,@@ -26,37 +25,13 @@ export const AgentTable: React.FC<AgentTableProps> = ({onEditSubmission,onDeleteSubmission,}) => {- const { selectedAgents, handleSelectAll, setSelectedAgents } = useAgentTable({- agents,- });-return (<div className="w-full">{/* Table header - Hide on mobile */}<div className="hidden flex-col md:flex"><div className="border-t border-neutral-300 dark:border-neutral-700" /><div className="flex items-center px-4 py-2">- <div className="flex items-center">- <div className="flex min-w-[120px] items-center">- <input- type="checkbox"- id="selectAllAgents"- aria-label="Select all agents"- className="mr-4 h-5 w-5 rounded border-2 border-neutral-400 dark:border-neutral-600"- checked={- selectedAgents.size === agents.length && agents.length > 0- }- onChange={handleSelectAll}- />- <label- htmlFor="selectAllAgents"- className="text-sm font-medium text-neutral-800 dark:text-neutral-200"- >- Select all- </label>- </div>- </div>- <div className="ml-2 grid w-full grid-cols-[400px,150px,150px,100px,100px,50px] items-center">+ <div className="grid w-full grid-cols-[minmax(400px,1fr),180px,140px,100px,100px,40px] items-center gap-4"><div className="text-sm font-medium text-neutral-800 dark:text-neutral-200">Agent info</div>@@ -85,8 +60,6 @@ export const AgentTable: React.FC<AgentTableProps> = ({<div key={agent.id} className="md:block"><AgentTableRow{...agent}- selectedAgents={selectedAgents}- setSelectedAgents={setSelectedAgents}onEditSubmission={onEditSubmission}onDeleteSubmission={onDeleteSubmission}/>diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTable/useAgentTable.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTable/useAgentTable.tsdeleted file mode 100644index 13d6fa8518..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTable/useAgentTable.ts+++ /dev/null@@ -1,25 +0,0 @@-import { useState } from "react";-import { AgentTableRowProps } from "../AgentTableRow/AgentTableRow";--interface useAgentTableProps {- agents: Omit<- AgentTableRowProps,- | "setSelectedAgents"- | "selectedAgents"- | "onEditSubmission"- | "onDeleteSubmission"- >[];-}--export const useAgentTable = ({ agents }: useAgentTableProps) => {- const [selectedAgents, setSelectedAgents] = useState<Set<string>>(new Set());-- const handleSelectAll = (e: React.ChangeEvent<HTMLInputElement>) => {- if (e.target.checked) {- setSelectedAgents(new Set(agents.map((agent) => agent.agent_id)));- } else {- setSelectedAgents(new Set());- }- };- return { selectedAgents, handleSelectAll, setSelectedAgents };-};diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/AgentTableRow.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/AgentTableRow.tsxindex 030552ed8c..80a4d40f7f 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/AgentTableRow.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/AgentTableRow.tsx@@ -1,6 +1,7 @@"use client";import Image from "next/image";+import { Text } from "@/components/atoms/Text/Text";import { IconStarFilled, IconMore, IconEdit } from "@/components/ui/icons";import * as DropdownMenu from "@radix-ui/react-dropdown-menu";import { TrashIcon } from "@radix-ui/react-icons";@@ -21,8 +22,6 @@ export interface AgentTableRowProps {rating: number;dateSubmitted: string;id: number;- selectedAgents: Set<string>;- setSelectedAgents: React.Dispatch<React.SetStateAction<Set<string>>>;onEditSubmission: (submission: StoreSubmissionRequest) => void;onDeleteSubmission: (submission_id: string) => void;}@@ -39,45 +38,23 @@ export const AgentTableRow = ({runs,rating,id,- selectedAgents,- setSelectedAgents,onEditSubmission,onDeleteSubmission,}: AgentTableRowProps) => {- const { checkboxId, handleEdit, handleDelete, handleCheckboxChange } =- useAgentTableRow({- id,- onEditSubmission,- onDeleteSubmission,- agent_id,- agent_version,- agentName,- sub_heading,- description,- imageSrc,- selectedAgents,- setSelectedAgents,- });+ const { handleEdit, handleDelete } = useAgentTableRow({+ id,+ onEditSubmission,+ onDeleteSubmission,+ agent_id,+ agent_version,+ agentName,+ sub_heading,+ description,+ imageSrc,+ });return (<div className="hidden items-center border-b border-neutral-300 px-4 py-4 hover:bg-neutral-50 dark:border-neutral-700 dark:hover:bg-neutral-800 md:flex">- <div className="flex items-center">- <div className="flex items-center">- <input- type="checkbox"- id={checkboxId}- aria-label={`Select ${agentName}`}- className="mr-4 h-5 w-5 rounded border-2 border-neutral-400 dark:border-neutral-600"- checked={selectedAgents.has(agent_id)}- onChange={handleCheckboxChange}- />- {/* Single label instead of multiple */}- <label htmlFor={checkboxId} className="sr-only">- Select {agentName}- </label>- </div>- </div>-<div className="grid w-full grid-cols-[minmax(400px,1fr),180px,140px,100px,100px,40px] items-center gap-4">{/* Agent info column */}<div className="flex items-center gap-4">@@ -90,12 +67,19 @@ export const AgentTableRow = ({/></div><div className="flex flex-col">- <h3 className="text-[15px] font-medium text-neutral-800 dark:text-neutral-200">+ <Text+ variant="h3"+ className="line-clamp-1 text-neutral-800 dark:text-neutral-200"+ size="large-medium"+ >{agentName}- </h3>- <p className="line-clamp-2 text-sm text-neutral-600 dark:text-neutral-400">+ </Text>+ <Text+ variant="body"+ className="text-neutral-600 dark:text-neutral-400"+ >{description}- </p>+ </Text></div></div>@@ -105,7 +89,7 @@ export const AgentTableRow = ({</div>{/* Status column */}- <div>+ <div data-testid="agent-status"><Status status={status} /></div>@@ -134,9 +118,7 @@ export const AgentTableRow = ({<div className="flex justify-end"><DropdownMenu.Root><DropdownMenu.Trigger>- <button className="rounded-full p-1 hover:bg-neutral-100 dark:hover:bg-neutral-700">- <IconMore className="h-5 w-5 text-neutral-800 dark:text-neutral-200" />- </button>+ <IconMore className="h-5 w-5 text-neutral-800 dark:text-neutral-200" /></DropdownMenu.Trigger><DropdownMenu.Content className="z-10 rounded-xl border bg-white p-1 shadow-md dark:bg-gray-800"><DropdownMenu.Itemdiff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/useAgentTableRow.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/useAgentTableRow.tsindex 1cb0f2c520..b043b46a3b 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/useAgentTableRow.ts+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/useAgentTableRow.ts@@ -10,12 +10,9 @@ interface useAgentTableRowProps {sub_heading: string;description: string;imageSrc: string[];- selectedAgents: Set<string>;- setSelectedAgents: React.Dispatch<React.SetStateAction<Set<string>>>;}export const useAgentTableRow = ({- id,onEditSubmission,onDeleteSubmission,agent_id,@@ -24,11 +21,7 @@ export const useAgentTableRow = ({sub_heading,description,imageSrc,- selectedAgents,- setSelectedAgents,}: useAgentTableRowProps) => {- const checkboxId = `agent-${id}-checkbox`;-const handleEdit = () => {onEditSubmission({agent_id,@@ -46,14 +39,5 @@ export const useAgentTableRow = ({onDeleteSubmission(agent_id);};- const handleCheckboxChange = () => {- if (selectedAgents.has(agent_id)) {- selectedAgents.delete(agent_id);- } else {- selectedAgents.add(agent_id);- }- setSelectedAgents(new Set(selectedAgents));- };-- return { checkboxId, handleEdit, handleDelete, handleCheckboxChange };+ return { handleEdit, handleDelete };};diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/MainDashboardPage.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/MainDashboardPage.tsxindex b72bc66084..853f7eab19 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/MainDashboardPage.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/MainDashboardPage.tsx@@ -1,56 +1,57 @@-import { PublishAgentPopout } from "@/components/agptui/composite/PublishAgentPopout";-import { Button } from "@/components/ui/button";import { useMainDashboardPage } from "./useMainDashboardPage";import { Separator } from "@/components/ui/separator";import { AgentTable } from "../AgentTable/AgentTable";import { StatusType } from "@/components/agptui/Status";+import { PublishAgentModal } from "@/components/contextual/PublishAgentModal/PublishAgentModal";+import { Button } from "@/components/atoms/Button/Button";+import { EmptySubmissions } from "./components/EmptySubmissions";+import { SubmissionLoadError } from "./components/SumbmissionLoadError";+import { SubmissionsLoading } from "./components/SubmissionsLoading";+import { Text } from "@/components/atoms/Text/Text";export const MainDashboardPage = () => {const {- onOpenPopout,onDeleteSubmission,onEditSubmission,+ onOpenSubmitModal,+ onPublishStateChange,+ publishState,+ // API datasubmissions,isLoading,- openPopout,- submissionData,- popoutStep,+ error,} = useMainDashboardPage();- if (isLoading) {- return "Loading....";- }-return (<main className="flex-1 py-8">{/* Header Section */}<div className="mb-8 flex flex-col gap-4 md:flex-row md:items-end md:justify-between"><div className="space-y-6">- <h1 className="text-4xl font-medium text-neutral-900 dark:text-neutral-100">+ <Text variant="h1" size="h3">Agent dashboard- </h1>+ </Text><div className="space-y-2">- <h2 className="text-xl font-medium text-neutral-900 dark:text-neutral-100">+ <Text+ variant="h2"+ size="large-medium"+ className="text-neutral-900 dark:text-neutral-100"+ >Submit a New Agent- </h2>- <p className="text-sm text-[#707070] dark:text-neutral-400">+ </Text>+ <Text variant="body" size="small">Select from the list of agents you currently have, or upload fromyour local machine.- </p>+ </Text></div></div>- <PublishAgentPopout+ <PublishAgentModal+ targetState={publishState}+ onStateChange={onPublishStateChange}trigger={- <Button- onClick={onOpenPopout}- className="h-9 rounded-full bg-black px-4 text-sm font-medium text-white hover:bg-neutral-700 dark:hover:bg-neutral-600"- >+ <Button size="small" onClick={onOpenSubmitModal}>Submit agent</Button>}- openPopout={openPopout}- inputStep={popoutStep}- submissionData={submissionData}/></div>@@ -58,32 +59,41 @@ export const MainDashboardPage = () => {{/* Agents Section */}<div>- <h2 className="mb-4 text-xl font-bold text-neutral-900 dark:text-neutral-100">+ <Text+ variant="h2"+ size="large-medium"+ className="mb-4 text-neutral-900 dark:text-neutral-100"+ >Your uploaded agents- </h2>- {submissions && (+ </Text>++ {error ? (+ <SubmissionLoadError />+ ) : isLoading ? (+ <SubmissionsLoading />+ ) : submissions && submissions.submissions.length > 0 ? (<AgentTable- agents={- submissions?.submissions.map((submission, index) => ({- id: index,- agent_id: submission.agent_id,- agent_version: submission.agent_version,- sub_heading: submission.sub_heading,- date_submitted: submission.date_submitted,- agentName: submission.name,- description: submission.description,- imageSrc: submission.image_urls || [""],- dateSubmitted: new Date(- submission.date_submitted,- ).toLocaleDateString(),- status: submission.status.toLowerCase() as StatusType,- runs: submission.runs,- rating: submission.rating,- })) || []- }+ agents={submissions.submissions.map((submission, index) => ({+ id: index,+ agent_id: submission.agent_id,+ agent_version: submission.agent_version,+ sub_heading: submission.sub_heading,+ date_submitted: submission.date_submitted,+ agentName: submission.name,+ description: submission.description,+ imageSrc: submission.image_urls || [""],+ dateSubmitted: new Date(+ submission.date_submitted,+ ).toLocaleDateString(),+ status: submission.status.toLowerCase() as StatusType,+ runs: submission.runs,+ rating: submission.rating,+ }))}onEditSubmission={onEditSubmission}onDeleteSubmission={onDeleteSubmission}/>+ ) : (+ <EmptySubmissions />)}</div></main>diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/EmptySubmissions.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/EmptySubmissions.tsxnew file mode 100644index 0000000000..d0841f0138--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/EmptySubmissions.tsx@@ -0,0 +1,30 @@+import { Tray } from "@phosphor-icons/react/dist/ssr";+import { Text } from "@/components/atoms/Text/Text";++export function EmptySubmissions() {+ return (+ <div className="flex min-h-[400px] flex-col items-center justify-center rounded-lg border border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50">+ <div className="flex flex-col items-center gap-4 text-center">+ <div className="rounded-full bg-neutral-100 p-3 dark:bg-neutral-700">+ <Tray className="h-8 w-8 text-neutral-500 dark:text-neutral-400" />+ </div>+ <div className="space-y-2">+ <Text+ variant="large-medium"+ className="text-neutral-900 dark:text-neutral-100"+ >+ No agents submitted yet+ </Text>+ <Text+ variant="body"+ className="text-neutral-600 dark:text-neutral-400"+ >+ You haven't submitted any agents to the store yet.+ <br />+ Click “Submit agent” above to get started.+ </Text>+ </div>+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/SubmissionsLoading.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/SubmissionsLoading.tsxnew file mode 100644index 0000000000..68b2d47b04--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/SubmissionsLoading.tsx@@ -0,0 +1,27 @@+import { Skeleton } from "@/components/ui/skeleton";++export function SubmissionsLoading() {+ return (+ <div className="space-y-4">+ {Array.from({ length: 3 }).map((_, i) => (+ <div+ key={i}+ className="rounded-lg border border-neutral-200 p-4 dark:border-neutral-700"+ >+ <div className="flex items-center gap-4">+ <Skeleton className="h-16 w-16 rounded-lg" />+ <div className="flex-1 space-y-2">+ <Skeleton className="h-5 w-3/4" />+ <Skeleton className="h-4 w-1/2" />+ <Skeleton className="h-4 w-1/4" />+ </div>+ <div className="flex gap-2">+ <Skeleton className="h-8 w-16" />+ <Skeleton className="h-8 w-16" />+ </div>+ </div>+ </div>+ ))}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/SumbmissionLoadError.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/SumbmissionLoadError.tsxnew file mode 100644index 0000000000..70184b7c5a--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/components/SumbmissionLoadError.tsx@@ -0,0 +1,36 @@+import { Tray } from "@phosphor-icons/react";+import { Text } from "@/components/atoms/Text/Text";+import { Button } from "@/components/atoms/Button/Button";++export function SubmissionLoadError() {+ return (+ <div className="flex min-h-[400px] flex-col items-center justify-center rounded-lg border border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50">+ <div className="flex flex-col items-center gap-4 text-center">+ <div className="rounded-full bg-red-100 p-3 dark:bg-red-900/20">+ <Tray className="h-8 w-8 text-red-600 dark:text-red-400" />+ </div>+ <div className="space-y-2">+ <Text+ variant="large-medium"+ className="text-neutral-900 dark:text-neutral-100"+ >+ Failed to load agents+ </Text>+ <Text+ variant="body"+ className="text-neutral-600 dark:text-neutral-400"+ >+ Something went wrong while loading your submitted agents.+ </Text>+ </div>+ <Button+ variant="secondary"+ size="small"+ onClick={() => window.location.reload()}+ >+ Try again+ </Button>+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/useMainDashboardPage.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/useMainDashboardPage.tsindex 46340ba27f..bfda3ac35f 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/useMainDashboardPage.ts+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/useMainDashboardPage.ts@@ -9,16 +9,24 @@ import { getQueryClient } from "@/lib/react-query/queryClient";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";import { useState } from "react";+type PublishStep = "select" | "info" | "review";++type PublishState = {+ isOpen: boolean;+ step: PublishStep;+ submissionData: StoreSubmissionRequest | null;+};+export const useMainDashboardPage = () => {const queryClient = getQueryClient();const { user } = useSupabase();- const [openPopout, setOpenPopout] = useState<boolean>(false);- const [submissionData, setSubmissionData] =- useState<StoreSubmissionRequest>();- const [popoutStep, setPopoutStep] = useState<"select" | "info" | "review">(- "info",- );++ const [publishState, setPublishState] = useState<PublishState>({+ isOpen: false,+ step: "select",+ submissionData: null,+ });const { mutateAsync: deleteSubmission } = useDeleteV2DeleteStoreSubmission({mutation: {@@ -30,22 +38,25 @@ export const useMainDashboardPage = () => {},});- const { data: submissions, isLoading } = useGetV2ListMySubmissions(- undefined,- {- query: {- select: (x) => {- return x.data as StoreSubmissionsResponse;- },- enabled: !!user,+ const {+ data: submissions,+ isSuccess,+ error,+ } = useGetV2ListMySubmissions(undefined, {+ query: {+ select: (x) => {+ return x.data as StoreSubmissionsResponse;},+ enabled: !!user,},- );+ });const onEditSubmission = (submission: StoreSubmissionRequest) => {- setSubmissionData(submission);- setPopoutStep("review");- setOpenPopout(true);+ setPublishState({+ isOpen: true,+ step: "review",+ submissionData: submission,+ });};const onDeleteSubmission = async (submission_id: string) => {@@ -54,19 +65,28 @@ export const useMainDashboardPage = () => {});};- const onOpenPopout = () => {- setPopoutStep("select");- setOpenPopout(true);+ const onOpenSubmitModal = () => {+ // Always reset to clean state when opening for new submission+ setPublishState({+ isOpen: true,+ step: "select",+ submissionData: null,+ });+ };++ const onPublishStateChange = (newState: PublishState) => {+ setPublishState(newState);};return {- onOpenPopout,+ onOpenSubmitModal,+ onPublishStateChange,onDeleteSubmission,onEditSubmission,+ publishState,+ // API datasubmissions,- isLoading,- openPopout,- submissionData,- popoutStep,+ isLoading: !isSuccess,+ error,};};diff --git a/autogpt_platform/frontend/src/components/agptui/BecomeACreator.tsx b/autogpt_platform/frontend/src/components/agptui/BecomeACreator.tsxindex cea48b63d7..954ac1dd33 100644--- a/autogpt_platform/frontend/src/components/agptui/BecomeACreator.tsx+++ b/autogpt_platform/frontend/src/components/agptui/BecomeACreator.tsx@@ -1,24 +1,19 @@"use client";import * as React from "react";-import { PublishAgentPopout } from "./composite/PublishAgentPopout";+import { PublishAgentModal } from "../contextual/PublishAgentModal/PublishAgentModal";+interface BecomeACreatorProps {title?: string;description?: string;buttonText?: string;- onButtonClick?: () => void;}-export const BecomeACreator: React.FC<BecomeACreatorProps> = ({+export function BecomeACreator({title = "Become a creator",description = "Join a community where your AI creations can inspire, engage, and be downloaded by users around the world.",buttonText = "Upload your agent",- onButtonClick,-}) => {- const handleButtonClick = () => {- onButtonClick?.();- };-+}: BecomeACreatorProps) {return (<div className="relative mx-auto h-auto min-h-[300px] w-full max-w-[1360px] md:min-h-[400px] lg:h-[459px]">{/* Title */}@@ -41,12 +36,9 @@ export const BecomeACreator: React.FC<BecomeACreatorProps> = ({{description}</p>- <PublishAgentPopout+ <PublishAgentModaltrigger={- <button- onClick={handleButtonClick}- className="inline-flex h-[48px] cursor-pointer items-center justify-center rounded-[38px] bg-neutral-800 px-8 py-3 transition-colors hover:bg-neutral-700 dark:bg-neutral-700 dark:hover:bg-neutral-600 md:h-[56px] md:px-10 md:py-4 lg:h-[68px] lg:px-12 lg:py-5"- >+ <button className="inline-flex h-[48px] cursor-pointer items-center justify-center rounded-[38px] bg-neutral-800 px-8 py-3 transition-colors hover:bg-neutral-700 dark:bg-neutral-700 dark:hover:bg-neutral-600 md:h-[56px] md:px-10 md:py-4 lg:h-[68px] lg:px-12 lg:py-5"><span className="whitespace-nowrap font-poppins text-base font-medium leading-normal text-neutral-50 md:text-lg md:leading-relaxed lg:text-xl lg:leading-7">{buttonText}</span>@@ -56,4 +48,4 @@ export const BecomeACreator: React.FC<BecomeACreatorProps> = ({</div></div>);-};+}diff --git a/autogpt_platform/frontend/src/components/agptui/PublishAgentAwaitingReview.tsx b/autogpt_platform/frontend/src/components/agptui/PublishAgentAwaitingReview.tsxdeleted file mode 100644index 07b792af1f..0000000000--- a/autogpt_platform/frontend/src/components/agptui/PublishAgentAwaitingReview.tsx+++ /dev/null@@ -1,116 +0,0 @@-"use client";--import * as React from "react";-import { IconCross } from "../ui/icons";-import Image from "next/image";-import { Button } from "../agptui/Button";--interface PublishAgentAwaitingReviewProps {- agentName: string;- subheader: string;- description: string;- thumbnailSrc?: string;- onClose: () => void;- onDone: () => void;- onViewProgress: () => void;-}--export const PublishAgentAwaitingReview: React.FC<- PublishAgentAwaitingReviewProps-> = ({- agentName,- subheader,- description,- thumbnailSrc,- onClose,- onDone,- onViewProgress,-}) => {- return (- <div- className="inline-flex min-h-screen w-full flex-col items-center justify-center rounded-none bg-white dark:bg-neutral-900 sm:h-auto sm:min-h-[824px] sm:rounded-3xl"- role="dialog"- aria-labelledby="modal-title"- >- <div className="relative h-[180px] w-full rounded-none bg-white dark:bg-neutral-800 sm:h-[140px] sm:rounded-t-3xl">- <div className="absolute left-0 top-[40px] flex w-full flex-col items-center justify-start px-6 sm:top-[40px]">- <div- id="modal-title"- className="mb-4 text-center font-poppins text-xl font-semibold leading-relaxed text-neutral-900 dark:text-neutral-100 sm:mb-2 sm:text-2xl"- >- Agent is awaiting review- </div>- <div className="max-w-[280px] text-center font-sans text-sm font-normal leading-relaxed text-slate-500 dark:text-slate-400 sm:max-w-none">- In the meantime you can check your progress on your Creator- Dashboard page- </div>- </div>- <button- onClick={onClose}- className="absolute right-4 top-4 flex h-[38px] w-[38px] items-center justify-center rounded-full bg-gray-100 transition-colors hover:bg-gray-200 dark:bg-neutral-700 dark:hover:bg-neutral-600"- aria-label="Close dialog"- >- <IconCross- size="default"- className="text-neutral-600 dark:text-neutral-300"- />- </button>- </div>-- <div className="flex flex-1 flex-col items-center gap-8 px-6 py-6 sm:gap-6">- <div className="mt-4 flex w-full flex-col items-center gap-6 sm:mt-0 sm:gap-4">- <div className="flex flex-col items-center gap-3 sm:gap-2">- <div className="text-center font-sans text-lg font-semibold leading-7 text-neutral-800 dark:text-neutral-200">- {agentName}- </div>- <div className="max-w-[280px] text-center font-sans text-base font-normal leading-normal text-neutral-600 dark:text-neutral-400 sm:max-w-none">- {subheader}- </div>- </div>-- <div- className="h-[280px] w-full rounded-xl bg-neutral-200 dark:bg-neutral-700 sm:h-[350px]"- role="img"- aria-label={- thumbnailSrc ? "Agent thumbnail" : "Thumbnail placeholder"- }- >- {thumbnailSrc && (- <Image- src={thumbnailSrc}- alt="Agent thumbnail"- width={500}- height={350}- className="h-full w-full rounded-xl object-cover"- />- )}- </div>-- <div- className="h-[150px] w-full overflow-y-auto font-sans text-base font-normal leading-normal text-neutral-600 dark:text-neutral-400 sm:h-[180px]"- tabIndex={0}- role="region"- aria-label="Agent description"- >- {description}- </div>- </div>- </div>-- <div className="flex w-full flex-col items-center justify-center gap-4 border-t border-slate-200 p-6 dark:border-slate-700 sm:flex-row">- <Button- onClick={onDone}- className="h-12 w-full rounded-[59px] sm:flex-1"- >- Done- </Button>- <Button- onClick={onViewProgress}- className="h-12 w-full rounded-[59px] bg-neutral-800 text-white hover:bg-neutral-900 dark:bg-neutral-700 dark:text-neutral-100 dark:hover:bg-neutral-600 sm:flex-1"- >- View progress- </Button>- </div>- </div>- );-};diff --git a/autogpt_platform/frontend/src/components/agptui/PublishAgentSelect.tsx b/autogpt_platform/frontend/src/components/agptui/PublishAgentSelect.tsxdeleted file mode 100644index f999ceb15b..0000000000--- a/autogpt_platform/frontend/src/components/agptui/PublishAgentSelect.tsx+++ /dev/null@@ -1,174 +0,0 @@-"use client";--import * as React from "react";-import Image from "next/image";-import { Button } from "../agptui/Button";-import { IconCross } from "../ui/icons";--export interface Agent {- name: string;- id: string;- version: number;- lastEdited: string;- imageSrc: string;-}--interface PublishAgentSelectProps {- agents: Agent[];- onSelect: (agentId: string, agentVersion: number) => void;- onCancel: () => void;- onNext: (agentId: string, agentVersion: number) => void;- onClose: () => void;- onOpenBuilder: () => void;- onListScroll?: (e: React.UIEvent<HTMLDivElement>) => void;-}--export const PublishAgentSelect: React.FC<PublishAgentSelectProps> = ({- agents,- onSelect,- onCancel,- onNext,- onClose,- onOpenBuilder,- onListScroll,-}) => {- const [selectedAgentId, setSelectedAgentId] = React.useState<string | null>(- null,- );- const [selectedAgentVersion, setSelectedAgentVersion] = React.useState<- number | null- >(null);-- const handleAgentClick = (- agentName: string,- agentId: string,- agentVersion: number,- ) => {- setSelectedAgentId(agentId);- setSelectedAgentVersion(agentVersion);- onSelect(agentId, agentVersion);- };-- return (- <div className="mx-auto flex w-full max-w-[900px] flex-col rounded-3xl bg-white shadow-lg dark:bg-gray-800">- <div className="relative border-b border-slate-200 p-4 dark:border-slate-700 sm:p-6">- <div className="absolute right-4 top-4">- <button- onClick={onClose}- className="flex h-8 w-8 items-center justify-center rounded-full bg-gray-100 transition-colors hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600"- aria-label="Close"- >- <IconCross- size="default"- className="text-neutral-600 dark:text-neutral-400"- />- </button>- </div>- <div className="text-center">- <h3 className="font-poppins text-2xl font-semibold text-neutral-900 dark:text-neutral-100">- Publish Agent- </h3>- <p className="text-sm font-normal text-neutral-600 dark:text-neutral-400">- Select your project that you'd like to publish- </p>- </div>- </div>-- {agents.length === 0 ? (- <div className="inline-flex h-[370px] flex-col items-center justify-center gap-[29px] px-4 py-5 sm:px-6">- <div className="w-full text-center font-sans text-lg font-normal leading-7 text-neutral-600 dark:text-neutral-400 sm:w-[573px] sm:text-xl">- Uh-oh.. It seems like you don't have any agents in your- library.- <br />- We'd suggest you to create an agent in our builder first- </div>- <Button- onClick={onOpenBuilder}- size="lg"- className="bg-neutral-800 text-white hover:bg-neutral-900"- >- Open builder- </Button>- </div>- ) : (- <>- <div className="flex-grow overflow-hidden p-4 sm:p-6">- <h3 className="sr-only">List of agents</h3>- <div- className="h-[300px] overflow-y-auto overscroll-contain pr-2 sm:h-[400px] md:h-[500px]"- role="region"- aria-labelledby="agentListHeading"- onScroll={onListScroll}- onWheel={(e) => e.stopPropagation()}- >- <div id="agentListHeading" className="sr-only">- Scrollable list of agents- </div>- <div className="p-2">- <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">- {agents.map((agent) => (- <div- key={agent.id}- className={`cursor-pointer overflow-hidden rounded-2xl transition-all ${- selectedAgentId === agent.id- ? "shadow-lg ring-4 ring-violet-600"- : "hover:shadow-md"- }`}- onClick={() =>- handleAgentClick(agent.name, agent.id, agent.version)- }- onKeyDown={(e) => {- if (e.key === "Enter" || e.key === " ") {- e.preventDefault();- handleAgentClick(agent.name, agent.id, agent.version);- }- }}- tabIndex={0}- role="button"- aria-pressed={selectedAgentId === agent.id}- >- <div className="relative h-32 bg-gray-100 dark:bg-gray-700 sm:h-40">- <Image- src={agent.imageSrc}- alt={agent.name}- fill- style={{ objectFit: "cover" }}- />- </div>- <div className="p-3">- <p className="font-poppins text-base font-medium leading-normal text-neutral-800 dark:text-neutral-100 sm:text-base">- {agent.name}- </p>- <small className="text-xs font-normal leading-[14px] text-neutral-500 dark:text-neutral-400 sm:text-sm">- Edited {agent.lastEdited}- </small>- </div>- </div>- ))}- </div>- </div>- </div>- </div>-- <div className="flex justify-between gap-4 border-t border-slate-200 p-4 dark:border-slate-700 sm:p-6">- <Button onClick={onCancel} size="lg" className="w-full sm:flex-1">- Back- </Button>- <Button- onClick={() => {- if (selectedAgentId && selectedAgentVersion) {- onNext(selectedAgentId, selectedAgentVersion);- }- }}- disabled={!selectedAgentId || !selectedAgentVersion}- size="lg"- className="w-full bg-neutral-800 text-white hover:bg-neutral-900 sm:flex-1"- >- Next- </Button>- </div>- </>- )}- </div>- );-};diff --git a/autogpt_platform/frontend/src/components/agptui/PublishAgentSelectInfo.tsx b/autogpt_platform/frontend/src/components/agptui/PublishAgentSelectInfo.tsxdeleted file mode 100644index f9ab2acbcf..0000000000--- a/autogpt_platform/frontend/src/components/agptui/PublishAgentSelectInfo.tsx+++ /dev/null@@ -1,448 +0,0 @@-"use client";--import * as React from "react";-import Image from "next/image";-import { Button } from "../agptui/Button";-import { IconCross, IconPlus } from "../ui/icons";-import BackendAPI from "@/lib/autogpt-server-api";-import { toast } from "../molecules/Toast/use-toast";--export interface PublishAgentInfoInitialData {- agent_id: string;- title: string;- subheader: string;- slug: string;- thumbnailSrc: string;- youtubeLink: string;- category: string;- description: string;- additionalImages?: string[];-}--interface PublishAgentInfoProps {- onBack: () => void;- onSubmit: (- name: string,- subHeading: string,- slug: string,- description: string,- imageUrls: string[],- videoUrl: string,- categories: string[],- ) => void;- onClose: () => void;- initialData?: PublishAgentInfoInitialData;-}--export const PublishAgentInfo: React.FC<PublishAgentInfoProps> = ({- onBack,- onSubmit,- onClose,- initialData,-}) => {- const [agentId, setAgentId] = React.useState<string | null>(null);- const [images, setImages] = React.useState<string[]>([]);- const [selectedImage, setSelectedImage] = React.useState<string | null>(- initialData?.thumbnailSrc || null,- );- const [title, setTitle] = React.useState(initialData?.title || "");- const [subheader, setSubheader] = React.useState(- initialData?.subheader || "",- );- const [youtubeLink, setYoutubeLink] = React.useState(- initialData?.youtubeLink || "",- );- const [category, setCategory] = React.useState(initialData?.category || "");- const [description, setDescription] = React.useState(- initialData?.description || "",- );- const [slug, setSlug] = React.useState(initialData?.slug || "");- const thumbnailsContainerRef = React.useRef<HTMLDivElement | null>(null);- React.useEffect(() => {- if (initialData) {- setAgentId(initialData.agent_id);- setImagesWithValidation([- ...(initialData?.thumbnailSrc ? [initialData.thumbnailSrc] : []),- ...(initialData.additionalImages || []),- ]);- setSelectedImage(initialData.thumbnailSrc || null);- setTitle(initialData.title);- setSubheader(initialData.subheader);- setYoutubeLink(initialData.youtubeLink);- setCategory(initialData.category);- setDescription(initialData.description);- setSlug(initialData.slug);- }- }, [initialData]);-- const setImagesWithValidation = (newImages: string[]) => {- // Remove duplicates- const uniqueImages = Array.from(new Set(newImages));- // Keep only first 5 images- const limitedImages = uniqueImages.slice(0, 5);- setImages(limitedImages);- };-- const handleRemoveImage = (indexToRemove: number) => {- const newImages = [...images];- newImages.splice(indexToRemove, 1);- setImagesWithValidation(newImages);- if (newImages[indexToRemove] === selectedImage) {- setSelectedImage(newImages[0] || null);- }- if (newImages.length === 0) {- setSelectedImage(null);- }- };-- const handleAddImage = async () => {- if (images.length >= 5) return;-- const input = document.createElement("input");- input.type = "file";- input.accept = "image/*";-- // Create a promise that resolves when file is selected- const fileSelected = new Promise<File | null>((resolve) => {- input.onchange = (e) => {- const file = (e.target as HTMLInputElement).files?.[0];- resolve(file || null);- };- });-- // Trigger file selection- input.click();-- // Wait for file selection- const file = await fileSelected;- if (!file) return;-- try {- const api = new BackendAPI();-- const imageUrl = (await api.uploadStoreSubmissionMedia(file)).replace(- /^"(.*)"$/,- "$1",- );-- setImagesWithValidation([...images, imageUrl]);- if (!selectedImage) {- setSelectedImage(imageUrl);- }- } catch (error) {- toast({- title: "Failed to upload image",- description: `Error: ${error}`,- variant: "destructive",- });- }- };-- const [isGenerating, setIsGenerating] = React.useState(false);-- const handleGenerateImage = async () => {- if (isGenerating || images.length >= 5) return;-- setIsGenerating(true);- try {- const api = new BackendAPI();- if (!agentId) {- throw new Error("Agent ID is required");- }- const { image_url } = await api.generateStoreSubmissionImage(agentId);- setImagesWithValidation([...images, image_url]);- } catch (error) {- console.error("Failed to generate image:", error);- } finally {- setIsGenerating(false);- }- };-- const handleSubmit = (e: React.MouseEvent<HTMLButtonElement>) => {- e.preventDefault();- const categories = category ? [category] : [];- onSubmit(- title,- subheader,- slug,- description,- images,- youtubeLink,- categories,- );- };-- return (- <div className="mx-auto flex w-full flex-col rounded-3xl bg-white dark:bg-gray-800">- <div className="relative p-6">- <div className="absolute right-4 top-2">- <button- onClick={onClose}- className="flex h-[38px] w-[38px] items-center justify-center rounded-full bg-gray-100 transition-colors hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600"- aria-label="Close"- >- <IconCross- size="default"- className="text-neutral-600 dark:text-neutral-300"- />- </button>- </div>- <h3 className="h3-poppins text-center text-2xl font-semibold leading-loose text-neutral-900 dark:text-neutral-100">- Publish Agent- </h3>- <p className="p text-center text-base font-normal leading-7 text-neutral-600 dark:text-neutral-400">- Write a bit of details about your agent- </p>- </div>-- <div className="flex-grow space-y-5 overflow-y-auto p-6">- <div className="space-y-1.5">- <label- htmlFor="title"- className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300"- >- Title- </label>- <input- id="title"- type="text"- placeholder="Agent name"- value={title}- onChange={(e) => setTitle(e.target.value)}- className="p-ui-medium w-full rounded-[55px] border border-slate-200 py-2.5 pl-4 pr-14 text-base font-normal leading-normal text-slate-500 dark:border-slate-700 dark:bg-gray-700 dark:text-slate-300"- />- </div>-- <div className="space-y-1.5">- <label- htmlFor="subheader"- className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300"- >- Subheader- </label>- <input- id="subheader"- type="text"- placeholder="A tagline for your agent"- value={subheader}- onChange={(e) => setSubheader(e.target.value)}- className="w-full rounded-[55px] border border-slate-200 py-2.5 pl-4 pr-14 font-sans text-base font-normal leading-normal text-slate-500 dark:border-slate-700 dark:bg-gray-700 dark:text-slate-300"- />- </div>-- <div className="space-y-1.5">- <label- htmlFor="slug"- className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300"- >- Slug- </label>- <input- id="slug"- type="text"- placeholder="URL-friendly name for your agent"- value={slug}- onChange={(e) => setSlug(e.target.value)}- className="w-full rounded-[55px] border border-slate-200 py-2.5 pl-4 pr-14 font-sans text-base font-normal leading-normal text-slate-500 dark:border-slate-700 dark:bg-gray-700 dark:text-slate-300"- />- </div>-- <div className="space-y-2.5">- <label className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300">- Thumbnail images- </label>- <div className="flex h-[350px] items-center justify-center overflow-hidden rounded-[20px] border border-neutral-300 p-2.5 dark:border-neutral-600">- {selectedImage !== null && selectedImage !== undefined ? (- <Image- src={selectedImage}- alt="Selected Thumbnail"- width={500}- height={350}- style={{ objectFit: "cover" }}- className="rounded-md"- />- ) : (- <p className="font-sans text-sm font-normal text-neutral-600 dark:text-neutral-400">- No images yet- </p>- )}- </div>- <div- ref={thumbnailsContainerRef}- className="flex items-center space-x-2 overflow-x-auto"- >- {images.length === 0 ? (- <div className="flex w-full justify-center">- <Button- onClick={handleAddImage}- variant="ghost"- className="flex h-[70px] w-[100px] flex-col items-center justify-center rounded-md bg-neutral-200 hover:bg-neutral-300 dark:bg-neutral-700 dark:hover:bg-neutral-600"- >- <label htmlFor="image-upload" className="cursor-pointer">- <input- id="image-upload"- type="file"- accept="image/*"- onChange={handleAddImage}- className="hidden"- />- <IconPlus- size="lg"- className="text-neutral-600 dark:text-neutral-300"- />- <span className="mt-1 font-sans text-xs font-normal text-neutral-600 dark:text-neutral-300">- Add image- </span>- </label>- </Button>- </div>- ) : (- <>- {images.map((src, index) => (- <div key={index} className="relative flex-shrink-0">- <Image- src={src}- alt={`Thumbnail ${index + 1}`}- width={100}- height={70}- style={{ objectFit: "cover" }}- className="cursor-pointer rounded-md"- onClick={() => setSelectedImage(src)}- />- <button- onClick={() => handleRemoveImage(index)}- className="absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full bg-white bg-opacity-70 transition-opacity hover:bg-opacity-100 dark:bg-gray-800 dark:bg-opacity-70 dark:hover:bg-opacity-100"- aria-label="Remove image"- >- <IconCross- size="sm"- className="text-neutral-600 dark:text-neutral-300"- />- </button>- </div>- ))}- {images.length < 5 && (- <Button- onClick={handleAddImage}- variant="ghost"- className="flex h-[70px] w-[100px] flex-col items-center justify-center rounded-md bg-neutral-200 hover:bg-neutral-300 dark:bg-neutral-700 dark:hover:bg-neutral-600"- >- <IconPlus- size="lg"- className="text-neutral-600 dark:text-neutral-300"- />- <span className="mt-1 font-sans text-xs font-normal text-neutral-600 dark:text-neutral-300">- Add image- </span>- </Button>- )}- </>- )}- </div>- </div>-- <div className="space-y-1.5">- <label className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300">- AI image generator- </label>- <div className="flex items-center justify-between">- <p className="text-base font-normal leading-normal text-slate-700 dark:text-slate-400">- You can use AI to generate a cover image for you- </p>- <Button- className={`bg-neutral-800 text-white hover:bg-neutral-900 dark:bg-neutral-600 dark:hover:bg-neutral-500 ${- images.length >= 5 ? "cursor-not-allowed opacity-50" : ""- }`}- onClick={handleGenerateImage}- disabled={isGenerating || images.length >= 5}- >- {isGenerating- ? "Generating..."- : images.length >= 5- ? "Max images reached"- : "Generate"}- </Button>- </div>- </div>-- <div className="space-y-1.5">- <label- htmlFor="youtube"- className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300"- >- YouTube video link- </label>- <input- id="youtube"- type="text"- placeholder="Paste a video link here"- value={youtubeLink}- onChange={(e) => setYoutubeLink(e.target.value)}- className="w-full rounded-[55px] border border-slate-200 py-2.5 pl-4 pr-14 font-sans text-base font-normal leading-normal text-slate-500 dark:border-slate-700 dark:bg-gray-700 dark:text-slate-300"- />- </div>-- <div className="space-y-1.5">- <label- htmlFor="category"- className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300"- >- Category- </label>- <select- id="category"- value={category}- onChange={(e) => setCategory(e.target.value)}- className="w-full appearance-none rounded-[55px] border border-slate-200 py-2.5 pl-4 pr-5 font-sans text-base font-normal leading-normal text-slate-500 dark:border-slate-700 dark:bg-gray-700 dark:text-slate-300"- >- <option value="">Select a category for your agent</option>- <option value="productivity">Productivity</option>- <option value="writing">Writing & Content</option>- <option value="development">Development</option>- <option value="data">Data & Analytics</option>- <option value="marketing">Marketing & SEO</option>- <option value="research">Research & Learning</option>- <option value="creative">Creative & Design</option>- <option value="business">Business & Finance</option>- <option value="personal">Personal Assistant</option>- <option value="other">Other</option>- {/* Add more options here */}- </select>- </div>-- <div className="space-y-1.5">- <label- htmlFor="description"- className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300"- >- Description- </label>- <textarea- id="description"- placeholder="Describe your agent and what it does"- value={description}- onChange={(e) => setDescription(e.target.value)}- className="h-[100px] w-full resize-none rounded-2xl border border-slate-200 bg-white py-2.5 pl-4 pr-14 font-sans text-base font-normal leading-normal text-slate-900 dark:border-slate-700 dark:bg-gray-700 dark:text-slate-300"- ></textarea>- </div>- </div>-- <div className="flex justify-between gap-4 border-t border-slate-200 p-6 dark:border-slate-700">- <Button- onClick={onBack}- size="lg"- className="w-full dark:border-slate-700 dark:text-slate-300 sm:flex-1"- >- Back- </Button>- <Button- onClick={handleSubmit}- size="lg"- className="w-full bg-neutral-800 text-white hover:bg-neutral-900 dark:bg-neutral-600 dark:hover:bg-neutral-500 sm:flex-1"- >- Submit for review- </Button>- </div>- </div>- );-};diff --git a/autogpt_platform/frontend/src/components/agptui/composite/PublishAgentPopout.tsx b/autogpt_platform/frontend/src/components/agptui/composite/PublishAgentPopout.tsxdeleted file mode 100644index 4735ce267b..0000000000--- a/autogpt_platform/frontend/src/components/agptui/composite/PublishAgentPopout.tsx+++ /dev/null@@ -1,392 +0,0 @@-"use client";--import * as React from "react";-import {- Popover,- PopoverTrigger,- PopoverContent,- PopoverAnchor,-} from "@/components/ui/popover";-import { PublishAgentSelect } from "../PublishAgentSelect";-import {- PublishAgentInfo,- PublishAgentInfoInitialData,-} from "../PublishAgentSelectInfo";-import { PublishAgentAwaitingReview } from "../PublishAgentAwaitingReview";-import { Button } from "../Button";-import { MyAgent } from "@/app/api/__generated__/models/myAgent";-import { useRouter } from "next/navigation";-import { useBackendAPI } from "@/lib/autogpt-server-api/context";-import { useToast } from "@/components/molecules/Toast/use-toast";-import LoadingBox, { LoadingSpinner } from "@/components/ui/loading";-import { StoreSubmissionRequest } from "@/app/api/__generated__/models/storeSubmissionRequest";-import { useGetV2GetMyAgents } from "@/app/api/__generated__/endpoints/store/store";-interface PublishAgentPopoutProps {- trigger?: React.ReactNode;- openPopout?: boolean;- inputStep?: "select" | "info" | "review";- submissionData?: StoreSubmissionRequest;-}--export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({- trigger,- openPopout = false,- inputStep = "select",- submissionData = {- name: "",- sub_heading: "",- slug: "",- description: "",- image_urls: [],- agent_id: "",- agent_version: 0,- categories: [],- },-}) => {- const [step, setStep] = React.useState<"select" | "info" | "review">(- inputStep,- );- const [allAgents, setAllAgents] = React.useState<MyAgent[]>([]);- const [_, setSelectedAgent] = React.useState<string | null>(null);- const [initialData, setInitialData] =- React.useState<PublishAgentInfoInitialData>({- agent_id: "",- title: "",- subheader: "",- slug: "",- thumbnailSrc: "",- youtubeLink: "",- category: "",- description: "",- });- const [publishData, setPublishData] =- React.useState<StoreSubmissionRequest>(submissionData);- const [selectedAgentId, setSelectedAgentId] = React.useState<string | null>(- null,- );- const [selectedAgentVersion, setSelectedAgentVersion] = React.useState<- number | null- >(null);- const [open, setOpen] = React.useState(false);- const [currentPage, setCurrentPage] = React.useState(1);- const [loadingMore, setLoadingMore] = React.useState(false);- const [hasMore, setHasMore] = React.useState(true);-- const api = useBackendAPI();-- // Use the auto-generated API hook- const { data, error, isLoading, refetch } = useGetV2GetMyAgents({- request: {- params: {- page: currentPage,- page_size: 20,- },- },- query: {- enabled: open, // Only fetch when the popout is open- },- });-- // Update allAgents when new data arrives- React.useEffect(() => {- if (data?.status === 200 && data.data) {- if (currentPage === 1) {- setAllAgents(data.data.agents);- } else {- setAllAgents((prev) => [...prev, ...data.data.agents]);- }- setHasMore(- data.data.pagination.current_page < data.data.pagination.total_pages,- );- }- }, [data, currentPage]);-- const fetchMyAgents = React.useCallback(- async (page: number, append = false) => {- if (append) {- setLoadingMore(true);- setCurrentPage(page);- } else {- setCurrentPage(page);- setAllAgents([]);- }- },- [],- );-- const popupId = React.useId();- const router = useRouter();-- const { toast } = useToast();-- React.useEffect(() => {- setOpen(openPopout);- setStep(inputStep);- setPublishData(submissionData);- }, [openPopout]); // eslint-disable-line react-hooks/exhaustive-deps-- React.useEffect(() => {- if (open) {- setCurrentPage(1);- setHasMore(true);- setAllAgents([]);- }- }, [open]);-- // Handle loading state for pagination- React.useEffect(() => {- if (currentPage > 1 && !isLoading) {- setLoadingMore(false);- }- }, [currentPage, isLoading]);-- const handleClose = () => {- setStep("select");- setSelectedAgent(null);- setPublishData({- name: "",- sub_heading: "",- description: "",- image_urls: [],- agent_id: "",- agent_version: 0,- slug: "",- categories: [],- });- setOpen(false);- };-- const handleAgentSelect = (agentName: string) => {- setSelectedAgent(agentName);- };-- const handleNextFromSelect = (agentId: string, agentVersion: number) => {- const selectedAgentData = allAgents.find(- (agent) => agent.agent_id === agentId,- ) as any;-- const name = selectedAgentData?.agent_name || "";- const description = selectedAgentData?.description || "";- setInitialData({- agent_id: agentId,- title: name,- subheader: "",- description: description,- thumbnailSrc: selectedAgentData?.agent_image || "",- youtubeLink: "",- category: "",- slug: name.replace(/ /g, "-"),- additionalImages: [],- });-- setStep("info");- setSelectedAgentId(agentId);- setSelectedAgentVersion(agentVersion);- };-- const handleNextFromInfo = async (- name: string,- subHeading: string,- slug: string,- description: string,- imageUrls: string[],- videoUrl: string,- categories: string[],- ) => {- 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.filter(Boolean).length) missingFields.push("Categories");-- if (missingFields.length > 0) {- toast({- title: "Missing Required Fields",- description: `Please fill in: ${missingFields.join(", ")}`,- duration: 3000,- });- return;- }-- const filteredCategories = categories.filter(Boolean);- setPublishData({- name,- sub_heading: subHeading,- description,- image_urls: imageUrls,- video_url: videoUrl,- agent_id: selectedAgentId || "",- agent_version: selectedAgentVersion || 0,- slug,- categories: filteredCategories,- });-- // Create store submission- try {- await api.createStoreSubmission({- name: name,- sub_heading: subHeading,- description: description,- image_urls: imageUrls,- video_url: videoUrl,- agent_id: selectedAgentId || "",- agent_version: selectedAgentVersion || 0,- slug: slug.replace(/\s+/g, "-"),- categories: filteredCategories,- });- } catch (error) {- console.error("Error creating store submission:", error);- }- setStep("review");- };-- const handleBack = () => {- if (step === "info") {- setStep("select");- } else if (step === "review") {- setStep("info");- }- };-- const handleScroll = React.useCallback(- (e: React.UIEvent<HTMLDivElement>) => {- const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;- if (- hasMore &&- !loadingMore &&- scrollTop + clientHeight >= scrollHeight - 50- ) {- fetchMyAgents(currentPage + 1, true);- }- },- [hasMore, loadingMore, currentPage],- );-- const renderContent = () => {- switch (step) {- case "select":- return (- <div className="flex min-h-screen items-center justify-center">- <div className="mx-auto flex w-full max-w-[900px] flex-col rounded-3xl bg-white shadow-lg dark:bg-gray-800">- <div className="h-full overflow-y-hidden">- {isLoading && currentPage === 1 ? (- <LoadingBox className="p-8" />- ) : error ? (- <div className="flex flex-col items-center justify-center gap-4 p-8">- <p className="text-red-600">- Failed to load agents. Please try again.- </p>- <Button- onClick={() => {- refetch();- }}- variant="outline"- >- Try Again- </Button>- </div>- ) : (- <>- <PublishAgentSelect- agents={- allAgents- .map((agent) => ({- name: agent.agent_name,- id: agent.agent_id,- version: agent.agent_version,- lastEdited: agent.last_edited,- imageSrc:- agent.agent_image ||- "https://picsum.photos/300/200",- }))- .sort(- (a, b) =>- new Date(b.lastEdited).getTime() -- new Date(a.lastEdited).getTime(),- ) || []- }- onSelect={handleAgentSelect}- onCancel={handleClose}- onNext={handleNextFromSelect}- onClose={handleClose}- onOpenBuilder={() => router.push("/build")}- onListScroll={handleScroll}- />- {loadingMore && (- <div className="flex items-center justify-center p-4">- <LoadingSpinner className="size-6" />- </div>- )}- </>- )}- </div>- </div>- </div>- );- case "info":- return (- <div className="flex min-h-screen items-center justify-center">- <div className="mx-auto flex w-full max-w-[900px] flex-col rounded-3xl bg-white shadow-lg dark:bg-gray-800">- <div className="h-[700px] overflow-y-auto">- <PublishAgentInfo- onBack={handleBack}- onSubmit={handleNextFromInfo}- onClose={handleClose}- initialData={initialData}- />- </div>- </div>- </div>- );- case "review":- return publishData ? (- <div className="flex justify-center">- <div className="mx-auto flex w-full max-w-[900px] flex-col rounded-3xl bg-white shadow-lg dark:bg-gray-800">- <div className="h-[600px] overflow-y-auto">- <PublishAgentAwaitingReview- agentName={publishData.name}- subheader={publishData.sub_heading}- description={publishData.description || ""}- thumbnailSrc={publishData.image_urls?.[0]}- onClose={handleClose}- onDone={handleClose}- onViewProgress={() => {- router.push("/profile/dashboard");- handleClose();- }}- />- </div>- </div>- </div>- ) : null;- }- };-- return (- <Popover- open={open}- onOpenChange={(isOpen) => {- if (isOpen !== open) {- setOpen(isOpen);- }- }}- >- <PopoverTrigger asChild>- {trigger || <Button>Publish Agent</Button>}- </PopoverTrigger>- <PopoverAnchor asChild>- <div className="fixed left-0 top-0 hidden h-screen w-screen items-center justify-center"></div>- </PopoverAnchor>-- <PopoverContent- id={popupId}- align="center"- className="z-50 h-screen w-screen bg-transparent"- >- {renderContent()}- </PopoverContent>- </Popover>- );-};diff --git a/autogpt_platform/frontend/src/components/atoms/Input/Input.stories.tsx b/autogpt_platform/frontend/src/components/atoms/Input/Input.stories.tsxindex a78649f008..4f6246c49a 100644--- a/autogpt_platform/frontend/src/components/atoms/Input/Input.stories.tsx+++ b/autogpt_platform/frontend/src/components/atoms/Input/Input.stories.tsx@@ -17,7 +17,16 @@ const meta: Meta<typeof Input> = {argTypes: {type: {control: "select",- options: ["text", "email", "password", "number", "amount", "tel", "url"],+ options: [+ "text",+ "email",+ "password",+ "number",+ "amount",+ "tel",+ "url",+ "textarea",+ ],description: "Input type",},placeholder: {@@ -50,6 +59,10 @@ const meta: Meta<typeof Input> = {control: "text",description: "Error message to display below the input",},+ rows: {+ control: "number",+ description: "Number of rows for textarea type. Default is 3.",+ },},args: {placeholder: "Enter text...",@@ -58,6 +71,7 @@ const meta: Meta<typeof Input> = {disabled: false,hideLabel: false,decimalCount: 4,+ rows: 3,},};@@ -96,6 +110,15 @@ export const WithError: Story = {},};+export const TextareaInput: Story = {+ args: {+ label: "Description",+ type: "textarea",+ placeholder: "Enter your description",+ rows: 4,+ },+};+export const InputTypes: Story = {render: renderInputTypes,parameters: {@@ -176,6 +199,19 @@ function renderInputTypes() {placeholder="https://example.com"id="website"/>+ <div className="flex flex-col gap-4">+ <p className="font-mono text-sm">+ If type="textarea" prop is provided, it renders a multi-line+ text area with specified rows.+ </p>+ <Input+ label="Description"+ type="textarea"+ placeholder="Enter your description"+ id="description"+ rows={4}+ />+ </div></div>);}diff --git a/autogpt_platform/frontend/src/components/atoms/Input/Input.tsx b/autogpt_platform/frontend/src/components/atoms/Input/Input.tsxindex e67ea946d3..c896481045 100644--- a/autogpt_platform/frontend/src/components/atoms/Input/Input.tsx+++ b/autogpt_platform/frontend/src/components/atoms/Input/Input.tsx@@ -14,6 +14,17 @@ export interface TextFieldProps extends Omit<InputProps, "size"> {hint?: ReactNode;size?: "small" | "medium";wrapperClassName?: string;+ type?:+ | "text"+ | "email"+ | "password"+ | "number"+ | "amount"+ | "tel"+ | "url"+ | "textarea";+ // Textarea-specific props+ rows?: number;}export function Input({@@ -28,7 +39,11 @@ export function Input({wrapperClassName,...props}: TextFieldProps) {- const { handleInputChange } = useInput({ ...props, decimalCount });+ const { handleInputChange, handleTextareaChange } = useInput({+ type: props.type,+ onChange: props.onChange,+ decimalCount,+ });const [showPassword, setShowPassword] = useState(false);const isPasswordType = props.type === "password";@@ -46,19 +61,55 @@ export function Input({setShowPassword(false);}- const input = (- <div className={cn("relative", wrapperClassName)}>+ const baseStyles = cn(+ // Base styles+ "rounded-3xl border border-zinc-200 bg-white px-4 shadow-none",+ "font-normal text-black",+ "placeholder:font-normal placeholder:text-zinc-400",+ // Focus and hover states+ "focus:border-zinc-400 focus:shadow-none focus:outline-none focus:ring-1 focus:ring-zinc-400 focus:ring-offset-0",+ className,+ );++ const errorStyles =+ error && "!border !border-red-500 focus:border-red-500 focus:ring-red-500";++ const renderInput = () => {+ if (props.type === "textarea") {+ return (+ <textarea+ className={cn(+ baseStyles,+ errorStyles,+ "-mb-1 h-auto min-h-[2.875rem] w-full",+ // Size variants for textarea+ size === "small" && [+ "min-h-[2.25rem]", // 36px minimum+ "py-2",+ "text-sm leading-[22px]",+ "placeholder:text-sm placeholder:leading-[22px]",+ ],+ size === "medium" && [+ "min-h-[2.875rem]", // 46px minimum (current default)+ "py-2.5",+ ],+ )}+ placeholder={placeholder || label}+ onChange={handleTextareaChange}+ rows={props.rows || 3}+ {...(hideLabel ? { "aria-label": label } : {})}+ id={props.id}+ disabled={props.disabled}+ value={props.value}+ />+ );+ }++ return (<BaseInputclassName={cn(- // Base styles- "rounded-3xl border border-zinc-200 bg-white px-4 shadow-none",- "font-normal text-black",- "placeholder:font-normal placeholder:text-zinc-400",- // Focus and hover states- "focus:border-zinc-400 focus:shadow-none focus:outline-none focus:ring-1 focus:ring-zinc-400 focus:ring-offset-0",- // Error state- error &&- "border-1.5 border-red-500 focus:border-red-500 focus:ring-red-500",+ baseStyles,+ errorStyles,// Add padding for password toggle buttonisPasswordType && "pr-12",// Size variants@@ -72,7 +123,6 @@ export function Input({"h-[2.875rem]", // 46px (current default)"py-2.5",],- className,)}placeholder={placeholder || label}onChange={handleInputChange}@@ -80,6 +130,12 @@ export function Input({{...props}type={inputType}/>+ );+ };++ const input = (+ <div className={cn("relative", wrapperClassName)}>+ {renderInput()}{isPasswordType && (<buttontype="button"diff --git a/autogpt_platform/frontend/src/components/atoms/Input/useInput.ts b/autogpt_platform/frontend/src/components/atoms/Input/useInput.tsindex b931bc663e..e5938f8e78 100644--- a/autogpt_platform/frontend/src/components/atoms/Input/useInput.ts+++ b/autogpt_platform/frontend/src/components/atoms/Input/useInput.ts@@ -9,6 +9,15 @@ import {interface ExtendedInputProps extends InputProps {decimalCount?: number;+ type?:+ | "text"+ | "email"+ | "password"+ | "number"+ | "amount"+ | "tel"+ | "url"+ | "textarea";}export function useInput(args: ExtendedInputProps) {@@ -54,5 +63,20 @@ export function useInput(args: ExtendedInputProps) {}}- return { handleInputChange };+ function handleTextareaChange(e: React.ChangeEvent<HTMLTextAreaElement>) {+ if (args.onChange) {+ // Create synthetic event with HTMLInputElement-like target for compatibility+ const syntheticEvent = {+ ...e,+ target: {+ ...e.target,+ value: e.target.value,+ },+ } as unknown as React.ChangeEvent<HTMLInputElement>;++ args.onChange(syntheticEvent);+ }+ }++ return { handleInputChange, handleTextareaChange };}diff --git a/autogpt_platform/frontend/src/components/atoms/Select/Select.stories.tsx b/autogpt_platform/frontend/src/components/atoms/Select/Select.stories.tsxnew file mode 100644index 0000000000..510978c9d2--- /dev/null+++ b/autogpt_platform/frontend/src/components/atoms/Select/Select.stories.tsx@@ -0,0 +1,225 @@+import type { Meta, StoryObj } from "@storybook/nextjs";+import { Select } from "./Select";++const meta: Meta<typeof Select> = {+ title: "Atoms/Select",+ tags: ["autodocs"],+ component: Select,+ parameters: {+ layout: "centered",+ docs: {+ description: {+ component:+ "Select component based on our design system. Built on top of shadcn/ui select with custom styling matching Figma designs and consistent with the Input component.",+ },+ },+ },+ argTypes: {+ placeholder: {+ control: "text",+ description: "Placeholder text",+ },+ value: {+ control: "text",+ description: "The selected value",+ },+ label: {+ control: "text",+ description:+ "Label text (used as placeholder if no placeholder provided)",+ },+ disabled: {+ control: "boolean",+ description: "Disable the select",+ },+ hideLabel: {+ control: "boolean",+ description: "Hide the label",+ },+ error: {+ control: "text",+ description: "Error message to display below the select",+ },+ options: {+ control: "object",+ description: "Array of options with value and label properties",+ },+ },+ args: {+ placeholder: "Select an option...",+ value: "",+ disabled: false,+ hideLabel: false,+ options: [+ { value: "option1", label: "Option 1" },+ { value: "option2", label: "Option 2" },+ { value: "option3", label: "Option 3" },+ ],+ },+};++export default meta;+type Story = StoryObj<typeof meta>;++// Basic variants+export const Default: Story = {+ args: {+ label: "Country",+ placeholder: "Select a country",+ options: [+ { value: "us", label: "United States" },+ { value: "ca", label: "Canada" },+ { value: "uk", label: "United Kingdom" },+ { value: "de", label: "Germany" },+ { value: "fr", label: "France" },+ ],+ },+};++export const WithValue: Story = {+ args: {+ label: "Country",+ placeholder: "Select a country",+ value: "us",+ options: [+ { value: "us", label: "United States" },+ { value: "ca", label: "Canada" },+ { value: "uk", label: "United Kingdom" },+ { value: "de", label: "Germany" },+ { value: "fr", label: "France" },+ ],+ },+};++export const WithoutLabel: Story = {+ args: {+ label: "Country",+ hideLabel: true,+ placeholder: "Select a country",+ options: [+ { value: "us", label: "United States" },+ { value: "ca", label: "Canada" },+ { value: "uk", label: "United Kingdom" },+ { value: "de", label: "Germany" },+ { value: "fr", label: "France" },+ ],+ },+};++export const Disabled: Story = {+ args: {+ label: "Country",+ placeholder: "Select a country",+ disabled: true,+ options: [+ { value: "us", label: "United States" },+ { value: "ca", label: "Canada" },+ { value: "uk", label: "United Kingdom" },+ { value: "de", label: "Germany" },+ { value: "fr", label: "France" },+ ],+ },+};++export const WithError: Story = {+ args: {+ label: "Country",+ placeholder: "Select a country",+ error: "Please select a valid country",+ options: [+ { value: "us", label: "United States" },+ { value: "ca", label: "Canada" },+ { value: "uk", label: "United Kingdom" },+ { value: "de", label: "Germany" },+ { value: "fr", label: "France" },+ ],+ },+};++export const ManyOptions: Story = {+ args: {+ label: "Programming Language",+ placeholder: "Select a programming language",+ options: [+ { value: "javascript", label: "JavaScript" },+ { value: "typescript", label: "TypeScript" },+ { value: "python", label: "Python" },+ { value: "java", label: "Java" },+ { value: "csharp", label: "C#" },+ { value: "cpp", label: "C++" },+ { value: "rust", label: "Rust" },+ { value: "go", label: "Go" },+ { value: "php", label: "PHP" },+ { value: "ruby", label: "Ruby" },+ { value: "swift", label: "Swift" },+ { value: "kotlin", label: "Kotlin" },+ ],+ },+};++export const AllVariants: Story = {+ render: renderAllVariants,+ parameters: {+ controls: {+ disable: true,+ },+ docs: {+ description: {+ story: "Complete showcase of all Select component variants and states.",+ },+ },+ },+};++function renderAllVariants() {+ const options = [+ { value: "us", label: "United States" },+ { value: "ca", label: "Canada" },+ { value: "uk", label: "United Kingdom" },+ { value: "de", label: "Germany" },+ { value: "fr", label: "France" },+ ];++ return (+ <div className="w-full max-w-md space-y-8">+ <Select+ label="Default Select"+ placeholder="Select a country"+ id="default"+ options={options}+ />++ <Select+ label="With Selected Value"+ placeholder="Select a country"+ value="us"+ id="with-value"+ options={options}+ />++ <Select+ label="Hidden Label"+ hideLabel={true}+ placeholder="Select a country"+ id="hidden-label"+ options={options}+ />++ <Select+ label="Disabled Select"+ placeholder="Select a country"+ disabled={true}+ id="disabled"+ options={options}+ />++ <Select+ label="With Error"+ placeholder="Select a country"+ error="Please select a valid country"+ id="with-error"+ options={options}+ />+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/components/atoms/Select/Select.tsx b/autogpt_platform/frontend/src/components/atoms/Select/Select.tsxnew file mode 100644index 0000000000..77b3097872--- /dev/null+++ b/autogpt_platform/frontend/src/components/atoms/Select/Select.tsx@@ -0,0 +1,111 @@+"use client";++import * as React from "react";+import {+ Select as BaseSelect,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { cn } from "@/lib/utils";+import { ReactNode } from "react";+import { Text } from "../Text/Text";++export interface SelectOption {+ value: string;+ label: string;+}++export interface SelectFieldProps {+ label: string;+ id: string;+ hideLabel?: boolean;+ error?: string;+ hint?: ReactNode;+ placeholder?: string;+ className?: string;+ disabled?: boolean;+ value?: string;+ onValueChange?: (value: string) => void;+ options: SelectOption[];+}++export function Select({+ className,+ label,+ placeholder,+ hideLabel = false,+ hint,+ error,+ id,+ disabled,+ value,+ onValueChange,+ options,+}: SelectFieldProps) {+ const triggerStyles = cn(+ // Override the default select styles with Figma design matching Input+ "h-[2.875rem] rounded-3xl border border-zinc-200 bg-white px-4 py-2.5 shadow-none",+ "font-normal text-black text-sm w-full",+ "placeholder:font-normal !placeholder:text-zinc-400",+ // Focus and hover states+ "focus:border-zinc-400 focus:shadow-none focus:outline-none focus:ring-1 focus:ring-zinc-400 focus:ring-offset-0",+ // Error state+ error &&+ "border-1.5 border-red-500 focus:border-red-500 focus:ring-red-500",+ // Placeholder styling for SelectValue when data-placeholder is present+ "[&[data-placeholder]>span]:text-zinc-400 [&[data-placeholder]>span]:font-normal",+ className,+ );++ const select = (+ <BaseSelect value={value} onValueChange={onValueChange} disabled={disabled}>+ <SelectTrigger+ className={triggerStyles}+ {...(hideLabel ? { "aria-label": label } : {})}+ id={id}+ >+ <SelectValue placeholder={placeholder || label} />+ </SelectTrigger>+ <SelectContent>+ {options.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </BaseSelect>+ );++ const selectWithError = (+ <div className="relative mb-6">+ {select}+ <Text+ variant="small-medium"+ as="span"+ className={cn(+ "absolute left-0 top-full mt-1 !text-red-500 transition-opacity duration-200",+ error ? "opacity-100" : "opacity-0",+ )}+ >+ {error || " "}{" "}+ {/* Always render with space to maintain consistent height calculation */}+ </Text>+ </div>+ );++ return hideLabel ? (+ selectWithError+ ) : (+ <label htmlFor={id} className="flex flex-col gap-2">+ <div className="flex items-center justify-between">+ <Text variant="body-medium" as="span" className="text-black">+ {label}+ </Text>+ {hint}+ </div>+ {selectWithError}+ </label>+ );+}diff --git a/autogpt_platform/frontend/src/components/atoms/Text/Text.tsx b/autogpt_platform/frontend/src/components/atoms/Text/Text.tsxindex d100fd7e44..8bae184e5b 100644--- a/autogpt_platform/frontend/src/components/atoms/Text/Text.tsx+++ b/autogpt_platform/frontend/src/components/atoms/Text/Text.tsx@@ -4,6 +4,7 @@ import { As, Variant, variantElementMap, variants } from "./helpers";type CustomProps = {variant: Variant;as?: As;+ size?: Variant;className?: string;};@@ -15,10 +16,11 @@ export function Text({children,variant,as: outerAs,+ size,className = "",...rest}: TextProps) {- const variantClasses = variants[variant] || variants.body;+ const variantClasses = variants[size || variant] || variants.body;const Element = outerAs || variantElementMap[variant];const combinedClassName = `${variantClasses} ${className}`.trim();diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsxnew file mode 100644index 0000000000..6015ca7b66--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx@@ -0,0 +1,107 @@+"use client";++import * as React from "react";+import { AgentSelectStep } from "./components/AgentSelectStep/AgentSelectStep";+import { AgentInfoStep } from "./components/AgentInfoStep/AgentInfoStep";+import { AgentReviewStep } from "./components/AgentReviewStep";+import { Dialog } from "@/components/molecules/Dialog/Dialog";+import { Skeleton } from "@/components/ui/skeleton";+import { Button } from "@/components/atoms/Button/Button";+import { Props, usePublishAgentModal } from "./usePublishAgentModal";++export function PublishAgentModal({+ trigger,+ targetState,+ onStateChange,+}: Props) {+ const {+ // State+ currentState,+ updateState,+ initialData,+ // Handlers+ handleClose,+ handleAgentSelect,+ handleNextFromSelect,+ handleGoToDashboard,+ handleGoToBuilder,+ handleNextFromInfo,+ handleBack,+ } = usePublishAgentModal({ targetState, onStateChange });++ console.log({+ currentState,+ });++ function renderContent() {+ switch (currentState.step) {+ case "select":+ return (+ <AgentSelectStep+ onSelect={handleAgentSelect}+ onCancel={handleClose}+ onNext={handleNextFromSelect}+ onOpenBuilder={handleGoToBuilder}+ />+ );+ case "info":+ return (+ <AgentInfoStep+ onBack={handleBack}+ onSubmit={handleNextFromInfo}+ initialData={initialData}+ />+ );+ case "review":+ return currentState.submissionData &&+ currentState.submissionData.name ? (+ <AgentReviewStep+ agentName={currentState.submissionData.name}+ subheader={currentState.submissionData.sub_heading}+ description={currentState.submissionData.description || ""}+ thumbnailSrc={currentState.submissionData.image_urls?.[0]}+ onClose={handleClose}+ onDone={handleClose}+ onViewProgress={() => handleGoToDashboard()}+ />+ ) : (+ <div className="space-y-2">+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-3/4" />+ <Skeleton className="h-4 w-1/2" />+ </div>+ );+ }+ }++ return (+ <>+ <Dialog+ styling={{+ maxWidth: "45rem",+ }}+ controlled={{+ isOpen: currentState.isOpen,+ set: (isOpen) => {+ if (!isOpen) {+ // When closing, always reset to clean state+ handleClose();+ } else {+ updateState({+ ...currentState,+ isOpen: isOpen,+ });+ }+ },+ }}+ >+ <Dialog.Trigger>+ {trigger || <Button size="small">Publish Agent</Button>}+ </Dialog.Trigger>+ <Dialog.Content>+ <div data-testid="publish-agent-modal">{renderContent()}</div>+ </Dialog.Content>+ </Dialog>+ </>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/AgentInfoStep.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/AgentInfoStep.tsxnew file mode 100644index 0000000000..22c0835865--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/AgentInfoStep.tsx@@ -0,0 +1,164 @@+"use client";++import * as React from "react";+import { Button } from "@/components/atoms/Button/Button";+import { StepHeader } from "../StepHeader";+import { Input } from "@/components/atoms/Input/Input";+import { Select } from "@/components/atoms/Select/Select";+import { Form, FormField } from "@/components/ui/form";+import { Props, useAgentInfoStep } from "./useAgentInfoStep";+import { ThumbnailImages } from "./components/ThumbnailImages";++export function AgentInfoStep({ onBack, onSubmit, initialData }: Props) {+ const {+ form,+ agentId,+ initialImages,+ initialSelectedImage,+ handleImagesChange,+ handleSubmit,+ } = useAgentInfoStep({ onBack, onSubmit, initialData });++ const categoryOptions = [+ { value: "productivity", label: "Productivity" },+ { value: "writing", label: "Writing & Content" },+ { value: "development", label: "Development" },+ { value: "data", label: "Data & Analytics" },+ { value: "marketing", label: "Marketing & SEO" },+ { value: "research", label: "Research & Learning" },+ { value: "creative", label: "Creative & Design" },+ { value: "business", label: "Business & Finance" },+ { value: "personal", label: "Personal Assistant" },+ { value: "other", label: "Other" },+ ];++ return (+ <div className="mx-auto flex w-full flex-col rounded-3xl">+ <StepHeader+ title="Publish Agent"+ description="Write a bit of details about your agent"+ />++ <Form {...form}>+ <form onSubmit={handleSubmit} className="flex-grow overflow-y-auto p-6">+ <FormField+ control={form.control}+ name="title"+ render={({ field }) => (+ <Input+ id={field.name}+ label="Title"+ type="text"+ placeholder="Agent name"+ error={form.formState.errors.title?.message}+ {...field}+ />+ )}+ />++ <FormField+ control={form.control}+ name="subheader"+ render={({ field }) => (+ <Input+ id={field.name}+ label="Subheader"+ type="text"+ placeholder="A tagline for your agent"+ error={form.formState.errors.subheader?.message}+ {...field}+ />+ )}+ />++ <FormField+ control={form.control}+ name="slug"+ render={({ field }) => (+ <Input+ id={field.name}+ label="Slug"+ type="text"+ placeholder="URL-friendly name for your agent"+ error={form.formState.errors.slug?.message}+ {...field}+ />+ )}+ />++ <ThumbnailImages+ agentId={agentId}+ onImagesChange={handleImagesChange}+ initialImages={initialImages}+ initialSelectedImage={initialSelectedImage}+ errorMessage={form.formState.errors.root?.message}+ />++ <FormField+ control={form.control}+ name="youtubeLink"+ render={({ field }) => (+ <Input+ id={field.name}+ label="YouTube video link"+ type="url"+ placeholder="Paste a video link here"+ error={form.formState.errors.youtubeLink?.message}+ {...field}+ />+ )}+ />++ <FormField+ control={form.control}+ name="category"+ render={({ field }) => (+ <Select+ id={field.name}+ label="Category"+ placeholder="Select a category for your agent"+ value={field.value}+ onValueChange={field.onChange}+ error={form.formState.errors.category?.message}+ options={categoryOptions}+ />+ )}+ />++ <FormField+ control={form.control}+ name="description"+ render={({ field }) => (+ <Input+ id={field.name}+ label="Description"+ type="textarea"+ placeholder="Describe your agent and what it does"+ error={form.formState.errors.description?.message}+ {...field}+ />+ )}+ />++ <div className="flex justify-between gap-4 pt-6">+ <Button+ type="button"+ onClick={onBack}+ variant="secondary"+ className="w-full"+ >+ Back+ </Button>+ <Button+ type="submit"+ className="w-full"+ disabled={Object.keys(form.formState.errors).length > 0}+ >+ Submit for review+ </Button>+ </div>+ </form>+ </Form>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/components/ThumbnailImages.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/components/ThumbnailImages.tsxnew file mode 100644index 0000000000..060cb93ab8--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/components/ThumbnailImages.tsx@@ -0,0 +1,145 @@+"use client";++import * as React from "react";+import Image from "next/image";+import { IconCross, IconPlus } from "../../../../../ui/icons";+import { Button } from "@/components/atoms/Button/Button";+import { MagicWand } from "@phosphor-icons/react";+import { useThumbnailImages } from "./useThumbnailImages";++interface ThumbnailImagesProps {+ agentId: string | null;+ onImagesChange: (images: string[]) => void;+ initialImages?: string[];+ initialSelectedImage?: string | null;+ errorMessage?: string;+}++export function ThumbnailImages({+ agentId,+ onImagesChange,+ initialImages = [],+ initialSelectedImage = null,+ errorMessage,+}: ThumbnailImagesProps) {+ const {+ images,+ selectedImage,+ isGenerating,+ thumbnailsContainerRef,+ handleRemoveImage,+ handleAddImage,+ handleFileChange,+ handleGenerateImage,+ handleImageSelect,+ } = useThumbnailImages({+ agentId,+ onImagesChange,+ initialImages,+ initialSelectedImage,+ });++ return (+ <div className="space-y-2.5">+ <div className="flex items-center justify-start gap-2">+ <label className="text-sm font-medium leading-tight text-slate-950 dark:text-slate-300">+ Thumbnail images+ </label>+ {errorMessage && <p className="text-sm text-red-500">{errorMessage}</p>}+ </div>+ <div className="flex h-[300px] items-center justify-center overflow-hidden rounded-md border border-neutral-300 p-2.5 dark:border-neutral-600">+ {selectedImage !== null && selectedImage !== undefined ? (+ <Image+ src={selectedImage}+ alt="Selected Thumbnail"+ width={500}+ height={350}+ style={{ objectFit: "cover" }}+ className="h-auto w-full rounded-md object-cover"+ />+ ) : (+ <p className="font-sans text-sm font-normal text-neutral-600 dark:text-neutral-400">+ No images yet+ </p>+ )}+ </div>+ <div+ ref={thumbnailsContainerRef}+ className="flex items-center space-x-2 overflow-x-auto pb-6"+ >+ {images.length === 0 ? (+ <div className="flex w-full items-center justify-start gap-2 pl-2">+ <label+ htmlFor="image-upload"+ className="inline-flex h-[2.25rem] cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-full border border-zinc-700 bg-transparent px-3 py-2 font-sans text-sm font-medium leading-snug text-black transition-colors hover:border-zinc-700 hover:bg-zinc-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-neutral-950 disabled:pointer-events-none disabled:opacity-50"+ >+ <input+ id="image-upload"+ type="file"+ accept="image/*"+ onChange={handleFileChange}+ className="hidden"+ />+ <IconPlus className="h-4 w-4" />+ <span>Add image</span>+ </label>+ <Button+ type="button"+ variant="outline"+ size="small"+ onClick={handleGenerateImage}+ disabled={isGenerating || images.length >= 5}+ >+ <MagicWand className="h-4 w-4" />+ {isGenerating+ ? "Generating..."+ : images.length >= 5+ ? "Max images reached"+ : "Generate"}+ </Button>+ </div>+ ) : (+ <>+ {images.map((src, index) => (+ <div+ key={index}+ className="relative flex-shrink-0 overflow-visible"+ >+ <Button+ type="button"+ size="small"+ onClick={() => handleRemoveImage(index)}+ className="absolute right-0 top-0 z-50 h-6 w-6 p-0"+ aria-label="Remove image"+ >+ <IconCross className="h-2 w-2 text-white" />+ </Button>+ <Image+ src={src}+ alt={`Thumbnail ${index + 1}`}+ width={100}+ height={70}+ style={{ objectFit: "cover" }}+ className="cursor-pointer rounded-md"+ onClick={() => handleImageSelect(src)}+ />+ </div>+ ))}+ {images.length < 5 ? (+ <Button+ type="button"+ onClick={handleAddImage}+ variant="outline"+ size="small"+ className="!ml-4"+ >+ <IconPlus className="h-4 w-4" />+ <span>Add image</span>+ </Button>+ ) : null}+ </>+ )}+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/components/useThumbnailImages.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/components/useThumbnailImages.tsnew file mode 100644index 0000000000..1813377243--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/components/useThumbnailImages.ts@@ -0,0 +1,151 @@+import { useState, useRef, useEffect } from "react";+import BackendAPI from "@/lib/autogpt-server-api";+import { useToast } from "@/components/molecules/Toast/use-toast";++interface UseThumbnailImagesProps {+ agentId: string | null;+ onImagesChange: (images: string[]) => void;+ initialImages?: string[];+ initialSelectedImage?: string | null;+}++export function useThumbnailImages({+ agentId,+ onImagesChange,+ initialImages = [],+ initialSelectedImage = null,+}: UseThumbnailImagesProps) {+ const [images, setImages] = useState<string[]>(initialImages);++ const [selectedImage, setSelectedImage] = useState<string | null>(+ initialSelectedImage,+ );++ const [isGenerating, setIsGenerating] = useState(false);+ const thumbnailsContainerRef = useRef<HTMLDivElement | null>(null);+ const { toast } = useToast();++ // Notify parent when images change+ useEffect(() => {+ onImagesChange(images);+ }, [images, onImagesChange]);++ const setImagesWithValidation = (newImages: string[]) => {+ // Remove duplicates+ const uniqueImages = Array.from(new Set(newImages));+ // Keep only first 5 images+ const limitedImages = uniqueImages.slice(0, 5);+ setImages(limitedImages);+ };++ function handleRemoveImage(indexToRemove: number) {+ const newImages = [...images];+ newImages.splice(indexToRemove, 1);+ setImagesWithValidation(newImages);+ if (newImages[indexToRemove] === selectedImage) {+ setSelectedImage(newImages[0] || null);+ }+ if (newImages.length === 0) {+ setSelectedImage(null);+ }+ }++ async function handleAddImage() {+ if (images.length >= 5) return;++ const input = document.createElement("input");+ input.type = "file";+ input.accept = "image/*";++ // Create a promise that resolves when file is selected+ const fileSelected = new Promise<File | null>((resolve) => {+ input.onchange = (e) => {+ const file = (e.target as HTMLInputElement).files?.[0];+ resolve(file || null);+ };+ });++ // Trigger file selection+ input.click();++ // Wait for file selection+ const file = await fileSelected;+ if (!file) return;++ await uploadImage(file);+ }++ async function handleFileChange(e: React.ChangeEvent<HTMLInputElement>) {+ if (images.length >= 5) return;++ const file = e.target.files?.[0];+ if (!file) return;++ await uploadImage(file);+ }++ async function uploadImage(file: File) {+ try {+ const api = new BackendAPI();++ const imageUrl = (await api.uploadStoreSubmissionMedia(file)).replace(+ /^"(.*)"$/,+ "$1",+ );++ setImagesWithValidation([...images, imageUrl]);+ if (!selectedImage) {+ setSelectedImage(imageUrl);+ }+ } catch (_error) {+ toast({+ title: "Upload failed",+ description: "Failed to upload image. Please try again.",+ variant: "destructive",+ });+ }+ }++ async function handleGenerateImage() {+ if (isGenerating || images.length >= 5) return;++ setIsGenerating(true);+ try {+ const api = new BackendAPI();+ if (!agentId) {+ throw new Error("Agent ID is required");+ }+ const { image_url } = await api.generateStoreSubmissionImage(agentId);+ setImagesWithValidation([...images, image_url]);+ if (!selectedImage) {+ setSelectedImage(image_url);+ }+ } catch (_error) {+ toast({+ title: "Generation failed",+ description: "Failed to generate image. Please try again.",+ variant: "destructive",+ });+ } finally {+ setIsGenerating(false);+ }+ }++ function handleImageSelect(imageSrc: string) {+ setSelectedImage(imageSrc);+ }++ return {+ // State+ images,+ selectedImage,+ isGenerating,+ thumbnailsContainerRef,+ // Handlers+ handleRemoveImage,+ handleAddImage,+ handleFileChange,+ handleGenerateImage,+ handleImageSelect,+ };+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/helpers.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/helpers.tsnew file mode 100644index 0000000000..75e845f043--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/helpers.ts@@ -0,0 +1,57 @@+import z from "zod";++export const publishAgentSchema = z.object({+ title: z+ .string()+ .min(1, "Title is required")+ .max(100, "Title must be less than 100 characters"),+ subheader: z+ .string()+ .min(1, "Subheader is required")+ .max(200, "Subheader must be less than 200 characters"),+ slug: z+ .string()+ .min(1, "Slug is required")+ .max(50, "Slug must be less than 50 characters")+ .regex(+ /^[a-z0-9-]+$/,+ "Slug can only contain lowercase letters, numbers, and hyphens",+ ),+ youtubeLink: z+ .string()+ .optional()+ .refine((val) => {+ if (!val) return true;+ try {+ const url = new URL(val);+ const allowedHosts = [+ "youtube.com",+ "www.youtube.com",+ "youtu.be",+ "www.youtu.be",+ ];+ return allowedHosts.includes(url.hostname);+ } catch {+ return false;+ }+ }, "Please enter a valid YouTube URL"),+ category: z.string().min(1, "Category is required"),+ description: z+ .string()+ .min(1, "Description is required")+ .max(1000, "Description must be less than 1000 characters"),+});++export type PublishAgentFormData = z.infer<typeof publishAgentSchema>;++export interface PublishAgentInfoInitialData {+ agent_id: string;+ title: string;+ subheader: string;+ slug: string;+ thumbnailSrc: string;+ youtubeLink: string;+ category: string;+ description: string;+ additionalImages?: string[];+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/useAgentInfoStep.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/useAgentInfoStep.tsnew file mode 100644index 0000000000..2cd151a36b--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentInfoStep/useAgentInfoStep.ts@@ -0,0 +1,105 @@+import { useEffect, useCallback, useState } from "react";+import { useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import {+ PublishAgentFormData,+ PublishAgentInfoInitialData,+ publishAgentSchema,+} from "./helpers";++export interface Props {+ onBack: () => void;+ onSubmit: (+ name: string,+ subHeading: string,+ slug: string,+ description: string,+ imageUrls: string[],+ videoUrl: string,+ categories: string[],+ ) => void;+ initialData?: PublishAgentInfoInitialData;+}++export function useAgentInfoStep({+ onBack: _onBack,+ onSubmit,+ initialData,+}: Props) {+ const [agentId, setAgentId] = useState<string | null>(null);+ const [images, setImages] = useState<string[]>([]);++ const form = useForm<PublishAgentFormData>({+ resolver: zodResolver(publishAgentSchema),+ defaultValues: {+ title: "",+ subheader: "",+ slug: "",+ youtubeLink: "",+ category: "",+ description: "",+ },+ });++ useEffect(() => {+ if (initialData) {+ setAgentId(initialData.agent_id);+ const initialImages = [+ ...(initialData?.thumbnailSrc ? [initialData.thumbnailSrc] : []),+ ...(initialData.additionalImages || []),+ ];+ setImages(initialImages);++ // Update form with initial data+ form.reset({+ title: initialData.title,+ subheader: initialData.subheader,+ slug: initialData.slug,+ youtubeLink: initialData.youtubeLink,+ category: initialData.category,+ description: initialData.description,+ });+ }+ }, [initialData, form]);++ const handleImagesChange = useCallback((newImages: string[]) => {+ setImages(newImages);+ }, []);++ function handleFormSubmit(data: PublishAgentFormData) {+ // Validate that at least one image is present+ if (images.length === 0) {+ form.setError("root", {+ type: "manual",+ message: "At least one image is required",+ });+ return;+ }++ const categories = data.category ? [data.category] : [];+ onSubmit(+ data.title,+ data.subheader,+ data.slug,+ data.description,+ images,+ data.youtubeLink || "",+ categories,+ );+ }++ return {+ form,+ agentId,+ images,+ initialImages: initialData+ ? [+ ...(initialData?.thumbnailSrc ? [initialData.thumbnailSrc] : []),+ ...(initialData.additionalImages || []),+ ]+ : [],+ initialSelectedImage: initialData?.thumbnailSrc || null,+ handleImagesChange,+ handleSubmit: form.handleSubmit(handleFormSubmit),+ };+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentReviewStep.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentReviewStep.tsxnew file mode 100644index 0000000000..a8dd2455e7--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentReviewStep.tsx@@ -0,0 +1,100 @@+"use client";++import * as React from "react";++import Image from "next/image";+import { StepHeader } from "./StepHeader";+import { Button } from "@/components/atoms/Button/Button";+import { Text } from "@/components/atoms/Text/Text";+import { usePathname } from "next/navigation";++interface Props {+ agentName: string;+ subheader: string;+ description: string;+ onClose: () => void;+ onDone: () => void;+ onViewProgress: () => void;+ thumbnailSrc?: string;+}++export function AgentReviewStep({+ agentName,+ subheader,+ description,+ thumbnailSrc,+ onDone,+ onViewProgress,+}: Props) {+ const pathname = usePathname();+ const isDashboardPage = pathname.includes("/profile/dashboard");++ return (+ <div aria-labelledby="modal-title">+ <StepHeader+ title="Agent is awaiting review"+ description={+ isDashboardPage+ ? "Once the agent is approved, it will be available in the AutoGPT marketplace."+ : "In the meantime you can check your progress on your Creator Dashboard page"+ }+ />++ <div className="flex flex-1 flex-col items-center gap-8 px-6 pt-6 sm:gap-6">+ <div className="mt-4 flex w-full flex-col items-center gap-6 sm:mt-0 sm:gap-4">+ <div className="flex flex-col items-center gap-3 sm:gap-2">+ <Text variant="large-medium">{agentName}</Text>+ <Text variant="body" className="!text-neutral-500">+ {subheader}+ </Text>+ </div>++ <div+ className="h-[280px] w-full rounded-xl bg-neutral-200 dark:bg-neutral-700"+ role="img"+ aria-label={+ thumbnailSrc ? "Agent thumbnail" : "Thumbnail placeholder"+ }+ >+ {thumbnailSrc && (+ <Image+ src={thumbnailSrc}+ alt="Agent thumbnail"+ width={400}+ height={280}+ className="h-full w-full rounded-xl object-cover"+ />+ )}+ </div>++ {description ? (+ <Text+ variant="body-medium"+ className="pb-16 pt-4 !text-neutral-500"+ >+ {description}+ </Text>+ ) : null}+ </div>+ </div>+ <div className="flex justify-between gap-4">+ <Button+ variant={isDashboardPage ? "primary" : "secondary"}+ onClick={onDone}+ className="w-full"+ >+ Done+ </Button>+ {!isDashboardPage ? (+ <Button+ onClick={onViewProgress}+ className="w-full"+ data-testid="view-progress-button"+ >+ View progress+ </Button>+ ) : null}+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/AgentSelectStep.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/AgentSelectStep.tsxnew file mode 100644index 0000000000..1b809e6092--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/AgentSelectStep.tsx@@ -0,0 +1,184 @@+"use client";++import * as React from "react";+import { Text } from "../../../../atoms/Text/Text";+import { Button } from "../../../../atoms/Button/Button";+import { StepHeader } from "../StepHeader";+import { Skeleton } from "@/components/ui/skeleton";+import { useAgentSelectStep } from "./useAgentSelectStep";++interface Props {+ onSelect: (agentId: string, agentVersion: number) => void;+ onCancel: () => void;+ onNext: (+ agentId: string,+ agentVersion: number,+ agentData: { name: string; description: string; imageSrc: string },+ ) => void;+ onOpenBuilder: () => void;+}++export function AgentSelectStep({+ onSelect,+ onCancel,+ onNext,+ onOpenBuilder,+}: Props) {+ const {+ // Data+ agents,+ isLoading,+ error,+ // State+ selectedAgentId,+ // Handlers+ handleAgentClick,+ handleNext,+ // Computed+ isNextDisabled,+ } = useAgentSelectStep({ onSelect, onNext });++ if (isLoading) {+ return (+ <div className="mx-auto flex w-full max-w-[900px] flex-col rounded-3xl">+ <StepHeader+ title="Publish Agent"+ description="Select your project that you'd like to publish"+ />+ <div className="flex-grow p-4 sm:p-6">+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">+ {Array.from({ length: 6 }).map((_, i) => (+ <div+ key={i}+ className="overflow-hidden rounded-2xl border border-neutral-200"+ >+ <Skeleton className="h-32 w-full sm:h-40" />+ <div className="flex flex-col gap-2 p-3">+ <Skeleton className="h-5 w-3/4" />+ <Skeleton className="h-4 w-1/2" />+ </div>+ </div>+ ))}+ </div>+ </div>+ </div>+ );+ }++ if (error) {+ return (+ <div className="mx-auto flex w-full max-w-[900px] flex-col rounded-3xl">+ <StepHeader+ title="Publish Agent"+ description="Select your project that you'd like to publish"+ />+ <div className="inline-flex h-[370px] flex-col items-center justify-center gap-[29px] px-4 py-5 sm:px-6">+ <Text variant="lead" className="text-center text-red-600">+ Failed to load agents. Please try again.+ </Text>+ <Button onClick={() => window.location.reload()} variant="secondary">+ Retry+ </Button>+ </div>+ </div>+ );+ }++ return (+ <div className="mx-auto flex w-full max-w-[900px] flex-col rounded-3xl">+ <StepHeader+ title="Publish Agent"+ description="Select your project that you'd like to publish"+ />++ {agents.length === 0 ? (+ <div className="inline-flex h-[370px] flex-col items-center justify-center gap-[29px] px-4 py-5 sm:px-6">+ <Text variant="lead" className="text-center">+ Uh-oh.. It seems like you don't have any agents in your+ library. We'd suggest you to create an agent in our builder+ first+ </Text>+ <Button+ onClick={onOpenBuilder}+ className="bg-neutral-800 text-white hover:bg-neutral-900"+ >+ Open builder+ </Button>+ </div>+ ) : (+ <>+ <div className="flex-grow overflow-hidden p-4 sm:p-6">+ <h3 className="sr-only">List of agents</h3>+ <div+ className="h-[300px] overflow-y-auto pr-2 sm:h-[400px] md:h-[500px]"+ role="region"+ aria-labelledby="agentListHeading"+ >+ <div id="agentListHeading" className="sr-only">+ Scrollable list of agents+ </div>+ <div className="p-2">+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">+ {agents.map((agent) => (+ <div+ key={agent.id}+ data-testid="agent-card"+ className={`cursor-pointer select-none overflow-hidden rounded-2xl border border-neutral-200 shadow-sm transition-all ${+ selectedAgentId === agent.id+ ? "border-transparent shadow-none ring-4 ring-violet-600"+ : "hover:shadow-md"+ }`}+ onClick={() =>+ handleAgentClick(agent.name, agent.id, agent.version)+ }+ onKeyDown={(e) => {+ if (e.key === "Enter" || e.key === " ") {+ e.preventDefault();+ handleAgentClick(agent.name, agent.id, agent.version);+ }+ }}+ tabIndex={0}+ role="button"+ aria-pressed={selectedAgentId === agent.id}+ >+ <div className="relative h-32 bg-gray-700 sm:h-40">+ <img+ src={agent.imageSrc}+ alt={agent.name}+ className="h-full w-full object-cover"+ />+ </div>+ <div className="flex flex-col gap-2 p-3">+ <Text variant="large-medium">{agent.name}</Text>+ <Text variant="small" className="!text-neutral-500">+ Edited {agent.lastEdited}+ </Text>+ </div>+ </div>+ ))}+ </div>+ </div>+ </div>+ </div>++ <div className="flex justify-between gap-4 p-4 sm:p-6">+ <Button+ variant="secondary"+ onClick={onCancel}+ className="w-full sm:flex-1"+ >+ Back+ </Button>+ <Button+ onClick={handleNext}+ disabled={isNextDisabled}+ className="w-full bg-neutral-800 text-white hover:bg-neutral-900 sm:flex-1"+ >+ Next+ </Button>+ </div>+ </>+ )}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.tsnew file mode 100644index 0000000000..37abe1b3c2--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts@@ -0,0 +1,88 @@+import * as React from "react";+import { useGetV2GetMyAgents } from "@/app/api/__generated__/endpoints/store/store";++export interface Agent {+ name: string;+ id: string;+ version: number;+ lastEdited: string;+ imageSrc: string;+ description: string;+}++interface UseAgentSelectStepProps {+ onSelect: (agentId: string, agentVersion: number) => void;+ onNext: (+ agentId: string,+ agentVersion: number,+ agentData: { name: string; description: string; imageSrc: string },+ ) => void;+}++export function useAgentSelectStep({+ onSelect,+ onNext,+}: UseAgentSelectStepProps) {+ const [selectedAgentId, setSelectedAgentId] = React.useState<string | null>(+ null,+ );+ const [selectedAgentVersion, setSelectedAgentVersion] = React.useState<+ number | null+ >(null);++ const { data: myAgents, isLoading, error } = useGetV2GetMyAgents();++ const agents: Agent[] =+ myAgents?.data?.agents+ ?.map((agent) => ({+ name: agent.agent_name,+ id: agent.agent_id,+ version: agent.agent_version,+ lastEdited: agent.last_edited,+ imageSrc: agent.agent_image || "https://picsum.photos/300/200",+ description: agent.description || "",+ }))+ .sort(+ (a, b) =>+ new Date(b.lastEdited).getTime() - new Date(a.lastEdited).getTime(),+ ) || [];++ const handleAgentClick = (+ _: string,+ agentId: string,+ agentVersion: number,+ ) => {+ setSelectedAgentId(agentId);+ setSelectedAgentVersion(agentVersion);+ onSelect(agentId, agentVersion);+ };++ const handleNext = () => {+ if (selectedAgentId && selectedAgentVersion) {+ const selectedAgent = agents.find(+ (agent) => agent.id === selectedAgentId,+ );+ if (selectedAgent) {+ onNext(selectedAgentId, selectedAgentVersion, {+ name: selectedAgent.name,+ description: selectedAgent.description,+ imageSrc: selectedAgent.imageSrc,+ });+ }+ }+ };++ return {+ // Data+ agents,+ isLoading,+ error,+ // State+ selectedAgentId,+ // Handlers+ handleAgentClick,+ handleNext,+ // Computed+ isNextDisabled: !selectedAgentId || !selectedAgentVersion,+ };+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/StepHeader.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/StepHeader.tsxnew file mode 100644index 0000000000..8ffe77ba0d--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/StepHeader.tsx@@ -0,0 +1,21 @@+import { Text } from "@/components/atoms/Text/Text";++type Props = {+ title: string;+ description: string;+};++export function StepHeader({ title, description }: Props) {+ return (+ <div className="relative border-b border-neutral-100 px-4 pb-4 sm:px-6 sm:pb-6">+ <div className="text-center">+ <Text variant="h3" className="text-xl">+ {title}+ </Text>+ <Text variant="body-medium" className="!text-neutral-400">+ {description}+ </Text>+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.tsnew file mode 100644index 0000000000..2bd4c1fb6d--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts@@ -0,0 +1,258 @@+import { getGetV2ListMySubmissionsQueryKey } from "@/app/api/__generated__/endpoints/store/store";+import { StoreSubmissionRequest } from "@/app/api/__generated__/models/storeSubmissionRequest";+import { useCallback, useEffect, useState } from "react";+import { PublishAgentInfoInitialData } from "./components/AgentInfoStep/helpers";+import { useQueryClient } from "@tanstack/react-query";+import { useRouter } from "next/navigation";+import { useBackendAPI } from "@/lib/autogpt-server-api/context";+import { useToast } from "@/components/molecules/Toast/use-toast";++const defaultTargetState: PublishState = {+ isOpen: false,+ step: "select",+ submissionData: null,+};++export type PublishStep = "select" | "info" | "review";++export type PublishState = {+ isOpen: boolean;+ step: PublishStep;+ submissionData: StoreSubmissionRequest | null;+};++export interface Props {+ trigger?: React.ReactNode;+ targetState?: PublishState;+ onStateChange?: (state: PublishState) => void;+}++export function usePublishAgentModal({ targetState, onStateChange }: Props) {+ const [currentState, setCurrentState] = useState<PublishState>(+ targetState || defaultTargetState,+ );++ const updateState = useCallback(+ (newState: PublishState) => {+ setCurrentState(newState);+ onStateChange?.(newState);+ },+ [onStateChange],+ );++ const [initialData, setInitialData] = useState<PublishAgentInfoInitialData>({+ agent_id: "",+ title: "",+ subheader: "",+ slug: "",+ thumbnailSrc: "",+ youtubeLink: "",+ category: "",+ description: "",+ });++ const [_, setSelectedAgent] = useState<string | null>(null);++ const [selectedAgentId, setSelectedAgentId] = useState<string | null>(null);++ const [selectedAgentVersion, setSelectedAgentVersion] = useState<+ number | null+ >(null);++ const queryClient = useQueryClient();+ const router = useRouter();+ const api = useBackendAPI();+ const { toast } = useToast();++ // Sync currentState with targetState when it changes from outside+ useEffect(() => {+ if (targetState) {+ setCurrentState(targetState);+ }+ }, [targetState]);++ // Reset internal state when modal opens+ useEffect(() => {+ if (!targetState) return;+ if (targetState.isOpen && targetState.step === "select") {+ setSelectedAgent(null);+ setSelectedAgentId(null);+ setSelectedAgentVersion(null);+ setInitialData({+ agent_id: "",+ title: "",+ subheader: "",+ slug: "",+ thumbnailSrc: "",+ youtubeLink: "",+ category: "",+ description: "",+ });+ }+ }, [targetState]);++ function handleClose() {+ // Reset all internal state+ setSelectedAgent(null);+ setSelectedAgentId(null);+ setSelectedAgentVersion(null);+ setInitialData({+ agent_id: "",+ title: "",+ subheader: "",+ slug: "",+ thumbnailSrc: "",+ youtubeLink: "",+ category: "",+ description: "",+ });++ // Update parent with clean closed state+ const newState = {+ isOpen: false,+ step: "select" as PublishStep,+ submissionData: null,+ };+ updateState(newState);+ }++ function handleAgentSelect(agentName: string) {+ setSelectedAgent(agentName);+ }++ function handleNextFromSelect(+ agentId: string,+ agentVersion: number,+ agentData: { name: string; description: string; imageSrc: string },+ ) {+ setInitialData({+ agent_id: agentId,+ title: agentData.name,+ subheader: "",+ description: agentData.description,+ thumbnailSrc: agentData.imageSrc,+ youtubeLink: "",+ category: "",+ slug: agentData.name.replace(/ /g, "-"),+ additionalImages: [],+ });++ updateState({+ ...currentState,+ step: "info",+ });++ setSelectedAgentId(agentId);+ setSelectedAgentVersion(agentVersion);+ }++ async function handleNextFromInfo(+ name: string,+ subHeading: string,+ slug: string,+ description: string,+ imageUrls: string[],+ videoUrl: string,+ categories: string[],+ ) {+ 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.filter(Boolean).length) missingFields.push("Categories");++ if (missingFields.length > 0) {+ toast({+ title: "Missing Required Fields",+ description: `Please fill in: ${missingFields.join(", ")}`,+ duration: 3000,+ });+ return;+ }++ const filteredCategories = categories.filter(Boolean);++ updateState({+ ...currentState,+ submissionData: {+ name,+ sub_heading: subHeading,+ description,+ image_urls: imageUrls,+ video_url: videoUrl,+ agent_id: selectedAgentId || "",+ agent_version: selectedAgentVersion || 0,+ slug,+ categories: filteredCategories,+ },+ });++ // Create store submission+ try {+ const response = await api.createStoreSubmission({+ name: name,+ sub_heading: subHeading,+ description: description,+ image_urls: imageUrls,+ video_url: videoUrl,+ agent_id: selectedAgentId || "",+ agent_version: selectedAgentVersion || 0,+ slug: slug.replace(/\s+/g, "-"),+ categories: filteredCategories,+ });++ updateState({+ ...currentState,+ submissionData: response,+ step: "review",+ });++ await queryClient.invalidateQueries({+ queryKey: getGetV2ListMySubmissionsQueryKey(),+ });+ } catch (error) {+ console.error("Error creating store submission:", error);+ }+ }++ function handleBack() {+ if (currentState.step === "info") {+ updateState({+ ...currentState,+ step: "select",+ });+ } else if (currentState.step === "review") {+ updateState({+ ...currentState,+ step: "info",+ });+ }+ }++ function handleGoToDashboard() {+ router.push("/profile/dashboard");+ handleClose();+ }++ function handleGoToBuilder() {+ router.push("/build");+ handleClose();+ }++ return {+ // handlers+ handleClose,+ handleAgentSelect,+ handleNextFromSelect,+ handleGoToDashboard,+ handleGoToBuilder,+ handleNextFromInfo,+ handleBack,+ // state+ currentState,+ updateState,+ initialData,+ };+}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenu.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenu.tsxindex 794c0aab42..4a6e55d2a3 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenu.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenu.tsx@@ -6,9 +6,9 @@ import {} from "@/components/ui/popover";import Link from "next/link";import * as React from "react";-import { PublishAgentPopout } from "../../../../agptui/composite/PublishAgentPopout";import { getAccountMenuOptionIcon, MenuItemGroup } from "../../helpers";import { AccountLogoutOption } from "./components/AccountLogoutOption";+import { PublishAgentModal } from "@/components/contextual/PublishAgentModal/PublishAgentModal";interface Props {userName?: string;@@ -99,21 +99,23 @@ export function AccountMenu({return <AccountLogoutOption key={itemIndex} />;} else if (item.text === "Publish an agent") {return (- <PublishAgentPopout+ <PublishAgentModalkey={itemIndex}trigger={- <div className="inline-flex w-full items-center justify-start gap-2.5">+ <div className="inline-flex w-full flex-row flex-nowrap items-center justify-start gap-2.5"><div className="relative h-6 w-6">{getAccountMenuOptionIcon(item.icon)}</div>- <div className="font-sans text-base font-medium leading-normal text-neutral-800 dark:text-neutral-200">+ <div className="font-sans text-base font-medium leading-normal text-neutral-800">{item.text}</div></div>}- inputStep="select"- submissionData={undefined}- openPopout={false}+ targetState={{+ isOpen: true,+ step: "select",+ submissionData: null,+ }}/>);} else {diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/AgentActivityDropdown.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/AgentActivityDropdown.tsxindex 339add5619..9a6c92575e 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/AgentActivityDropdown.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/AgentActivityDropdown.tsx@@ -7,17 +7,19 @@ import {PopoverTrigger,} from "@/components/ui/popover";import { Bell } from "@phosphor-icons/react";-import { useState } from "react";import { ActivityDropdown } from "./components/ActivityDropdown/ActivityDropdown";import { formatNotificationCount } from "./helpers";import { useAgentActivityDropdown } from "./useAgentActivityDropdown";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";export function AgentActivityDropdown() {- const isAgentActivityEnabled = useGetFlag(Flag.AGENT_ACTIVITY);- const [isOpen, setIsOpen] = useState(false);- const { activeExecutions, recentCompletions, recentFailures } =- useAgentActivityDropdown();+ const {+ activeExecutions,+ recentCompletions,+ recentFailures,+ isOpen,+ setIsOpen,+ isAgentActivityEnabled,+ } = useAgentActivityDropdown();const activeCount = activeExecutions.length;diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/useAgentActivityDropdown.ts b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/useAgentActivityDropdown.tsindex bb2d7e1dd9..d0dbc69511 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/useAgentActivityDropdown.ts+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/useAgentActivityDropdown.ts@@ -11,6 +11,7 @@ import {categorizeExecutions,handleExecutionUpdate,} from "./helpers";+import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";type AgentInfoMap = Map<string,@@ -18,6 +19,9 @@ type AgentInfoMap = Map<>;export function useAgentActivityDropdown() {+ const isAgentActivityEnabled = useGetFlag(Flag.AGENT_ACTIVITY);+ const [isOpen, setIsOpen] = useState(false);+const [api] = useState(() => new BackendAPI());const [notifications, setNotifications] = useState<NotificationState>({@@ -128,5 +132,8 @@ export function useAgentActivityDropdown() {isConnected,isReady: executionsSuccess && agentsSuccess,error: executionsError || agentsError,+ isOpen,+ setIsOpen,+ isAgentActivityEnabled,};}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarView.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarView.tsxindex 1241c43fb2..329f960086 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarView.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarView.tsx@@ -25,7 +25,7 @@ export const NavbarView = ({ isLoggedIn }: NavbarViewProps) => {return (<>- <nav className="sticky top-0 z-40 hidden h-16 items-center rounded-bl-2xl rounded-br-2xl border border-white/50 bg-[#f3f4f6]/20 p-3 backdrop-blur-[26px] md:inline-flex">+ <nav className="sticky top-0 z-40 hidden h-16 items-center border border-white/50 bg-[#f3f4f6]/20 p-3 backdrop-blur-[26px] md:inline-flex">{/* Left section */}<div className="flex flex-1 items-center gap-5">{isLoggedIndiff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/components/BaseTrigger.tsx b/autogpt_platform/frontend/src/components/molecules/Dialog/components/BaseTrigger.tsxindex 36db5305c4..ef58976c8a 100644--- a/autogpt_platform/frontend/src/components/molecules/Dialog/components/BaseTrigger.tsx+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/components/BaseTrigger.tsx@@ -1,12 +1,14 @@import React, { PropsWithChildren } from "react";import { useDialogCtx } from "../useDialogCtx";+import { cn } from "@/lib/utils";export function BaseTrigger({ children }: PropsWithChildren) {const ctx = useDialogCtx();+ const child = children as React.ReactElement;- return React.cloneElement(children as React.ReactElement, {+ return React.cloneElement(child, {onClick: ctx.handleOpen,- className: "cursor-pointer",+ className: cn("cursor-pointer", child.props.className),});}diff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/components/DialogWrap.tsx b/autogpt_platform/frontend/src/components/molecules/Dialog/components/DialogWrap.tsxindex 2aec6333a5..23797ea18b 100644--- a/autogpt_platform/frontend/src/components/molecules/Dialog/components/DialogWrap.tsx+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/components/DialogWrap.tsx@@ -4,6 +4,8 @@ import * as RXDialog from "@radix-ui/react-dialog";import { CSSProperties, PropsWithChildren } from "react";import { DialogCtx } from "../useDialogCtx";import { modalStyles } from "./styles";+import styles from "./styles.module.css";+import { Button } from "@/components/atoms/Button/Button";type BaseProps = DialogCtx & PropsWithChildren;@@ -49,17 +51,19 @@ export function DialogWrap({)}{isForceOpen && !handleClose ? null : (- <button- type="button"+ <Button+ variant="ghost"onClick={handleClose}aria-label="Close"- className={`${modalStyles.iconWrap} transition-colors duration-200 hover:bg-gray-200 dark:hover:bg-stone-900`}+ className="absolute -right-2 top-2 z-50 hover:border-transparent hover:bg-transparent"><X className={modalStyles.icon} />- </button>+ </Button>)}</div>- <div className="overflow-y-auto">{children}</div>+ <div className={`overflow-y-auto ${styles.scrollableContent}`}>+ {children}+ </div></RXDialog.Content></RXDialog.Portal>);diff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/components/DrawerWrap.tsx b/autogpt_platform/frontend/src/components/molecules/Dialog/components/DrawerWrap.tsxindex 11d33826b7..198735ea45 100644--- a/autogpt_platform/frontend/src/components/molecules/Dialog/components/DrawerWrap.tsx+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/components/DrawerWrap.tsx@@ -4,6 +4,7 @@ import { PropsWithChildren } from "react";import { Drawer } from "vaul";import { DialogCtx } from "../useDialogCtx";import { drawerStyles, modalStyles } from "./styles";+import styles from "./styles.module.css";type BaseProps = DialogCtx & PropsWithChildren;@@ -56,7 +57,9 @@ export function DrawerWrap({)) : null}</div>- <div className="overflow-auto">{children}</div>+ <div className={`overflow-auto ${styles.scrollableContent}`}>+ {children}+ </div></Drawer.Content></Drawer.Portal>);diff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/components/styles.module.css b/autogpt_platform/frontend/src/components/molecules/Dialog/components/styles.module.cssnew file mode 100644index 0000000000..51040dbc15--- /dev/null+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/components/styles.module.css@@ -0,0 +1,43 @@+/* Scrollable content area for dialogs */+.scrollableContent {+ scrollbar-width: thin;+ scrollbar-color: rgb(209, 213, 219) white;+}++/* Webkit scrollbar styles */+.scrollableContent::-webkit-scrollbar {+ width: 8px;+}++.scrollableContent::-webkit-scrollbar-track {+ background: white;+ border-radius: 4px;+}++.scrollableContent::-webkit-scrollbar-thumb {+ background: rgb(209, 213, 219); /* gray-300 */+ border-radius: 4px;+}++.scrollableContent::-webkit-scrollbar-thumb:hover {+ background: rgb(156, 163, 175); /* gray-400 */+}++/* Dark mode support */+@media (prefers-color-scheme: dark) {+ .scrollableContent {+ scrollbar-color: rgb(107, 114, 128) rgb(31, 41, 55);+ }++ .scrollableContent::-webkit-scrollbar-track {+ background: rgb(31, 41, 55);+ }++ .scrollableContent::-webkit-scrollbar-thumb {+ background: rgb(107, 114, 128); /* gray-500 */+ }++ .scrollableContent::-webkit-scrollbar-thumb:hover {+ background: rgb(75, 85, 99); /* gray-600 */+ }+}diff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/components/styles.ts b/autogpt_platform/frontend/src/components/molecules/Dialog/components/styles.tsindex d430d703af..f394d3b273 100644--- a/autogpt_platform/frontend/src/components/molecules/Dialog/components/styles.ts+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/components/styles.ts@@ -4,16 +4,16 @@ const commonStyles = {overlay:"fixed inset-0 z-50 bg-stone-500/20 dark:bg-black/50 backdrop-blur-md animate-fade-in",content:- "bg-stone-100 dark:bg-stone-800 p-6 fixed rounded-xl flex flex-col z-50 w-full overflow-hidden",+ "bg-white p-6 fixed rounded-xl flex flex-col z-50 w-full overflow-hidden",};// Modal specific stylesexport const modalStyles = {...commonStyles,- content: `${commonStyles.content} p-6 border border-stone-200 dark:border-stone-700 overflow-y-auto min-w-[40vw] max-w-[60vw] max-h-[95vh] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-fadein`,+ content: `${commonStyles.content} p-6 border border-stone-200 overflow-y-auto min-w-[40vw] max-w-[60vw] max-h-[95vh] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-fadein`,iconWrap:"absolute top-2 right-3 bg-transparent p-2 rounded-full transition-colors duration-300 ease-in-out outline-none border-none",- icon: "w-4 h-4 text-stone-800 dark:text-stone-300",+ icon: "w-4 h-4 text-stone-800",};// Drawer specific stylesdiff --git a/autogpt_platform/frontend/src/tests/publish-agent.spec.ts b/autogpt_platform/frontend/src/tests/publish-agent.spec.tsnew file mode 100644index 0000000000..bc1247507e--- /dev/null+++ b/autogpt_platform/frontend/src/tests/publish-agent.spec.ts@@ -0,0 +1,265 @@+import test from "@playwright/test";+import { LoginPage } from "./pages/login.page";+import { TEST_CREDENTIALS } from "./credentials";+import { getSelectors } from "./utils/selectors";+import {+ hasUrl,+ isDisabled,+ isEnabled,+ isHidden,+ isVisible,+} from "./utils/assertion";++test("user can publish an agent through the complete flow", async ({+ page,+}) => {+ const { getId, getText, getButton } = getSelectors(page);++ const loginPage = new LoginPage(page);+ await page.goto("/login");+ await loginPage.login(TEST_CREDENTIALS.email, TEST_CREDENTIALS.password);+ await hasUrl(page, "/marketplace");++ await page.goto("/marketplace");+ await getButton("Become a creator").click();++ const publishAgentModal = getId("publish-agent-modal");+ await isVisible(publishAgentModal, 10000);++ await isVisible(+ publishAgentModal.getByText(+ "Select your project that you'd like to publish",+ ),+ );++ const agentToSelect = publishAgentModal.getByTestId("agent-card").first();+ await agentToSelect.click();++ const nextButton = publishAgentModal.getByRole("button", { name: "Next" });+ await isEnabled(nextButton);+ await nextButton.click();++ // 2. Adding details of agent+ await isVisible(getText("Write a bit of details about your agent"));++ const agentName = "Test Agent Name";++ const agentTitle = publishAgentModal.getByLabel("Title");+ await agentTitle.fill(agentName);++ const agentSubheader = publishAgentModal.getByLabel("Subheader");+ await agentSubheader.fill("Test Agent Subheader");++ const agentSlug = publishAgentModal.getByLabel("Slug");+ await agentSlug.fill("test-agent-slug");++ const youtubeInput = publishAgentModal.getByLabel("Youtube video link");+ await youtubeInput.fill("https://www.youtube.com/watch?v=test");++ const categorySelect = publishAgentModal.locator(+ 'select[aria-hidden="true"]',+ );+ await categorySelect.selectOption({ value: "other" });++ const descriptionInput = publishAgentModal.getByLabel("Description");+ await descriptionInput.fill(+ "This is a test agent description for the automated test.",+ );++ await isEnabled(publishAgentModal.getByRole("button", { name: "Submit" }));+});++test("should display appropriate content in agent creation modal when user is logged out", async ({+ page,+}) => {+ const { getText, getButton } = getSelectors(page);++ await page.goto("/marketplace");+ await getButton("Become a creator").click();++ await isVisible(+ getText("Uh-oh.. It seems like you don't have any agents in your library."),+ );+});++test("should validate all form fields in publish agent form", async ({+ page,+}) => {+ const { getId, getText, getButton } = getSelectors(page);++ const loginPage = new LoginPage(page);+ await page.goto("/login");+ await loginPage.login(TEST_CREDENTIALS.email, TEST_CREDENTIALS.password);+ await hasUrl(page, "/marketplace");++ await page.goto("/marketplace");+ await getButton("Become a creator").click();++ const publishAgentModal = getId("publish-agent-modal");+ await isVisible(publishAgentModal, 10000);++ const agentToSelect = publishAgentModal.getByTestId("agent-card").first();+ await agentToSelect.click();++ const nextButton = publishAgentModal.getByRole("button", { name: "Next" });+ await nextButton.click();++ await isVisible(getText("Write a bit of details about your agent"));++ // Get form elements+ const agentTitle = publishAgentModal.getByLabel("Title");+ const agentSubheader = publishAgentModal.getByLabel("Subheader");+ const agentSlug = publishAgentModal.getByLabel("Slug");+ const youtubeInput = publishAgentModal.getByLabel("Youtube video link");+ const categorySelect = publishAgentModal.locator(+ 'select[aria-hidden="true"]',+ );+ const descriptionInput = publishAgentModal.getByLabel("Description");+ const submitButton = publishAgentModal.getByRole("button", {+ name: "Submit",+ });++ async function clearForm() {+ await agentTitle.clear();+ await agentSubheader.clear();+ await agentSlug.clear();+ await youtubeInput.clear();+ await descriptionInput.clear();+ }++ // 1. Test required field validations+ await clearForm();+ await submitButton.click();++ await isVisible(publishAgentModal.getByText("Title is required"));+ await isVisible(publishAgentModal.getByText("Subheader is required"));+ await isVisible(publishAgentModal.getByText("Slug is required"));+ await isVisible(publishAgentModal.getByText("Category is required"));+ await isVisible(publishAgentModal.getByText("Description is required"));++ // 2. Test field length limits+ await clearForm();++ // Test title length limit (100 characters)+ const longTitle = "a".repeat(101);+ await agentTitle.fill(longTitle);+ await agentTitle.blur();+ await isVisible(+ publishAgentModal.getByText("Title must be less than 100 characters"),+ );++ // Test subheader length limit (200 characters)+ const longSubheader = "b".repeat(201);+ await agentSubheader.fill(longSubheader);+ await agentSubheader.blur();+ await isVisible(+ publishAgentModal.getByText("Subheader must be less than 200 characters"),+ );++ // Test slug length limit (50 characters)+ const longSlug = "c".repeat(51);+ await agentSlug.fill(longSlug);+ await agentSlug.blur();+ await isVisible(+ publishAgentModal.getByText("Slug must be less than 50 characters"),+ );++ // Test description length limit (1000 characters)+ const longDescription = "d".repeat(1001);+ await descriptionInput.fill(longDescription);+ await descriptionInput.blur();+ await isVisible(+ publishAgentModal.getByText(+ "Description must be less than 1000 characters",+ ),+ );++ // Test invalid characters in slug+ await agentSlug.fill("Invalid Slug With Spaces");+ await agentSlug.blur();+ await isVisible(+ publishAgentModal.getByText(+ "Slug can only contain lowercase letters, numbers, and hyphens",+ ),+ );++ await agentSlug.clear();+ await agentSlug.fill("InvalidSlugWithCapitals");+ await agentSlug.blur();+ await isVisible(+ publishAgentModal.getByText(+ "Slug can only contain lowercase letters, numbers, and hyphens",+ ),+ );++ await agentSlug.clear();+ await agentSlug.fill("invalid-slug-with-@#$");+ await agentSlug.blur();+ await isVisible(+ publishAgentModal.getByText(+ "Slug can only contain lowercase letters, numbers, and hyphens",+ ),+ );++ // Test valid slug format should not show error+ await agentSlug.clear();+ await agentSlug.fill("valid-slug-123");+ await agentSlug.blur();+ await page.waitForTimeout(500);++ await isHidden(+ publishAgentModal.getByText(+ "Slug can only contain lowercase letters, numbers, and hyphens",+ ),+ );++ // Test invalid YouTube URL+ await youtubeInput.fill("https://www.google.com/invalid-url");+ await youtubeInput.blur();+ await isVisible(+ publishAgentModal.getByText("Please enter a valid YouTube URL"),+ );++ await youtubeInput.clear();+ await youtubeInput.fill("not-a-url-at-all");+ await youtubeInput.blur();+ await isVisible(+ publishAgentModal.getByText("Please enter a valid YouTube URL"),+ );++ // Test valid YouTube URLs should not show error+ await youtubeInput.clear();+ await youtubeInput.fill("https://www.youtube.com/watch?v=test");+ await youtubeInput.blur();+ await page.waitForTimeout(500);++ await isHidden(+ publishAgentModal.getByText("Please enter a valid YouTube URL"),+ );++ await youtubeInput.clear();+ await youtubeInput.fill("https://youtu.be/test123");+ await youtubeInput.blur();+ await page.waitForTimeout(500);++ await isHidden(+ publishAgentModal.getByText("Please enter a valid YouTube URL"),+ );++ // 5. Test submit button enabled/disabled state+ await clearForm();++ // Submit button should be disabled when form is empty+ await page.waitForTimeout(1000);+ await isDisabled(submitButton);++ // Fill all required fields with valid data+ await agentTitle.fill("Valid Title");+ await agentSubheader.fill("Valid Subheader");+ await agentSlug.fill("valid-slug");+ await categorySelect.selectOption({ value: "other" });+ await descriptionInput.fill("Valid description text");++ // Submit button should now be enabled+ await isEnabled(submitButton);+});