Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const connectWalletBtn = document.querySelector('.connect-wallet');
+ const voteButtons = document.querySelectorAll('.vote-button');
+ const voteOptions = document.querySelectorAll('.vote-options button');
+
+ // Wallet connection simulation
+ connectWalletBtn.addEventListener('click', async () => {
+ try {
+ connectWalletBtn.textContent = 'Connecting...';
+ await new Promise(resolve => setTimeout(resolve, 1000));
+ connectWalletBtn.textContent = '0x1234...5678';
+ updateVotingPower();
+ } catch (error) {
+ connectWalletBtn.textContent = 'Connect Wallet';
+ alert('Could not connect wallet. Please try again.');
+ }
+ });
+
+ // Update voting power display
+ function updateVotingPower() {
+ const votingPowerElement = document.querySelector('.voting-power p');
+ votingPowerElement.textContent = '1000.00 Tokens';
+ }
+
+ // Vote button handlers
+ voteButtons.forEach(button => {
+ button.addEventListener('click', () => {
+ if (connectWalletBtn.textContent === 'Connect Wallet') {
+ alert('Please connect your wallet first');
+ return;
+ }
+
+ const proposalCard = button.closest('.proposal-card');
+ const votesSpan = proposalCard.querySelector('.proposal-meta span:last-child');
+
+ button.textContent = 'Voting...';
+ setTimeout(() => {
+ button.textContent = 'Voted';
+ button.disabled = true;
+ const currentVotes = parseInt(votesSpan.textContent.split(': ')[1]);
+ votesSpan.textContent = `Votes: ${currentVotes + 1}`;
+ }, 1000);
+ });
+ });
+
+ // Vote options animation
+ voteOptions.forEach(button => {
+ button.addEventListener('click', function() {
+ if (connectWalletBtn.textContent === 'Connect Wallet') {
+ alert('Please connect your wallet first');
+ return;
+ }
+
+ voteOptions.forEach(btn => btn.style.transform = 'scale(1)');
+ this.style.transform = 'scale(1.05)';
+
+ setTimeout(() => {
+ this.style.transform = 'scale(1)';
+ }, 200);
+ });
+ });
+ });