diff --git a/autogpt_platform/frontend/src/app/profile/page.tsx b/autogpt_platform/frontend/src/app/profile/page.tsx index c1df9e705..9d479732a 100644 --- a/autogpt_platform/frontend/src/app/profile/page.tsx +++ b/autogpt_platform/frontend/src/app/profile/page.tsx @@ -31,6 +31,8 @@ import { AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; +import useCredits from "@/hooks/useCredits"; +import { Input } from "@/components/ui/input"; export default function PrivatePage() { const { user, isLoading, error } = useUser(); @@ -38,6 +40,8 @@ export default function PrivatePage() { const router = useRouter(); const providers = useContext(CredentialsProvidersContext); const { toast } = useToast(); + const { credits } = useCredits(); + const [amount, setAmount] = useState(5); const [confirmationDialogState, setConfirmationDialogState] = useState< | { @@ -115,6 +119,10 @@ export default function PrivatePage() { [], ); + const handleTopUp = useCallback(() => { + + }, []); + if (isLoading || !providers) { return (
@@ -152,6 +160,28 @@ export default function PrivatePage() {
+

Top-up Credits

+
+
+ Current credits: {credits}
1 USD = 100 credits, 5 USD is + a minimum top-up +
+
+ setAmount(parseInt(e.target.value))} + className="flex-1" + min="5" + step="1" + /> + +
+
+

Connections & Credentials

diff --git a/autogpt_platform/frontend/src/hooks/useCredits.ts b/autogpt_platform/frontend/src/hooks/useCredits.ts index 1b2962adb..f064aabff 100644 --- a/autogpt_platform/frontend/src/hooks/useCredits.ts +++ b/autogpt_platform/frontend/src/hooks/useCredits.ts @@ -2,8 +2,8 @@ import AutoGPTServerAPI from "@/lib/autogpt-server-api"; import { useCallback, useEffect, useMemo, useState } from "react"; export default function useCredits(): { - credits: number | null - fetchCredits: () => void + credits: number | null; + fetchCredits: () => void; } { const [credits, setCredits] = useState(null); const api = useMemo(() => new AutoGPTServerAPI(), []);