From 7cbd74fc1497518ba54b026d10a1f789838d21a5 Mon Sep 17 00:00:00 2001 From: JaiPandey425 Date: Wed, 30 Jul 2025 14:15:44 +0530 Subject: [PATCH] loaderUI --- src/components/contacts/Contacts.tsx | 152 +++++++++++++------------ src/components/dashboard/Loader.tsx | 1 - src/components/templates/Templates.tsx | 22 ++-- src/helper/LoaderUi.tsx | 31 ++--- 4 files changed, 106 insertions(+), 100 deletions(-) diff --git a/src/components/contacts/Contacts.tsx b/src/components/contacts/Contacts.tsx index 0942e70..e164dfd 100644 --- a/src/components/contacts/Contacts.tsx +++ b/src/components/contacts/Contacts.tsx @@ -83,11 +83,11 @@ const Contacts = () => { const handleContactSubmit = async (data: ContactData, type: "") => { try { - let res ; + let res; setCreateAndInviteLoader(true); if (type === 'Edit') { - res = await api.put(`/api/accounts/${activeAccountId}/contacts`, [data]) - }else{ + res = await api.put(`/api/accounts/${activeAccountId}/contacts`, [data]) + } else { res = await api.post(`/api/accounts/${activeAccountId}/contacts`, [data]); } if (res.status === 200) { @@ -115,82 +115,84 @@ const Contacts = () => { return ( <> -
-
setShowModal((prev) => !prev)} - className="flex items-center gap-2 bg-[var(--primary)] px-3 py-1.5 rounded-sm hover:opacity-90 "> - - +
+
+
setShowModal((prev) => !prev)} + className="flex items-center gap-2 bg-[var(--primary)] px-3 py-1.5 rounded-sm hover:opacity-90 "> + + +
-
-
- - - - - - - - - - - {loading ? ( +
+
First NameLast NameEmailActions
+ - + + + + - ) : contacts.length === 0 ? ( - - - - ) : ( - contacts.map((contact) => ( - - - - - + + + {loading ? ( + + - )) - )} - -
Loading...First NameLast NameEmailActions
No contacts found.
{contact.firstName}{contact.lastName}{contact.email} -
- - - {openMenuId === contact.id && ( -
- - -
- )} -
-
Loading...
- {showModal && - - } + ) : contacts.length === 0 ? ( + + No contacts found. + + ) : ( + contacts.map((contact) => ( + + {contact.firstName} + {contact.lastName} + {contact.email} + +
+ + + {openMenuId === contact.id && ( +
+ + +
+ )} +
+ + + )) + )} + + + {showModal && + + } +
); diff --git a/src/components/dashboard/Loader.tsx b/src/components/dashboard/Loader.tsx index 3f1093e..8e094ca 100644 --- a/src/components/dashboard/Loader.tsx +++ b/src/components/dashboard/Loader.tsx @@ -1,4 +1,3 @@ -import React from 'react' import { LuSignature } from "react-icons/lu"; import { useSelector } from 'react-redux'; import { RootState } from '../../store/store'; diff --git a/src/components/templates/Templates.tsx b/src/components/templates/Templates.tsx index 47c22c6..9a4391d 100644 --- a/src/components/templates/Templates.tsx +++ b/src/components/templates/Templates.tsx @@ -136,7 +136,15 @@ const Templates = () => { - {templates.length > 0 ? ( + {loading ? ( + + + + + + + + ) : templates.length > 0 ? ( {templates.map((item, index) => { return ( @@ -200,18 +208,12 @@ const Templates = () => { ) : ( - -
- {/* Pulsing background div */} -
- - {/* Loader stays on top, no animation */} - -
+ + No templates found. - + )}
diff --git a/src/helper/LoaderUi.tsx b/src/helper/LoaderUi.tsx index c118cb4..0113300 100644 --- a/src/helper/LoaderUi.tsx +++ b/src/helper/LoaderUi.tsx @@ -1,19 +1,22 @@ +import { LuSignature } from "react-icons/lu"; interface StyleProps { - classStyle : string + classStyle?: string; } -const LoaderUi = ({ classStyle }:StyleProps) => { - return ( -
- - - - - - -
- ) -} +const LoaderUi = ({ classStyle = '' }: StyleProps) => { + return ( +
+ {/* Overlay */} +
-export default LoaderUi \ No newline at end of file + {/* Loader box */} +
+ +

Loading...!

+
+
+ ); +}; + +export default LoaderUi;