From f2f8185c2099d94e302669e52a301d8644928e9a Mon Sep 17 00:00:00 2001 From: jp Date: Thu, 13 Aug 2026 18:56:18 +0100 Subject: [PATCH] Use floating modal for add-contact from messages page - replace inline row form with overlay modal - keep Name + Email fields and POST /api/contacts submit --- frontend/src/components/MessagesPage.tsx | 29 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/MessagesPage.tsx b/frontend/src/components/MessagesPage.tsx index 36a9e4c..9c0e297 100644 --- a/frontend/src/components/MessagesPage.tsx +++ b/frontend/src/components/MessagesPage.tsx @@ -68,7 +68,6 @@ export default function MessagesPage() { const whoRaw = m.contact_name || m.callerid || "Unknown caller"; const num = (m.callerid || "").replace(/[^\d+]/g, ""); const showAdd = !m.contact_name && num; - const isAdding = addingId === m.id; return (
@@ -109,17 +108,9 @@ export default function MessagesPage() { {m.has_audio && Download} - {showAdd && !isAdding && ( + {showAdd && ( )} - {isAdding && ( -
{ e.preventDefault(); if (!addName.trim()) return; addContact.mutate({ name: addName.trim(), number: num, email: addEmail.trim() || null }); }}> - setAddName(e.target.value)} placeholder="Name" required style={{ flex: 1, minWidth: 120 }} /> - setAddEmail(e.target.value)} placeholder="Email" type="email" style={{ flex: 1, minWidth: 140 }} /> - - -
- )}
); @@ -128,6 +119,24 @@ export default function MessagesPage() { {data?.messages?.length === 0 && (
No voicemails match your filters.
)} + + {addingId !== null && ( +
setAddingId(null)}> +
e.stopPropagation()}> +

Add contact

+
{ e.preventDefault(); if (!addName.trim()) return; const target = data?.messages?.find((x: any) => x.id === addingId); const targetNum = target ? (target.callerid || "").replace(/[^\d+]/g, "") : ""; addContact.mutate({ name: addName.trim(), number: targetNum, email: addEmail.trim() || null }); }}> + + setAddName(e.target.value)} required /> + + setAddEmail(e.target.value)} /> +
+ + +
+
+
+
+ )} ); }