Skip to content

Commit 42dfe78

Browse files
authored
removed email modal (#153)
1 parent 64b3072 commit 42dfe78

File tree

5 files changed

+0
-332
lines changed

5 files changed

+0
-332
lines changed

_static/main.js

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,56 +19,3 @@ function getCookie(cname) {
1919
}
2020
return "";
2121
}
22-
23-
document.addEventListener('DOMContentLoaded', function() {
24-
// Show the email modal if the user has not entered their email
25-
let modal = document.getElementById('email-modal');
26-
let emailCookie = getCookie("email");
27-
let emailInput = document.getElementById("email-input");
28-
let body = document.body
29-
if (emailCookie === false || emailCookie === "" || emailCookie === null) {
30-
modal.style.display = 'flex';
31-
emailInput.value = "";
32-
body.style.overflow = "hidden";
33-
}
34-
emailInput.focus()
35-
36-
// When user click Enter, click the submit button
37-
emailInput.addEventListener("keypress", function(event) {
38-
if (event.key === "Enter") {
39-
event.preventDefault();
40-
document.getElementById("email-submit").click();
41-
}
42-
});
43-
44-
// Handle form submission
45-
const form = document.getElementById('email-form');
46-
form.addEventListener('submit', async function(event) {
47-
event.preventDefault();
48-
const formData = new FormData(form);
49-
const email = formData.get('email');
50-
if (!email) return;
51-
try {
52-
const response = await fetch('https://state-of-open-source-ai.vercel.app/api/add-member', {
53-
method: 'POST',
54-
body: JSON.stringify({ email }),
55-
headers: {
56-
'Content-Type': 'application/json',
57-
},
58-
});
59-
60-
const responseData = await response.json();
61-
62-
if (response.ok) {
63-
let modal = document.getElementById('email-modal');
64-
modal.style.display = 'none';
65-
setCookie("email", emailInput.value, 365); // might fail if cookies disabled
66-
} else {
67-
document.querySelector('.email-error').textContent = responseData.error || 'An unexpected error occurred. Please enter a valid email.';
68-
}
69-
} catch (error) {
70-
console.error('Error:', error);
71-
document.querySelector('.email-error').textContent = 'An unexpected error occurred. Please try again.';
72-
}
73-
});
74-
});

backend/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

backend/api/add-member.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

backend/package.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

backend/pnpm-lock.yaml

Lines changed: 0 additions & 200 deletions
This file was deleted.

0 commit comments

Comments
 (0)