update
This commit is contained in:
@@ -10,6 +10,29 @@
|
||||
$seoNext = (isset($latestUploads) && method_exists($latestUploads, 'hasMorePages') && $latestUploads->hasMorePages())
|
||||
? $seoBase . '?page=' . ($seoPage + 1)
|
||||
: null;
|
||||
$homeUploadsItems = collect(method_exists($latestUploads ?? null, 'items') ? $latestUploads->items() : ($latestUploads ?? []));
|
||||
$homeGalleryArtworks = $homeUploadsItems->map(fn ($upload) => [
|
||||
'id' => $upload->id ?? null,
|
||||
'name' => $upload->name ?? $upload->title ?? null,
|
||||
'slug' => $upload->slug ?? \Illuminate\Support\Str::slug($upload->name ?? $upload->title ?? 'artwork'),
|
||||
'url' => $upload->url ?? ((isset($upload->id) && $upload->id) ? '/art/' . $upload->id . '/' . ($upload->slug ?? \Illuminate\Support\Str::slug($upload->name ?? $upload->title ?? 'artwork')) : '#'),
|
||||
'thumb' => $upload->thumb ?? $upload->thumb_url ?? null,
|
||||
'thumb_url' => $upload->thumb_url ?? $upload->thumb ?? null,
|
||||
'thumb_srcset' => $upload->thumb_srcset ?? null,
|
||||
'uname' => $upload->uname ?? $upload->author_name ?? '',
|
||||
'username' => $upload->username ?? $upload->uname ?? '',
|
||||
'avatar_url' => $upload->avatar_url ?? null,
|
||||
'content_type_name' => $upload->content_type_name ?? '',
|
||||
'content_type_slug' => $upload->content_type_slug ?? '',
|
||||
'category_name' => $upload->category_name ?? '',
|
||||
'category_slug' => $upload->category_slug ?? '',
|
||||
'width' => $upload->width ?? null,
|
||||
'height' => $upload->height ?? null,
|
||||
'published_at' => !empty($upload->published_at)
|
||||
? (method_exists($upload->published_at, 'toIsoString') ? $upload->published_at->toIsoString() : (string) $upload->published_at)
|
||||
: null,
|
||||
]);
|
||||
$homeGalleryNextPageUrl = method_exists($latestUploads ?? null, 'nextPageUrl') ? $latestUploads->nextPageUrl() : null;
|
||||
@endphp
|
||||
|
||||
@push('head')
|
||||
@@ -19,25 +42,15 @@
|
||||
@endpush
|
||||
|
||||
{{-- Latest uploads grid — use same Nova gallery layout as /browse --}}
|
||||
<section class="px-6 pb-10 pt-6 md:px-10" data-nova-gallery data-gallery-type="home-uploads">
|
||||
<div class="{{ ($gridV2 ?? false) ? 'gallery' : 'grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-6' }}" data-gallery-grid>
|
||||
@forelse($latestUploads as $upload)
|
||||
<x-artwork-card :art="$upload" />
|
||||
@empty
|
||||
<div class="panel panel-default effect2">
|
||||
<div class="panel-heading"><strong>No uploads yet</strong></div>
|
||||
<div class="panel-body text-neutral-400">No recent uploads to show.</div>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="flex justify-center mt-10" data-gallery-pagination>
|
||||
{{-- no pagination for home grid; kept for parity with browse layout --}}
|
||||
</div>
|
||||
<div class="hidden" data-gallery-skeleton-template aria-hidden="true">
|
||||
<x-skeleton.artwork-card />
|
||||
</div>
|
||||
<div class="hidden mt-8" data-gallery-skeleton></div>
|
||||
<section class="px-6 pb-10 pt-6 md:px-10">
|
||||
<div
|
||||
data-react-masonry-gallery
|
||||
data-artworks='@json($homeGalleryArtworks)'
|
||||
data-gallery-type="home-uploads"
|
||||
@if ($homeGalleryNextPageUrl) data-next-page-url="{{ $homeGalleryNextPageUrl }}" @endif
|
||||
data-limit="{{ method_exists($latestUploads ?? null, 'perPage') ? $latestUploads->perPage() : $homeGalleryArtworks->count() }}"
|
||||
class="min-h-32"
|
||||
></div>
|
||||
</section>
|
||||
|
||||
@push('styles')
|
||||
@@ -66,5 +79,6 @@
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
@vite('resources/js/entry-masonry-gallery.jsx')
|
||||
@endpush
|
||||
|
||||
|
||||
Reference in New Issue
Block a user