From 3993dcfc4e588945281dcdb4c5d74324191fb00a Mon Sep 17 00:00:00 2001 From: Vikas Nale Date: Sat, 26 Jul 2025 11:23:12 +0530 Subject: [PATCH] Add GUI improvements in directory notes --- src/components/Directory/NotesDirectory.jsx | 155 ++++++++++---------- 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/src/components/Directory/NotesDirectory.jsx b/src/components/Directory/NotesDirectory.jsx index f310bfcc..2ba497d5 100644 --- a/src/components/Directory/NotesDirectory.jsx +++ b/src/components/Directory/NotesDirectory.jsx @@ -22,7 +22,10 @@ const NotesDirectory = ({ setProfileContact, }) => { const [IsActive, setIsActive] = useState(true); - const { contactNotes, refetch } = useContactNotes(contactProfile?.id, IsActive); + const { contactNotes, refetch } = useContactNotes( + contactProfile?.id, + IsActive + ); const [IsSubmitting, setIsSubmitting] = useState(false); const [showEditor, setShowEditor] = useState(false); @@ -67,7 +70,10 @@ const NotesDirectory = ({ ...cached_contactProfile.data, notes: [...(cached_contactProfile.data.notes || []), createdNote], }; - cacheData("Contact Profile", { contactId: contactProfile?.id, data: updatedProfile }); + cacheData("Contact Profile", { + contactId: contactProfile?.id, + data: updatedProfile, + }); } setValue("note", ""); @@ -100,36 +106,34 @@ const NotesDirectory = ({ }; // Use the fullName from contactProfile, which now includes middle and last names if available - const contactName = contactProfile?.fullName || contactProfile?.firstName || "Contact"; + const contactName = + contactProfile?.fullName || contactProfile?.firstName || "Contact"; const noNotesMessage = `Be the first to share your insights! ${contactName} currently has no notes.`; - const notesToDisplay = IsActive ? (contactProfile?.notes || []) : (contactNotes || []); + const notesToDisplay = IsActive + ? contactProfile?.notes || [] + : contactNotes || []; return (
-

Notes :

-
-
-
- {(contactProfile?.notes?.length > 0 || contactNotes?.length > 0) && ( - - )} - {!(contactProfile?.notes?.length > 0 || contactNotes?.length > 0) && ( -
-
{showEditor && (
- + > + +
Loading...

{" "}
)} - {!isLoading && notesToDisplay.length > 0 ? ( - notesToDisplay - .slice() - .reverse() - .map((noteItem) => ( - - )) - ) : ( - !isLoading && !showEditor && ( -
- {noNotesMessage} -
- ) - )} + {!isLoading && notesToDisplay.length > 0 + ? notesToDisplay + .slice() + .reverse() + .map((noteItem) => ( + + )) + : !isLoading && + !showEditor && ( +
{noNotesMessage}
+ )}
); }; -export default NotesDirectory; \ No newline at end of file +export default NotesDirectory;