From f92ef4e52af7c8732cfc328dead4c98738d8588e Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Tue, 3 Jun 2025 00:09:33 +0530 Subject: [PATCH 1/2] enhance UX for loading and empty states in contact table --- src/pages/Directory/Directory.jsx | 253 ++++++++++++++++-------------- 1 file changed, 137 insertions(+), 116 deletions(-) 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} + + + ))} + +
  • + +
  • + + + )} + + + ); }; From 1298994f58ca48abeb376b3fa22ee24e4c954529 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Tue, 3 Jun 2025 00:12:39 +0530 Subject: [PATCH 2/2] enhance UX for loading and empty states in contact table --- src/pages/Directory/Directory.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Directory/Directory.jsx b/src/pages/Directory/Directory.jsx index dc6661de..692ca1af 100644 --- a/src/pages/Directory/Directory.jsx +++ b/src/pages/Directory/Directory.jsx @@ -341,7 +341,7 @@ const handleDeleteContact = async (overrideId = null) => { {/* Messages when listView is false */} {!listView && ( -
    +
    {loading &&

    Loading...

    } {!loading && contacts?.length === 0 &&

    No contact found

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