feature: main page - always show current user at the bottom of ranking

This commit is contained in:
antv
2026-07-06 16:54:41 +07:00
parent e163d2f349
commit 1e050233b9
3 changed files with 92 additions and 52 deletions
@@ -1,45 +1,51 @@
@if(count($rankers) > 0)
@foreach($rankers as $item)
<x-ranking-item
rank="{{ $item->rank }}"
name="{{ $item->name }}"
team="{{ match((int) $item->departments) {
1 => 'Dev Team',
2 => 'HR Team',
3 => 'Sale Team',
4 => 'Board Team',
5 => 'Marketing Team',
default => 'Team'
} }}"
avatar="{{ $item->avatar ?? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode($item->name) . '&backgroundColor=bfdbfe' }}"
score="{{ $item->score }}"
unit="thẻ"
:isCurrent="$item->msnv == Auth::user()->msnv"
/>
@endforeach
<div class="flex-1 flex flex-col justify-between min-h-[340px]">
@if(count($rankers) > 0)
<div class="flex flex-col">
@foreach($rankers as $item)
<x-ranking-item
rank="{{ $item->rank }}"
name="{{ $item->name }}"
team="{{ match((int) $item->departments) {
1 => 'Dev Team',
2 => 'HR Team',
3 => 'Sale Team',
4 => 'Board Team',
5 => 'Marketing Team',
default => 'Team'
} }}"
avatar="{{ $item->avatar ?? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode($item->name) . '&backgroundColor=bfdbfe' }}"
score="{{ $item->score }}"
unit="thẻ"
:isCurrent="$item->msnv == Auth::user()->msnv"
/>
@endforeach
</div>
@else
<div class="flex-1 flex flex-col justify-center items-center py-6 text-center">
<span class="text-[36px]">🏆</span>
<p class="text-gray-400 font-medium text-[13px] mt-2">Chưa xếp hạng cho tháng này</p>
</div>
@endif
@if($currentUserRankItem)
<div class="my-3 border-t border-dashed border-gray-100 mx-2"></div>
<x-ranking-item
rank="{{ $currentUserRankItem->rank }}"
name="{{ $currentUserRankItem->name }}"
team="{{ match((int) $currentUserRankItem->departments) {
1 => 'Dev Team',
2 => 'HR Team',
3 => 'Sale Team',
4 => 'Board Team',
5 => 'Marketing Team',
default => 'Team'
} }}"
avatar="{{ $currentUserRankItem->avatar ?? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode($currentUserRankItem->name) . '&backgroundColor=bfdbfe' }}"
score="{{ $currentUserRankItem->score }}"
unit="thẻ"
:isCurrent="true"
/>
<div class="mt-auto">
<div class="my-3 border-t border-dashed border-gray-100 mx-2"></div>
<x-ranking-item
rank="{{ $currentUserRankItem->rank > 0 ? $currentUserRankItem->rank : '-' }}"
name="{{ $currentUserRankItem->name }}"
team="{{ match((int) $currentUserRankItem->departments) {
1 => 'Dev Team',
2 => 'HR Team',
3 => 'Sale Team',
4 => 'Board Team',
5 => 'Marketing Team',
default => 'Team'
} }}"
avatar="{{ $currentUserRankItem->avatar ?? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode($currentUserRankItem->name) . '&backgroundColor=bfdbfe' }}"
score="{{ $currentUserRankItem->score }}"
unit="thẻ"
:isCurrent="true"
/>
</div>
@endif
@else
<div class="py-12 text-center">
<span class="text-[36px]">🏆</span>
<p class="text-gray-400 font-medium text-[13px] mt-2">Chưa xếp hạng cho tháng này</p>
</div>
@endif
</div>