From 218bc2a52333215c885dd7e7e7d64775f9115170 Mon Sep 17 00:00:00 2001 From: p00pcvm <103101201+p00pcvm@users.noreply.github.com> Date: Sat, 4 Jan 2025 18:07:34 -0800 Subject: [PATCH] Update index.html --- index.html | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index b7b0274..5efbb1c 100644 --- a/index.html +++ b/index.html @@ -60,6 +60,11 @@ margin-top: 20px; font-size: 14px; } + .loading { + margin-top: 20px; + font-size: 14px; + color: #3498db; + } @media (prefers-color-scheme: dark) { :root { --background-color: #121212; @@ -96,6 +101,7 @@ <h1>Welcome to Conway's Farm of Life</h1> <h1>Connect Your TON Wallet</h1> <button class="connect-button" id="connectButton">Connect Wallet</button> <div class="status" id="status"></div> + <div class="loading" id="loading" style="display: none;">Connecting...</div> </div> <script> @@ -117,19 +123,28 @@ <h1>Connect Your TON Wallet</h1> } document.getElementById('connectButton').addEventListener('click', async () => { + document.getElementById('status').innerText = ''; + document.getElementById('loading').style.display = 'block'; + if (typeof window.ton !== 'undefined') { try { const provider = window.ton; await provider.requestPermissions(); const account = await provider.getAccount(); - document.getElementById('status').innerText = `Connected to ${account.address}`; + if (account && account.address) { + document.getElementById('status').innerText = `Connected to ${account.address}`; + } else { + document.getElementById('status').innerText = 'Failed to retrieve account information.'; + } } catch (error) { - document.getElementById('status').innerText = `Error connecting wallet: ${error.message}`; + document.getElementById('status').innerText = `Error connecting wallet: ${error.message}. Please ensure your TON wallet extension is up to date and properly configured.`; } } else { document.getElementById('status').innerText = 'TON provider not found. Please install a TON wallet extension.'; } + + document.getElementById('loading').style.display = 'none'; }); </script> </body> -</html> \ No newline at end of file +</html>