From 24a28dce720a97cec94a08d7cb00cd50163553b8 Mon Sep 17 00:00:00 2001 From: Yashas Date: Wed, 28 Oct 2026 12:21:20 +0530 Subject: [PATCH] Conversation: render WhatsApp bold markers as bold Co-Authored-By: Claude Fable 5.1 --- src/screens/Enquiry.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/screens/Enquiry.tsx b/src/screens/Enquiry.tsx index bd13355..dd39324 100644 --- a/src/screens/Enquiry.tsx +++ b/src/screens/Enquiry.tsx @@ -217,6 +217,11 @@ function author(tag: string): { label: string; tone: 'ai' | 'human' | 'auto' } { return { label: `Desk ยท ${tag}`, tone: 'auto' }; } const REPLY_STATES = ['Awaiting Ops Input', 'Awaiting Offer', 'Offer Sent', 'Confirmed']; +/** WhatsApp bold markers (*text*) as the customer sees them. Email messages carry none. */ +function richText(text: string): ReactNode { + const parts = text.split(/(\*[^*\n]+\*)/g); + return parts.map((p, i) => (p.length > 2 && p.startsWith('*') && p.endsWith('*') ? {p.slice(1, -1)} : {p})); +} function Conversation({ e, onDone }: { e: Enquiry; onDone: () => void }) { const { has, user } = useZino(); @@ -251,7 +256,7 @@ function Conversation({ e, onDone }: { e: Enquiry; onDone: () => void }) { {a?.tone === 'human' && } {m.who === 'Customer' ? 'Customer' : a!.label} -
{m.text}
+
{richText(m.text)}
);