alxbouchard commited on
Commit
86b2e4e
·
verified ·
1 Parent(s): f17d560

enleve ce bouton - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +90 -17
index.html CHANGED
@@ -30,6 +30,10 @@
30
  .contact-input:focus {
31
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
32
  }
 
 
 
 
33
  .language-selector {
34
  transition: all 0.3s ease;
35
  }
@@ -133,7 +137,7 @@
133
  <div class="container mx-auto px-4 max-w-4xl">
134
  <h2 class="text-3xl md:text-4xl font-bold text-center mb-16 gradient-text">Contact Us</h2>
135
 
136
- <form class="space-y-6">
137
  <div class="grid md:grid-cols-2 gap-6">
138
  <div>
139
  <label for="name" class="block text-sm font-medium text-gray-700 mb-1">Name *</label>
@@ -177,19 +181,6 @@
177
  <a href="#contact" class="text-gray-600 hover:text-gray-900 font-medium">• SOLVE • DO</a>
178
  </div>
179
 
180
- <div class="relative">
181
- <button id="language-toggle" class="flex items-center text-gray-600 hover:text-gray-900">
182
- <i class="fas fa-globe mr-2"></i>
183
- English
184
- <i class="fas fa-chevron-down ml-2 text-xs"></i>
185
- </button>
186
-
187
- <div id="language-dropdown" class="hidden absolute right-0 mt-2 w-40 bg-white rounded-md shadow-lg py-1 z-50">
188
- <a href="#" data-lang="en" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">English</a>
189
- <a href="#" data-lang="fr" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">Français</a>
190
- <a href="#" data-lang="zh" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">简体</a>
191
- </div>
192
- </div>
193
  </div>
194
 
195
  <div class="mt-8 pt-8 border-t border-gray-200 text-center text-gray-500 text-sm">
@@ -199,6 +190,76 @@
199
  </footer>
200
 
201
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  // Language content
203
  const translations = {
204
  en: {
@@ -222,7 +283,11 @@
222
  messageLabel: "Message *",
223
  submitBtn: "Send Message",
224
  copyright: "© 2025 PAZ",
225
- madeWith: "Made with <i class='fas fa-heart text-red-500'></i> by PAZ"
 
 
 
 
226
  },
227
  fr: {
228
  title: "Transformer les idées en solutions - PAZ",
@@ -245,7 +310,11 @@
245
  messageLabel: "Message *",
246
  submitBtn: "Envoyer",
247
  copyright: "© 2025 PAZ",
248
- madeWith: "Conçu avec <i class='fas fa-heart text-red-500'></i> par PAZ"
 
 
 
 
249
  },
250
  zh: {
251
  title: "将想法转化为解决方案 - PAZ",
@@ -268,7 +337,11 @@
268
  messageLabel: "留言 *",
269
  submitBtn: "发送信息",
270
  copyright: "© 2025 PAZ",
271
- madeWith: "由PAZ <i class='fas fa-heart text-red-500'></i> 制作"
 
 
 
 
272
  }
273
  };
274
 
 
30
  .contact-input:focus {
31
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
32
  }
33
+ .border-red-500 {
34
+ border-color: #ef4444;
35
+ box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.5);
36
+ }
37
  .language-selector {
38
  transition: all 0.3s ease;
39
  }
 
137
  <div class="container mx-auto px-4 max-w-4xl">
138
  <h2 class="text-3xl md:text-4xl font-bold text-center mb-16 gradient-text">Contact Us</h2>
139
 
140
+ <form id="contact-form" class="space-y-6" action="https://formspree.io/f/xwkgnqvr" method="POST">
141
  <div class="grid md:grid-cols-2 gap-6">
142
  <div>
143
  <label for="name" class="block text-sm font-medium text-gray-700 mb-1">Name *</label>
 
181
  <a href="#contact" class="text-gray-600 hover:text-gray-900 font-medium">• SOLVE • DO</a>
182
  </div>
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  </div>
185
 
186
  <div class="mt-8 pt-8 border-t border-gray-200 text-center text-gray-500 text-sm">
 
190
  </footer>
191
 
192
  <script>
193
+ // Contact form handling
194
+ document.getElementById('contact-form').addEventListener('submit', async function(e) {
195
+ e.preventDefault();
196
+
197
+ const form = e.target;
198
+ const submitButton = form.querySelector('button[type="submit"]');
199
+ const formData = new FormData(form);
200
+
201
+ // Create JSON object from form data
202
+ const formObject = {};
203
+ formData.forEach((value, key) => {
204
+ formObject[key] = value;
205
+ });
206
+
207
+ try {
208
+ submitButton.disabled = true;
209
+ submitButton.innerHTML = 'Sending...';
210
+
211
+ // Ensure all required fields are filled
212
+ const requiredFields = form.querySelectorAll('[required]');
213
+ let isValid = true;
214
+ requiredFields.forEach(field => {
215
+ if (!field.value.trim()) {
216
+ field.classList.add('border-red-500');
217
+ isValid = false;
218
+ } else {
219
+ field.classList.remove('border-red-500');
220
+ }
221
+ });
222
+
223
+ if (!isValid) {
224
+ throw new Error(translations[currentLang].validationError);
225
+ }
226
+
227
+ const response = await fetch(form.action, {
228
+ method: 'POST',
229
+ body: new FormData(form),
230
+ headers: {
231
+ 'Accept': 'application/json'
232
+ }
233
+ });
234
+
235
+ let result;
236
+ try {
237
+ result = await response.json();
238
+ } catch (e) {
239
+ // Handle case where response isn't JSON
240
+ if (response.ok) {
241
+ // Formspree sometimes returns empty response on success
242
+ result = { ok: true };
243
+ } else {
244
+ throw new Error(translations[currentLang].parseError);
245
+ }
246
+ }
247
+
248
+ if (response.ok) {
249
+ form.reset();
250
+ alert(translations[currentLang].successMessage);
251
+ } else {
252
+ throw new Error(result.error || translations[currentLang].errorMessage);
253
+ }
254
+ } catch (error) {
255
+ console.error('Error:', error);
256
+ alert(error.message);
257
+ } finally {
258
+ submitButton.disabled = false;
259
+ submitButton.innerHTML = 'Send Message <i class="fas fa-paper-plane ml-2"></i>';
260
+ }
261
+ });
262
+
263
  // Language content
264
  const translations = {
265
  en: {
 
283
  messageLabel: "Message *",
284
  submitBtn: "Send Message",
285
  copyright: "© 2025 PAZ",
286
+ madeWith: "Made with <i class='fas fa-heart text-red-500'></i> by PAZ",
287
+ successMessage: "Thank you! Your message has been sent.",
288
+ errorMessage: "Failed to send message. Please try again later.",
289
+ validationError: "Please fill all required fields",
290
+ parseError: "Failed to parse server response"
291
  },
292
  fr: {
293
  title: "Transformer les idées en solutions - PAZ",
 
310
  messageLabel: "Message *",
311
  submitBtn: "Envoyer",
312
  copyright: "© 2025 PAZ",
313
+ madeWith: "Conçu avec <i class='fas fa-heart text-red-500'></i> par PAZ",
314
+ successMessage: "Merci ! Votre message a bien été envoyé.",
315
+ errorMessage: "Échec de l'envoi du message. Veuillez réessayer plus tard.",
316
+ validationError: "Veuillez remplir tous les champs obligatoires",
317
+ parseError: "Échec de l'analyse de la réponse du serveur"
318
  },
319
  zh: {
320
  title: "将想法转化为解决方案 - PAZ",
 
337
  messageLabel: "留言 *",
338
  submitBtn: "发送信息",
339
  copyright: "© 2025 PAZ",
340
+ madeWith: "由PAZ <i class='fas fa-heart text-red-500'></i> 制作",
341
+ successMessage: "谢谢!您的消息已发送。",
342
+ errorMessage: "发送消息失败,请稍后再试。",
343
+ validationError: "请填写所有必填字段",
344
+ parseError: "解析服务器响应失败"
345
  }
346
  };
347