diff --git a/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetInlineCellEditMode.tsx b/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetInlineCellEditMode.tsx index 0546efc23eeff..f85dc54adfc31 100644 --- a/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetInlineCellEditMode.tsx +++ b/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetInlineCellEditMode.tsx @@ -284,7 +284,6 @@ export const ActivityTargetInlineCellEditMode = ({ - {' '} diff --git a/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsProvider.tsx b/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsProvider.tsx index 3a076037d947e..0a3f21e1e418c 100644 --- a/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsProvider.tsx +++ b/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsProvider.tsx @@ -20,7 +20,7 @@ export const ObjectMetadataItemsProvider = ({ {shouldDisplayChildren ? ( {children} diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunity.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunity.tsx index d3a4a3915969a..34c0c3bed274b 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunity.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunity.tsx @@ -45,7 +45,7 @@ export const RecordBoardColumnNewOpportunity = ({ } objectNameSingular={CoreObjectNameSingular.Company} recordPickerInstanceId="relation-picker" - selectedRelationRecordIds={[]} + selectedRecordIds={[]} /> )} diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/hooks/useAddNewCard.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/hooks/useAddNewCard.ts index a60dac7a4e979..7fce3b598f21d 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/hooks/useAddNewCard.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/hooks/useAddNewCard.ts @@ -21,7 +21,7 @@ export const useAddNewCard = () => { const { createOneRecord, selectFieldMetadataItem, objectMetadataItem } = useContext(RecordBoardContext); const { resetSearchFilter } = useRecordSelectSearch({ - recordPickerInstanceId: 'relation-picker', + recordPickerInstanceId: 'record-picker', }); const { diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationFromManyFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationFromManyFieldInput.tsx index 5cbdaa1a32452..a13f9e5c33782 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationFromManyFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationFromManyFieldInput.tsx @@ -58,7 +58,6 @@ export const RelationFromManyFieldInput = ({ - {' '} void; + onSubmit: (selectedRecord: RecordForSelect | null) => void; onCancel?: () => void; width?: number; - excludeRecordIds?: string[]; + excludedRecordIds?: string[]; initialSearchFilter?: string | null; fieldDefinition: FieldDefinition; }; @@ -24,7 +24,7 @@ export const RelationPicker = ({ selectedRecordId, onSubmit, onCancel, - excludeRecordIds, + excludedRecordIds, width, initialSearchFilter, fieldDefinition, @@ -32,8 +32,8 @@ export const RelationPicker = ({ const recordPickerInstanceId = 'relation-picker'; const handleRecordSelected = ( - selectedEntity: RecordForSelect | null | undefined, - ) => onSubmit(selectedEntity ?? null); + selectedRecord: RecordForSelect | null | undefined, + ) => onSubmit(selectedRecord ?? null); const { objectMetadataItem: relationObjectMetadataItem } = useObjectMetadataItem({ @@ -73,8 +73,8 @@ export const RelationPicker = ({ fieldDefinition.metadata.relationObjectMetadataNameSingular } recordPickerInstanceId={recordPickerInstanceId} - selectedRelationRecordIds={selectedRecordId ? [selectedRecordId] : []} - excludedRelationRecordIds={excludeRecordIds} + selectedRecordIds={selectedRecordId ? [selectedRecordId] : []} + excludedRecordIds={excludedRecordIds} /> ); diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelect.tsx b/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelect.tsx index add26c8baf503..221fa3961fb93 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelect.tsx @@ -17,13 +17,13 @@ export const SingleRecordSelect = ({ disableBackgroundBlur = false, EmptyIcon, emptyLabel, - excludedRelationRecordIds, + excludedRecordIds, onCancel, onCreate, onRecordSelected, objectNameSingular, recordPickerInstanceId, - selectedRelationRecordIds, + selectedRecordIds, width = 200, }: SingleRecordSelectProps) => { const containerRef = useRef(null); @@ -54,13 +54,13 @@ export const SingleRecordSelect = ({ {...{ EmptyIcon, emptyLabel, - excludedRelationRecordIds, + excludedRecordIds, onCancel, onCreate, onRecordSelected, objectNameSingular, recordPickerInstanceId, - selectedRelationRecordIds, + selectedRecordIds, }} /> diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelectMenuItemsWithSearch.tsx b/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelectMenuItemsWithSearch.tsx index 4efd6919541b1..4eb6ac1083505 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelectMenuItemsWithSearch.tsx +++ b/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelectMenuItemsWithSearch.tsx @@ -14,11 +14,11 @@ import { isDefined } from '~/utils/isDefined'; import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull'; export type SingleRecordSelectMenuItemsWithSearchProps = { - excludedRelationRecordIds?: string[]; + excludedRecordIds?: string[]; onCreate?: ((searchInput?: string) => void) | (() => void); objectNameSingular: string; recordPickerInstanceId?: string; - selectedRelationRecordIds: string[]; + selectedRecordIds: string[]; dropdownPlacement?: Placement | null; } & Pick< SingleRecordSelectMenuItemsProps, @@ -32,13 +32,13 @@ export type SingleRecordSelectMenuItemsWithSearchProps = { export const SingleRecordSelectMenuItemsWithSearch = ({ EmptyIcon, emptyLabel, - excludedRelationRecordIds, + excludedRecordIds, onCancel, onCreate, onRecordSelected, objectNameSingular, - recordPickerInstanceId = 'relation-picker', - selectedRelationRecordIds, + recordPickerInstanceId = 'record-picker', + selectedRecordIds, dropdownPlacement, }: SingleRecordSelectMenuItemsWithSearchProps) => { const { handleSearchFilterChange } = useRecordSelectSearch({ @@ -47,8 +47,8 @@ export const SingleRecordSelectMenuItemsWithSearch = ({ const { records, recordPickerSearchFilter } = useRecordPickerRecordsOptions({ objectNameSingular, - selectedRelationRecordIds, - excludedRelationRecordIds, + selectedRecordIds, + excludedRecordIds, }); const createNewButton = isDefined(onCreate) && ( @@ -68,7 +68,7 @@ export const SingleRecordSelectMenuItemsWithSearch = ({ ? records.recordsToSelect[0] : undefined } - shouldSelectEmptyOption={selectedRelationRecordIds?.length === 0} + shouldSelectEmptyOption={selectedRecordIds?.length === 0} hotkeyScope={recordPickerInstanceId} isFiltered={!!recordPickerSearchFilter} {...{ diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/components/__stories__/SingleRecordSelect.stories.tsx b/packages/twenty-front/src/modules/object-record/relation-picker/components/__stories__/SingleRecordSelect.stories.tsx index bac982626375d..fb445e84b8d88 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/components/__stories__/SingleRecordSelect.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/relation-picker/components/__stories__/SingleRecordSelect.stories.tsx @@ -36,7 +36,7 @@ const meta: Meta = { ], args: { objectNameSingular: CoreObjectNameSingular.WorkspaceMember, - selectedRelationRecordIds: [], + selectedRecordIds: [], }, argTypes: { selectedRecord: { @@ -57,7 +57,7 @@ type Story = StoryObj; export const Default: Story = {}; -export const WithSelectedEntity: Story = { +export const WithSelectedRecord: Story = { args: { selectedRecord: records[2] }, }; diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/hooks/__tests__/useEntitySelectSearch.test.tsx b/packages/twenty-front/src/modules/object-record/relation-picker/hooks/__tests__/useRecordSelectSearch.test.tsx similarity index 88% rename from packages/twenty-front/src/modules/object-record/relation-picker/hooks/__tests__/useEntitySelectSearch.test.tsx rename to packages/twenty-front/src/modules/object-record/relation-picker/hooks/__tests__/useRecordSelectSearch.test.tsx index 92faa5c8d31fe..3f521cf186d9b 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/hooks/__tests__/useEntitySelectSearch.test.tsx +++ b/packages/twenty-front/src/modules/object-record/relation-picker/hooks/__tests__/useRecordSelectSearch.test.tsx @@ -18,14 +18,14 @@ describe('useRecordSelectSearch', () => { it('should update searchFilter after change event', async () => { const { result } = renderHook( () => { - const entitySelectSearchHook = useRecordSelectSearch({ + const recordSelectSearchHook = useRecordSelectSearch({ recordPickerInstanceId: instanceId, }); const internallyStoredFilter = useRecoilComponentValueV2( recordPickerSearchFilterComponentState, instanceId, ); - return { entitySelectSearchHook, internallyStoredFilter }; + return { recordSelectSearchHook, internallyStoredFilter }; }, { wrapper: Wrapper, @@ -35,7 +35,7 @@ describe('useRecordSelectSearch', () => { const filter = 'value'; act(() => { - result.current.entitySelectSearchHook.handleSearchFilterChange({ + result.current.recordSelectSearchHook.handleSearchFilterChange({ currentTarget: { value: filter }, } as ChangeEvent); }); diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordPicker.ts b/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordPicker.ts index 6cbece196831b..723f4e2a07d55 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordPicker.ts +++ b/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordPicker.ts @@ -2,7 +2,7 @@ import { recordPickerPreselectedIdComponentState } from '@/object-record/relatio import { recordPickerSearchFilterComponentState } from '@/object-record/relation-picker/states/recordPickerSearchFilterComponentState'; import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2'; -export const useRelationPicker = ({ +export const useRecordPicker = ({ recordPickerInstanceId, }: { recordPickerInstanceId?: string; diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordPickerRecordsOptions.ts b/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordPickerRecordsOptions.ts index e0b399c656154..9064a67adf644 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordPickerRecordsOptions.ts +++ b/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordPickerRecordsOptions.ts @@ -1,31 +1,24 @@ -import { RecordPickerComponentInstanceContext } from '@/object-record/relation-picker/states/contexts/RecordPickerComponentInstanceContext'; import { recordPickerSearchFilterComponentState } from '@/object-record/relation-picker/states/recordPickerSearchFilterComponentState'; import { useFilteredSearchRecordQuery } from '@/search/hooks/useFilteredSearchRecordQuery'; -import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2'; export const useRecordPickerRecordsOptions = ({ objectNameSingular, - selectedRelationRecordIds = [], - excludedRelationRecordIds = [], + selectedRecordIds = [], + excludedRecordIds = [], }: { objectNameSingular: string; - selectedRelationRecordIds?: string[]; - excludedRelationRecordIds?: string[]; + selectedRecordIds?: string[]; + excludedRecordIds?: string[]; }) => { - const instanceId = useAvailableComponentInstanceIdOrThrow( - RecordPickerComponentInstanceContext, - ); - const recordPickerSearchFilter = useRecoilComponentValueV2( recordPickerSearchFilterComponentState, - instanceId, ); const records = useFilteredSearchRecordQuery({ searchFilter: recordPickerSearchFilter, - selectedIds: selectedRelationRecordIds, - excludeRecordIds: excludedRelationRecordIds, + selectedIds: selectedRecordIds, + excludedRecordIds: excludedRecordIds, objectNameSingular, }); diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordSelectSearch.ts b/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordSelectSearch.ts index e6af25f224344..1e615cb1f95f4 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordSelectSearch.ts +++ b/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRecordSelectSearch.ts @@ -1,6 +1,6 @@ import { useDebouncedCallback } from 'use-debounce'; -import { useRelationPicker } from '@/object-record/relation-picker/hooks/useRecordPicker'; +import { useRecordPicker } from '@/object-record/relation-picker/hooks/useRecordPicker'; export const useRecordSelectSearch = ({ recordPickerInstanceId, @@ -8,7 +8,7 @@ export const useRecordSelectSearch = ({ recordPickerInstanceId?: string; } = {}) => { const { setRecordPickerSearchFilter, setRecordPickerPreselectedId } = - useRelationPicker({ recordPickerInstanceId }); + useRecordPicker({ recordPickerInstanceId }); const debouncedSetSearchFilter = useDebouncedCallback( setRecordPickerSearchFilter, diff --git a/packages/twenty-front/src/modules/object-record/select/hooks/useRecordsForSelect.ts b/packages/twenty-front/src/modules/object-record/select/hooks/useRecordsForSelect.ts index 73bacf2e7cf60..3abb7bcefd5dd 100644 --- a/packages/twenty-front/src/modules/object-record/select/hooks/useRecordsForSelect.ts +++ b/packages/twenty-front/src/modules/object-record/select/hooks/useRecordsForSelect.ts @@ -16,14 +16,14 @@ export const useRecordsForSelect = ({ sortOrder = 'AscNullsLast', selectedIds, limit, - excludeRecordIds = [], + excludedRecordIds = [], objectNameSingular, }: { searchFilterText: string; sortOrder?: OrderBy; selectedIds: string[]; limit?: number; - excludeRecordIds?: string[]; + excludedRecordIds?: string[]; objectNameSingular: string; }) => { const { mapToObjectRecordIdentifier } = useMapToObjectRecordIdentifier({ @@ -91,7 +91,7 @@ export const useRecordsForSelect = ({ skip: !selectedIds.length, }); - const notFilterIds = [...selectedIds, ...excludeRecordIds]; + const notFilterIds = [...selectedIds, ...excludedRecordIds]; const notFilter = notFilterIds.length ? { not: { id: { in: notFilterIds } } } : undefined; diff --git a/packages/twenty-front/src/modules/object-record/utils/getRecordChipGenerators.ts b/packages/twenty-front/src/modules/object-record/utils/getRecordChipGenerators.ts index c1d2e8de339be..46f145c45b841 100644 --- a/packages/twenty-front/src/modules/object-record/utils/getRecordChipGenerators.ts +++ b/packages/twenty-front/src/modules/object-record/utils/getRecordChipGenerators.ts @@ -47,13 +47,13 @@ export const getRecordChipGenerators = ( labelIdentifierFieldMetadataItem?.id === fieldMetadataItem.id; const currentObjectNameSingular = objectMetadataItem.nameSingular; - const fieldobjectNameSingular = + const fieldObjectNameSingular = fieldMetadataItem.relationDefinition?.targetObjectMetadata .nameSingular ?? undefined; const objectNameSingularToFind = isLabelIdentifier ? currentObjectNameSingular - : fieldobjectNameSingular; + : fieldObjectNameSingular; const objectMetadataItemToUse = objectMetadataItems.find( (objectMetadataItem) => diff --git a/packages/twenty-front/src/modules/search/hooks/__tests__/useFilteredSearchRecordQuery.test.tsx b/packages/twenty-front/src/modules/search/hooks/__tests__/useFilteredSearchRecordQuery.test.tsx index 2c9ed511a6155..05ede72d5d057 100644 --- a/packages/twenty-front/src/modules/search/hooks/__tests__/useFilteredSearchRecordQuery.test.tsx +++ b/packages/twenty-front/src/modules/search/hooks/__tests__/useFilteredSearchRecordQuery.test.tsx @@ -82,7 +82,7 @@ describe('useFilteredSearchRecordQuery', () => { return useFilteredSearchRecordQuery({ selectedIds: ['1'], limit: 10, - excludeRecordIds: ['2'], + excludedRecordIds: ['2'], objectNameSingular: 'person', searchFilter: 'Entity', }); diff --git a/packages/twenty-front/src/modules/search/hooks/useFilteredSearchRecordQuery.ts b/packages/twenty-front/src/modules/search/hooks/useFilteredSearchRecordQuery.ts index 9ca6e297232ff..7d49da6c27c92 100644 --- a/packages/twenty-front/src/modules/search/hooks/useFilteredSearchRecordQuery.ts +++ b/packages/twenty-front/src/modules/search/hooks/useFilteredSearchRecordQuery.ts @@ -12,13 +12,13 @@ import { isDefined } from '~/utils/isDefined'; export const useFilteredSearchRecordQuery = ({ selectedIds, limit, - excludeRecordIds = [], + excludedRecordIds = [], objectNameSingular, searchFilter, }: { selectedIds: string[]; limit?: number; - excludeRecordIds?: string[]; + excludedRecordIds?: string[]; objectNameSingular: string; searchFilter?: string; }): RecordsForMultipleRecordSelect => { @@ -50,7 +50,7 @@ export const useFilteredSearchRecordQuery = ({ searchInput: searchFilter, }); - const notFilterIds = [...selectedIds, ...excludeRecordIds]; + const notFilterIds = [...selectedIds, ...excludedRecordIds]; const notFilter = notFilterIds.length ? { not: { id: { in: notFilterIds } } } : undefined; diff --git a/packages/twenty-front/src/testing/decorators/RecordPickerDecorator.tsx b/packages/twenty-front/src/testing/decorators/RecordPickerDecorator.tsx index 89d8658db60d6..46fd5bbc25b83 100644 --- a/packages/twenty-front/src/testing/decorators/RecordPickerDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/RecordPickerDecorator.tsx @@ -4,7 +4,7 @@ import { RecordPickerComponentInstanceContext } from '@/object-record/relation-p export const RecordPickerDecorator: Decorator = (Story) => (