@extends('layouts.app')
@section('title', 'Chat with ' . $otherUser->name)
@section('styles')
@endsection
@section('content')
@if($conversation->ride)
🚗 About ride: {{ $conversation->ride->route->fromCity->name ?? '' }} → {{ $conversation->ride->route->toCity->name ?? '' }}
@endif
@if($conversation->messages->count() > 0)
@php $lastDate = null; @endphp
@foreach($conversation->messages as $message)
@php
$messageDate = $message->created_at->format('M d, Y');
$showDate = $messageDate !== $lastDate;
$lastDate = $messageDate;
$isSent = $message->sender_id == $user->id;
@endphp
@if($showDate)
{{ $message->created_at->isToday() ? 'Today' : $messageDate }}
@endif
{{ $message->content }}
{{ $message->created_at->format('h:i A') }}
@endforeach
@else
👋 Say hello to {{ $otherUser->name }}!
@endif
@endsection