Update conversations.php

This commit is contained in:
Lizandro Guarnizo
2026-01-24 10:02:36 -05:00
parent 775b2c1c7f
commit 922f8b90c3
+17 -8
View File
@@ -1365,19 +1365,25 @@
const text = (messageInput && messageInput.value) ? messageInput.value.trim() : '';
const typeSelect = document.getElementById('message-type');
const isTemplate = typeSelect && typeSelect.value === 'template';
const fileSelected = !!this.selectedFile;
// Consider both selectedFile and visible media-preview as indicators of media pending send
const previewEl = document.getElementById('media-preview');
const fileSelected = !!this.selectedFile || (previewEl && previewEl.style.display && previewEl.style.display !== 'none');
// If currently recording, show mic and don't switch to send
if (this._mediaRecorder && this._mediaRecorder.state === 'recording') {
if (sendBtn) sendBtn.style.display = 'none';
if (micBtn) micBtn.style.display = 'inline-flex';
if (sendBtn) { sendBtn.style.display = 'none'; }
if (micBtn) { micBtn.style.display = 'inline-flex'; }
return;
}
if (text.length > 0 || isTemplate || fileSelected) {
if (sendBtn) sendBtn.style.display = 'inline-block';
if (micBtn) micBtn.style.display = 'none';
// If there's a file selected or there's text/template, show send button (media overrides mic)
if (fileSelected || text.length > 0 || isTemplate) {
if (sendBtn) { sendBtn.style.display = 'inline-block'; }
if (micBtn) { micBtn.style.display = 'none'; }
} else {
if (sendBtn) sendBtn.style.display = 'none';
if (micBtn) micBtn.style.display = 'inline-flex';
// Force mic visible when input empty and no file selected
if (sendBtn) { sendBtn.style.display = 'none'; }
if (micBtn) { micBtn.style.display = 'inline-flex'; }
}
};
@@ -3346,6 +3352,9 @@
const sendBtn = document.getElementById('send-btn');
if (sendBtn) { sendBtn.onclick = null; sendBtn.disabled = false; sendBtn.innerHTML = '<i class="fas fa-paper-plane"></i>'; }
const delBtn = document.getElementById('delete-file-btn'); if (delBtn) delBtn.style.display = 'none';
// Ensure mic/send visibility reflects the current state
if (this._updateSendMicVisibility) this._updateSendMicVisibility();
}
renderMediaMessage(message) {