diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..08961ef --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,49 @@ +@keyframes pulse-ring { + 0% { + transform: scale(0.33); + opacity: 0; + } + 80%, 100% { + opacity: 0; + } + 40% { + opacity: 0.3; + } +} + +/* Particles */ +.particles-container { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + overflow: hidden; + pointer-events: none; + z-index: 0; +} + +.particle { + position: absolute; + background-color: rgba(59, 130, 246, 0.2); + border-radius: 50%; + pointer-events: none; +} + +@keyframes float-particle { + 0% { + transform: translate(0, 0); + } + 25% { + transform: translate(50px, -50px); + } + 50% { + transform: translate(100px, 0); + } + 75% { + transform: translate(50px, 50px); + } + 100% { + transform: translate(0, 0); + } +} \ No newline at end of file diff --git a/assets/js/script.js b/assets/js/script.js new file mode 100644 index 0000000..b3401f4 --- /dev/null +++ b/assets/js/script.js @@ -0,0 +1,50 @@ +function initFormHandling() { + const form = document.getElementById('contact-form'); + if (!form) return; + + form.addEventListener('submit', async (e) => { + e.preventDefault(); + + const submitBtn = form.querySelector('button[type="submit"]'); + const originalBtnText = submitBtn.innerHTML; + submitBtn.innerHTML = ' Sending...'; + submitBtn.disabled = true; + + const formData = new FormData(form); + const data = { + name: formData.get('name'), + email: formData.get('email'), + subject: formData.get('subject'), + message: formData.get('message') + }; + + try { + const response = await fetch('/api/send-email', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(data) + }); + + const result = await response.json(); + + if (!response.ok) { + throw new Error(result.details || result.error || 'Failed to send message'); + } + + // Show success message + showAlert('success', 'Message sent successfully! I will get back to you soon.'); + form.reset(); + + } catch (error) { + console.error('Form submission error:', error); + showAlert('error', `Something went wrong: ${error.message}`); + } finally { + submitBtn.innerHTML = originalBtnText; + submitBtn.disabled = false; + } + }); +} + +// ... existing code ... \ No newline at end of file diff --git a/functions/api/send-email.js b/functions/api/send-email.js index 4a64c77..9eb86e6 100644 --- a/functions/api/send-email.js +++ b/functions/api/send-email.js @@ -6,6 +6,13 @@ export async function onRequestPost(context) { const { name, email, subject, message } = await context.request.json(); try { + // Check if API key is configured + if (!context.env.MAILERSEND_API_KEY) { + throw new Error('MailerSend API key is not configured'); + } + + console.log('Attempting to send email with MailerSend...'); + const response = await fetch("https://api.mailersend.com/v1/email", { method: "POST", headers: { @@ -14,16 +21,16 @@ export async function onRequestPost(context) { }, body: JSON.stringify({ from: { - email: "contact@argobox.com", + email: "contact@laforceit.com", name: "Daniel LaForce" }, to: [ { - email: "daniel.laforce@argobox.com", + email: "daniel.laforce@laforceit.com", name: "Daniel LaForce" } ], - subject: `[Argobox] ${subject}`, + subject: `[LaForceIT] ${subject}`, html: `
Name: ${name}
@@ -39,15 +46,32 @@ export async function onRequestPost(context) { }) }); + const responseData = await response.text(); + console.log("MailerSend Response:", responseData); + if (!response.ok) { - console.error("MailerSend Error:", await response.json()); - return new Response(JSON.stringify({ error: "Failed to send email" }), { status: 500 }); + const errorDetail = responseData ? JSON.parse(responseData) : {}; + throw new Error(`MailerSend API error (${response.status}): ${JSON.stringify(errorDetail)}`); } - return new Response(JSON.stringify({ success: true }), { status: 200 }); + return new Response(JSON.stringify({ success: true }), { + status: 200, + headers: { + 'Content-Type': 'application/json' + } + }); } catch (err) { - console.error("Unexpected Error:", err); - return new Response(JSON.stringify({ error: "Unexpected server error" }), { status: 500 }); + console.error("Email Send Error:", err); + return new Response(JSON.stringify({ + error: "Failed to send email", + details: err.message, + timestamp: new Date().toISOString() + }), { + status: 500, + headers: { + 'Content-Type': 'application/json' + } + }); } } diff --git a/images/android-chrome-192x192.png b/images/android-chrome-192x192.png index bcdbd68..1775ef7 100644 Binary files a/images/android-chrome-192x192.png and b/images/android-chrome-192x192.png differ diff --git a/images/android-chrome-512x512.png b/images/android-chrome-512x512.png index 49143a7..86e3368 100644 Binary files a/images/android-chrome-512x512.png and b/images/android-chrome-512x512.png differ diff --git a/images/apple-touch-icon.png b/images/apple-touch-icon.png index 75fd2a8..ab1f1e5 100644 Binary files a/images/apple-touch-icon.png and b/images/apple-touch-icon.png differ diff --git a/images/favicon-16x16.png b/images/favicon-16x16.png index 04b3075..9acbaf5 100644 Binary files a/images/favicon-16x16.png and b/images/favicon-16x16.png differ diff --git a/images/favicon-32x32.png b/images/favicon-32x32.png index be227e2..79a05b3 100644 Binary files a/images/favicon-32x32.png and b/images/favicon-32x32.png differ diff --git a/images/favicon.ico b/images/favicon.ico index d998449..12d1439 100644 Binary files a/images/favicon.ico and b/images/favicon.ico differ diff --git a/index.html b/index.html index c0b4adb..178f86c 100644 --- a/index.html +++ b/index.html @@ -35,6 +35,9 @@ + + +