Files
hstream/resources/views/partials/comment.blade.php
T
w33b 40fe75d9b7 feat(comments): add character limit to comment markdown body
Add an optional `$limit` parameter to `CommentPresenter::markdownBody()`
that truncates the comment body before rendering Markdown. The comment
partial now passes a default limit of 250 characters, preventing long
comments from dominating the layout. Unit tests cover rendering with and
without a limit.
2026-08-16 10:15:08 +02:00

26 lines
1.3 KiB
PHP

<div>
<div class="flex">
<div class="flex-shrink-0 mr-4">
<img class="h-10 w-10 rounded-full" src="{{ $comment->user->getAvatar() }}" alt="{{ $comment->user->name }}">
</div>
<div class="flex-grow">
<div class="flex gap-2">
<p class="font-medium text-gray-900 dark:text-gray-100">{{ $comment->user->name }}</p>
@if($comment->user->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
<a data-te-toggle="tooltip" title="Admin"><i class="fa-solid fa-crown text-yellow-600"></i></a>
@endif
@if($comment->user->hasRole(\App\Enums\UserRole::SUPPORTER))
<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"></i></a>
@endif
</div>
<div class="mt-1 flex-grow w-full">
<div class="text-gray-700 dark:text-gray-200">{!! $comment->presenter()->markdownBody($limit ?? 250) !!}</div>
</div>
<div class="mt-2 space-x-2">
<span class="text-gray-500 dark:text-gray-300 font-medium">
{{ $comment->presenter()->relativeCreatedAt() }}
</span>
</div>
</div>
</div>
</div>