From d539bd67f1f3059a6d2c2b43fb3593ef6bca8508 Mon Sep 17 00:00:00 2001 From: Kartik sharma Date: Tue, 8 Jul 2025 12:38:08 +0530 Subject: [PATCH] UI Misaligned on Toggling 'Show Inactive Contact' When No Inactive Contacts Exist in Directory at projects. --- src/pages/Directory/Directory.jsx | 151 ++++++++++++------------------ 1 file changed, 61 insertions(+), 90 deletions(-) diff --git a/src/pages/Directory/Directory.jsx b/src/pages/Directory/Directory.jsx index 2509364f..465f9f10 100644 --- a/src/pages/Directory/Directory.jsx +++ b/src/pages/Directory/Directory.jsx @@ -39,7 +39,6 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { 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 @@ -355,7 +354,6 @@ const Directory = ({ IsPage = true, prefernceContacts }) => { contactsToExport={contacts} notesToExport={notes} selectedNoteNames={selectedNoteNames} - selectedNoteNames={selectedNoteNames} setSelectedNoteNames={setSelectedNoteNames} notesForFilter={notes} setFilterAppliedNotes={setFilterAppliedNotes} @@ -363,97 +361,75 @@ const Directory = ({ IsPage = true, prefernceContacts }) => {
- {/* LIST VIEW */} - {viewType === "list" && ( -
-
+ {/* Loader when switching between Active/Pending or filtering */} + {loading && ( +
+
+ Loading... +
+
+ )} + + {/* Empty state messages */} + {!loading && (viewType === "card" || viewType === "list") && ( +
+ {contacts?.length === 0 && ( +

No contact found

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

No matching contact found

+ )} +
+ )} + + {/* List View */} + {!loading && viewType === "list" && currentItems.length > 0 && ( +
+
- {!loading && contacts?.length === 0 ? ( - - -
-

No contact found

-
- - - ) : !loading && contacts?.length > 0 && currentItems.length === 0 ? ( - - -
-

No matching contact found

-
- - - ) : ( - !loading && - currentItems.map((contact) => ( - - )) - )} + {currentItems.map((contact) => ( + + ))}
)} - {/* CARD VIEW */} - {viewType === "card" && ( - <> - {contacts?.length === 0 && !loading ? ( + {/* Card View */} + {!loading && viewType === "card" && currentItems.length > 0 && ( +
+ {currentItems.map((contact) => (
-

No contact found

+
- ) : currentItems.length === 0 && !loading ? ( -
-

No matching contact found

-
- ) : ( -
- {currentItems.map((contact) => ( -
- -
- ))} -
- )} - + ))} +
)} - {/* NOTES VIEW */} - {viewType === "notes" && ( + {/* Notes View */} + {!loading && viewType === "notes" && (
{ searchText={searchText} setIsOpenModalNote={setIsOpenModalNote} filterAppliedNotes={filterAppliedNotes} - filterAppliedNotes={filterAppliedNotes} />
)} @@ -470,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; +