diff --git a/src/admin.css b/src/admin.css index babdb8a..9447201 100644 --- a/src/admin.css +++ b/src/admin.css @@ -226,6 +226,8 @@ } .sub-row .name { color: var(--accent-dark); font-weight: 700; font-size: 14px; } .sub-row .dog { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; } +.sub-row .phone { color: var(--accent-dark); font-size: 13px; font-weight: 600; text-decoration: none; } +.sub-row .phone:hover { text-decoration: underline; } .sub-row .msg { font-size: 14px; color: var(--text); line-height: 1.55; white-space: pre-wrap; } .sub-row .meta { color: var(--text-muted); font-size: 12px; } diff --git a/src/lib/content/defaults.ts b/src/lib/content/defaults.ts index 01811e3..1098eff 100644 --- a/src/lib/content/defaults.ts +++ b/src/lib/content/defaults.ts @@ -133,6 +133,8 @@ export const DEFAULT_SLOTS: CopySlot[] = [ { id: 'contact.placeholder_name', section: 'Contact', label: 'Placeholder — Name', kind: 'inline', value: 'Nome e Cognome' }, { id: 'contact.label_dog', section: 'Contact', label: 'Label — Dog', kind: 'inline', value: 'Come si chiama il tuo cane?' }, { id: 'contact.placeholder_dog', section: 'Contact', label: 'Placeholder — Dog', kind: 'inline', value: 'Il nome del peloso...' }, + { id: 'contact.label_phone', section: 'Contact', label: 'Label — Phone', kind: 'inline', value: 'Numero di telefono' }, + { id: 'contact.placeholder_phone', section: 'Contact', label: 'Placeholder — Phone', kind: 'inline', value: '+39 ...' }, { id: 'contact.label_msg', section: 'Contact', label: 'Label — Message', kind: 'inline', value: 'Il tuo messaggio' }, { id: 'contact.placeholder_msg', section: 'Contact', label: 'Placeholder — Message', kind: 'inline', value: 'Raccontami di te e del tuo cane...' }, { id: 'contact.submit', section: 'Contact', label: 'Submit button', kind: 'inline', value: 'Invia il messaggio' }, diff --git a/src/lib/server/submissions.ts b/src/lib/server/submissions.ts index d15b206..0c533ec 100644 --- a/src/lib/server/submissions.ts +++ b/src/lib/server/submissions.ts @@ -5,6 +5,7 @@ export type Submission = { id: string; name: string; dog: string; + phone: string; message: string; createdAt: string; ip?: string; diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 88969dd..7c37c37 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -13,13 +13,14 @@ export const actions: Actions = { const data = await request.formData(); const name = String(data.get('name') ?? '').trim(); const dog = String(data.get('dog') ?? '').trim(); + const phone = String(data.get('phone') ?? '').trim(); const message = String(data.get('message') ?? '').trim(); - if (!name || !message) { - return fail(400, { error: 'Compila almeno nome e messaggio.', name, dog, message }); + if (!name || !phone || !message) { + return fail(400, { error: 'Compila nome, telefono e messaggio.', name, dog, phone, message }); } - const entry = addSubmission({ name, dog, message, ip: getClientAddress() }); + const entry = addSubmission({ name, dog, phone, message, ip: getClientAddress() }); addNotification({ type: 'submission', title: 'Nuova richiesta dal form', diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index d2ee8e0..3410277 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -17,6 +17,11 @@ if (form?.success) submitted = true; }); + const phoneDigits = $derived((c['contact.phone_value'] ?? '').replace(/\D/g, '')); + const telHref = $derived(phoneDigits ? `tel:+${phoneDigits}` : '#'); + const waHref = $derived(phoneDigits ? `https://wa.me/${phoneDigits}` : '#'); + const mailHref = $derived(`mailto:${c['contact.email_value'] ?? ''}`); + onMount(() => { const onScroll = () => { scrolled = window.scrollY > 20; @@ -312,6 +317,10 @@ +
{c['contact.phone_label']}
-{c['contact.phone_value']}
-{c['contact.email_label']}
-{c['contact.email_value']}
-{c['contact.wa_label']}
-{c['contact.wa_value']}
-{c['contact.phone_label']}
+{c['contact.phone_value']}
+{c['contact.email_label']}
+{c['contact.email_value']}
+{c['contact.wa_label']}
+{c['contact.wa_value']}
+{c['footer.copyright']}