diff --git a/apps/provider-console/src/components/become-provider/ServerAccess.tsx b/apps/provider-console/src/components/become-provider/ServerAccess.tsx index a6ce77aaa..cadc11592 100644 --- a/apps/provider-console/src/components/become-provider/ServerAccess.tsx +++ b/apps/provider-console/src/components/become-provider/ServerAccess.tsx @@ -1,7 +1,8 @@ "use client"; import React, { useCallback, useState } from "react"; -import { Button, Input, Separator } from "@akashnetwork/ui/components"; +import { Button, Input, Popup, Separator } from "@akashnetwork/ui/components"; +import { useWallet } from "@src/context/WalletProvider"; import { ServerForm } from "./ServerForm"; interface ServerAccessProps { @@ -12,6 +13,16 @@ export const ServerAccess: React.FC = ({ onComplete }) => { const [numberOfServers, setNumberOfServers] = useState(1); const [activateServerForm, setActivateServerForm] = useState(false); const [currentServer, setCurrentServer] = useState(0); + const [showBalancePopup, setShowBalancePopup] = useState(false); + + const { walletBalances } = useWallet(); + const hasEnoughBalance = (walletBalances?.uakt || 0) >= 5000000; + + React.useEffect(() => { + if (!hasEnoughBalance) { + setShowBalancePopup(true); + } + }, [hasEnoughBalance]); const handleServerFormSubmit = useCallback(() => { if (currentServer + 1 >= numberOfServers) { @@ -25,6 +36,18 @@ export const ServerAccess: React.FC = ({ onComplete }) => { setNumberOfServers(value); }, []); + const handleNextClick = useCallback(() => { + if (!hasEnoughBalance) { + setShowBalancePopup(true); + return; + } + setActivateServerForm(true); + }, [hasEnoughBalance]); + + const handleClosePopup = useCallback(() => { + setShowBalancePopup(false); + }, []); + return (
{!activateServerForm ? ( @@ -50,13 +73,46 @@ export const ServerAccess: React.FC = ({ onComplete }) => {
- +
) : ( )} + + +
+
+

+ You need at least 5 AKT to become a provider. Please add more funds to your wallet to continue. +

+
+ +
+

+ You currently have {(walletBalances?.uakt || 0) / 1000000} AKT. +

+
+
+
); };