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): Update user profile from marketplace to appropriate profile route (#9465)
Andy Hooker40613fe23e0d
diff --git a/autogpt_platform/frontend/src/app/layout.tsx b/autogpt_platform/frontend/src/app/layout.tsxindex 9f05958370..e6888f6fb4 100644--- a/autogpt_platform/frontend/src/app/layout.tsx+++ b/autogpt_platform/frontend/src/app/layout.tsx@@ -66,7 +66,7 @@ export default async function RootLayout({{icon: IconType.Edit,text: "Edit profile",- href: "/marketplace/profile",+ href: "/profile",},],},@@ -75,7 +75,7 @@ export default async function RootLayout({{icon: IconType.LayoutDashboard,text: "Creator Dashboard",- href: "/marketplace/dashboard",+ href: "/profile/dashboard",},{icon: IconType.UploadCloud,@@ -88,7 +88,7 @@ export default async function RootLayout({{icon: IconType.Settings,text: "Settings",- href: "/marketplace/settings",+ href: "/profile/settings",},],},diff --git a/autogpt_platform/frontend/src/app/marketplace/(user)/api_keys/page.tsx b/autogpt_platform/frontend/src/app/profile/(user)/api_keys/page.tsxsimilarity index 100%rename from autogpt_platform/frontend/src/app/marketplace/(user)/api_keys/page.tsxrename to autogpt_platform/frontend/src/app/profile/(user)/api_keys/page.tsxdiff --git a/autogpt_platform/frontend/src/app/marketplace/(user)/credits/page.tsx b/autogpt_platform/frontend/src/app/profile/(user)/credits/page.tsxsimilarity index 100%rename from autogpt_platform/frontend/src/app/marketplace/(user)/credits/page.tsxrename to autogpt_platform/frontend/src/app/profile/(user)/credits/page.tsxdiff --git a/autogpt_platform/frontend/src/app/marketplace/(user)/dashboard/page.tsx b/autogpt_platform/frontend/src/app/profile/(user)/dashboard/page.tsxsimilarity index 98%rename from autogpt_platform/frontend/src/app/marketplace/(user)/dashboard/page.tsxrename to autogpt_platform/frontend/src/app/profile/(user)/dashboard/page.tsxindex 221e751b40..704f4820b6 100644--- a/autogpt_platform/frontend/src/app/marketplace/(user)/dashboard/page.tsx+++ b/autogpt_platform/frontend/src/app/profile/(user)/dashboard/page.tsx@@ -2,7 +2,6 @@import * as React from "react";import { AgentTable } from "@/components/agptui/AgentTable";-import { AgentTableRowProps } from "@/components/agptui/AgentTableRow";import { Button } from "@/components/agptui/Button";import { Separator } from "@/components/ui/separator";import { StatusType } from "@/components/agptui/Status";diff --git a/autogpt_platform/frontend/src/app/marketplace/(user)/integrations/page.tsx b/autogpt_platform/frontend/src/app/profile/(user)/integrations/page.tsxsimilarity index 98%rename from autogpt_platform/frontend/src/app/marketplace/(user)/integrations/page.tsxrename to autogpt_platform/frontend/src/app/profile/(user)/integrations/page.tsxindex f92d63344d..8069664017 100644--- a/autogpt_platform/frontend/src/app/marketplace/(user)/integrations/page.tsx+++ b/autogpt_platform/frontend/src/app/profile/(user)/integrations/page.tsx@@ -2,10 +2,9 @@import { Button } from "@/components/ui/button";import { useRouter } from "next/navigation";import { useCallback, useContext, useMemo, useState } from "react";-import { Separator } from "@/components/ui/separator";import { useToast } from "@/components/ui/use-toast";import { IconKey, IconUser } from "@/components/ui/icons";-import { LogOutIcon, Trash2Icon } from "lucide-react";+import { Trash2Icon } from "lucide-react";import { providerIcons } from "@/components/integrations/credentials-input";import { CredentialsProvidersContext } from "@/components/integrations/credentials-provider";import {diff --git a/autogpt_platform/frontend/src/app/marketplace/(user)/layout.tsx b/autogpt_platform/frontend/src/app/profile/(user)/layout.tsxsimilarity index 50%rename from autogpt_platform/frontend/src/app/marketplace/(user)/layout.tsxrename to autogpt_platform/frontend/src/app/profile/(user)/layout.tsxindex ea88d5edc4..72b4d09fed 100644--- a/autogpt_platform/frontend/src/app/marketplace/(user)/layout.tsx+++ b/autogpt_platform/frontend/src/app/profile/(user)/layout.tsx@@ -5,13 +5,13 @@ export default function Layout({ children }: { children: React.ReactNode }) {const sidebarLinkGroups = [{links: [- { text: "Creator Dashboard", href: "/marketplace/dashboard" },- { text: "Agent dashboard", href: "/marketplace/agent-dashboard" },- { text: "Billing", href: "/marketplace/credits" },- { text: "Integrations", href: "/marketplace/integrations" },- { text: "API Keys", href: "/marketplace/api_keys" },- { text: "Profile", href: "/marketplace/profile" },- { text: "Settings", href: "/marketplace/settings" },+ { text: "Creator Dashboard", href: "/profile/dashboard" },+ { text: "Agent dashboard", href: "/profile/agent-dashboard" },+ { text: "Billing", href: "/profile/credits" },+ { text: "Integrations", href: "/profile/integrations" },+ { text: "API Keys", href: "/profile/api_keys" },+ { text: "Profile", href: "/profile" },+ { text: "Settings", href: "/profile/settings" },],},];diff --git a/autogpt_platform/frontend/src/app/marketplace/(user)/profile/page.tsx b/autogpt_platform/frontend/src/app/profile/(user)/page.tsxsimilarity index 100%rename from autogpt_platform/frontend/src/app/marketplace/(user)/profile/page.tsxrename to autogpt_platform/frontend/src/app/profile/(user)/page.tsxdiff --git a/autogpt_platform/frontend/src/app/marketplace/(user)/settings/page.tsx b/autogpt_platform/frontend/src/app/profile/(user)/settings/page.tsxsimilarity index 100%rename from autogpt_platform/frontend/src/app/marketplace/(user)/settings/page.tsxrename to autogpt_platform/frontend/src/app/profile/(user)/settings/page.tsxdiff --git a/autogpt_platform/frontend/src/app/profile/page.tsx b/autogpt_platform/frontend/src/app/profile/page.tsxdeleted file mode 100644index 445077dabe..0000000000--- a/autogpt_platform/frontend/src/app/profile/page.tsx+++ /dev/null@@ -1,242 +0,0 @@-"use client";-import { Button } from "@/components/ui/button";-import { useRouter } from "next/navigation";-import { useCallback, useContext, useMemo, useState } from "react";-import { Separator } from "@/components/ui/separator";-import { useToast } from "@/components/ui/use-toast";-import { IconKey, IconUser } from "@/components/ui/icons";-import { LogOutIcon, Trash2Icon } from "lucide-react";-import { providerIcons } from "@/components/integrations/credentials-input";-import { CredentialsProvidersContext } from "@/components/integrations/credentials-provider";-import {- Table,- TableBody,- TableCell,- TableHead,- TableHeader,- TableRow,-} from "@/components/ui/table";-import { CredentialsProviderName } from "@/lib/autogpt-server-api";-import {- AlertDialog,- AlertDialogAction,- AlertDialogCancel,- AlertDialogContent,- AlertDialogDescription,- AlertDialogFooter,- AlertDialogHeader,- AlertDialogTitle,-} from "@/components/ui/alert-dialog";-import useSupabase from "@/hooks/useSupabase";-import Spinner from "@/components/Spinner";--export default function PrivatePage() {- const { supabase, user, isUserLoading } = useSupabase();- const router = useRouter();- const providers = useContext(CredentialsProvidersContext);- const { toast } = useToast();-- const [confirmationDialogState, setConfirmationDialogState] = useState<- | {- open: true;- message: string;- onConfirm: () => void;- onReject: () => void;- }- | { open: false }- >({ open: false });-- const removeCredentials = useCallback(- async (- provider: CredentialsProviderName,- id: string,- force: boolean = false,- ) => {- if (!providers || !providers[provider]) {- return;- }-- let result;- try {- result = await providers[provider].deleteCredentials(id, force);- } catch (error: any) {- toast({- title: "Something went wrong when deleting credentials: " + error,- variant: "destructive",- duration: 2000,- });- setConfirmationDialogState({ open: false });- return;- }- if (result.deleted) {- if (result.revoked) {- toast({- title: "Credentials deleted",- duration: 2000,- });- } else {- toast({- title: "Credentials deleted from AutoGPT",- description: `You may also manually remove the connection to AutoGPT at ${provider}!`,- duration: 3000,- });- }- setConfirmationDialogState({ open: false });- } else if (result.need_confirmation) {- setConfirmationDialogState({- open: true,- message: result.message,- onConfirm: () => removeCredentials(provider, id, true),- onReject: () => setConfirmationDialogState({ open: false }),- });- }- },- [providers, toast],- );-- //TODO: remove when the way system credentials are handled is updated- // This contains ids for built-in "Use Credits for X" credentials- const hiddenCredentials = useMemo(- () => [- "744fdc56-071a-4761-b5a5-0af0ce10a2b5", // Ollama- "fdb7f412-f519-48d1-9b5f-d2f73d0e01fe", // Revid- "760f84fc-b270-42de-91f6-08efe1b512d0", // Ideogram- "6b9fc200-4726-4973-86c9-cd526f5ce5db", // Replicate- "53c25cb8-e3ee-465c-a4d1-e75a4c899c2a", // OpenAI- "24e5d942-d9e3-4798-8151-90143ee55629", // Anthropic- "4ec22295-8f97-4dd1-b42b-2c6957a02545", // Groq- "7f7b0654-c36b-4565-8fa7-9a52575dfae2", // D-ID- "7f26de70-ba0d-494e-ba76-238e65e7b45f", // Jina- "66f20754-1b81-48e4-91d0-f4f0dd82145f", // Unreal Speech- "b5a0e27d-0c98-4df3-a4b9-10193e1f3c40", // Open Router- "6c0f5bd0-9008-4638-9d79-4b40b631803e", // FAL- "96153e04-9c6c-4486-895f-5bb683b1ecec", // Exa- "78d19fd7-4d59-4a16-8277-3ce310acf2b7", // E2B- "96b83908-2789-4dec-9968-18f0ece4ceb3", // Nvidia- "ed55ac19-356e-4243-a6cb-bc599e9b716f", // Mem0- ],- [],- );-- if (isUserLoading) {- return <Spinner />;- }-- if (!user || !supabase) {- router.push("/login");- return null;- }-- const allCredentials = providers- ? Object.values(providers).flatMap((provider) =>- [- ...provider.savedOAuthCredentials,- ...provider.savedApiKeys,- ...provider.savedUserPasswordCredentials,- ]- .filter((cred) => !hiddenCredentials.includes(cred.id))- .map((credentials) => ({- ...credentials,- provider: provider.provider,- providerName: provider.providerName,- ProviderIcon: providerIcons[provider.provider],- TypeIcon: {- oauth2: IconUser,- api_key: IconKey,- user_password: IconKey,- }[credentials.type],- })),- )- : [];-- return (- <div className="mx-auto max-w-3xl md:py-8">- <div className="flex items-center justify-between">- <p>- Hello <span data-testid="profile-email">{user.email}</span>- </p>- <Button onClick={() => supabase.auth.signOut()}>- <LogOutIcon className="mr-1.5 size-4" />- Log out- </Button>- </div>- <Separator className="my-6" />- <h2 className="mb-4 text-lg">Connections & Credentials</h2>- <Table>- <TableHeader>- <TableRow>- <TableHead>Provider</TableHead>- <TableHead>Name</TableHead>- <TableHead>Actions</TableHead>- </TableRow>- </TableHeader>- <TableBody>- {allCredentials.map((cred) => (- <TableRow key={cred.id}>- <TableCell>- <div className="flex items-center space-x-1.5">- <cred.ProviderIcon className="h-4 w-4" />- <strong>{cred.providerName}</strong>- </div>- </TableCell>- <TableCell>- <div className="flex h-full items-center space-x-1.5">- <cred.TypeIcon />- <span>{cred.title || cred.username}</span>- </div>- <small className="text-muted-foreground">- {- {- oauth2: "OAuth2 credentials",- api_key: "API key",- user_password: "User password",- }[cred.type]- }{" "}- - <code>{cred.id}</code>- </small>- </TableCell>- <TableCell className="w-0 whitespace-nowrap">- <Button- variant="destructive"- onClick={() => removeCredentials(cred.provider, cred.id)}- >- <Trash2Icon className="mr-1.5 size-4" /> Delete- </Button>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>-- <AlertDialog open={confirmationDialogState.open}>- <AlertDialogContent>- <AlertDialogHeader>- <AlertDialogTitle>Are you sure?</AlertDialogTitle>- <AlertDialogDescription>- {confirmationDialogState.open && confirmationDialogState.message}- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogCancel- onClick={() =>- confirmationDialogState.open &&- confirmationDialogState.onReject()- }- >- Cancel- </AlertDialogCancel>- <AlertDialogAction- variant="destructive"- onClick={() =>- confirmationDialogState.open &&- confirmationDialogState.onConfirm()- }- >- Continue- </AlertDialogAction>- </AlertDialogFooter>- </AlertDialogContent>- </AlertDialog>- </div>- );-}diff --git a/autogpt_platform/frontend/src/components/agptui/Sidebar.tsx b/autogpt_platform/frontend/src/components/agptui/Sidebar.tsxindex 637b3202a3..3a16fa211e 100644--- a/autogpt_platform/frontend/src/components/agptui/Sidebar.tsx+++ b/autogpt_platform/frontend/src/components/agptui/Sidebar.tsx@@ -46,7 +46,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {<div className="h-full w-full rounded-2xl bg-zinc-200 dark:bg-zinc-800"><div className="inline-flex h-[264px] flex-col items-start justify-start gap-6 p-3"><Link- href="/marketplace/dashboard"+ href="/profile/dashboard"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconDashboardLayout className="h-6 w-6" />@@ -56,7 +56,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</Link>{stripeAvailable && (<Link- href="/marketplace/credits"+ href="/profile/credits"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconCoin className="h-6 w-6" />@@ -66,7 +66,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</Link>)}<Link- href="/marketplace/integrations"+ href="/profile/integrations"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconIntegrations className="h-6 w-6" />@@ -75,7 +75,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</div></Link><Link- href="/marketplace/api_keys"+ href="/profile/api_keys"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><KeyIcon className="h-6 w-6" />@@ -84,7 +84,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</div></Link><Link- href="/marketplace/profile"+ href="/profile"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconProfile className="h-6 w-6" />@@ -93,7 +93,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</div></Link><Link- href="/marketplace/settings"+ href="/profile/settings"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconSliders className="h-6 w-6" />@@ -110,7 +110,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {<div className="h-full w-full rounded-2xl bg-zinc-200 dark:bg-zinc-800"><div className="inline-flex h-[264px] flex-col items-start justify-start gap-6 p-3"><Link- href="/marketplace/dashboard"+ href="/profile/dashboard"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconDashboardLayout className="h-6 w-6" />@@ -120,7 +120,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</Link>{stripeAvailable && (<Link- href="/marketplace/credits"+ href="/profile/credits"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconCoin className="h-6 w-6" />@@ -130,7 +130,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</Link>)}<Link- href="/marketplace/integrations"+ href="/profile/integrations"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconIntegrations className="h-6 w-6" />@@ -139,7 +139,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</div></Link><Link- href="/marketplace/api_keys"+ href="/profile/api_keys"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><KeyIcon className="h-6 w-6" strokeWidth={1} />@@ -148,7 +148,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</div></Link><Link- href="/marketplace/profile"+ href="/profile"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconProfile className="h-6 w-6" />@@ -157,7 +157,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ linkGroups }) => {</div></Link><Link- href="/marketplace/settings"+ href="/profile/settings"className="inline-flex w-full items-center gap-2.5 rounded-xl px-3 py-3 text-neutral-800 hover:bg-neutral-800 hover:text-white dark:text-neutral-200 dark:hover:bg-neutral-700 dark:hover:text-white"><IconSliders className="h-6 w-6" />