@inject('markdown', 'Parsedown')
@php
    // TODO: There should be a better place for this.
    $markdown->setSafeMode(true);
@endphp
<div id="comment-{{ $comment->id }}" class="flex rounded-lg bg-white p-1 mb-2 shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] dark:bg-neutral-900">
    @php $user = cache()->rememberForever('commentUser'.$comment->commenter_id, fn () => \App\Models\User::where('id', $comment->commenter_id)->first()); @endphp
    <a class="contents" href="{{ route('user.index', ['username' => $user->username]) }}">
        @if($user->avatar)
        <img class="w-16 h-16 rounded-full m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $comment->commenter_id }}/{{ $user->avatar }}.webp" alt="{{ $user->global_name ?? $user->username }} Avatar">
        @else
        <img class="w-16 h-16 rounded-full m-2" src="/images/default-avatar.webp" alt="{{ $user->global_name ?? $user->username }} Avatar">
        @endif
    </a>
    <div class="text-gray-800 dark:text-gray-200">
        <a href="{{ route('user.index', ['username' => $user->username]) }}">
            @if($user->is_patreon)
            <h5 class="text-gray-800 dark:text-gray-400">{{ $user->global_name ?? $user->username }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
            @else
            <h5 class="text-gray-800 dark:text-gray-400">{{ $user->global_name ?? $user->username }} <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
            @endif
        </a>
        <div style="white-space: pre-wrap;">{!! $markdown->line($comment->comment) !!}</div>                                    
        <br />
    </div>
</div>