Skip to content

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

move emptyPlaceHolder logic in TaskListByDueDate to avoid one query

ThieryMichel931f3966bdf3
diff --git a/src/components/atomic-crm/dashboard/TasksListByDueDate.tsx b/src/components/atomic-crm/dashboard/TasksListByDueDate.tsx
index f79baa6f..c29a1f98 100644
--- a/src/components/atomic-crm/dashboard/TasksListByDueDate.tsx
+++ b/src/components/atomic-crm/dashboard/TasksListByDueDate.tsx
@@ -15,8 +15,10 @@ import { useMemo } from "react";
export const TasksListByDueDate = ({
filterByContact,
+ emptyPlaceholder,
}: {
filterByContact?: Identifier;
+ emptyPlaceholder?: React.ReactNode;
}) => {
const { identity } = useGetIdentity();
const isMobile = useIsMobile();
@@ -81,6 +83,10 @@ export const TasksListByDueDate = ({
return null;
}
+ if (!total) {
+ return emptyPlaceholder ?? null;
+ }
+
return (
<div className="flex flex-col gap-4">
<TaskListFilter
diff --git a/src/components/atomic-crm/tasks/TasksListContent.tsx b/src/components/atomic-crm/tasks/TasksListContent.tsx
index beccc5d7..682a6897 100644
--- a/src/components/atomic-crm/tasks/TasksListContent.tsx
+++ b/src/components/atomic-crm/tasks/TasksListContent.tsx
@@ -1,11 +1,15 @@
-import { TasksListEmpty } from "../dashboard/TasksListEmpty";
import { TasksListByDueDate } from "../dashboard/TasksListByDueDate";
export const TasksListContent = () => {
return (
<div className="flex flex-col gap-4">
- <TasksListEmpty />
- <TasksListByDueDate />
+ <TasksListByDueDate
+ emptyPlaceholder={
+ <p className="text-sm">
+ Tasks added to your contacts will appear here.
+ </p>
+ }
+ />
</div>
);
};