optimizations
This commit is contained in:
@@ -24,6 +24,49 @@
|
||||
</x-slot>
|
||||
</x-nova-page-header>
|
||||
|
||||
@php
|
||||
$cacheTone = match ($feed_meta['cache_status'] ?? null) {
|
||||
'hit' => 'text-emerald-200 ring-emerald-400/30 bg-emerald-500/12',
|
||||
'stale' => 'text-amber-200 ring-amber-400/30 bg-amber-500/12',
|
||||
default => 'text-sky-100 ring-sky-300/30 bg-sky-500/12',
|
||||
};
|
||||
$generatedAt = !empty($feed_meta['generated_at']) ? \Illuminate\Support\Carbon::parse($feed_meta['generated_at'])->diffForHumans() : null;
|
||||
@endphp
|
||||
|
||||
<section class="px-6 md:px-10">
|
||||
<div class="grid gap-3 rounded-[1.6rem] border border-white/8 bg-[radial-gradient(circle_at_top_left,_rgba(56,189,248,0.14),_transparent_42%),linear-gradient(180deg,rgba(15,23,42,0.96),rgba(2,6,23,0.88))] p-5 shadow-[0_18px_60px_rgba(2,6,23,0.38)] md:grid-cols-[minmax(0,1fr)_auto] md:items-center">
|
||||
<div class="space-y-2">
|
||||
<p class="text-[0.7rem] font-semibold uppercase tracking-[0.28em] text-sky-200/70">Personalized discovery</p>
|
||||
<p class="max-w-3xl text-sm leading-6 text-slate-300">
|
||||
This feed now runs on the same recommendation engine as the API, so your views and clicks on this page can refine what shows up next.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2 text-xs text-slate-200/85">
|
||||
<span class="inline-flex items-center gap-2 rounded-full ring-1 ring-white/12 bg-white/6 px-3 py-1.5">
|
||||
<span class="text-slate-400">Model</span>
|
||||
<span>{{ $feed_meta['algo_version'] ?? 'n/a' }}</span>
|
||||
</span>
|
||||
<span class="inline-flex items-center gap-2 rounded-full ring-1 px-3 py-1.5 {{ $cacheTone }}">
|
||||
<span class="text-slate-300/70">Cache</span>
|
||||
<span>{{ str_replace(['-', '_'], ' ', $feed_meta['cache_status'] ?? 'unknown') }}</span>
|
||||
</span>
|
||||
@if (!empty($feed_meta['total_candidates']))
|
||||
<span class="inline-flex items-center gap-2 rounded-full ring-1 ring-white/12 bg-white/6 px-3 py-1.5">
|
||||
<span class="text-slate-400">Candidates</span>
|
||||
<span>{{ number_format((int) $feed_meta['total_candidates']) }}</span>
|
||||
</span>
|
||||
@endif
|
||||
@if ($generatedAt)
|
||||
<span class="inline-flex items-center gap-2 rounded-full ring-1 ring-white/12 bg-white/6 px-3 py-1.5">
|
||||
<span class="text-slate-400">Refreshed</span>
|
||||
<span>{{ $generatedAt }}</span>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{-- ── Artwork grid (React MasonryGallery) ── --}}
|
||||
@php
|
||||
$galleryArtworks = $artworks->map(fn ($art) => [
|
||||
@@ -32,13 +75,20 @@
|
||||
'thumb' => $art->thumb_url ?? null,
|
||||
'thumb_srcset' => $art->thumb_srcset ?? null,
|
||||
'uname' => $art->uname ?? '',
|
||||
'username' => $art->uname ?? '',
|
||||
'username' => $art->username ?? '',
|
||||
'avatar_url' => $art->avatar_url ?? null,
|
||||
'published_at' => $art->published_at ?? null,
|
||||
'content_type_name' => $art->content_type_name ?? '',
|
||||
'category_name' => $art->category_name ?? '',
|
||||
'category_slug' => $art->category_slug ?? '',
|
||||
'slug' => $art->slug ?? '',
|
||||
'url' => $art->url ?? null,
|
||||
'width' => $art->width ?? null,
|
||||
'height' => $art->height ?? null,
|
||||
'recommendation_source' => $art->recommendation_source ?? 'mixed',
|
||||
'recommendation_reason' => $art->recommendation_reason ?? 'Picked for you',
|
||||
'recommendation_score' => $art->recommendation_score,
|
||||
'recommendation_algo_version' => $art->recommendation_algo_version ?? ($feed_meta['algo_version'] ?? null),
|
||||
])->values();
|
||||
@endphp
|
||||
<section class="px-6 pt-8 md:px-10">
|
||||
@@ -47,6 +97,8 @@
|
||||
data-artworks="{{ json_encode($galleryArtworks) }}"
|
||||
data-gallery-type="for-you"
|
||||
data-cursor-endpoint="{{ route('discover.for-you') }}"
|
||||
data-discovery-endpoint="{{ route('api.discovery.events.store') }}"
|
||||
data-algo-version="{{ $feed_meta['algo_version'] ?? '' }}"
|
||||
@if (!empty($next_cursor)) data-next-cursor="{{ $next_cursor }}" @endif
|
||||
data-limit="40"
|
||||
class="min-h-32"
|
||||
|
||||
Reference in New Issue
Block a user