From 989608bddc439d5d9546028dccb068fc16f38c89 Mon Sep 17 00:00:00 2001 From: pociej Date: Wed, 19 Jun 2024 17:50:45 +0200 Subject: [PATCH] feat: add selected button #82 --- .../components/homePage/statusSections/approve.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 (
{
-