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 1bc74848..ce1fd519 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 @@ -573,6 +573,7 @@ export default function CreateConvoForm({

Participants

- {userEmailIdentities?.emailIdentities.map((email) => ( - - - - {`${email.sendName} (${email.username}@${email.domainName})`} + {userEmailIdentities?.emailIdentities.length == 0 ? ( + + {`No email identities available`} + + ) : ( + userEmailIdentities?.emailIdentities.map((email) => ( + + + + {`${email.sendName} (${email.username}@${email.domainName})`} + + {!email.sendingEnabled && ( + + + + + + + Sending from this email identity is + disabled. + + + {isAdmin + ? 'Please check that the DNS records are correctly set up.' + : 'Please contact your admin for assistance.'} + + + + )} - {!email.sendingEnabled && ( - - - - - - - Sending from this email identity is disabled. - - - {isAdmin - ? 'Please check that the DNS records are correctly set up.' - : 'Please contact your admin for assistance.'} - - - - )} - - - ))} + + )) + )}
@@ -740,9 +751,16 @@ export default function CreateConvoForm({ ); } +const showDisabledMessage = () => { + toast.warning( + 'You cannot add participants to conversation until you have an email identity associated.' + ); +}; + type ParticipantsComboboxPopoverProps = { participants: NewConvoParticipant[]; loading: boolean; + disabled?: boolean; selectedParticipants: NewConvoParticipant[]; setSelectedParticipants: Dispatch>; setNewEmailParticipants: Dispatch>; @@ -751,6 +769,7 @@ type ParticipantsComboboxPopoverProps = { function ParticipantsComboboxPopover({ participants, loading, + disabled = false, selectedParticipants, setSelectedParticipants, setNewEmailParticipants @@ -768,6 +787,7 @@ function ParticipantsComboboxPopover({ ); const addEmailParticipant = (email: string) => { + if (disabled) return; setNewEmailParticipants((prev) => prev.includes(email) ? prev : prev.concat(email) ); @@ -795,29 +815,11 @@ function ParticipantsComboboxPopover({ onOpenChange={setOpen}>