Update new comments design
This commit is contained in:
@@ -1,68 +1,81 @@
|
|||||||
<p class="text-lg font-bold leading-normal text-neutral-800 dark:text-white">
|
<p class="mb-6 text-2xl font-bold tracking-tight text-neutral-900 dark:text-white">
|
||||||
{{ __('home.latest-comments') }}
|
{{ __('home.latest-comments') }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="grid gap-2 grid-cols-1 xl:grid-cols-2">
|
<div class="grid grid-cols-1 gap-6 xl:grid-cols-2">
|
||||||
@foreach ($latestComments as $comment)
|
@foreach ($latestComments as $comment)
|
||||||
@if ($comment->commentable_type == \App\Models\Episode::class)
|
|
||||||
@php $episode = cache()->rememberForever('commentEpisode'.$comment->commentable_id, fn () => App\Models\Episode::with('gallery')->where('id', $comment->commentable_id)->first()); @endphp
|
|
||||||
<div id="comments" class="flex p-4 bg-white rounded-lg dark:bg-neutral-950">
|
|
||||||
<div
|
|
||||||
class="w-[15vw] mr-5 p-1 md:p-2 mb-4 relative transition ease-in-out hover:-translate-y-1 hover:scale-110 duration-300">
|
|
||||||
<a class="hidden 2xl:block"
|
|
||||||
href="{{ route('hentai.index', ['title' => $episode->slug]) }}">
|
|
||||||
<img alt="{{ $episode->title }} - {{ $episode->episode }}" loading="lazy" width="1000"
|
|
||||||
class="block object-cover object-center relative z-20 rounded-lg aspect-video"
|
|
||||||
src="{{ $episode->gallery->first()->thumbnail_url }}"></img>
|
|
||||||
<p
|
|
||||||
class="absolute right-2 top-2 bg-rose-700/70 !text-white rounded-bl-lg rounded-tr-lg p-1 pr-2 pl-2 font-semibold text-sm z-30">
|
|
||||||
{{ $episode->getResolution() }}</p>
|
|
||||||
<div class="absolute w-[95%] grid grid-cols-1 text-center">
|
|
||||||
<p class="text-sm text-center text-black dark:text-white truncate">{{ $episode->title }} -
|
|
||||||
{{ $episode->episode }}</p>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a class="block 2xl:hidden"
|
@php
|
||||||
href="{{ route('hentai.index', ['title' => $episode->slug]) }}">
|
$isEpisode = $comment->commentable_type == \App\Models\Episode::class;
|
||||||
<img alt="{{ $episode->title }} - {{ $episode->episode }}" loading="lazy" width="1000"
|
|
||||||
class="block object-cover object-center relative z-20 rounded-lg"
|
if ($isEpisode) {
|
||||||
src="{{ $episode->cover_url }}"></img>
|
$item = cache()->rememberForever(
|
||||||
</a>
|
'commentEpisode' . $comment->commentable_id,
|
||||||
</div>
|
fn () => \App\Models\Episode::with('gallery')
|
||||||
<div class="w-[60vw] pt-4 bg-neutral-100 dark:bg-neutral-800 rounded-lg pl-4">
|
->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])
|
@include('partials.comment', ['comment' => $comment])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
@elseif($comment->commentable_type == \App\Models\Hentai::class)
|
|
||||||
@php $hentai = cache()->rememberForever('commentHentai'.$comment->commentable_id, fn () => App\Models\Hentai::with('gallery', 'episodes')->where('id', $comment->commentable_id)->first()); @endphp
|
|
||||||
<div id="comments" class="flex p-4 bg-white rounded-lg dark:bg-neutral-950">
|
|
||||||
<div
|
|
||||||
class="w-[15vw] mr-5 p-1 md:p-2 mb-8 relative transition ease-in-out hover:-translate-y-1 hover:scale-110 duration-300">
|
|
||||||
<a class="hidden 2xl:block" href="{{ route('hentai.index', ['title' => $hentai->slug]) }}">
|
|
||||||
<img alt="{{ $hentai->episodes->first()->title }}" loading="lazy" width="1000"
|
|
||||||
class="block object-cover object-center relative z-20 rounded-lg aspect-video"
|
|
||||||
src="{{ $hentai->gallery->first()->thumbnail_url }}"></img>
|
|
||||||
<p
|
|
||||||
class="absolute right-2 top-2 bg-rose-700/70 !text-white rounded-bl-lg rounded-tr-lg p-1 pr-2 pl-2 font-semibold text-sm z-30">
|
|
||||||
{{ $hentai->episodes->first()->getResolution() }}</p>
|
|
||||||
<div class="absolute w-[95%] grid grid-cols-1 text-center">
|
|
||||||
<p class="text-sm text-center text-black dark:text-white truncate">
|
|
||||||
{{ $hentai->episodes->first()->title }}</p>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a class="block 2xl:hidden"
|
|
||||||
href="{{ route('hentai.index', ['title' => $hentai->slug]) }}">
|
|
||||||
<img alt="{{ $hentai->episodes->first()->title }}" loading="lazy" width="1000"
|
|
||||||
class="block object-cover object-center relative z-20 rounded-lg"
|
|
||||||
src="{{ $hentai->episodes->first()->cover_url }}"></img>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="w-[60vw] pt-4 bg-neutral-100 dark:bg-neutral-800 rounded-lg pl-4">
|
|
||||||
@include('partials.comment', ['comment' => $comment])
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
</div>
|
||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user