@@ -424,7 +424,7 @@ export default function CreateConvoForm() {
424
424
}
425
425
setSelectedEmailIdentity ( value ) ;
426
426
} } >
427
- < SelectTrigger className = "h-fit" >
427
+ < SelectTrigger >
428
428
< SelectValue >
429
429
{ selectedEmailIdentityString ?? 'Select an Email Identity to Use' }
430
430
</ SelectValue >
@@ -470,7 +470,7 @@ export default function CreateConvoForm() {
470
470
type = "text"
471
471
value = { topic }
472
472
onChange = { ( e ) => setTopic ( e . target . value ) }
473
- className = "h-fit w-full"
473
+ className = "w-full"
474
474
/>
475
475
</ div >
476
476
@@ -531,6 +531,7 @@ function ParticipantsComboboxPopover({
531
531
) ;
532
532
533
533
const [ currentSelectValue , setCurrentSelectValue ] = useState ( '' ) ;
534
+ const [ search , setSearch ] = useState ( '' ) ;
534
535
const hasExternalParticipants = useMemo (
535
536
( ) =>
536
537
selectedParticipants . some (
@@ -540,6 +541,30 @@ function ParticipantsComboboxPopover({
540
541
[ selectedParticipants ]
541
542
) ;
542
543
544
+ const setEmailParticipants = useSetAtom ( newEmailParticipantsAtom ) ;
545
+ const addSelectedParticipant = useSetAtom ( selectedParticipantsAtom ) ;
546
+
547
+ const addEmailParticipant = ( email : string ) => {
548
+ setEmailParticipants ( ( prev ) =>
549
+ prev . includes ( email ) ? prev : prev . concat ( email )
550
+ ) ;
551
+ addSelectedParticipant ( ( prev ) =>
552
+ prev . find ( ( p ) => p . publicId === email )
553
+ ? prev
554
+ : prev . concat ( {
555
+ type : 'email' ,
556
+ publicId : email ,
557
+ address : email ,
558
+ keywords : [ email ] ,
559
+ avatarPublicId : null ,
560
+ avatarTimestamp : null ,
561
+ color : null ,
562
+ own : false ,
563
+ name : email
564
+ } )
565
+ ) ;
566
+ } ;
567
+
543
568
return (
544
569
< div className = "flex w-full items-center space-x-4" >
545
570
< Popover
@@ -638,20 +663,28 @@ function ParticipantsComboboxPopover({
638
663
< CommandInput asChild >
639
664
< Input
640
665
label = "Search or type an Email address"
641
- className = "h-8"
666
+ value = { search }
667
+ onChange = { ( e ) => setSearch ( e . target . value ) }
642
668
onKeyDown = { ( e ) => {
643
669
// Hack to prevent cmdk from preventing Home and End keys
644
670
if ( e . key === 'Home' || e . key === 'End' ) {
645
671
e . stopPropagation ( ) ;
646
672
}
673
+ if ( e . key === 'Enter' ) {
674
+ if ( z . string ( ) . email ( ) . safeParse ( search ) . success ) {
675
+ addEmailParticipant ( search ) ;
676
+ setCurrentSelectValue ( '' ) ;
677
+ setSearch ( '' ) ;
678
+ }
679
+ }
647
680
} }
648
681
onFocus = { ( ) => {
649
682
// Remove current select value when input is focused
650
683
setCurrentSelectValue ( '' ) ;
651
684
} }
652
685
/>
653
686
</ CommandInput >
654
- < CommandList className = "max-h-[calc(var(--radix-popover-content-available-height)*0.9)] overflow-scroll" >
687
+ < CommandList className = "max-h-[calc(var(--radix-popover-content-available-height)*0.9)] overflow-x-clip overflow-y- scroll" >
655
688
{ loading && < CommandLoading > Loading Participants</ CommandLoading > }
656
689
< CommandGroup className = "flex flex-col gap-2 px-1" >
657
690
{ ! loading && < EmptyStateHandler /> }
0 commit comments