diff --git a/app/javascript/dashboard/components-next/Conversation/ConversationCard/CardHeader.vue b/app/javascript/dashboard/components-next/Conversation/ConversationCard/CardHeader.vue deleted file mode 100644 index e39fcff2b..000000000 --- a/app/javascript/dashboard/components-next/Conversation/ConversationCard/CardHeader.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/app/javascript/dashboard/components-next/Conversation/ConversationCard/CardMetaSection.vue b/app/javascript/dashboard/components-next/Conversation/ConversationCard/CardMetaSection.vue deleted file mode 100644 index 782f6b96c..000000000 --- a/app/javascript/dashboard/components-next/Conversation/ConversationCard/CardMetaSection.vue +++ /dev/null @@ -1,103 +0,0 @@ - - - diff --git a/app/javascript/dashboard/components-next/Conversation/ConversationCard/ConversationCardCompact.vue b/app/javascript/dashboard/components-next/Conversation/ConversationCard/ConversationCardCompact.vue index 05282cd95..d415485af 100644 --- a/app/javascript/dashboard/components-next/Conversation/ConversationCard/ConversationCardCompact.vue +++ b/app/javascript/dashboard/components-next/Conversation/ConversationCard/ConversationCardCompact.vue @@ -118,7 +118,7 @@ const onSelectConversation = checked => {

{{ currentContact.name }}

@@ -131,7 +131,7 @@ const onSelectConversation = checked => {
-
+
{ - if (!parentRef.value || props.items.length === 0) return; + if (!parentRef.value) return; - const activeElement = parentRef.value.querySelector('.active'); - if (!activeElement) { - // No active conversation, select first one - const firstWrapper = parentRef.value.querySelector('[data-id]'); - firstWrapper?.firstElementChild?.click(); - return; - } + // Get all wrapper divs with data-id + const allWrappers = Array.from(parentRef.value.querySelectorAll('[data-id]')); + if (allWrappers.length === 0) return; - // Find current conversation ID from active element - const currentWrapper = activeElement.closest('[data-id]'); - const currentId = currentWrapper?.dataset.id; - if (!currentId) return; - - // Find index in data array - const currentIndex = props.items.findIndex( - item => String(item.id) === currentId + const activeIndex = allWrappers.findIndex(wrapper => + wrapper.querySelector('.active') ); - if (currentIndex === -1) return; - // Calculate target index const delta = direction === 'previous' ? -1 : 1; - const targetIndex = currentIndex + delta; + const newIndex = activeIndex + delta; + // Clamp index to valid range [0, length-1] + const targetIndex = Math.max(0, Math.min(newIndex, allWrappers.length - 1)); - // Clamp to valid range - if (targetIndex < 0 || targetIndex >= props.items.length) return; - - // Find and click target conversation - const targetId = props.items[targetIndex].id; - const targetWrapper = parentRef.value.querySelector( - `[data-id="${targetId}"]` - ); - targetWrapper?.firstElementChild?.click(); + // Click the first child (ConversationItem root element) + allWrappers[targetIndex]?.firstElementChild?.click(); }; useKeyboardEvents({