Fix: Wrong assignee on loading team member picker (#1894)

show only skeleton when loading
This commit is contained in:
Ayush Agrawal
2023-10-06 14:36:05 +05:30
committed by GitHub
parent 53021dc64f
commit 7574ad82fe

View File

@ -104,48 +104,52 @@ export const SingleEntitySelectBase = <
return ( return (
<> <>
<StyledDropdownMenuItemsContainer ref={containerRef} hasMaxHeight> <StyledDropdownMenuItemsContainer ref={containerRef} hasMaxHeight>
{isAllEntitySelectShown && selectAllLabel && onAllEntitySelected && (
<MenuItemSelect
onClick={() => onAllEntitySelected()}
LeftIcon={SelectAllIcon}
text={selectAllLabel}
hovered={preselectedOptionId === EmptyButtonId}
selected={!!isAllEntitySelected}
/>
)}
{emptyLabel && (
<MenuItemSelect
onClick={() => onEntitySelected()}
LeftIcon={EmptyIcon}
text={emptyLabel}
hovered={preselectedOptionId === EmptyButtonId}
selected={!selectedEntity}
/>
)}
{loading ? ( {loading ? (
<DropdownMenuSkeletonItem /> <DropdownMenuSkeletonItem />
) : entitiesInDropdown.length === 0 && !isAllEntitySelectShown ? ( ) : entitiesInDropdown.length === 0 && !isAllEntitySelectShown ? (
<MenuItem text="No result" /> <MenuItem text="No result" />
) : ( ) : (
entitiesInDropdown?.map((entity) => ( <>
<MenuItemSelectAvatar {isAllEntitySelectShown &&
key={entity.id} selectAllLabel &&
testId="menu-item" onAllEntitySelected && (
selected={selectedEntity?.id === entity.id} <MenuItemSelect
onClick={() => onEntitySelected(entity)} onClick={() => onAllEntitySelected()}
text={entity.name} LeftIcon={SelectAllIcon}
hovered={preselectedOptionId === entity.id} text={selectAllLabel}
avatar={ hovered={preselectedOptionId === EmptyButtonId}
<Avatar selected={!!isAllEntitySelected}
avatarUrl={entity.avatarUrl}
colorId={entity.id}
placeholder={entity.name}
size="md"
type={entity.avatarType ?? 'rounded'}
/> />
} )}
/> {emptyLabel && (
)) <MenuItemSelect
onClick={() => onEntitySelected()}
LeftIcon={EmptyIcon}
text={emptyLabel}
hovered={preselectedOptionId === EmptyButtonId}
selected={!selectedEntity}
/>
)}
{entitiesInDropdown?.map((entity) => (
<MenuItemSelectAvatar
key={entity.id}
testId="menu-item"
selected={selectedEntity?.id === entity.id}
onClick={() => onEntitySelected(entity)}
text={entity.name}
hovered={preselectedOptionId === entity.id}
avatar={
<Avatar
avatarUrl={entity.avatarUrl}
colorId={entity.id}
placeholder={entity.name}
size="md"
type={entity.avatarType ?? 'rounded'}
/>
}
/>
))}
</>
)} )}
</StyledDropdownMenuItemsContainer> </StyledDropdownMenuItemsContainer>
{showCreateButton && ( {showCreateButton && (