Improve Data Importer Select Matching - Post Merge Updates (#6750)

This PR was created by [GitStart](https://gitstart.com/) to address the
requirements from this ticket:
[TWNTY-6135-1](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6135-1).

 --- 
### Description
This [PR](https://github.com/twentyhq/twenty/pull/6338) was merged, but
the reviewr asked for some changes in another PR
https://github.com/twentyhq/twenty/pull/6338#pullrequestreview-2255006727


### Refs
https://github.com/twentyhq/twenty/pull/6338

### Demo
<https://jam.dev/c/80336c7a-4536-4a58-b531-981bac81cb26>

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
This commit is contained in:
gitstart-app[bot]
2024-08-28 17:33:39 +02:00
committed by GitHub
parent 0531eb5015
commit 7c894fe870
13 changed files with 70 additions and 66 deletions

View File

@ -2,14 +2,12 @@ import styled from '@emotion/styled';
import { SelectOption } from '@/spreadsheet-import/types';
import { SelectFieldHotkeyScope } from '@/object-record/select/types/SelectFieldHotkeyScope';
import { DropdownMenu } from '@/ui/layout/dropdown/components/DropdownMenu';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
import { MenuItemSelectTag } from '@/ui/navigation/menu-item/components/MenuItemSelectTag';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { useTheme } from '@emotion/react';
import {
@ -40,6 +38,7 @@ interface SelectInputProps {
onFilterChange?: (filteredOptions: SelectOption[]) => void;
onClear?: () => void;
clearLabel?: string;
hotkeyScope: string;
}
export const SelectInput = ({
@ -51,6 +50,7 @@ export const SelectInput = ({
defaultOption,
parentRef,
onFilterChange,
hotkeyScope,
}: SelectInputProps) => {
const containerRef = useRef<HTMLDivElement>(null);
@ -97,12 +97,6 @@ export const SelectInput = ({
placement: 'bottom-start',
});
const setHotkeyScope = useSetHotkeyScope();
useEffect(() => {
setHotkeyScope(SelectFieldHotkeyScope.SelectField);
}, [setHotkeyScope]);
useEffect(() => {
onFilterChange?.(optionsInDropDown);
}, [onFilterChange, optionsInDropDown]);
@ -132,7 +126,7 @@ export const SelectInput = ({
handleOptionChange(selectedOption);
}
},
SelectFieldHotkeyScope.SelectField,
hotkeyScope,
[searchFilter, optionsInDropDown],
);