A full-featured CRM built with React, shadcn/ui, and Supabase.
Move DeleteButton to Sidebar
François Zaninottodb49577a1939
diff --git a/src/components/atomic-crm/companies/CompanyAside.tsx b/src/components/atomic-crm/companies/CompanyAside.tsxindex d8265379..0125abe8 100644--- a/src/components/atomic-crm/companies/CompanyAside.tsx+++ b/src/components/atomic-crm/companies/CompanyAside.tsx@@ -1,6 +1,7 @@import { Globe, Linkedin, Phone } from "lucide-react";import { useRecordContext } from "ra-core";import { EditButton } from "@/components/admin/edit-button";+import { DeleteButton } from "@/components/admin/delete-button";import { ReferenceField } from "@/components/admin/reference-field";import { ShowButton } from "@/components/admin/show-button";import { TextField } from "@/components/admin/text-field";@@ -38,6 +39,15 @@ export const CompanyAside = ({ link = "edit" }: CompanyAsideProps) => {<ContextInfo record={record} /><AdditionalInfo record={record} />++ {link !== "edit" && (+ <div className="mt-6 pt-6 border-t hidden sm:flex flex-col gap-2 items-start">+ <DeleteButton+ className="h-6 cursor-pointer hover:bg-destructive/10! text-destructive! border-destructive! focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40"+ size="sm"+ />+ </div>+ )}</div>);};diff --git a/src/components/atomic-crm/contacts/ContactAside.tsx b/src/components/atomic-crm/contacts/ContactAside.tsxindex de816eaa..ba7859f8 100644--- a/src/components/atomic-crm/contacts/ContactAside.tsx+++ b/src/components/atomic-crm/contacts/ContactAside.tsx@@ -3,6 +3,7 @@ import { useRecordContext, WithRecord } from "ra-core";import type { ReactNode } from "react";import { ArrayField } from "@/components/admin/array-field";import { EditButton } from "@/components/admin/edit-button";+import { DeleteButton } from "@/components/admin";import { ReferenceField } from "@/components/admin/reference-field";import { ReferenceManyField } from "@/components/admin/reference-many-field";import { ShowButton } from "@/components/admin/show-button";@@ -142,10 +143,18 @@ export const ContactAside = ({ link = "edit" }: { link?: "edit" | "show" }) => {</AsideSection>{link !== "edit" && (- <div className="mt-6 pt-6 border-t hidden sm:flex flex-col gap-2 items-start">- <ExportVCardButton />- <ContactMergeButton />- </div>+ <>+ <div className="mt-6 pt-6 border-t hidden sm:flex flex-col gap-2 items-start">+ <ExportVCardButton />+ <ContactMergeButton />+ </div>+ <div className="mt-6 pt-6 border-t hidden sm:flex flex-col gap-2 items-start">+ <DeleteButton+ className="h-6 cursor-pointer hover:bg-destructive/10! text-destructive! border-destructive! focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40"+ size="sm"+ />+ </div>+ </>)}</div>);diff --git a/src/components/atomic-crm/deals/DealEdit.tsx b/src/components/atomic-crm/deals/DealEdit.tsxindex f61beb63..e8c8117d 100644--- a/src/components/atomic-crm/deals/DealEdit.tsx+++ b/src/components/atomic-crm/deals/DealEdit.tsx@@ -8,11 +8,10 @@ import {import { Link } from "react-router";import { DeleteButton } from "@/components/admin/delete-button";import { ReferenceField } from "@/components/admin/reference-field";-import { SaveButton } from "@/components/admin/form";-import { FormToolbar } from "@/components/admin/simple-form";import { Button } from "@/components/ui/button";import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";+import { FormToolbar } from "../layout/FormToolbar";import { CompanyAvatar } from "../companies/CompanyAvatar";import type { Deal } from "../types";import { DealInputs } from "./DealInputs";@@ -46,7 +45,7 @@ export const DealEdit = ({ open, id }: { open: boolean; id?: string }) => {<EditHeader /><Form><DealInputs />- <EditToolbar />+ <FormToolbar /></Form></EditBase>) : null}@@ -71,6 +70,7 @@ function EditHeader() {<h2 className="text-2xl font-semibold">Edit {deal.name} deal</h2></div><div className="flex gap-2 pr-12">+ <DeleteButton /><Button asChild variant="outline" className="h-9"><Link to={`/deals/${deal.id}/show`}>Back to deal</Link></Button>@@ -79,14 +79,3 @@ function EditHeader() {</DialogTitle>);}--function EditToolbar() {- return (- <FormToolbar>- <div className="flex-1 flex justify-between">- <DeleteButton />- <SaveButton />- </div>- </FormToolbar>- );-}diff --git a/src/components/atomic-crm/layout/FormToolbar.tsx b/src/components/atomic-crm/layout/FormToolbar.tsxindex 4dabe363..da3b8586 100644--- a/src/components/atomic-crm/layout/FormToolbar.tsx+++ b/src/components/atomic-crm/layout/FormToolbar.tsx@@ -1,15 +1,12 @@import { CancelButton } from "@/components/admin/cancel-button";-import { DeleteButton } from "@/components/admin/delete-button";import { SaveButton } from "@/components/admin/form";-import { FormToolbar as KitFormToolbar } from "@/components/admin/simple-form";export const FormToolbar = () => (- <KitFormToolbar className="flex md:flex flex-row justify-between gap-2">- <DeleteButton />-- <div className="flex flex-row gap-2 justify-end">- <CancelButton />- <SaveButton />- </div>- </KitFormToolbar>+ <div+ role="toolbar"+ className="sticky flex pt-4 pb-4 md:pb-0 bottom-0 bg-linear-to-b from-transparent to-card to-10% flex-row justify-end gap-2"+ >+ <CancelButton />+ <SaveButton />+ </div>);