AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(frontend): Update "Edit a copy" modal and buttons (#9876)
Krzysztof Czerwinski11a69170b5f0
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/page.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/page.tsxindex 38bdd0ed02..b3b974aae1 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/page.tsx@@ -268,22 +268,22 @@ export default function AgentRunsPage(): React.ReactElement {const agentActions: ButtonAction[] = useMemo(() => [- ...(agent?.can_access_graph+ {+ label: "Customize agent",+ href: `/build?flowID=${agent?.graph_id}&flowVersion=${agent?.graph_version}`,+ disabled: !agent?.can_access_graph,+ },+ { label: "Export agent to file", callback: downloadGraph },+ ...(!agent?.can_access_graph? [{- label: "Open graph in builder",- href: `/build?flowID=${agent.graph_id}&flowVersion=${agent.graph_version}`,+ label: "Edit a copy",+ callback: () => setCopyAgentDialogOpen(true),},]: []),- { label: "Export agent to file", callback: downloadGraph },- {- label: "Edit a copy",- callback: () => setCopyAgentDialogOpen(true),- },{label: "Delete agent",- variant: "destructive",callback: () => setAgentDeleteDialogOpen(true),},],@@ -381,10 +381,11 @@ export default function AgentRunsPage(): React.ReactElement {<DialogHeader><DialogTitle>You're making an editable copy</DialogTitle><DialogDescription className="pt-2">- We'll save a new version of this agent to your library so- you can customize it however you'd like. You'll still- have the original from the marketplace too — it won't be- changed and can't be edited.+ The original Marketplace agent stays the same and cannot be+ edited. We'll save a new version of this agent to your+ Library. From there, you can customize it however you'd+ like by clicking "Customize agent" — this will open+ the builder where you can see and modify the inner workings.</DialogDescription></DialogHeader><DialogFooter className="justify-end">diff --git a/autogpt_platform/frontend/src/components/agptui/action-button-group.tsx b/autogpt_platform/frontend/src/components/agptui/action-button-group.tsxindex a9d565ae7c..3d69a3e330 100644--- a/autogpt_platform/frontend/src/components/agptui/action-button-group.tsx+++ b/autogpt_platform/frontend/src/components/agptui/action-button-group.tsx@@ -22,6 +22,7 @@ export default function ActionButtonGroup({<Buttonkey={i}variant={action.variant ?? "outline"}+ disabled={action.disabled}onClick={action.callback}>{action.label}@@ -29,7 +30,11 @@ export default function ActionButtonGroup({) : (<Linkkey={i}- className={buttonVariants({ variant: action.variant })}+ className={cn(+ buttonVariants({ variant: action.variant }),+ action.disabled &&+ "pointer-events-none border-zinc-400 text-zinc-400",+ )}href={action.href}>{action.label}diff --git a/autogpt_platform/frontend/src/components/agptui/types.ts b/autogpt_platform/frontend/src/components/agptui/types.tsindex 2cdcb1912e..24f371d165 100644--- a/autogpt_platform/frontend/src/components/agptui/types.ts+++ b/autogpt_platform/frontend/src/components/agptui/types.ts@@ -4,4 +4,5 @@ import React from "react";export type ButtonAction = {label: React.ReactNode;variant?: ButtonProps["variant"];+ disabled?: boolean;} & ({ callback: () => void } | { href: string });