@extends('siswa.layouts.app') @section('title', 'Leaderboard') @push('styles') @endpush @section('content') @php $siswaLogin = Auth::guard('siswa')->user(); @endphp

๐Ÿ… Leaderboard

Peringkat siswa berdasarkan total EXP yang dikumpulkan.

Semester {{ $semester }} ยท {{ $tahunAjaran }} @if($leaderboard->isEmpty())
๐Ÿ“Š

Belum ada data leaderboard.

Kerjakan challenge untuk masuk leaderboard!

@else @php $top3 = $leaderboard->take(3); $first = $top3->firstWhere('ranking', 1); $second = $top3->firstWhere('ranking', 2); $third = $top3->firstWhere('ranking', 3); @endphp @if($first)
@if($second)
@if(!empty($second['foto_profil'])) @else {{ strtoupper(substr($second['nama'], 0, 1)) }} @endif
{{ $second['nama'] }}
โญ {{ number_format($second['exp']) }}
2
@endif
๐Ÿ‘‘ @if(!empty($first['foto_profil'])) @else {{ strtoupper(substr($first['nama'], 0, 1)) }} @endif
{{ $first['nama'] }}
โญ {{ number_format($first['exp']) }}
1
@if($third)
@if(!empty($third['foto_profil'])) @else {{ strtoupper(substr($third['nama'], 0, 1)) }} @endif
{{ $third['nama'] }}
โญ {{ number_format($third['exp']) }}
3
@endif
@endif @if($myRank)
@if(!empty($myRank['foto_profil'])) @else
{{ strtoupper(substr($myRank['nama'], 0, 1)) }}
@endif
#{{ $myRank['ranking'] }}
Posisimu saat ini
{{ $myRank['nama'] }}
โญ {{ number_format($myRank['exp']) }} EXP
๐ŸŽฏ
@endif

๐Ÿ“‹ Semua Peringkat

@foreach($leaderboard as $item) @php $isMe = $item['id_siswa'] === $siswaLogin->id_siswa; $rankClass = match($item['ranking']) { 1=>'gold', 2=>'silver', 3=>'bronze', default=>'' }; @endphp
@if($item['ranking'] === 1) ๐Ÿฅ‡ @elseif($item['ranking'] === 2) ๐Ÿฅˆ @elseif($item['ranking'] === 3) ๐Ÿฅ‰ @else {{ $item['ranking'] }} @endif
@if(!empty($item['foto_profil'])) @else
{{ strtoupper(substr($item['nama'], 0, 1)) }}
@endif
{{ $item['nama'] }} @if($isMe) Kamu @endif
{{ $item['nisn'] }}
โญ {{ number_format($item['exp']) }}
@endforeach
@endif @endsection