login update
This commit is contained in:
@@ -36,9 +36,61 @@
|
||||
|
||||
{{-- ── Leaderboard ── --}}
|
||||
<div class="px-6 pb-16 md:px-10">
|
||||
@php $offset = ($authors->currentPage() - 1) * $authors->perPage(); @endphp
|
||||
@php
|
||||
$offset = ($authors->currentPage() - 1) * $authors->perPage();
|
||||
$isFirstPage = $authors->currentPage() === 1;
|
||||
$showcaseTop = $isFirstPage ? $authors->getCollection()->take(3)->values() : collect();
|
||||
$tableAuthors = $isFirstPage ? $authors->getCollection()->slice(3)->values() : $authors->getCollection();
|
||||
$rankBase = $isFirstPage ? 3 : 0;
|
||||
@endphp
|
||||
|
||||
@if ($authors->isNotEmpty())
|
||||
@if ($showcaseTop->isNotEmpty())
|
||||
<div class="mb-6 grid gap-4 md:grid-cols-3">
|
||||
@foreach ($showcaseTop as $i => $author)
|
||||
@php
|
||||
$rank = $i + 1;
|
||||
$profileUrl = ($author->username ?? null)
|
||||
? '/@' . $author->username
|
||||
: '/profile/' . (int) $author->user_id;
|
||||
$avatarUrl = \App\Support\AvatarUrl::forUser((int) $author->user_id, $author->avatar_hash ?? null, 64);
|
||||
|
||||
$rankClasses = $rank === 1
|
||||
? 'bg-amber-400/15 text-amber-300 ring-amber-400/30'
|
||||
: ($rank === 2
|
||||
? 'bg-slate-400/15 text-slate-300 ring-slate-400/30'
|
||||
: 'bg-orange-700/20 text-orange-400 ring-orange-600/30');
|
||||
@endphp
|
||||
|
||||
<a href="{{ $profileUrl }}"
|
||||
class="rounded-xl border border-white/[0.08] bg-white/[0.03] p-5 hover:bg-white/[0.05] transition-colors">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<span class="inline-flex items-center justify-center w-8 h-8 rounded-full text-sm font-bold ring-1 {{ $rankClasses }}">
|
||||
{{ $rank }}
|
||||
</span>
|
||||
<span class="text-xs font-semibold uppercase tracking-widest {{ $metric === 'downloads' ? 'text-emerald-300/80' : 'text-sky-300/80' }}">
|
||||
{{ $metric === 'downloads' ? 'Downloads' : 'Views' }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<img src="{{ $avatarUrl }}" alt="{{ $author->uname }}"
|
||||
class="w-14 h-14 rounded-full object-cover ring-1 ring-white/[0.12]">
|
||||
<div class="min-w-0">
|
||||
<div class="truncate text-base font-semibold text-white">{{ $author->uname ?? 'Unknown' }}</div>
|
||||
@if (!empty($author->username))
|
||||
<div class="truncate text-xs text-white/40">{{ '@' . $author->username }}</div>
|
||||
@endif
|
||||
<div class="mt-1 text-lg font-bold {{ $metric === 'downloads' ? 'text-emerald-400' : 'text-sky-400' }}">
|
||||
{{ number_format($author->total ?? 0) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="rounded-xl border border-white/[0.06] overflow-hidden">
|
||||
|
||||
{{-- Table header --}}
|
||||
@@ -52,13 +104,13 @@
|
||||
|
||||
{{-- Rows --}}
|
||||
<div class="divide-y divide-white/[0.04]">
|
||||
@foreach ($authors as $i => $author)
|
||||
@foreach ($tableAuthors as $i => $author)
|
||||
@php
|
||||
$rank = $offset + $i + 1;
|
||||
$rank = $offset + $rankBase + $i + 1;
|
||||
$profileUrl = ($author->username ?? null)
|
||||
? '/@' . $author->username
|
||||
: '/profile/' . (int) $author->user_id;
|
||||
$avatarUrl = \App\Support\AvatarUrl::forUser((int) $author->user_id, null, 40);
|
||||
$avatarUrl = \App\Support\AvatarUrl::forUser((int) $author->user_id, $author->avatar_hash ?? null, 64);
|
||||
@endphp
|
||||
<div class="grid grid-cols-[3rem_1fr_auto] items-center gap-4 px-5 py-4
|
||||
{{ $rank <= 3 ? 'bg-white/[0.015]' : '' }} hover:bg-white/[0.03] transition-colors">
|
||||
|
||||
Reference in New Issue
Block a user