Skip to content

Commit 4a7a812

Browse files
authored
style(create-convo-form): overflow fixes and hover info (#626)
1 parent ab0145c commit 4a7a812

File tree

1 file changed

+83
-51
lines changed

1 file changed

+83
-51
lines changed

apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx

Lines changed: 83 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ import {
3333
emptyTiptapEditorContent
3434
} from '@u22n/tiptap/react/components';
3535

36+
import {
37+
HoverCard,
38+
HoverCardContent,
39+
HoverCardTrigger
40+
} from '@/src/components/shadcn-ui/hover-card';
3641
import {
3742
At,
3843
CaretDown,
@@ -560,7 +565,7 @@ function ParticipantsComboboxPopover({
560565
variant={'outline'}
561566
className="h-fit w-full justify-between">
562567
{selectedParticipants.length > 0 ? (
563-
<div className="flex flex-wrap gap-2">
568+
<div className="flex flex-wrap gap-2 overflow-hidden">
564569
{selectedParticipants.map((participant, i) => {
565570
let info = '';
566571
switch (participant.type) {
@@ -685,58 +690,85 @@ function ParticipantsComboboxPopover({
685690
: prev.concat(participant)
686691
);
687692
}}>
688-
<Button
689-
variant={'ghost'}
690-
className={cn(
691-
'my-1 w-full justify-start px-1',
692-
selectedParticipants.find(
693+
<HoverCard>
694+
<Button
695+
variant={'ghost'}
696+
className={cn(
697+
'my-1 w-full justify-start px-1',
698+
selectedParticipants.find(
699+
(p) => p.publicId === participant.publicId
700+
)
701+
? 'text-gray-10'
702+
: 'text-base-11'
703+
)}
704+
disabled={
705+
participant.type === 'orgMember' &&
706+
participant.disabled
707+
}
708+
onFocus={() =>
709+
setCurrentSelectValue(participant.publicId)
710+
}>
711+
<div className="flex items-center justify-center gap-2">
712+
<HoverCardTrigger className="flex flex-row items-center gap-1">
713+
<Avatar
714+
avatarProfilePublicId={
715+
participant.avatarPublicId ?? 'no_avatar'
716+
}
717+
avatarTimestamp={participant.avatarTimestamp}
718+
name={participant.name ?? ''}
719+
color={
720+
participant.color
721+
? (participant.color as 'base')
722+
: 'base'
723+
}
724+
size="sm"
725+
hideTooltip
726+
/>
727+
<p className="text-base-11 text-sm">
728+
{participant.own && participant.own
729+
? 'You (already a participant)'
730+
: `${participant.name} ${participant.title ? `(${participant.title})` : ''}`}
731+
</p>
732+
</HoverCardTrigger>
733+
<AvatarIcon
734+
avatarProfilePublicId={
735+
participant.avatarPublicId ?? 'no_avatar'
736+
}
737+
size="sm"
738+
address={participant.address ?? undefined}
739+
withDot={!!participant.address}
740+
/>
741+
</div>
742+
743+
{selectedParticipants.find(
693744
(p) => p.publicId === participant.publicId
694-
)
695-
? 'text-gray-10'
696-
: 'text-base-11'
745+
) ? (
746+
<Check size={16} />
747+
) : null}
748+
</Button>
749+
{participant.address && participant.name && (
750+
<HoverCardContent className="bg-slate-6 min-w-[280px] flex flex-col gap-1">
751+
<span className="font-100 text-xs">
752+
<span className="font-medium">Name :</span>{' '}
753+
{participant.name}
754+
</span>
755+
{!participant.handle ||
756+
(participant.handle !== '' && (
757+
<span className="font-100 text-xs">
758+
<span className="font-medium">Handle :</span>{' '}
759+
{participant.handle}
760+
</span>
761+
))}
762+
{!participant.address ||
763+
(participant.address !== '' && (
764+
<span className="font-100 text-xs">
765+
<span className="font-medium">Address :</span>{' '}
766+
{participant.address}
767+
</span>
768+
))}
769+
</HoverCardContent>
697770
)}
698-
disabled={
699-
participant.type === 'orgMember' && participant.disabled
700-
}
701-
onFocus={() =>
702-
setCurrentSelectValue(participant.publicId)
703-
}>
704-
<div className="flex items-center justify-center gap-2">
705-
<Avatar
706-
avatarProfilePublicId={
707-
participant.avatarPublicId ?? 'no_avatar'
708-
}
709-
avatarTimestamp={participant.avatarTimestamp}
710-
name={participant.name ?? ''}
711-
color={
712-
participant.color
713-
? (participant.color as 'base')
714-
: 'base'
715-
}
716-
size="sm"
717-
hideTooltip
718-
/>
719-
<p className="text-base-11 text-sm">
720-
{participant.own && participant.own
721-
? 'You (already a participant)'
722-
: `${participant.name} ${participant.title ? `(${participant.title})` : ''}`}
723-
</p>
724-
<AvatarIcon
725-
avatarProfilePublicId={
726-
participant.avatarPublicId ?? 'no_avatar'
727-
}
728-
size="sm"
729-
address={participant.address ?? undefined}
730-
withDot={!!participant.address}
731-
/>
732-
</div>
733-
734-
{selectedParticipants.find(
735-
(p) => p.publicId === participant.publicId
736-
) ? (
737-
<Check size={16} />
738-
) : null}
739-
</Button>
771+
</HoverCard>
740772
</CommandItem>
741773
))}
742774
</CommandGroup>

0 commit comments

Comments
 (0)