From b06d6eda94e6026980fe669e587c0c9e05aa74fd Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Mon, 11 Aug 2025 14:56:12 +0530 Subject: [PATCH 1/2] Contact list grid columns not displayed when no contact is available --- src/pages/Directory/Directory.jsx | 51 +++++++++++-------- .../Directory/DirectoryListTableHeader.jsx | 2 +- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/pages/Directory/Directory.jsx b/src/pages/Directory/Directory.jsx index 8f72ac81..1319da5e 100644 --- a/src/pages/Directory/Directory.jsx +++ b/src/pages/Directory/Directory.jsx @@ -38,7 +38,7 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { const [IsDeleting, setDeleting] = useState(false); const [openBucketModal, setOpenBucketModal] = useState(false); const [notes, setNotes] = useState([]); - const [filterAppliedNotes, setFilterAppliedNotes] = useState([]); + const [filterAppliedNotes, setFilterAppliedNotes] = useState([]); // const [selectedOrgs, setSelectedOrgs] = useState([]); // ✅ Changed to an array for multiple selections @@ -260,7 +260,7 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { }, [prefernceContacts]); return ( -
+
{IsPage && ( { setOpenBucketModal={setOpenBucketModal} contactsToExport={contacts} notesToExport={notes} - selectedNoteNames={selectedNoteNames} + selectedNoteNames={selectedNoteNames} setSelectedNoteNames={setSelectedNoteNames} notesForFilter={notes} setFilterAppliedNotes={setFilterAppliedNotes} @@ -361,23 +361,9 @@ const Directory = ({ IsPage = true, prefernceContacts }) => {
- {(viewType === "card" || viewType === "list" || viewType === "notes") && ( -
- {!loading && (viewType === "card" || viewType === "list") && contacts?.length === 0 && ( -

No contact found

- )} - {!loading && - (viewType === "card" || viewType === "list") && - contacts?.length > 0 && - currentItems.length === 0 && ( -

No matching contact found

- )} -
- )} - {viewType === "list" && (
-
+
{!loading && currentItems.map((contact) => ( @@ -394,12 +380,22 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { /> ))} + + {/* Empty state AFTER list */} + {!loading && contacts?.length === 0 && ( +

No contact found

+ )} + {!loading && + contacts?.length > 0 && + currentItems.length === 0 && ( +

No matching contact found

+ )}
)} {viewType === "card" && ( -
+
{!loading && currentItems.map((contact) => (
{ />
))} + + {/* Empty state for card view */} + {!loading && contacts?.length === 0 && ( +

No contact found

+ )} + {!loading && + contacts?.length > 0 && + currentItems.length === 0 && ( +

No matching contact found

+ )}
)} @@ -428,7 +434,7 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { setNotesForFilter={setNotes} searchText={searchText} setIsOpenModalNote={setIsOpenModalNote} - filterAppliedNotes={filterAppliedNotes} + filterAppliedNotes={filterAppliedNotes} />
)} @@ -464,7 +470,10 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { ))} -
  • +