This commit is contained in:
Lizandro Guarnizo
2026-01-22 00:19:20 -05:00
parent ee016d62f5
commit 5e345b951f
7 changed files with 211 additions and 7 deletions
+32
View File
@@ -1086,6 +1086,38 @@ body {
justify-content: center;
}
/* Unread conversation visual state: darker green and subtle background */
.conversation-item.unread {
background: linear-gradient(90deg, #effff5, #f6fff9);
}
.conversation-item.unread .conversation-avatar {
background: linear-gradient(135deg, #0f9a6a, #0b7a57);
box-shadow: 0 6px 18px rgba(11, 122, 87, 0.25);
}
/* Notification bell indicator when there are unseen notifications */
#notification-bell.has-notifications {
position: relative;
}
#notification-bell.has-notifications::after {
content: '';
position: absolute;
top: 6px;
right: 6px;
width: 12px;
height: 12px;
background: #15803d; /* darker green */
border-radius: 50%;
box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
animation: pulseGreen 2s infinite;
}
@keyframes pulseGreen {
0% { transform: scale(1); opacity: 0.9; }
50% { transform: scale(1.15); opacity: 0.6; }
100% { transform: scale(1); opacity: 0.9; }
}
.conversation-status-icon {
font-size: 0.8rem;
}
+18 -4
View File
@@ -504,6 +504,8 @@ class SimpleWhatsAppManager {
// Unread badge
const unreadBadge = (conv.unread_count && conv.unread_count > 0) ?
`<div class="conversation-unread">${conv.unread_count}</div>` : '';
// Add class to highlight unread conversation (darker green)
const unreadClass = (conv.unread_count && conv.unread_count > 0) ? ' unread' : '';
// Status icon
const statusIcon = conv.last_direction === 'outgoing'
@@ -518,7 +520,7 @@ class SimpleWhatsAppManager {
: '';
html += `
<div class="conversation-item" onclick="openChatWindow(${conv.user_id})">
<div class="conversation-item${unreadClass}" onclick="openChatWindow(${conv.user_id})">
<div class="conversation-avatar ${isOnline ? 'online' : ''}">
${userInitial}
</div>
@@ -622,8 +624,10 @@ class SimpleWhatsAppManager {
? '<i class="fas fa-image text-info" title="Imagen"></i> '
: '';
const unreadClass = (conv.unread_count && conv.unread_count > 0) ? ' unread' : '';
html += `
<div class="conversation-item" onclick="openChatWindow(${conv.user_id})">
<div class="conversation-item${unreadClass}" onclick="openChatWindow(${conv.user_id})">
<div class="conversation-avatar ${isOnline ? 'online' : ''}">
${userInitial}
</div>
@@ -1664,9 +1668,19 @@ window.debugAPI = async function (endpoint) {
};
// Función para abrir ventana de chat
window.openChatWindow = function (userId) {
window.openChatWindow = async function (userId) {
console.log('Abriendo chat del usuario:', userId);
// Marcar conversación como leída en el backend y refrescar lista localmente
try {
await fetch('api/mark_conversation_read.php', {method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({user_id: userId})});
if (window.whatsappManager && typeof window.whatsappManager.loadConversations === 'function') {
window.whatsappManager.loadConversations();
}
} catch (e) {
console.warn('mark_conversation_read failed', e);
}
// Abrir nueva ventana de chat
const chatUrl = `chat_window.php?user_id=${userId}&debug=true`;
const windowFeatures = 'width=1000,height=700,resizable=yes,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no';