@php $status = $comment->status ?? 'active'; $badgeClass = $status === 'active' ? 'bg-success' : ($status === 'pending' ? 'bg-warning text-dark' : 'bg-secondary'); $canEdit = auth()->check() && (auth()->id() === $comment->user_id || Gate::allows('manage-comment', [$comment, $comment->commentable])); $canDelete = auth()->check() && (auth()->id() === $comment->user_id || Gate::allows('manage-comment', [$comment, $comment->commentable])); @endphp
@php $commentUser = $comment?->user; @endphp @if(!empty($commentUser?->profile_image)) {{ $commentUser->name }} @else {{ $commentUser?->name }} @endif
{{ $commentUser?->name }}
{{ $comment->created_at->diffForHumans() }} @if($comment->updated_at != $comment->created_at) (edited {{ $comment->updated_at->diffForHumans() }}) @endif
@if($commentUser->id != auth()->id())
{{-- View profile --}} @can('view', $commentUser) @endcan {{-- Direct chat: go to chats index and let frontend open/create chat --}}
@endif
{{-- Comment Actions Dropdown --}} @if($canEdit || $canDelete) @endif
{{-- Comment Content Display --}}

{!! nl2br(e($comment->content)) !!}

{{-- Edit Comment Form (Hidden by default) --}}
@csrf @method('PUT')
{{ strlen($comment->content) }}/2000 {{ __('labels.characters') }}
{{--
--}}
{{-- Reply Button --}} @auth @if($depth < 1)
{{ __('labels.reply') }}
@endif @endauth {{-- Reply Form --}}
@csrf
0/2000 {{ __('labels.characters') }}
{{--
--}}
{{-- Recursively render child comments --}} {{-- @if($comment->childrenRecursiveVisible && $comment->childrenRecursiveVisible->count() > 0)
@foreach($comment->childrenRecursiveVisible->sortBy('created_at') as $childComment) @include('components.comments.comment',[ 'comment' => $childComment, 'depth' => $depth + 1, 'marginLeft' => $marginLeft+10, 'commentStates' => $commentStates, 'commentableId' => $commentableId, 'commentableType' => $commentableType ]) @endforeach
@endif --}} @if($comment->children && $comment->children->count() > 0)
@foreach($comment->children->sortBy('created_at') as $childComment) @include('components.comments.comment',[ 'comment' => $childComment, 'depth' => $depth + 1, 'marginLeft' => $marginLeft+10, 'commentStates' => $commentStates, 'commentableId' => $commentableId, 'commentableType' => $commentableType ]) @endforeach
@endif