@if($conversation['type'] !== 'system')
@endif
@if($conversation['type'] === 'direct' && $conversation['other_user'])
{{ $conversation['other_user']['name'] }}
@if($conversation['last_message'])
{{ \Illuminate\Support\Str::limit(strip_tags(preg_replace('/\*\*|\*|__|_|~~|`|```|\|\||\[([^\]]+)\]\([^\)]+\)/', '$1', $conversation['last_message']->content)), 50) }}
@endif
@if($conversation['last_message_at'])
{{ $conversation['last_message_at']->diffForHumans() }}
@endif
@if($conversation['unread_count'] > 0)
{{ $conversation['unread_count'] }}
@endif
@elseif($conversation['type'] === 'group')
@if(isset($conversation['participants']) && count($conversation['participants']) > 0)
@foreach(array_slice($conversation['participants'], 0, 2) as $participant)
@if($participant['avatar'])
![{{ $participant['name'] }}]({{ $participant['avatar'] }})
@else
{{ strtoupper(substr($participant['name'], 0, 1)) }}
@endif
@endforeach
@else
@endif
{{ $conversation['subject'] ?? 'Group Chat' }}
({{ $conversation['participants_count'] ?? 0 }})
@if($conversation['last_message'])
{{ \Illuminate\Support\Str::limit(strip_tags(preg_replace('/\*\*|\*|__|_|~~|`|```|\|\||\[([^\]]+)\]\([^\)]+\)/', '$1', $conversation['last_message']->content)), 50) }}
@endif
@if($conversation['last_message_at'])
{{ $conversation['last_message_at']->diffForHumans() }}
@endif
@if($conversation['unread_count'] > 0)
{{ $conversation['unread_count'] }}
@endif
@elseif($conversation['type'] === 'system')
System Messages
@if($conversation['last_message'])
{{ \Illuminate\Support\Str::limit(strip_tags(preg_replace('/\*\*|\*|__|_|~~|`|```|\|\||\[([^\]]+)\]\([^\)]+\)/', '$1', $conversation['last_message']->content)), 50) }}
@endif
@if($conversation['unread_count'] > 0)
{{ $conversation['unread_count'] }}
@endif
@endif