In Contact View, empty Description and Notes section should be hidden and its needs to be fixed the UI of this pop-up #340
@ -114,55 +114,56 @@ const NotesDirectory = ({
|
|||||||
? contactProfile?.notes || []
|
? contactProfile?.notes || []
|
||||||
: contactNotes || [];
|
: contactNotes || [];
|
||||||
|
|
||||||
|
const hasNotes = notesToDisplay.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="text-start mt-10">
|
<div className="text-start mt-10">
|
||||||
<div className="d-flex align-items-center justify-content-between">
|
<div className="d-flex align-items-center justify-content-between">
|
||||||
<div className="row w-100 align-items-center">
|
<div className="row w-100 align-items-center">
|
||||||
<div className="col col-2">
|
{hasNotes && (
|
||||||
<p className="fw-semibold m-0 ms-3">Notes :</p>
|
<div className="col col-2">
|
||||||
</div>
|
<p className="fw-semibold m-0 ms-3">Notes :</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div className="col d-flex justify-content-end gap-2 pe-0">
|
<div className="col d-flex justify-content-end gap-2 pe-0">
|
||||||
{" "}
|
{" "}
|
||||||
<div className="d-flex align-items-center justify-content-between">
|
<div className="d-flex align-items-center justify-content-between">
|
||||||
<label
|
|
||||||
className="switch switch-primary"
|
<label
|
||||||
style={{
|
className="switch switch-primary"
|
||||||
visibility:
|
|
||||||
contactProfile?.notes?.length > 0 || contactNotes?.length > 0
|
|
||||||
? "visible"
|
|
||||||
: "hidden",
|
|
||||||
fontSize: "15px", // smaller text
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
className="switch-input"
|
|
||||||
onChange={() => handleSwitch(!IsActive)}
|
|
||||||
checked={IsActive}
|
|
||||||
style={{
|
style={{
|
||||||
transform: "scale(0.8)", // smaller toggle
|
fontSize: "15px",
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
<span
|
<input
|
||||||
className="switch-toggle-slider"
|
type="checkbox"
|
||||||
style={{
|
className="switch-input"
|
||||||
|
onChange={() => handleSwitch(!IsActive)}
|
||||||
|
checked={IsActive}
|
||||||
|
style={{
|
||||||
|
transform: "scale(0.8)", // smaller toggle
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="switch-toggle-slider"
|
||||||
|
style={{
|
||||||
width: "30px", // narrower slider
|
width: "30px", // narrower slider
|
||||||
height: "15px", // shorter slider
|
height: "15px", // shorter slider
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span className="switch-on"></span>
|
<span className="switch-on"></span>
|
||||||
<span className="switch-off"></span>
|
<span className="switch-off"></span>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className="switch-label"
|
className="switch-label"
|
||||||
style={{
|
style={{
|
||||||
fontSize: "14px", // smaller label text
|
fontSize: "14px", // smaller label text
|
||||||
marginLeft: "-14px"
|
marginLeft: "-14px"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Include Deleted Notes
|
Include Deleted Notes
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{!showEditor && (
|
{!showEditor && (
|
||||||
<div className="d-flex justify-content-end">
|
<div className="d-flex justify-content-end">
|
||||||
@ -224,23 +225,23 @@ const NotesDirectory = ({
|
|||||||
)}
|
)}
|
||||||
{!isLoading && notesToDisplay.length > 0
|
{!isLoading && notesToDisplay.length > 0
|
||||||
? notesToDisplay
|
? notesToDisplay
|
||||||
.slice()
|
.slice()
|
||||||
.reverse()
|
.reverse()
|
||||||
.map((noteItem) => (
|
.map((noteItem) => (
|
||||||
<NoteCardDirectory
|
<NoteCardDirectory
|
||||||
refetchProfile={refetchProfile}
|
refetchProfile={refetchProfile}
|
||||||
refetchNotes={refetch}
|
refetchNotes={refetch}
|
||||||
refetchContact={refetch}
|
refetchContact={refetch}
|
||||||
noteItem={noteItem}
|
noteItem={noteItem}
|
||||||
contactId={contactProfile?.id}
|
contactId={contactProfile?.id}
|
||||||
setProfileContact={setProfileContact}
|
setProfileContact={setProfileContact}
|
||||||
key={noteItem.id}
|
key={noteItem.id}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
: !isLoading &&
|
: !isLoading &&
|
||||||
!showEditor && (
|
!showEditor && (
|
||||||
<div className="text-center mt-5">{noNotesMessage}</div>
|
<div className="text-center mt-5">{noNotesMessage}</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -11,6 +11,7 @@ const ProfileContactDirectory = ({ contact, setOpen_contact, closeModal }) => {
|
|||||||
const [profileContactState, setProfileContactState] = useState(null);
|
const [profileContactState, setProfileContactState] = useState(null);
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
|
|
||||||
|
// Safely access description, defaulting to an empty string if not present
|
||||||
const description = profileContactState?.description || "";
|
const description = profileContactState?.description || "";
|
||||||
const limit = 500;
|
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]
|
middleName = names[1]; // This was an error in the original prompt, corrected to names[1]
|
||||||
lastName = names[names.length - 1];
|
lastName = names[names.length - 1];
|
||||||
// Reconstruct full name to be precise with spacing
|
// Reconstruct full name to be precise with spacing
|
||||||
fullName = `${firstName} ${middleName ? middleName + ' ' : ''}${lastName}`;
|
fullName = `${firstName} ${middleName ? middleName + " " : ""}${lastName}`;
|
||||||
} else {
|
} else {
|
||||||
// Fallback if no names or empty string
|
// Fallback if no names or empty string
|
||||||
firstName = "Contact";
|
firstName = "Contact";
|
||||||
@ -113,7 +114,7 @@ const ProfileContactDirectory = ({ contact, setOpen_contact, closeModal }) => {
|
|||||||
</span>
|
</span>
|
||||||
<i
|
<i
|
||||||
className={`bx bx-copy-alt cursor-pointer bx-xs text-start ${copiedIndex === idx ? "text-secondary" : "text-primary"
|
className={`bx bx-copy-alt cursor-pointer bx-xs text-start ${copiedIndex === idx ? "text-secondary" : "text-primary"
|
||||||
}`}
|
}`}
|
||||||
title={copiedIndex === idx ? "Copied!" : "Copy Email"}
|
title={copiedIndex === idx ? "Copied!" : "Copy Email"}
|
||||||
style={{ flexShrink: 0 }}
|
style={{ flexShrink: 0 }}
|
||||||
onClick={() => handleCopy(email.emailAddress, idx)}
|
onClick={() => handleCopy(email.emailAddress, idx)}
|
||||||
@ -292,31 +293,35 @@ const ProfileContactDirectory = ({ contact, setOpen_contact, closeModal }) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="d-flex mb-2 align-items-start" style={{ marginLeft: "3rem" }}>
|
{description && (
|
||||||
<div className="d-flex" style={{ minWidth: "130px" }}>
|
<div
|
||||||
<span className="d-flex align-items-start">
|
className="d-flex mb-2 align-items-start"
|
||||||
<i className="bx bx-book me-1"></i>
|
style={{ marginLeft: "3rem" }}
|
||||||
<span>Description</span>
|
>
|
||||||
</span>
|
<div className="d-flex" style={{ minWidth: "130px" }}>
|
||||||
<span style={{ marginLeft: "10px" }}>:</span>
|
<span className="d-flex align-items-start">
|
||||||
</div>
|
<i className="bx bx-book me-1"></i>
|
||||||
|
<span>Description</span>
|
||||||
|
</span>
|
||||||
|
<span style={{ marginLeft: "10px" }}>:</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="text-start">
|
<div className="text-start">
|
||||||
{displayText}
|
{displayText}
|
||||||
{isLong && (
|
{isLong && (
|
||||||
<>
|
<>
|
||||||
<br />
|
<br />
|
||||||
<span
|
<span
|
||||||
onClick={toggleReadMore}
|
onClick={toggleReadMore}
|
||||||
className="text-primary mx-1 cursor-pointer"
|
className="text-primary mx-1 cursor-pointer"
|
||||||
>
|
>
|
||||||
{expanded ? "Read less" : "Read more"}
|
{expanded ? "Read less" : "Read more"}
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
|
|
||||||
|
|
||||||
<hr className="my-1" />
|
<hr className="my-1" />
|
||||||
<NotesDirectory
|
<NotesDirectory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user