{{-- Top Actions Row --}}
{{-- Folder / Channel Label --}}
{{-- Dropdown --}}
{{-- Tags filter dropdown --}}
{{-- Team filter dropdown --}}
{{-- Refresh / Resync --}} {{-- Search toggle --}}
{{-- Search input (overlays on top bar) --}}
{{-- Compose + Select --}}
{{-- Bulk actions bar --}} @if(!empty($selectedIds))
{{ count($selectedIds) }} {{ __('selected') }} |
@endif {{-- Conversation Cards --}}
@php // Group conversations by month $grouped = collect($loadedConversations)->groupBy(function ($conv) { $date = $conv['time'] ?? ''; // Try to parse relative time to a month label // Since we only have relative time strings, group by first letter or use "Recent" return 'Recent'; }); // Better grouping: use actual timestamps if available, otherwise group all as "Conversations" $monthGroups = []; foreach ($loadedConversations as $conv) { $monthGroups[''][] = $conv; } @endphp @forelse($loadedConversations as $conv) @php $isActive = $selectedConversationId === $conv['id']; $isSelected = in_array($conv['id'], $selectedIds); @endphp
{{-- Avatar (if contact has initials) --}}
{{-- Checkbox overlay --}} @php $avatarColors = ['bg-pink-500/20 text-pink-400', 'bg-blue-500/20 text-blue-400', 'bg-emerald-500/20 text-emerald-400', 'bg-amber-500/20 text-amber-400', 'bg-violet-500/20 text-violet-400', 'bg-rose-500/20 text-rose-400', 'bg-cyan-500/20 text-cyan-400', 'bg-indigo-500/20 text-indigo-400']; $colorIndex = $conv['id'] % count($avatarColors); @endphp
{{ $conv['contact_initials'] }}
{{-- Title --}}

@if($conv['is_starred'] ?? false) @endif {{ $conv['contact_name'] }}

{{-- Subject --}} @if($conv['subject'] && $conv['subject'] !== '(no subject)')

{{ $conv['subject'] }}

@endif {{-- Preview --}}

{{ $conv['preview'] }}

{{-- Footer: timestamp, counts, tags --}}
{{ $conv['time'] }} {{-- Unread dot --}} @if($conv['is_unread'] && !$isActive) @endif {{-- Message count --}} @if(($conv['messages_count'] ?? 0) > 1)
{{ $conv['messages_count'] }}
@endif {{-- Channel icon --}} @if(($conv['channel'] ?? 'email') !== 'email') @switch($conv['channel']) @case('whatsapp') @break @case('sms') @break @case('telegram') @break @case('slack') @break @case('chat') @break @endswitch @endif {{-- AI badge --}} @if($conv['is_ai_handled'] ?? false) @endif {{-- Priority indicator --}} @if(in_array($conv['priority'] ?? 'normal', ['high', 'urgent'])) @endif
{{-- Tags --}}
@foreach(array_slice($conv['tags'] ?? [], 0, 3) as $tag) #{{ $tag['name'] }} @endforeach {{-- Assigned --}} @if($conv['assigned_to_initials'] ?? false) {{ $conv['assigned_to_initials'] }} @endif
@empty {{-- Empty states --}} @if($search || $filterTag)

{{ __('No conversations match') }}

{{ __('Try adjusting your search query or filters to find what you are looking for.') }}

@elseif(in_array($channel, ['whatsapp', 'sms', 'telegram', 'slack', 'chat']))
@switch($channel) @case('whatsapp') @break @case('sms') @break @case('telegram') @break @case('slack') @break @case('chat') @break @endswitch

{{ __('No conversations yet') }}

@switch($channel) @case('whatsapp') {{ __('Connect WhatsApp to start receiving messages.') }} @break @case('sms') {{ __('Connect SMS (Twilio) to receive text messages.') }} @break @case('telegram') {{ __('Connect Telegram to manage bot conversations.') }} @break @case('slack') {{ __('Connect Slack to manage workspace messages.') }} @break @case('chat') {{ __('Set up Live Chat widget for your website.') }} @break @endswitch

@switch($channel) @case('whatsapp') {{ __('Connect WhatsApp') }} @break @case('sms') {{ __('Connect Twilio') }} @break @case('telegram') {{ __('Connect Telegram') }} @break @case('slack') {{ __('Connect Slack') }} @break @case('chat') {{ __('Set Up Live Chat') }} @break @endswitch
@elseif($this->isSyncing)

{{ __('Syncing your inbox...') }}

{{ __('We\'re importing your emails. This may take a few minutes for large mailboxes.') }}

{{ __('This page refreshes automatically.') }}

@elseif(!$this->hasEmailAccounts)

{{ __('Connect your email') }}

{{ __('Link your Gmail, Outlook, or IMAP account to start managing all your conversations in one place.') }}

{{ __('Connect Email Account') }}
@else

{{ __('No conversations yet') }}

{{ __('Conversations will appear here when you receive messages in this channel.') }}

@endif @endforelse {{-- Load more --}} @if($hasMorePages ?? false)
@endif
{{-- Footer count --}} @if(count($loadedConversations) > 0)
{{ count($loadedConversations) }} {{ count($loadedConversations) !== 1 ? __('conversations') : __('conversation') }}
@endif {{-- Inbox sync loop — plain