From 8f5056c326b1e6632a7b32deb734efd2a4c499de Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 22 Nov 2024 19:00:38 -0300 Subject: [PATCH] feat: UI improvement - vouches info --- .../[pohid]/[chain]/[request]/ActionBar.tsx | 7 ++-- src/app/[pohid]/[chain]/[request]/page.tsx | 34 ++++++++++++++----- src/contracts/apis/APIPoH.ts | 19 +++++++++++ 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/app/[pohid]/[chain]/[request]/ActionBar.tsx b/src/app/[pohid]/[chain]/[request]/ActionBar.tsx index 5c6857c..e70bd61 100644 --- a/src/app/[pohid]/[chain]/[request]/ActionBar.tsx +++ b/src/app/[pohid]/[chain]/[request]/ActionBar.tsx @@ -103,6 +103,7 @@ export default withClientConnected(function ActionBar({ const errorRef = useRef(false); const offChainRef = useRef(false); const [action, setAction] = useState(ActionType.NONE); + const [canAdvance, setCanAdvance] = useState(true); const [didIVouchFor, setDidIVouchFor] = useState(false); const [isVouchOnchain, setIsVouchOnchain] = useState(false); @@ -205,7 +206,7 @@ export default withClientConnected(function ActionBar({ onFail() { !errorRef.current && toast.error("Advance is not possible"); errorRef.current = true; - //setAction(ActionType.VOUCH); + setCanAdvance(false); }, }), [loading], @@ -240,6 +241,7 @@ export default withClientConnected(function ActionBar({ useEffect(() => { if (action === ActionType.ADVANCE && !revocation) { + setCanAdvance(true); prepareAdvance({ args: [ requester, @@ -267,6 +269,7 @@ export default withClientConnected(function ActionBar({ revocation, chain, userChainId, + canAdvance, ]); useEffect(() => { @@ -405,7 +408,7 @@ export default withClientConnected(function ActionBar({ /> ) : null}