From 5fb3382a52fa50bc4a38ada4360d9adf75450828 Mon Sep 17 00:00:00 2001 From: Sagar Date: Fri, 23 Aug 2024 21:02:30 +0530 Subject: [PATCH] chore(new-convo): disabled for new contacts --- .../convo/_components/create-convo-form.tsx | 65 ++++++++++--------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx b/apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx index a297fea1..ad688093 100644 --- a/apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx +++ b/apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx @@ -751,6 +751,14 @@ export default function CreateConvoForm({ ); } +const showDisabledMessage = (disabled: boolean) => { + if (disabled) { + toast.warning( + 'You cannot add participants to conversation until you have an email identity associated.' + ); + } +}; + type ParticipantsComboboxPopoverProps = { participants: NewConvoParticipant[]; loading: boolean; @@ -802,26 +810,15 @@ function ParticipantsComboboxPopover({ ); }; - const handleDisabledClick = () => { - if (disabled) { - toast.warning( - 'You cannot add participants to conversation until you have an email identity associated.' - ); - } - }; - return ( -
handleDisabledClick()} - className="flex w-full items-center space-x-4"> +
+
disabled && showDisabledMessage(disabled)}> + +
) : (