UI Misaligned on Toggling 'Show Inactive Contact' When No Inactive Contacts Exist in Directory at projects.

This commit is contained in:
Kartik sharma 2025-07-08 12:38:08 +05:30 committed by pramod mahajan
parent 63c6d74434
commit 117dae81e4

View File

@ -361,26 +361,33 @@ const Directory = ({ IsPage = true, prefernceContacts }) => {
</div>
</div>
<div className="card-minHeight mt-0">
{(viewType === "card" || viewType === "list" || viewType === "notes") && (
{/* Loader when switching between Active/Pending or filtering */}
{loading && (
<div className="d-flex justify-content-center align-items-center py-5">
<div className="spinner-border text-primary" role="status">
<span className="visually-hidden">Loading...</span>
</div>
</div>
)}
{/* Empty state messages */}
{!loading && (viewType === "card" || viewType === "list") && (
<div className="d-flex flex-column justify-content-center align-items-center text-center">
{!loading && (viewType === "card" || viewType === "list") && contacts?.length === 0 && (
{contacts?.length === 0 && (
<p className="mt-10">No contact found</p>
)}
{!loading &&
(viewType === "card" || viewType === "list") &&
contacts?.length > 0 &&
currentItems.length === 0 && (
{contacts?.length > 0 && currentItems.length === 0 && (
<p className="mt-10">No matching contact found</p>
)}
</div>
)}
{viewType === "list" && (
{/* List View */}
{!loading && viewType === "list" && currentItems.length > 0 && (
<div className="card cursor-pointer mt-5">
<div className="card-body p-2 pb-1">
<DirectoryListTableHeader>
{!loading &&
currentItems.map((contact) => (
{currentItems.map((contact) => (
<ListViewDirectory
key={contact.id}
IsActive={IsActive}
@ -398,10 +405,10 @@ const Directory = ({ IsPage = true, prefernceContacts }) => {
</div>
)}
{viewType === "card" && (
{/* Card View */}
{!loading && viewType === "card" && currentItems.length > 0 && (
<div className="row mt-4">
{!loading &&
currentItems.map((contact) => (
{currentItems.map((contact) => (
<div
key={contact.id}
className="col-12 col-sm-6 col-md-4 col-lg-4 mb-4"
@ -421,7 +428,8 @@ const Directory = ({ IsPage = true, prefernceContacts }) => {
</div>
)}
{viewType === "notes" && (
{/* Notes View */}
{!loading && viewType === "notes" && (
<div className="mt-0">
<NotesCardViewDirectory
notes={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 && (
<nav aria-label="Page navigation">
<ul className="pagination pagination-sm justify-content-end py-1">
<li className={`page-item ${currentPage === 1 ? "disabled" : ""}`}>
@ -464,7 +472,10 @@ const Directory = ({ IsPage = true, prefernceContacts }) => {
</li>
))}
<li className={`page-item ${currentPage === totalPages ? "disabled" : ""}`}>
<li
className={`page-item ${currentPage === totalPages ? "disabled" : ""
}`}
>
<button
className="page-link"
onClick={() => paginate(currentPage + 1)}
@ -476,8 +487,10 @@ const Directory = ({ IsPage = true, prefernceContacts }) => {
</nav>
)}
</div>
</div>
);
};
export default Directory;