Skip to content

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

Remove ability to render DeleteButton at the bottom of the sheet

fzaninotto780aebcbc879
diff --git a/src/components/atomic-crm/contacts/ContactEditSheet.tsx b/src/components/atomic-crm/contacts/ContactEditSheet.tsx
index 889c0495..1f98e91c 100644
--- a/src/components/atomic-crm/contacts/ContactEditSheet.tsx
+++ b/src/components/atomic-crm/contacts/ContactEditSheet.tsx
@@ -39,7 +39,6 @@ export const ContactEditSheet = ({
phone_jsonb: defaultPhoneJsonb,
}}
headerActions={<ContactEditMenuButton onOpenChange={onOpenChange} />}
- deleteButton={false}
>
<ContactInputs />
</EditSheet>
diff --git a/src/components/atomic-crm/misc/EditSheet.tsx b/src/components/atomic-crm/misc/EditSheet.tsx
index 8108b454..29b65bd9 100644
--- a/src/components/atomic-crm/misc/EditSheet.tsx
+++ b/src/components/atomic-crm/misc/EditSheet.tsx
@@ -1,4 +1,3 @@
-import { DeleteButton } from "@/components/admin";
import { SaveButton } from "@/components/admin/form";
import {
Sheet,
@@ -97,7 +96,6 @@ export const EditSheet = ({
mutationOptions,
mutationMode = "undoable",
defaultValues,
- deleteButton,
headerActions,
...editBaseProps
}: EditSheetProps) => {
@@ -133,10 +131,6 @@ export const EditSheet = ({
onSuccess: handleSuccess,
};
- const defaultDeleteButton = (
- <DeleteButton variant="destructive" className="flex-1 h-12" />
- );
-
return (
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent
@@ -176,8 +170,6 @@ export const EditSheet = ({
<SheetFooter className="border-t">
<div className="flex w-full gap-4">
- {deleteButton !== false &&
- (deleteButton || defaultDeleteButton)}
<SaveButton className="flex-1 h-12" />
</div>
</SheetFooter>
diff --git a/src/components/atomic-crm/notes/NoteEditSheet.tsx b/src/components/atomic-crm/notes/NoteEditSheet.tsx
index 22eb5faf..72d98a17 100644
--- a/src/components/atomic-crm/notes/NoteEditSheet.tsx
+++ b/src/components/atomic-crm/notes/NoteEditSheet.tsx
@@ -69,7 +69,6 @@ export const NoteEditSheet = ({
getRedirectTo={getRedirectTo}
/>
}
- deleteButton={false}
>
<NoteInputsMobile />
</EditSheet>
diff --git a/src/components/atomic-crm/notes/NoteInputsMobile.tsx b/src/components/atomic-crm/notes/NoteInputsMobile.tsx
index 4b3c031d..926bc9ba 100644
--- a/src/components/atomic-crm/notes/NoteInputsMobile.tsx
+++ b/src/components/atomic-crm/notes/NoteInputsMobile.tsx
@@ -1,7 +1,12 @@
import { useCallback, useRef } from "react";
import { Paperclip } from "lucide-react";
-import { required, useInput, useTranslate, ValidationError } from "ra-core";
-import { RecordContextProvider } from "ra-core";
+import {
+ required,
+ useInput,
+ useTranslate,
+ ValidationError,
+ RecordContextProvider,
+} from "ra-core";
import { AutocompleteInput, ReferenceInput } from "@/components/admin";
import { FileInputPreview } from "@/components/admin/file-input";
import { useFormContext, useWatch } from "react-hook-form";
@@ -10,6 +15,7 @@ import { contactOptionText } from "../misc/ContactOption";
import { AttachmentField } from "./AttachmentField";
import { foreignKeyMapping } from "./foreignKeyMapping";
import { validateNoteOrAttachmentRequired } from "./noteModel";
+import type { ContactNote } from "../types";
export const NoteInputsMobile = ({
selectContact,
@@ -121,7 +127,9 @@ const AttachButton = () => {
const AttachmentPreviewsMobile = () => {
const { control, setValue } = useFormContext();
- const attachments = useWatch({ control, name: "attachments" });
+ const attachments = useWatch({ control, name: "attachments" }) as
+ | ContactNote["attachments"]
+ | undefined;
if (!Array.isArray(attachments) || attachments.length === 0) return null;
@@ -132,9 +140,9 @@ const AttachmentPreviewsMobile = () => {
return (
<div className="flex flex-col gap-1">
- {attachments.map((file: Record<string, unknown>, index: number) => (
+ {attachments.map((file, index: number) => (
<FileInputPreview
- key={index}
+ key={file.src}
file={file}
onRemove={() => onRemove(index)}
>
diff --git a/src/components/atomic-crm/tasks/TaskEditSheet.tsx b/src/components/atomic-crm/tasks/TaskEditSheet.tsx
index df6fe28d..5bd8ba25 100644
--- a/src/components/atomic-crm/tasks/TaskEditSheet.tsx
+++ b/src/components/atomic-crm/tasks/TaskEditSheet.tsx
@@ -39,7 +39,6 @@ export const TaskEditSheet = ({
redirect={false}
open={open}
onOpenChange={onOpenChange}
- deleteButton={false}
>
<TaskFormContent />
</EditSheet>