UI changes in Contact Profile page.

This commit is contained in:
Kartik Sharma 2025-07-26 10:00:27 +05:30
parent cb2db46e21
commit 683c0bedd5

View File

@ -22,10 +22,7 @@ const NotesDirectory = ({
setProfileContact, setProfileContact,
}) => { }) => {
const [IsActive, setIsActive] = useState(true); const [IsActive, setIsActive] = useState(true);
const { contactNotes, refetch } = useContactNotes( const { contactNotes, refetch } = useContactNotes(contactProfile?.id, IsActive);
contactProfile?.id,
IsActive
);
const [IsSubmitting, setIsSubmitting] = useState(false); const [IsSubmitting, setIsSubmitting] = useState(false);
const [showEditor, setShowEditor] = useState(false); const [showEditor, setShowEditor] = useState(false);
@ -70,10 +67,7 @@ const NotesDirectory = ({
...cached_contactProfile.data, ...cached_contactProfile.data,
notes: [...(cached_contactProfile.data.notes || []), createdNote], notes: [...(cached_contactProfile.data.notes || []), createdNote],
}; };
cacheData("Contact Profile", { cacheData("Contact Profile", { contactId: contactProfile?.id, data: updatedProfile });
contactId: contactProfile?.id,
data: updatedProfile,
});
} }
setValue("note", ""); setValue("note", "");
@ -104,13 +98,10 @@ const NotesDirectory = ({
}; };
// Use the fullName from contactProfile, which now includes middle and last names if available // Use the fullName from contactProfile, which now includes middle and last names if available
const contactName = const contactName = contactProfile?.fullName || contactProfile?.firstName || "Contact";
contactProfile?.fullName || contactProfile?.firstName || "Contact";
const noNotesMessage = `Be the first to share your insights! ${contactName} currently has no notes.`; const noNotesMessage = `Be the first to share your insights! ${contactName} currently has no notes.`;
const notesToDisplay = IsActive const notesToDisplay = IsActive ? (contactProfile?.notes || []) : (contactNotes || []);
? contactProfile?.notes || []
: contactNotes || [];
return ( return (
<div className="text-start mt-10"> <div className="text-start mt-10">
@ -172,10 +163,11 @@ const NotesDirectory = ({
{showEditor && ( {showEditor && (
<div className="card m-2 mb-5 position-relative"> <div className="card m-2 mb-5 position-relative">
<span <button
type="button" type="button"
className="position-absolute top-0 end-0  mt-3 bg-secondary rounded-circle" className="position-absolute top-0 end-0  mt-3 bg-secondary rounded-circle"
aria-label="Close" aria-label="Close"
style={{ backgroundColor: "#eee", color: "white" }}
onClick={() => setShowEditor(false)} onClick={() => setShowEditor(false)}
> >
<i className="bx bx-x fs-5  p-1 text-white"></i> <i className="bx bx-x fs-5  p-1 text-white"></i>
@ -202,8 +194,8 @@ const NotesDirectory = ({
<p>Loading...</p>{" "} <p>Loading...</p>{" "}
</div> </div>
)} )}
{!isLoading && notesToDisplay.length > 0 {!isLoading && notesToDisplay.length > 0 ? (
? notesToDisplay notesToDisplay
.slice() .slice()
.reverse() .reverse()
.map((noteItem) => ( .map((noteItem) => (
@ -217,9 +209,12 @@ const NotesDirectory = ({
key={noteItem.id} key={noteItem.id}
/> />
)) ))
: !isLoading && ) : (
!showEditor && ( !isLoading && !showEditor && (
<div className="text-center mt-5">{noNotesMessage}</div> <div className="text-center mt-5">
{noNotesMessage}
</div>
)
)} )}
</div> </div>
</div> </div>