Skip to content

Commit

Permalink
Fix modal popup problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillweston committed May 5, 2024
1 parent d426c27 commit b5c5668
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
11 changes: 0 additions & 11 deletions js/claim-airdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,6 @@ async function initiateTransaction() {
displayMessage('Waiting for user confirmation', 'info');

try {
// Ensuring activeNetwork is valid
if (!['baseSepolia', 'baseMainnet', 'sepolia'].includes(activeNetwork)) {
console.log('Invalid network selection');
displayMessage('Invalid network selection', 'error');
return;
}

// Acquire full address from the DOM element
const fullAddress = document.getElementById('address').getAttribute('data-full-address');
console.log('Full Address:', fullAddress);
Expand Down Expand Up @@ -341,10 +334,6 @@ async function confirmTransaction() {
// Show the modal
bootstrapModal.show();

// Set a timeout to close the modal after 5 seconds
setTimeout(function() {
bootstrapModal.hide();
}, 5000);
// Show fireworks animation for 10 seconds
startFireworksForDuration(10000);
} else {
Expand Down
1 change: 1 addition & 0 deletions js/cookie-consent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global $ */
$(document).ready(function() {
function checkCookieConsent() {
if (!localStorage.getItem('cookieConsent')) {
Expand Down
11 changes: 6 additions & 5 deletions js/get-promotion-code.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
let authWebAddress = null;

function checkPromotionCode(event) {
event.preventDefault();

Expand Down Expand Up @@ -74,8 +72,9 @@ function escapeHtml(str) {
.replace(/'/g, "'");
}

// Reset the promotionCodeInfo to empty after refreshing the webpage
document.addEventListener('DOMContentLoaded', function() {
/* global $ */
$(document).on('show.bs.modal','#connectModal2', function () {
// Reset the promotionCodeInfo to empty after popup is shown
document.getElementById('promotionCodeInfo').innerHTML = '';

fetch('../contract-config.json')
Expand All @@ -87,14 +86,15 @@ document.addEventListener('DOMContentLoaded', function() {
})
.then(jsonConfig => {
// Access properties
authWebAddress = jsonConfig.authWebAddress;
let authWebAddress = jsonConfig.authWebAddress;

// Additional validation can be performed here as needed
if (!authWebAddress) {
throw new Error("Required configuration values (authWebAddress) are missing.");
}

document.getElementById('generatePromotionButton').addEventListener('click', function() {
console.log('Generating promotion code...');
const address = getFullAddress();
if (address) {
// Construct the URL with the address query parameter
Expand All @@ -111,6 +111,7 @@ document.addEventListener('DOMContentLoaded', function() {
// Handle the response to display the promotion code
.then(response => {
const promotionCode = response.data.promotion_code;
console.log('Promotion code:', promotionCode);
// Assuming the response returns the promotion code directly
let promotionCodeHtml = '<div class="address-container code-container">';
promotionCodeHtml += '<input id="promotionCode" type="text" value="' + escapeHtml(promotionCode) + '" readonly data-full-code="' + escapeHtml(promotionCode) + '">';
Expand Down

0 comments on commit b5c5668

Please sign in to comment.