@props([ 'senderName' => 'Interviewer', 'isCandidate' => false, 'color' => '#6366f1', 'message' => '', 'timestamp' => null, ]) @php $resolvedColor = $isCandidate ? '#38bdf8' : ($color ?? '#6366f1'); $timeStr = $timestamp ? \Carbon\Carbon::parse($timestamp)->format('H:i:s') : now()->format('H:i:s'); // Hex to rgba helper for background opacity $hex = ltrim($resolvedColor, '#'); if (strlen($hex) == 3) { $r = hexdec(substr($hex,0,1).substr($hex,0,1)); $g = hexdec(substr($hex,1,1).substr($hex,1,1)); $b = hexdec(substr($hex,2,1).substr($hex,2,1)); } else { $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); } $bgRgba = "rgba({$r}, {$g}, {$b}, 0.1)"; $borderRgba = "rgba({$r}, {$g}, {$b}, 0.35)"; @endphp
merge(['class' => 'chat-message mb-2 p-2.5 rounded-lg transition-all']) }} style="background: {{ $bgRgba }}; border-color: {{ $resolvedColor }};">
{{ $senderName }} @if($isCandidate) Candidate @else Panelist @endif
{{ $timeStr }}
{{ $message }}