diff --git a/src/pages/Directory/Directory.jsx b/src/pages/Directory/Directory.jsx index ca95181f..d83e6328 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 @@ -353,7 +353,7 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { setOpenBucketModal={setOpenBucketModal} contactsToExport={contacts} notesToExport={notes} - selectedNoteNames={selectedNoteNames} + selectedNoteNames={selectedNoteNames} setSelectedNoteNames={setSelectedNoteNames} notesForFilter={notes} setFilterAppliedNotes={setFilterAppliedNotes} @@ -361,52 +361,35 @@ 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) => ( - - ))} - + {/* Loader when switching between Active/Pending or filtering */} + {loading && ( +
+
+ Loading...
)} - {viewType === "card" && ( -
- {!loading && - currentItems.map((contact) => ( -
- + {contacts?.length === 0 && ( +

No contact found

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

No matching contact found

+ )} +
+ )} + + {/* List View */} + {!loading && viewType === "list" && currentItems.length > 0 && ( +
+
+ + {currentItems.map((contact) => ( + { IsDeleted={setDeleteContact} restore={handleDeleteContact} /> -
- ))} + ))} + +
)} - {viewType === "notes" && ( + {/* Card View */} + {!loading && viewType === "card" && currentItems.length > 0 && ( +
+ {currentItems.map((contact) => ( +
+ +
+ ))} +
+ )} + + {/* Notes View */} + {!loading && viewType === "notes" && (
)} @@ -437,7 +445,7 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { {!loading && viewType !== "notes" && contacts?.length > 0 && - currentItems.length > ITEMS_PER_PAGE && ( + filteredContacts.length > ITEMS_PER_PAGE && ( )}
+
); }; -export default Directory; \ No newline at end of file +export default Directory; +