Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
p00pcvm authored Jan 5, 2025
1 parent e3a1e53 commit 218bc2a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>
Expand All @@ -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>
</html>

0 comments on commit 218bc2a

Please sign in to comment.