diff --git a/frontend/src/components/homePage/statusSections/approve.tsx b/frontend/src/components/homePage/statusSections/approve.tsx index ad374fb..bbccabd 100644 --- a/frontend/src/components/homePage/statusSections/approve.tsx +++ b/frontend/src/components/homePage/statusSections/approve.tsx @@ -3,7 +3,7 @@ import { GLMAmountStat } from "components/atoms/GLMAmount"; import { useLayout } from "components/providers/layoutProvider"; import { useAllowanceTx } from "hooks/GLM/useAllowanceTx"; import { useUser } from "hooks/useUser"; -import { useCallback } from "react"; +import { useCallback, useEffect, useState } from "react"; import { Link } from "react-daisyui"; import { formatBalance } from "utils/formatBalance"; import { shortTransaction } from "utils/shortTransaction"; @@ -17,6 +17,11 @@ export const Approve = () => { setModalContent(); openModal(); }, []); + const [isApproveButtonActive, setIsApproveButtonActive] = useState(false); + + useEffect(() => { + setIsApproveButtonActive(user.isRegistered() && !user.hasEnoughAllowance()); + }, [user.hasEnoughAllowance()]); return (
{
-