@php
$completedCount = isset($enrolledCourses) ? $enrolledCourses->filter(fn($c) => ($c->progress ?? 0) >= 100)->count() : 0;
$allTiers = [
['min' => 12, 'name' => 'Master', 'icon' => '👑', 'color' => '#fbbf24', 'desc' => 'Ultimate language champion'],
['min' => 9, 'name' => 'Expert', 'icon' => '💎', 'color' => '#22d3ee', 'desc' => 'Highly skilled polyglot'],
['min' => 6, 'name' => 'Achiever', 'icon' => '⭐', 'color' => '#a855f7', 'desc' => 'Dedicated learner'],
['min' => 3, 'name' => 'Explorer', 'icon' => '🔍', 'color' => '#3b82f6', 'desc' => 'Curious adventurer'],
['min' => 1, 'name' => 'Beginner', 'icon' => '🌱', 'color' => '#22c55e', 'desc' => 'Starting the journey'],
];
@endphp
{{ $completedCount }}
Courses Completed
@foreach($allTiers as $tier)
@php
$isUnlocked = $completedCount >= $tier['min'];
$isCurrent = false;
if ($isUnlocked) {
// Check if this is the current tier (highest unlocked)
$higherTiers = array_filter($allTiers, fn($t) => $t['min'] > $tier['min'] && $completedCount >= $t['min']);
$isCurrent = empty($higherTiers);
}
$tierClass = 'tier-' . strtolower($tier['name']);
@endphp
{{ $tier['icon'] }}
{{ $tier['desc'] }}
@if($isUnlocked)
Unlocked
@else
🔒 {{ $tier['min'] }} courses needed
@endif
@if(!$isUnlocked)
{{ $completedCount }}/{{ $tier['min'] }}
@endif
@endforeach