81 lines
3.3 KiB
PHP
81 lines
3.3 KiB
PHP
<p class="mb-6 text-2xl font-bold tracking-tight text-neutral-900 dark:text-white">
|
|
{{ __('home.latest-comments') }}
|
|
</p>
|
|
|
|
<div class="grid grid-cols-1 gap-6 xl:grid-cols-2">
|
|
@foreach ($latestComments as $comment)
|
|
|
|
@php
|
|
$isEpisode = $comment->commentable_type == \App\Models\Episode::class;
|
|
|
|
if ($isEpisode) {
|
|
$item = cache()->rememberForever(
|
|
'commentEpisode' . $comment->commentable_id,
|
|
fn () => \App\Models\Episode::with('gallery')
|
|
->find($comment->commentable_id)
|
|
);
|
|
|
|
$url = route('hentai.index', ['title' => $item->slug]);
|
|
$title = $item->title . ' - ' . $item->episode;
|
|
$thumbnail = $item->gallery->first()?->thumbnail_url ?? $item->cover_url;
|
|
$cover = $item->cover_url;
|
|
$resolution = $item->getResolution();
|
|
} else {
|
|
$item = cache()->rememberForever(
|
|
'commentHentai' . $comment->commentable_id,
|
|
fn () => \App\Models\Hentai::with('gallery', 'episodes')
|
|
->find($comment->commentable_id)
|
|
);
|
|
|
|
$episode = $item->episodes->first();
|
|
|
|
$url = route('hentai.index', ['title' => $item->slug]);
|
|
$title = $episode?->title;
|
|
$thumbnail = $item->gallery->first()?->thumbnail_url ?? $episode?->cover_url;
|
|
$cover = $episode?->cover_url;
|
|
$resolution = $episode?->getResolution();
|
|
}
|
|
@endphp
|
|
|
|
<div
|
|
class="group overflow-hidden rounded-2xl border border-neutral-200 bg-white shadow-sm transition-all duration-300 hover:-translate-y-1 hover:shadow-xl dark:border-neutral-800 dark:bg-neutral-950">
|
|
|
|
<div class="flex flex-col md:flex-row">
|
|
|
|
{{-- Thumbnail --}}
|
|
<a href="{{ $url }}"
|
|
class="relative w-full md:w-72 shrink-0 overflow-hidden">
|
|
|
|
{{-- Desktop Thumbnail --}}
|
|
<img
|
|
src="{{ $thumbnail }}"
|
|
alt="{{ $title }}"
|
|
loading="lazy"
|
|
class="h-full w-full object-cover transition-transform duration-500 group-hover:scale-105 aspect-video"
|
|
>
|
|
|
|
{{-- Resolution Badge --}}
|
|
<span
|
|
class="absolute right-0 top-0 rounded-bl-lg bg-rose-700/70 px-3 py-1 text-xs font-semibold text-white shadow-lg backdrop-blur">
|
|
{{ $resolution }}
|
|
</span>
|
|
|
|
{{-- Gradient Overlay --}}
|
|
<div
|
|
class="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 via-black/30 to-transparent p-4">
|
|
<p class="line-clamp-1 text-sm font-medium text-white">
|
|
{{ $title }}
|
|
</p>
|
|
</div>
|
|
</a>
|
|
|
|
{{-- Comment Content --}}
|
|
<div class="flex-1 p-4 md:p-6 bg-neutral-50 dark:bg-neutral-950">
|
|
@include('partials.comment', ['comment' => $comment])
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
@endforeach
|
|
</div> |