Files
msgs/web/js/profilemodal.js
T
wt b833266664
Continuous integration / Check (push) Successful in 35s
Continuous integration / Rustfmt (push) Successful in 31s
Continuous integration / build (push) Successful in 30s
Continuous integration / build-release (push) Successful in 51s
more refactor in frontend javascript
2025-11-28 02:28:52 +07:00

38 lines
1.2 KiB
JavaScript

function openProfileModal() {
updateProfileModal();
document.getElementById("profileModal").style.display = "flex";
document.body.classList.add("modal-open");
}
function closeProfileModal() {
document.getElementById("profileModal").style.display = "none";
document.body.classList.remove("modal-open");
}
function updateProfileModal() {
// Update profile modal content
document.getElementById("profileModalName").textContent = currentUser;
document.getElementById("profileModalUsername").textContent = currentUser;
document.getElementById("profileModalPhone").textContent = currentUserPhone;
document.getElementById("profileModalPhoneNumber").textContent =
currentUserPhone;
// Update large avatar in modal
const modalAvatar = document.getElementById("profileModalAvatar");
if (currentUserAvatar) {
modalAvatar.innerHTML = `<img src="${currentUserAvatar}" alt="${currentUser}">`;
} else {
modalAvatar.innerHTML = currentUser.charAt(0).toUpperCase();
}
// Add the upload overlay
modalAvatar.innerHTML +=
'<div class="avatar-upload-overlay">Change Photo</div>';
}
document.getElementById("profileModal").addEventListener("click", function (e) {
if (e.target === this) {
closeProfileModal();
}
});