@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())
@endif
{{-- Table header --}}
#
Author
{{ $metric === 'downloads' ? 'Downloads' : 'Views' }}
{{-- Rows --}}
@foreach ($tableAuthors as $i => $author)
@php
$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, $author->avatar_hash ?? null, 64);
@endphp
@endforeach
{{ $authors->withQueryString()->links() }}
@else
@endif
@endsection