diff --git a/src/pages/Directory/Directory.jsx b/src/pages/Directory/Directory.jsx index 6b89127a..dc6661de 100644 --- a/src/pages/Directory/Directory.jsx +++ b/src/pages/Directory/Directory.jsx @@ -319,124 +319,145 @@ const handleDeleteContact = async (overrideId = null) => { )} -
- - {!listView && loading &&

Loading...

} - {!listView && !loading && currentItems.length == 0 && ( -

No Matching Contact Found

- )} - {listView ? ( - - {loading && ( - - Loading... - - )} - {!loading && currentItems.length === 0 && ( - - No Matching Contact Found - - )} - {!loading && - currentItems.map((contact) => ( - - ))} - - ) : ( -
- {!loading && currentItems.map((contact, index) => ( -
- -
- ))} -
- )} - - +
+ - {!loading && currentItems < ITEMS_PER_PAGE && ( -
+ )} + + {/* Table view (listView === true) */} + {listView ? ( + + {loading && ( + + Loading... + + )} + + {!loading && contacts?.length === 0 && ( + + No contact found + + )} + + {!loading && currentItems.length === 0 && contacts?.length > 0 && ( + + No matching contact found + + )} + + {!loading && + currentItems.map((contact) => ( + + ))} + + ) : ( +
+ {!loading && + currentItems.map((contact) => ( +
+ +
+ ))} +
+ )} + + {/* Pagination */} + {!loading && + contacts?.length > 0 && + currentItems.length < ITEMS_PER_PAGE && ( + - )} -
+ {index + 1} + + + ))} + +
  • + +
  • + + + )} + + + ); };