From fac9e74ca4b2e06258799399760af917bfd91b29 Mon Sep 17 00:00:00 2001 From: David Ascanio Date: Tue, 28 Apr 2026 09:46:02 -0300 Subject: [PATCH] add popup subscription --- package-lock.json | 13 +++ prisma/schema.prisma | 10 +++ src/components/NewsletterPopup.vue | 114 ++++++++++++++++++++++++++ src/i18n/en.json | 10 ++- src/i18n/es.json | 10 ++- src/i18n/fr.json | 9 +- src/i18n/he.json | 9 +- src/i18n/pt.json | 9 +- src/i18n/ru.json | 9 +- src/i18n/rw.json | 9 +- src/i18n/uk.json | 9 +- src/layouts/MainLayout.astro | 4 +- src/pages/api/newsletter/subscribe.ts | 40 +++++++++ 13 files changed, 246 insertions(+), 9 deletions(-) create mode 100644 src/components/NewsletterPopup.vue create mode 100644 src/pages/api/newsletter/subscribe.ts diff --git a/package-lock.json b/package-lock.json index 54a19b2..73c1ec8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4268,6 +4268,19 @@ "url": "https://dotenvx.com" } }, + "node_modules/@prisma/config/node_modules/magicast": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@babel/parser": "^7.25.4", + "@babel/types": "^7.25.4", + "source-map-js": "^1.2.0" + } + }, "node_modules/@prisma/config/node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 2aa9ec2..48d2f8a 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -16,4 +16,14 @@ model Contact { updatedAt DateTime @updatedAt @@index([email, createdAt]) +} + +model NewsletterSubscriber { + id Int @id @default(autoincrement()) + email String + locale String? + createdAt DateTime @default(now()) + + @@unique([email, locale]) + @@index([email]) } \ No newline at end of file diff --git a/src/components/NewsletterPopup.vue b/src/components/NewsletterPopup.vue new file mode 100644 index 0000000..77be7ba --- /dev/null +++ b/src/components/NewsletterPopup.vue @@ -0,0 +1,114 @@ + + + diff --git a/src/i18n/en.json b/src/i18n/en.json index d666274..e108245 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -203,6 +203,14 @@ "footer.form.name": "Name and Lastname", "footer.form.mesagge": "Write a message", "footer.form.button": "Send", - "footer.reserved": "©2026 All Rights Reserved. Kingdom of Peace and Justice Center" + "footer.reserved": "©2026 All Rights Reserved. Kingdom of Peace and Justice Center", + + "newsletter.popup.title": "Stay informed", + "newsletter.popup.text": "Subscribe to receive the latest news and updates from the Kingdom of Peace and Justice Center.", + "newsletter.popup.placeholder": "Your email address", + "newsletter.popup.button": "Subscribe", + "newsletter.popup.sending": "Sending...", + "newsletter.popup.success": "Thank you for subscribing!", + "newsletter.popup.close": "Close" } \ No newline at end of file diff --git a/src/i18n/es.json b/src/i18n/es.json index cbdb767..b7c3ae8 100644 --- a/src/i18n/es.json +++ b/src/i18n/es.json @@ -208,5 +208,13 @@ "footer.form.name": "Nombre y Apellido", "footer.form.mesagge": "Escriba su mensaje", "footer.form.button": "Enviar", - "footer.reserved": "©2026. Todos los Derechos Reservados. Centro del Reino de Paz y Justicia" + "footer.reserved": "©2026. Todos los Derechos Reservados. Centro del Reino de Paz y Justicia", + + "newsletter.popup.title": "Mantente informado", + "newsletter.popup.text": "Suscríbete para recibir las últimas noticias y novedades del Centro del Reino de Paz y Justicia.", + "newsletter.popup.placeholder": "Tu correo electrónico", + "newsletter.popup.button": "Suscribirme", + "newsletter.popup.sending": "Enviando...", + "newsletter.popup.success": "¡Gracias por suscribirte!", + "newsletter.popup.close": "Cerrar" } \ No newline at end of file diff --git a/src/i18n/fr.json b/src/i18n/fr.json index 19a3197..f00924c 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -4,5 +4,12 @@ "nav.about": "À propos", "nav.news": "Nouvelles", "nav.programs": "Programmes", - "nav.contact": "Contactez" + "nav.contact": "Contactez", + "newsletter.popup.title": "Restez informé", + "newsletter.popup.text": "Abonnez-vous pour recevoir les dernières nouvelles et mises à jour du Centre du Royaume de Paix et de Justice.", + "newsletter.popup.placeholder": "Votre adresse e-mail", + "newsletter.popup.button": "S'abonner", + "newsletter.popup.sending": "Envoi en cours...", + "newsletter.popup.success": "Merci pour votre abonnement !", + "newsletter.popup.close": "Fermer" } \ No newline at end of file diff --git a/src/i18n/he.json b/src/i18n/he.json index 569723b..04edc17 100644 --- a/src/i18n/he.json +++ b/src/i18n/he.json @@ -203,7 +203,14 @@ "footer.form.name": "שם מלא", "footer.form.mesagge": "כתיבת הודעה", "footer.form.button": "שליחה", - "footer.reserved": "כל הזכויות שמורות 2026 © Centro del Reino de Paz y Justicia" + "footer.reserved": "כל הזכויות שמורות 2026 © Centro del Reino de Paz y Justicia", + "newsletter.popup.title": "הישארו מעודכנים", + "newsletter.popup.text": "הירשמו לקבלת החדשות והעדכונים האחרונים ממרכז הממלכה לשלום וצדק.", + "newsletter.popup.placeholder": "כתובת הדוא\"ל שלכם", + "newsletter.popup.button": "הרשמה", + "newsletter.popup.sending": "שולח...", + "newsletter.popup.success": "תודה שנרשמתם!", + "newsletter.popup.close": "סגור" } \ No newline at end of file diff --git a/src/i18n/pt.json b/src/i18n/pt.json index a1f1b0b..72fc413 100644 --- a/src/i18n/pt.json +++ b/src/i18n/pt.json @@ -4,5 +4,12 @@ "nav.about": "Somos", "nav.news": "Noticias", "nav.programs": "Programas", - "nav.contact": "Contacto" + "nav.contact": "Contacto", + "newsletter.popup.title": "Fique informado", + "newsletter.popup.text": "Inscreva-se para receber as últimas notícias e atualizações do Centro do Reino da Paz e da Justiça.", + "newsletter.popup.placeholder": "Seu endereço de e-mail", + "newsletter.popup.button": "Inscrever-se", + "newsletter.popup.sending": "Enviando...", + "newsletter.popup.success": "Obrigado por se inscrever!", + "newsletter.popup.close": "Fechar" } \ No newline at end of file diff --git a/src/i18n/ru.json b/src/i18n/ru.json index e4e97c8..81899aa 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -203,7 +203,14 @@ "footer.form.name": "Имя и фамилия", "footer.form.mesagge": "Напишите свое сообщение", "footer.form.button": "Отправить", - "footer.reserved": "© 2026. Все права защищены. Центр Царства мира и справедливости" + "footer.reserved": "© 2026. Все права защищены. Центр Царства мира и справедливости", + "newsletter.popup.title": "Будьте в курсе", + "newsletter.popup.text": "Подпишитесь, чтобы получать последние новости и обновления от Центра Царства мира и справедливости.", + "newsletter.popup.placeholder": "Ваш адрес электронной почты", + "newsletter.popup.button": "Подписаться", + "newsletter.popup.sending": "Отправка...", + "newsletter.popup.success": "Спасибо за подписку!", + "newsletter.popup.close": "Закрыть" } \ No newline at end of file diff --git a/src/i18n/rw.json b/src/i18n/rw.json index 4f60fcb..5773766 100644 --- a/src/i18n/rw.json +++ b/src/i18n/rw.json @@ -208,5 +208,12 @@ "footer.form.name": "Amazina yombi", "footer.form.mesagge": "Andika ubutumwa bwawe", "footer.form.button": "Ohereza", - "footer.reserved": "© 2026. Uburenganzira bwose bufitwe na Centro del Reino de Paz y Justicia(Ihuriro ry’Ubwami bw’Amahoro n’Ubutabera)" + "footer.reserved": "© 2026. Uburenganzira bwose bufitwe na Centro del Reino de Paz y Justicia(Ihuriro ry’Ubwami bw’Amahoro n’Ubutabera)", + "newsletter.popup.title": "Komeza uhabwe amakuru", + "newsletter.popup.text": "Iyandikishe kugira ngo ubone amakuru mashya n’amakuru y’Ihuriro ry’Ubwami bw’Amahoro n’Ubutabera.", + "newsletter.popup.placeholder": "Aderesi yawe ya imeyili", + "newsletter.popup.button": "Iyandikishe", + "newsletter.popup.sending": "Kohereza...", + "newsletter.popup.success": "Urakoze kwiyandikisha!", + "newsletter.popup.close": "Funga" } \ No newline at end of file diff --git a/src/i18n/uk.json b/src/i18n/uk.json index a1f1b0b..e6e030e 100644 --- a/src/i18n/uk.json +++ b/src/i18n/uk.json @@ -4,5 +4,12 @@ "nav.about": "Somos", "nav.news": "Noticias", "nav.programs": "Programas", - "nav.contact": "Contacto" + "nav.contact": "Contacto", + "newsletter.popup.title": "Будьте в курсі", + "newsletter.popup.text": "Підпишіться, щоб отримувати останні новини та оновлення від Центру Царства Миру та Справедливості.", + "newsletter.popup.placeholder": "Ваша електронна адреса", + "newsletter.popup.button": "Підписатися", + "newsletter.popup.sending": "Надсилання...", + "newsletter.popup.success": "Дякуємо за підписку!", + "newsletter.popup.close": "Закрити" } \ No newline at end of file diff --git a/src/layouts/MainLayout.astro b/src/layouts/MainLayout.astro index 731e103..dd829e9 100644 --- a/src/layouts/MainLayout.astro +++ b/src/layouts/MainLayout.astro @@ -7,7 +7,8 @@ import "@fontsource/poppins/400.css"; import "@fontsource/poppins/500.css"; import "@fontsource/poppins/700.css"; import "@fontsource-variable/kameron"; -import ShareSticky from "../components/ShareSticky.vue"; +import ShareSticky from "../components/ShareSticky.vue"; +import NewsletterPopup from "../components/NewsletterPopup.vue"; const { title, description, @@ -38,6 +39,7 @@ const direction = currentLocale === 'he' ? 'rtl' : 'ltr'; {Astro.url.pathname.includes('/news/') && ( )} +