Fixes "No Result" flash and add a separator (#8140)

Fix for #8137

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
Sanskar Jain 2024-10-29 16:06:25 +05:30 committed by GitHub
parent c0484aa9a2
commit 95b475c855
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 19 deletions

View File

@ -17,5 +17,5 @@ jobs:
with: with:
data_project_dir: packages/twenty-tinybird data_project_dir: packages/twenty-tinybird
secrets: secrets:
tb_admin_token: ${{ secrets.TINYBIRD_ADMIN_TOKEN }} tb_admin_token: ${{ secrets.TB_ADMIN_TOKEN }}
tb_host: https://api.eu-central-1.aws.tinybird.co tb_host: https://api.eu-central-1.aws.tinybird.co

View File

@ -13,7 +13,6 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM
import { SelectableItem } from '@/ui/layout/selectable-list/components/SelectableItem'; import { SelectableItem } from '@/ui/layout/selectable-list/components/SelectableItem';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope'; import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys'; import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope'; import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
@ -119,22 +118,15 @@ export const MultiRecordSelect = ({
); );
})} })}
</SelectableList> </SelectableList>
{objectRecordsIdsMultiSelect?.length === 0 &&
!recordMultiSelectIsLoading && <MenuItem text="No result" />}
</DropdownMenuItemsContainer> </DropdownMenuItemsContainer>
); );
const createNewButton = isDefined(onCreate) && ( const createNewButton = isDefined(onCreate) && (
<>
<DropdownMenuSeparator />
<DropdownMenuItemsContainer>
<CreateNewButton <CreateNewButton
onClick={() => onCreate?.(relationPickerSearchFilter)} onClick={() => onCreate?.(relationPickerSearchFilter)}
LeftIcon={IconPlus} LeftIcon={IconPlus}
text="Add New" text="Add New"
/> />
</DropdownMenuItemsContainer>
</>
); );
return ( return (
@ -148,14 +140,22 @@ export const MultiRecordSelect = ({
<DropdownMenu ref={containerRef} data-select-disable> <DropdownMenu ref={containerRef} data-select-disable>
{dropdownPlacement?.includes('end') && ( {dropdownPlacement?.includes('end') && (
<> <>
<DropdownMenuItemsContainer>
{createNewButton} {createNewButton}
</DropdownMenuItemsContainer>
<DropdownMenuSeparator />
{results} {results}
{recordMultiSelectIsLoading && !relationPickerSearchFilter && ( {recordMultiSelectIsLoading && !relationPickerSearchFilter && (
<>
<DropdownMenuSkeletonItem /> <DropdownMenuSkeletonItem />
)}
<DropdownMenuSeparator /> <DropdownMenuSeparator />
</> </>
)} )}
{objectRecordsIdsMultiSelect?.length > 0 && (
<DropdownMenuSeparator />
)}
</>
)}
<DropdownMenuSearchInput <DropdownMenuSearchInput
value={relationPickerSearchFilter} value={relationPickerSearchFilter}
onChange={handleFilterChange} onChange={handleFilterChange}
@ -166,10 +166,18 @@ export const MultiRecordSelect = ({
<> <>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
{recordMultiSelectIsLoading && !relationPickerSearchFilter && ( {recordMultiSelectIsLoading && !relationPickerSearchFilter && (
<>
<DropdownMenuSkeletonItem /> <DropdownMenuSkeletonItem />
<DropdownMenuSeparator />
</>
)} )}
{results} {results}
{objectRecordsIdsMultiSelect?.length > 0 && (
<DropdownMenuSeparator />
)}
<DropdownMenuItemsContainer>
{createNewButton} {createNewButton}
</DropdownMenuItemsContainer>
</> </>
)} )}
</DropdownMenu> </DropdownMenu>