import { useGetList, useTranslate } from "ra-core"; import { matchPath, useLocation, Link } from "react-router"; import type { ReactNode } from "react"; import { CreateButton } from "@/components/ds/admin/create-button"; import { Progress } from "@/components/ds/ui/progress"; import useAppBarHeight from "../misc/useAppBarHeight"; import type { Contact } from "../types"; import { DealCreate } from "./DealCreate"; export const DealEmpty = ({ children }: { children?: ReactNode }) => { const location = useLocation(); const matchCreate = matchPath("/deals/create", location.pathname); const appbarHeight = useAppBarHeight(); const translate = useTranslate(); // get Contact data const { data: contacts, isPending: contactsLoading } = useGetList( "contacts", { pagination: { page: 1, perPage: 1 }, }, ); if (contactsLoading) return ; return (
{translate("crm.deal.empty.title")} {contacts && contacts.length > 0 ? ( <>

{translate("crm.deal.empty.title")}

{translate("crm.deal.empty.description")}

{children} ) : (

{translate("crm.deal.empty.title")}

{translate("crm.deal.empty.no_contacts")}
{translate("crm.deal.empty.add_contact")} {" "} {translate("crm.deal.empty.before_creating")}

)}
); };