diff --git a/src/AppRouter.tsx b/src/AppRouter.tsx
index a80c5fea..c0d70908 100644
--- a/src/AppRouter.tsx
+++ b/src/AppRouter.tsx
@@ -11,6 +11,7 @@ import AISettings from "./pages/AISettings";
import GitSettings from "./pages/GitSettings";
import DataSettings from "./pages/DataSettings";
import AboutSettings from "./pages/AboutSettings";
+import EmailSettings from "./pages/EmailSettings";
import GitHubOAuth from "./pages/GitHubOAuth";
import { NIP19Page } from "./pages/NIP19Page";
import NotFound from "./pages/NotFound";
@@ -33,6 +34,7 @@ export function AppRouter() {
} />
} />
} />
+ } />
} />
} />
diff --git a/src/components/SettingsLayout.tsx b/src/components/SettingsLayout.tsx
index 6cf9ea0c..200fff49 100644
--- a/src/components/SettingsLayout.tsx
+++ b/src/components/SettingsLayout.tsx
@@ -3,7 +3,7 @@ import { useNavigate, useLocation, Outlet } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
import { ScrollArea } from '@/components/ui/scroll-area';
-import { Menu, Bot, GitBranch, Database, Wifi, Settings2, Info } from 'lucide-react';
+import { Menu, Bot, GitBranch, Database, Wifi, Settings2, Info, Mail } from 'lucide-react';
import { ProjectSidebar } from '@/components/ProjectSidebar';
import { useProjectsManager } from '@/hooks/useProjectsManager';
import { useIsMobile } from '@/hooks/useIsMobile';
@@ -56,6 +56,13 @@ const getSettingsItems = (t: (key: string) => string): SettingsItem[] => [
icon: Database,
href: '/settings/data',
},
+ {
+ id: 'email',
+ title: t('emailUpdates'),
+ description: t('emailUpdatesDescription'),
+ icon: Mail,
+ href: '/settings/email',
+ },
{
id: 'about',
title: t('aboutShakespeare'),
diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts
index 8e1b1296..65febe78 100644
--- a/src/lib/i18n.ts
+++ b/src/lib/i18n.ts
@@ -79,6 +79,9 @@ const resources = {
nostrSettingsDescription: 'Configure relay connections and Nostr preferences',
dataSettings: 'Data',
dataSettingsDescription: 'Export files and manage local data',
+ emailUpdates: 'Email Updates',
+ emailUpdatesDescription: 'Subscribe to Shakespeare updates and resources',
+ emailUpdatesDescriptionLong: 'Stay updated with the latest Shakespeare features, tutorials, and resources.',
aboutShakespeareSettings: 'About Shakespeare',
aboutShakespeareSettingsDescription: 'Information about Shakespeare',
@@ -378,6 +381,9 @@ const resources = {
nostrSettingsDescription: 'Configure conexões de relay e preferências do Nostr',
dataSettings: 'Dados',
dataSettingsDescription: 'Exporte arquivos e gerencie dados locais',
+ emailUpdates: 'Atualizações por Email',
+ emailUpdatesDescription: 'Inscreva-se para receber atualizações e recursos do Shakespeare',
+ emailUpdatesDescriptionLong: 'Mantenha-se atualizado com os recursos mais recentes do Shakespeare, tutoriais e recursos. Enviamos apenas atualizações ocasionais e você pode cancelar a inscrição a qualquer momento.',
aboutShakespeareSettings: 'Sobre o Shakespeare',
aboutShakespeareSettingsDescription: 'Informações sobre o Shakespeare',
@@ -677,6 +683,9 @@ const resources = {
nostrSettingsDescription: '配置中继连接和Nostr偏好',
dataSettings: '数据',
dataSettingsDescription: '导出文件和管理本地数据',
+ emailUpdates: '邮件更新',
+ emailUpdatesDescription: '订阅Shakespeare更新和资源',
+ emailUpdatesDescriptionLong: '及时了解最新的Shakespeare功能、教程和资源。我们只会偶尔发送更新,您可以随时取消订阅。',
aboutShakespeareSettings: '关于Shakespeare',
aboutShakespeareSettingsDescription: '关于Shakespeare的信息',
@@ -976,6 +985,9 @@ const resources = {
nostrSettingsDescription: 'Saita haɗin relay da zaɓuɓɓukan Nostr',
dataSettings: 'Bayanai',
dataSettingsDescription: 'Fitar da fayiloli da sarrafa bayanan gida',
+ emailUpdates: 'Sabuntawar Imel',
+ emailUpdatesDescription: 'Yi rajista don karbar sabuntawar Shakespeare da albarkatu',
+ emailUpdatesDescriptionLong: 'Kasance da sabuntawa game da sabbin fasalolin Shakespeare, koyarwa, da albarkatu. Muna aika sabuntawa lokaci-lokaci kawai kuma kuna iya dakatar da rajista koyaushe.',
aboutShakespeareSettings: 'Game da Shakespeare',
aboutShakespeareSettingsDescription: 'Bayani game da Shakespeare',
@@ -1275,6 +1287,9 @@ const resources = {
nostrSettingsDescription: 'Tunto awọn asopọ relay ati awọn ayanfẹ Nostr',
dataSettings: 'Data',
dataSettingsDescription: 'Gbe awọn faili jade ati ṣakoso data agbegbe',
+ emailUpdates: 'Awọn Imudojuiwọn Imeeli',
+ emailUpdatesDescription: 'Forukọsilẹ fun awọn imudojuiwọn Shakespeare ati awọn ohun elo',
+ emailUpdatesDescriptionLong: 'Wa pẹlu imudojuiwọn pẹlu awọn ẹya Shakespeare tuntun, awọn ikẹkọ, ati awọn ohun elo. A nfi awọn imudojuiwọn lọọrọọ nikan ranṣẹ ati pe o le da forukọsilẹ duro nigbakugba.',
aboutShakespeareSettings: 'Nipa Shakespeare',
aboutShakespeareSettingsDescription: 'Alaye nipa Shakespeare',
@@ -1569,6 +1584,9 @@ const resources = {
nostrSettingsDescription: 'Hazie njikọ relay na nhọrọ Nostr',
dataSettings: 'Data',
dataSettingsDescription: 'Bupụta faịlụ na jikwaa data mpaghara',
+ emailUpdates: 'Nmelite Email',
+ emailUpdatesDescription: 'Debanye aha maka nmelite Shakespeare na akụrụngwa',
+ emailUpdatesDescriptionLong: 'Nọrọ na-emelite na atụmatụ Shakespeare ọhụrụ, nkuzi, na akụrụngwa. Anyị na-eziga naanị nmelite mgbe ụfọdụ ma ị nwere ike ịkwụsị ndebanye aha mgbe ọ bụla.',
aboutShakespeareSettings: 'Gbasara Shakespeare',
aboutShakespeareSettingsDescription: 'Ozi gbasara Shakespeare',
diff --git a/src/pages/EmailSettings.tsx b/src/pages/EmailSettings.tsx
new file mode 100644
index 00000000..c8a0e176
--- /dev/null
+++ b/src/pages/EmailSettings.tsx
@@ -0,0 +1,256 @@
+import { useState } from 'react';
+import { ArrowLeft, Mail, CheckCircle } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
+import { useIsMobile } from '@/hooks/useIsMobile';
+import { useNavigate } from 'react-router-dom';
+import { useCurrentUser } from '@/hooks/useCurrentUser';
+import { useToast } from '@/hooks/useToast';
+import { nip19 } from 'nostr-tools';
+
+export function EmailSettings() {
+ const { t } = useTranslation();
+ const isMobile = useIsMobile();
+ const navigate = useNavigate();
+ const { user } = useCurrentUser();
+ const { toast } = useToast();
+
+ const [email, setEmail] = useState('');
+ const [isSubmitting, setIsSubmitting] = useState(false);
+ const [isSubmitted, setIsSubmitted] = useState(false);
+
+ const handleSubmit = async (e: React.FormEvent) => {
+ e.preventDefault();
+
+ if (!email.trim()) {
+ toast({
+ title: "Email required",
+ description: "Please enter your email address",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ // Basic email validation
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+ if (!emailRegex.test(email)) {
+ toast({
+ title: "Invalid email",
+ description: "Please enter a valid email address",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ setIsSubmitting(true);
+
+ try {
+ // Prepare form data
+ const formData = new FormData();
+ formData.append('email', email.trim());
+ formData.append('tag_id', '8982396');
+
+ // Include npub if user is signed in
+ if (user?.pubkey) {
+ const npub = nip19.npubEncode(user.pubkey);
+ formData.append('npub', npub);
+ }
+
+ // Submit to Mailchimp using the same setup as soapbox2
+ const form = document.createElement('form');
+ form.method = 'POST';
+ form.action = 'https://pub.us7.list-manage.com/subscribe/post?u=f1f718a93795f42a604d558d8&id=f7271442a0&f_id=00ffa3e4f0';
+ form.target = '_blank'; // Open in new tab
+ form.style.display = 'none';
+
+ // Add email field
+ const emailInput = document.createElement('input');
+ emailInput.type = 'email';
+ emailInput.name = 'EMAIL';
+ emailInput.value = email.trim();
+ form.appendChild(emailInput);
+
+ // Add tag field with the new Shakespeare tag ID
+ const tagInput = document.createElement('input');
+ tagInput.type = 'hidden';
+ tagInput.name = 'tags';
+ tagInput.value = '8982396';
+ form.appendChild(tagInput);
+
+ // Add npub if available
+ if (user?.pubkey) {
+ const npubInput = document.createElement('input');
+ npubInput.type = 'text';
+ npubInput.name = 'NPUB';
+ npubInput.value = nip19.npubEncode(user.pubkey);
+ npubInput.style.display = 'none';
+ form.appendChild(npubInput);
+ }
+
+ // Add honeypot field
+ const honeypotInput = document.createElement('input');
+ honeypotInput.type = 'text';
+ honeypotInput.name = 'b_f1f718a93795f42a604d558d8_f7271442a0';
+ honeypotInput.tabIndex = -1;
+ honeypotInput.style.position = 'absolute';
+ honeypotInput.style.left = '-5000px';
+ form.appendChild(honeypotInput);
+
+ // Add form to document and submit
+ document.body.appendChild(form);
+ form.submit();
+
+ // Clean up after a short delay
+ setTimeout(() => {
+ document.body.removeChild(form);
+ }, 1000);
+
+ setIsSubmitted(true);
+ toast({
+ title: "Successfully subscribed!",
+ description: "You'll receive Shakespeare updates and resources occasionally.",
+ });
+ } catch (error) {
+ console.error('Email signup error:', error);
+ toast({
+ title: "Subscription failed",
+ description: "There was an error subscribing you to updates. Please try again.",
+ variant: "destructive",
+ });
+ } finally {
+ setIsSubmitting(false);
+ }
+ };
+
+ if (isSubmitted) {
+ return (
+
+ {isMobile && (
+
+
+
+ )}
+
+
+
+
+
+
+
+
+ Thanks for subscribing!
+
+
+ You can opt out at any time using the unsubscribe link in our emails.
+
+
+
+
+
+
+
+
+ );
+ }
+
+ return (
+
+ {isMobile && (
+
+
+
+
+
+ {t('emailUpdates')}
+
+
+ {t('emailUpdatesDescriptionLong')}
+
+
+
+ )}
+
+ {!isMobile && (
+
+
+
+ {t('emailUpdates')}
+
+
+ {t('emailUpdatesDescriptionLong')}
+
+
+ )}
+
+
+
+
+
+ Stay Updated with Shakespeare
+
+
+
+
+
+
+
+
+ );
+}
+
+export default EmailSettings;
\ No newline at end of file
diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx
index cf978600..ecb29350 100644
--- a/src/pages/Settings.tsx
+++ b/src/pages/Settings.tsx
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
-import { Bot, GitBranch, Database, Wifi, Settings2, Info } from 'lucide-react';
+import { Bot, GitBranch, Database, Wifi, Settings2, Info, Mail } from 'lucide-react';
import { useIsMobile } from '@/hooks/useIsMobile';
interface SettingsItem {
@@ -48,6 +48,13 @@ const getSettingsItems = (t: (key: string) => string): SettingsItem[] => [
icon: Database,
href: '/settings/data',
},
+ {
+ id: 'email',
+ title: t('emailUpdates'),
+ description: t('emailUpdatesDescription'),
+ icon: Mail,
+ href: '/settings/email',
+ },
{
id: 'about',
title: t('aboutShakespeare'),