@use('Namu\WireChat\Facades\WireChat') @php $isSameAsNext = ($message?->sendable_id === $nextMessage?->sendable_id) && ($message?->sendable_type === $nextMessage?->sendable_type); $isNotSameAsNext = !$isSameAsNext; $isSameAsPrevious = ($message?->sendable_id === $previousMessage?->sendable_id) && ($message?->sendable_type === $previousMessage?->sendable_type); $isNotSameAsPrevious = !$isSameAsPrevious; @endphp
$belongsToAuth==true ]) @class([ 'flex flex-wrap max-w-fit text-[15px] border border-gray-200/40 dark:border-none rounded-xl p-2.5 flex flex-col text-black bg-[#f6f6f8fb]', 'text-white' => $belongsToAuth, // Background color for messages sent by the authenticated user 'bg-[var(--wc-light-secondary)] dark:bg-[var(--wc-dark-secondary)] dark:text-white' => !$belongsToAuth, // Message styles based on position and ownership // RIGHT // First message on RIGHT 'rounded-br-md rounded-tr-2xl' => ($isSameAsNext && $isNotSameAsPrevious && $belongsToAuth), // Middle message on RIGHT 'rounded-r-md' => ($isSameAsPrevious && $belongsToAuth), // Standalone message RIGHT 'rounded-br-xl rounded-r-xl' => ($isNotSameAsPrevious && $isNotSameAsNext && $belongsToAuth), // Last Message on RIGHT 'rounded-br-2xl' => ($isNotSameAsNext && $belongsToAuth), // LEFT // First message on LEFT 'rounded-bl-md rounded-tl-2xl' => ($isSameAsNext && $isNotSameAsPrevious && !$belongsToAuth), // Middle message on LEFT 'rounded-l-md' => ($isSameAsPrevious && !$belongsToAuth), // Standalone message LEFT 'rounded-bl-xl rounded-l-xl' => ($isNotSameAsPrevious && $isNotSameAsNext && !$belongsToAuth), // Last message on LEFT 'rounded-bl-2xl' => ($isNotSameAsNext && !$belongsToAuth), ]) > @if (!$belongsToAuth && $isGroup)
$isSameAsPrevious ])> {{ $message?->sendable?->display_name }}
@endif @php // Check if the body is a valid internal URL so a href link can be rendered $appUrl = rtrim(config('app.url'), '/'); $body = trim($message?->body ?? ''); $isInternalUrl = false; if (filter_var($body, FILTER_VALIDATE_URL)) { $isInternalUrl = str_starts_with($body, $appUrl); } // Check if body is a transaction statement URL $transactionShowPattern = '#^' . preg_quote($appUrl, '#') . '/[a-z]{2}/statement/\d+$#'; $isTransactionLink = preg_match($transactionShowPattern, $body); @endphp @if ($isTransactionLink)
    
    
{{ __('View transaction') }}
@else
    @if ($isInternalUrl)
            
                {{ $body }}
            
        @else
            {{ $body }}
        @endif
    
@endif {{-- Display the created time based on different conditions --}} !$belongsToAuth,'text-gray-100' => $belongsToAuth])> @php // If the message was created today, show only the time (e.g., 1:00 AM) echo $message?->created_at->format('H:i'); @endphp