Update the frontend to adhere to the custom eslint rule twenty/no-spread-props (#1958)

* Update the frontend to adhere to the custom eslint rule `twenty/no-spread-props`

Co-authored-by: v1b3m <vibenjamin6@gmail.com>

* Update the frontend to adhere to the custom eslint rule `twenty/no-spread-props`

Co-authored-by: v1b3m <vibenjamin6@gmail.com>

* resolve bug with data-testid

---------

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
gitstart-twenty
2023-10-10 16:40:49 +03:00
committed by GitHub
parent 5dddd77eb3
commit bf397bc6ec
33 changed files with 276 additions and 169 deletions

View File

@ -34,11 +34,16 @@ export type SingleEntitySelectProps<
export const SingleEntitySelect = <
CustomEntityForSelect extends EntityForSelect,
>({
EmptyIcon,
disableBackgroundBlur = false,
emptyLabel,
entitiesToSelect,
loading,
onCancel,
onCreate,
onEntitySelected,
selectedEntity,
width,
...props
}: SingleEntitySelectProps<CustomEntityForSelect>) => {
const containerRef = useRef<HTMLDivElement>(null);
@ -69,11 +74,17 @@ export const SingleEntitySelect = <
/>
<StyledDropdownMenuSeparator />
<SingleEntitySelectBase
// eslint-disable-next-line twenty/no-spread-props
{...props}
onCancel={onCancel}
onCreate={onCreate}
showCreateButton={showCreateButton}
{...{
EmptyIcon,
emptyLabel,
entitiesToSelect,
loading,
onCancel,
onCreate,
onEntitySelected,
selectedEntity,
showCreateButton,
}}
/>
</StyledDropdownMenu>
);

View File

@ -34,7 +34,17 @@ const meta: Meta<typeof SingleEntitySelect> = {
),
},
},
render: (args) => {
render: ({
EmptyIcon,
disableBackgroundBlur = false,
emptyLabel,
loading,
onCancel,
onCreate,
onEntitySelected,
selectedEntity,
width,
}) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const relationPickerSearchFilter = useRecoilScopedValue(
relationPickerSearchFilterScopedState,
@ -42,11 +52,20 @@ const meta: Meta<typeof SingleEntitySelect> = {
return (
<SingleEntitySelect
// eslint-disable-next-line twenty/no-spread-props
{...args}
{...{
EmptyIcon,
disableBackgroundBlur,
emptyLabel,
loading,
onCancel,
onCreate,
onEntitySelected,
selectedEntity,
width,
}}
entitiesToSelect={entities.filter(
(entity) =>
entity.id !== args.selectedEntity?.id &&
entity.id !== selectedEntity?.id &&
entity.name.includes(relationPickerSearchFilter),
)}
/>