@php $hasActiveConversation = isset($activeConversation); $currentId = $currentUserId ?? auth()->id(); $chatTitle = 'Wybierz rozmowę'; if ($hasActiveConversation) { if ($activeConversation->type === 'group') { $chatTitle = $activeConversation->name ?: 'Grupa #' . $activeConversation->id; } else { $other = $activeConversation->participantsUsers ->firstWhere('id', '!=', $currentId); $chatTitle = $other->name ?? 'Rozmowa #' . $activeConversation->id; } } // ostatnie ID wiadomości (albo 0 gdy brak) $lastMessageId = ($messages ?? collect())->last()->id ?? 0; @endphp
{{-- NAGŁÓWEK --}}
@if($hasActiveConversation && $activeConversation->type === 'group') @else @endif
{{ $chatTitle }}
@if($hasActiveConversation) {{ $activeConversation->participants_label ?? 'Uczestnicy rozmowy' }} @else Aby rozpocząć, wybierz rozmowę z listy po lewej stronie lub utwórz nową. @endif
{{-- WIADOMOŚCI – scrolluje się tylko ta sekcja --}}
@if($hasActiveConversation) @forelse(($messages ?? []) as $message) @include('modules.wiadomosci._message_bubble', [ 'message' => $message, 'own' => ($message->sender_id == $currentId), ]) @empty
Brak wiadomości w tej rozmowie. Napisz pierwszą wiadomość poniżej.
@endforelse @else

Wybierz rozmowę lub utwórz nową

Użyj panelu po lewej stronie, aby rozpocząć rozmowę z użytkownikiem lub grupą.

@endif
{{-- FORMULARZ WYSYŁANIA --}}
@csrf