Misc changes

This commit is contained in:
2026-01-10 20:33:35 +01:00
parent 3259e2197b
commit 819e2fde27
3 changed files with 71 additions and 51 deletions

View File

@@ -38,27 +38,27 @@
@endif @endif
</div> </div>
<div class="mt-2 space-x-2 flex flex-row"> <div class="mt-2 space-x-2 flex flex-row">
<span class="text-gray-500 dark:text-gray-300">
{{ $comment->presenter()->relativeCreatedAt() }}
</span>
@guest @guest
<span data-te-toggle="tooltip" title="Please login to like the episode" class=" text-gray-800 cursor-pointer dark:text-gray-200"> <span data-te-toggle="tooltip" title="Please login to like the episode" class="text-gray-800 cursor-pointer dark:text-gray-200">
<i class="fa-regular fa-heart pr-[4px]"></i> {{ $comment->likeCount() }} <i class="fa-regular fa-heart"></i> {{ $comment->likeCount() }}
</span> </span>
@endguest @endguest
@auth @auth
<!-- Like Button --> <!-- Like Button -->
<button class="text-xl text-gray-800 dark:text-gray-200 leading-tight cursor-pointer whitespace-nowrap" wire:click="like"> <button class="text-gray-800 dark:text-gray-200 leading-tight cursor-pointer whitespace-nowrap" wire:click="like">
@if ($liked) @if ($liked)
<i class="fa-solid fa-heart pr-[4px] text-rose-600"></i> {{ $likeCount }} <i class="fa-solid fa-heart text-rose-600"></i> {{ $likeCount }}
@else @else
<i class="fa-regular fa-heart pr-[4px]"></i> {{ $likeCount }} <i class="fa-solid fa-heart"></i> {{ $likeCount }}
@endif @endif
</button> </button>
@endauth @endauth
<span class="text-gray-500 dark:text-gray-300 font-medium">
{{ $comment->presenter()->relativeCreatedAt() }}
</span>
@auth @auth
@if ($comment->depth() < 2) @if ($comment->depth() < 2)
<button wire:click="$toggle('isReplying')" type="button" class="text-gray-900 dark:text-gray-100 font-medium"> <button wire:click="$toggle('isReplying')" type="button" class="text-gray-900 dark:text-gray-100 font-medium">

View File

@@ -4,51 +4,57 @@
<div class="px-4 py-5 sm:px-6"> <div class="px-4 py-5 sm:px-6">
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-200">Comments</h2> <h2 class="text-lg font-medium text-gray-900 dark:text-gray-200">Comments</h2>
</div> </div>
<div class="px-4 py-6 sm:px-6"> <div>
<div class="space-y-8"> <!-- Comment Input -->
@if ($comments->isNotEmpty()) <div class="bg-gray-50 dark:bg-neutral-800 px-4 py-6 sm:px-6">
@foreach($comments as $comment) @auth
<livewire:comment :comment="$comment" :key="$comment->id"/> <div class="flex">
@endforeach <div class="flex-shrink-0 mr-4">
{{ $comments->links('pagination::tailwind') }} <img class="h-10 w-10 rounded-full" src="{{ auth()->user()->getAvatar() }}" alt="{{ auth()->user()->name }}">
@else
<p class="text-gray-900 dark:text-gray-200">No comments yet.</p>
@endif
</div>
</div>
</div>
<div class="bg-gray-50 dark:bg-neutral-800 px-4 py-6 sm:px-6">
@auth
<div class="flex">
<div class="flex-shrink-0 mr-4">
<img class="h-10 w-10 rounded-full" src="{{ auth()->user()->getAvatar() }}" alt="{{ auth()->user()->name }}">
</div>
<div class="min-w-0 flex-1">
<form wire:submit.prevent="postComment">
<div>
<label for="comment" class="sr-only">Comment body</label>
<textarea id="comment" name="comment" rows="3"
class="bg-white dark:bg-neutral-700 shadow-sm block w-full focus:ring-rose-500 focus:border-rose-500 border-gray-300 dark:border-gray-400/40 text-gray-900 dark:text-gray-200 placeholder:text-gray-400 rounded-md
@error('newCommentState.body') border-red-500 @enderror"
placeholder="Write something" wire:model.defer="newCommentState.body"></textarea>
@error('newCommentState.body')
<p class="mt-2 text-sm text-red-500">{{ $message }}</p>
@enderror
</div> </div>
<div class="mt-3 flex items-center justify-between"> <div class="min-w-0 flex-1">
<button type="submit" <form wire:submit.prevent="postComment">
class="inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md shadow-sm text-white bg-rose-600 hover:bg-rose-700 focus:outline-none focus:ring-2 focus:ring-rose-500"> <div>
Comment <label for="comment" class="sr-only">Comment body</label>
</button> <textarea id="comment" name="comment" rows="3"
class="peer block min-h-[auto] w-full border-1 bg-transparent px-3 py-[0.32rem] leading-[1.6] outline-none transition-all duration-200 ease-linear dark:placeholder:text-neutral-200 border-gray-300 dark:border-neutral-950 dark:bg-neutral-900 dark:text-gray-300 focus:border-rose-500 dark:focus:border-rose-600 focus:ring-rose-500 dark:focus:ring-rose-600 rounded-md shadow-sm
@error('newCommentState.body') border-red-500 @enderror"
placeholder="Write something" wire:model.defer="newCommentState.body"></textarea>
@error('newCommentState.body')
<p class="mt-2 text-sm text-red-500">{{ $message }}</p>
@enderror
</div>
<div class="mt-3 flex items-center justify-between">
<button type="submit"
class="inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md shadow-sm text-white bg-rose-600 hover:bg-rose-700 focus:outline-none focus:ring-2 focus:ring-rose-500">
Comment
</button>
</div>
</form>
</div> </div>
</form> </div>
</div> @endauth
</div>
@endauth
@guest @guest
<p class="text-gray-900 dark:text-gray-200">Log in to comment.</p> <p class="text-gray-900 dark:text-gray-200">Log in to comment.</p>
@endguest @endguest
</div>
<!-- Comments -->
<div class="px-4 py-6 sm:px-6">
<div class="space-y-8">
@if ($comments->isNotEmpty())
@foreach($comments as $comment)
<livewire:comment :comment="$comment" :key="$comment->id"/>
@endforeach
{{ $comments->links('pagination::tailwind') }}
@else
<p class="text-gray-900 dark:text-gray-200">No comments yet.</p>
@endif
</div>
</div>
</div>
</div> </div>
</div> </div>
</section> </section>

View File

@@ -88,6 +88,20 @@
<i class="fa-regular fa-heart"></i> {{ $episode->likeCount() }} <i class="fa-regular fa-heart"></i> {{ $episode->likeCount() }}
<i class="fa-regular fa-comment"></i> {{ $episode->commentCount() }} <i class="fa-regular fa-comment"></i> {{ $episode->commentCount() }}
</p> </p>
</a>
</div>
@elseif($comment->commentable_type == \App\Models\Hentai::class)
@php
$hentai = \App\Models\Hentai::find($comment->commentable_id);
$episode = $hentai->episodes->first();
@endphp
<div class="relative p-1 w-full transition duration-300 ease-in-out md:p-2 md:hover:-translate-y-1 md:hover:scale-110">
<a href="{{ route('hentai.index', ['title' => $hentai->slug]) }}">
<img alt="{{ $episode->title }}" loading="lazy" width="1000"
class="block object-cover object-center relative z-20 rounded-lg aspect-video"
src="{{ $episode->gallery->first()->thumbnail_url }}" />
</a> </a>
</div> </div>
@endif @endif