sls/resources/views/components/chat-panel.blade.php

45 lines
1.4 KiB
PHP

@props([
'warnings' => [],
'candidateName' => 'Candidate',
])
@php
$interviewerColors = [
'#6366f1', // Indigo
'#10b981', // Emerald
'#f59e0b', // Amber
'#ec4899', // Pink
'#8b5cf6', // Purple
'#06b6d4', // Cyan
'#f97316', // Orange
];
@endphp
<div {{ $attributes->merge(['class' => 'bg-[#0d1220] border border-[#1b2233] rounded-[9px] h-[150px] overflow-y-auto p-3 flex flex-col gap-2']) }}>
@if(count($warnings) > 0)
@foreach($warnings as $w)
@php
$isCand = is_null($w->sent_by);
$senderName = $isCand
? ($candidateName ?: 'Candidate')
: ($w->sender ? $w->sender->name : 'Interviewer');
$color = $isCand
? '#38bdf8'
: $interviewerColors[($w->sent_by ?? 1) % count($interviewerColors)];
@endphp
<x-chat-message
:senderName="$senderName"
:isCandidate="$isCand"
:color="$color"
:message="$w->message"
:timestamp="$w->created_at"
/>
@endforeach
@else
<div class="h-full w-full flex items-center justify-center text-xs text-[#5b637a] italic">
No chat history. Send a message below.
</div>
@endif
</div>