diff --git a/src/components/Directory/NotesDirectory.jsx b/src/components/Directory/NotesDirectory.jsx index 4bb6b382..32756513 100644 --- a/src/components/Directory/NotesDirectory.jsx +++ b/src/components/Directory/NotesDirectory.jsx @@ -22,10 +22,7 @@ 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); @@ -70,10 +67,7 @@ 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", ""); @@ -104,13 +98,10 @@ 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 (
@@ -172,10 +163,11 @@ const NotesDirectory = ({ {showEditor && (
- setShowEditor(false)} > @@ -202,28 +194,31 @@ const NotesDirectory = ({

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; +export default NotesDirectory; \ No newline at end of file