diff --git a/src/components/Directory/NotesDirectory.jsx b/src/components/Directory/NotesDirectory.jsx index 93326e62..fab739ee 100644 --- a/src/components/Directory/NotesDirectory.jsx +++ b/src/components/Directory/NotesDirectory.jsx @@ -114,55 +114,56 @@ const NotesDirectory = ({ ? contactProfile?.notes || [] : contactNotes || []; + const hasNotes = notesToDisplay.length > 0; + return (
-
-

Notes :

-
+ {hasNotes && ( +
+

Notes :

+
+ )}
{" "}
- {!showEditor && (
@@ -224,23 +225,23 @@ const NotesDirectory = ({ )} {!isLoading && notesToDisplay.length > 0 ? notesToDisplay - .slice() - .reverse() - .map((noteItem) => ( - - )) + .slice() + .reverse() + .map((noteItem) => ( + + )) : !isLoading && !showEditor && ( -
{noNotesMessage}
- )} +
{noNotesMessage}
+ )}
); diff --git a/src/components/Directory/ProfileContactDirectory.jsx b/src/components/Directory/ProfileContactDirectory.jsx index f7e8c456..f3a59166 100644 --- a/src/components/Directory/ProfileContactDirectory.jsx +++ b/src/components/Directory/ProfileContactDirectory.jsx @@ -11,6 +11,7 @@ const ProfileContactDirectory = ({ contact, setOpen_contact, closeModal }) => { const [profileContactState, setProfileContactState] = useState(null); const [expanded, setExpanded] = useState(false); + // Safely access description, defaulting to an empty string if not present const description = profileContactState?.description || ""; const limit = 500; @@ -40,7 +41,7 @@ const ProfileContactDirectory = ({ contact, setOpen_contact, closeModal }) => { middleName = names[1]; // This was an error in the original prompt, corrected to names[1] lastName = names[names.length - 1]; // Reconstruct full name to be precise with spacing - fullName = `${firstName} ${middleName ? middleName + ' ' : ''}${lastName}`; + fullName = `${firstName} ${middleName ? middleName + " " : ""}${lastName}`; } else { // Fallback if no names or empty string firstName = "Contact"; @@ -113,7 +114,7 @@ const ProfileContactDirectory = ({ contact, setOpen_contact, closeModal }) => { handleCopy(email.emailAddress, idx)} @@ -292,31 +293,35 @@ const ProfileContactDirectory = ({ contact, setOpen_contact, closeModal }) => { )}
-
-
- - - Description - - : -
+ {description && ( +
+
+ + + Description + + : +
-
- {displayText} - {isLong && ( - <> -
- - {expanded ? "Read less" : "Read more"} - - - )} +
+ {displayText} + {isLong && ( + <> +
+ + {expanded ? "Read less" : "Read more"} + + + )} +
-
- + )}