Refactor home template

This commit is contained in:
2026-05-22 23:07:19 +02:00
parent 904604fcfb
commit ba3650899e
3 changed files with 25 additions and 46 deletions

View File

@@ -1,47 +1,26 @@
@if ($showThumbnails)
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-2">
@php
$limit = 15;
$limitcounter = 0;
@endphp
@php
$isThumbnail = $showThumbnails;
@foreach ($episodes as $ep)
@if (isset($popularView))
@php $episode = $ep->episode @endphp
@else
@php $episode = $ep @endphp
@endif
$gridClasses = $isThumbnail
? 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6'
: 'grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-8';
@if ($limitcounter >= $limit)
@break
@endif
$limit = $isThumbnail ? 12 : 16;
<x-episode-cover :episode="$episode" view="thumbnail" />
$view = $isThumbnail ? 'thumbnail' : 'poster';
@endphp
@php $limitcounter++; @endphp
<div class="grid {{ $gridClasses }}">
@foreach ($episodes->take($limit) as $ep)
@php
$episode = isset($popularView)
? $ep->episode
: $ep;
@endphp
<x-episode-cover
:episode="$episode"
:view="$view"
/>
@endforeach
</div>
@else
<div class="grid grid-cols-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-7 2xl:grid-cols-8 gap-2">
@php
$limit = 16;
$limitcounter = 0;
@endphp
@foreach ($episodes as $ep)
@if (isset($popularView))
@php $episode = $ep->episode @endphp
@else
@php $episode = $ep @endphp
@endif
@if ($limitcounter >= $limit)
@break
@endif
<x-episode-cover :episode="$episode" view="poster" />
@php $limitcounter++; @endphp
@endforeach
</div>
@endif
</div>