From 63f534397f07581230b6758830acd1f0fef6668b Mon Sep 17 00:00:00 2001 From: Ali Mahdiyar Date: Sun, 21 Apr 2024 17:52:13 +0330 Subject: [PATCH] (feat) handle loading state for computation --- packages/nextjs/app/page.tsx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/nextjs/app/page.tsx b/packages/nextjs/app/page.tsx index 04686f1..9b9d140 100644 --- a/packages/nextjs/app/page.tsx +++ b/packages/nextjs/app/page.tsx @@ -219,9 +219,12 @@ const Home: NextPage = () => { } } + const [computing, setComputing] = useState(false); + // compute on secrets async function handleCompute() { if (programId) { + setComputing(true); // await compute( // nillion, // nillionClient, @@ -263,6 +266,7 @@ const Home: NextPage = () => { console.log("error", error); return "error"; } + setComputing(false); } } @@ -413,15 +417,19 @@ const Home: NextPage = () => { value={partyIdToSecretIds} onChange={e => setPartyIdToSecretIds(e.target.value)} /> - + {computing ? ( + "Computing..." + ) : ( + + )} ) : (