From 1c578b14b0ddea2462d2da194db98e53c8b78a68 Mon Sep 17 00:00:00 2001 From: lizandrogd <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 21 Jan 2026 15:59:44 -0500 Subject: [PATCH] Update chat_window.php --- chat_window.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/chat_window.php b/chat_window.php index e6f6d04..129aa39 100644 --- a/chat_window.php +++ b/chat_window.php @@ -1030,10 +1030,9 @@ if (empty($user_id)) { } }); - // Mostrar contenedor solo si hay respuestas - if (container.children.length) { - wrapper.style.display = 'block'; - } else { + // No mostrar automáticamente el contenedor al cargar la conversación. + // Dejamos que el usuario lo abra con el botón toggle. Si no hay respuestas, mantener oculto. + if (!container.children.length) { wrapper.style.display = 'none'; } } else { @@ -1046,8 +1045,20 @@ if (empty($user_id)) { function toggleQuickReplies() { const wrapper = document.getElementById('quickRepliesContainer'); + const container = document.getElementById('quickRepliesButtons'); if (!wrapper) return; - wrapper.style.display = (wrapper.style.display === 'block') ? 'none' : 'block'; + + // Si no hay botones cargados, intentar cargarlos y luego mostrar + if (container && container.children.length === 0) { + loadQuickReplies().then(() => { + wrapper.style.display = (wrapper.style.display === 'block') ? 'none' : 'block'; + }).catch(() => { + // on error, mantener oculto + wrapper.style.display = 'none'; + }); + } else { + wrapper.style.display = (wrapper.style.display === 'block') ? 'none' : 'block'; + } } function showError(message) {