Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

update autocomplete-input fix

Jean-Baptiste Kaiser77bcda9a6fa4
diff --git a/src/components/admin/autocomplete-input.tsx b/src/components/admin/autocomplete-input.tsx
index 7aab719e..62b10098 100644
--- a/src/components/admin/autocomplete-input.tsx
+++ b/src/components/admin/autocomplete-input.tsx
@@ -39,6 +39,7 @@ import {
useSupportCreateSuggestion,
} from "ra-core";
import { InputHelperText } from "./input-helper-text";
+import { PopoverProps } from "@radix-ui/react-popover";
/**
* Form control that lets users choose a value from a list using a dropdown with autocompletion.
@@ -87,7 +88,7 @@ export const AutocompleteInput = (
inputText?:
| React.ReactNode
| ((option: any | undefined) => React.ReactNode);
- },
+ } & Pick<PopoverProps, "modal">,
) => {
const {
filterToQuery = DefaultFilterToQuery,
@@ -99,6 +100,7 @@ export const AutocompleteInput = (
createItemLabel,
onCreate,
optionText,
+ modal,
} = props;
const {
allChoices = [],
@@ -215,7 +217,7 @@ export const AutocompleteInput = (
</FormLabel>
)}
<FormControl>
- <Popover open={open} onOpenChange={handleOpenChange} modal>
+ <Popover open={open} onOpenChange={handleOpenChange} modal={modal}>
<PopoverTrigger asChild>
<Button
variant="outline"
diff --git a/src/components/atomic-crm/companies/AutocompleteCompanyInput.tsx b/src/components/atomic-crm/companies/AutocompleteCompanyInput.tsx
index 43b47f75..5e611e91 100644
--- a/src/components/atomic-crm/companies/AutocompleteCompanyInput.tsx
+++ b/src/components/atomic-crm/companies/AutocompleteCompanyInput.tsx
@@ -1,6 +1,7 @@
import { useCreate, useGetIdentity, useNotify } from "ra-core";
import { AutocompleteInput } from "@/components/admin/autocomplete-input";
import type { InputProps } from "ra-core";
+import { useIsMobile } from "@/hooks/use-mobile";
export const AutocompleteCompanyInput = ({
validate,
@@ -29,6 +30,7 @@ export const AutocompleteCompanyInput = ({
});
}
};
+ const isMobile = useIsMobile();
return (
<AutocompleteInput
@@ -38,6 +40,7 @@ export const AutocompleteCompanyInput = ({
createItemLabel="Create %{item}"
createLabel="Start typing to create a new company"
validate={validate}
+ modal={isMobile}
/>
);
};
diff --git a/src/components/atomic-crm/notes/NoteInputs.tsx b/src/components/atomic-crm/notes/NoteInputs.tsx
index 230fbc52..d17532c0 100644
--- a/src/components/atomic-crm/notes/NoteInputs.tsx
+++ b/src/components/atomic-crm/notes/NoteInputs.tsx
@@ -54,6 +54,7 @@ export const NoteInputs = ({
}
helperText={false}
validate={required()}
+ modal
/>
</ReferenceInput>
)}
diff --git a/src/components/atomic-crm/tasks/TaskFormContent.tsx b/src/components/atomic-crm/tasks/TaskFormContent.tsx
index eb25c7c6..5b80cc3b 100644
--- a/src/components/atomic-crm/tasks/TaskFormContent.tsx
+++ b/src/components/atomic-crm/tasks/TaskFormContent.tsx
@@ -32,6 +32,7 @@ export const TaskFormContent = ({
optionText={contactOptionText}
helperText={false}
validate={required()}
+ modal
/>
</ReferenceInput>
)}