๐ Trophy Cabinet
@if(count($allTrophies) > 0)
@php
$initialActiveIndex = 0;
foreach($allTrophies as $index => $trophy) {
$hasEarned = Auth::user()->cups >= $trophy->min_cups;
if ($hasEarned) {
$initialActiveIndex = $index;
}
}
@endphp
@php
$nextTrophy = null;
$prevTrophyCups = 0;
foreach($allTrophies as $index => $t) {
if (Auth::user()->cups < $t->min_cups) {
$nextTrophy = $t;
if ($index > 0) {
$prevTrophyCups = $allTrophies[$index - 1]->min_cups;
}
break;
}
}
if ($nextTrophy) {
$targetCups = $nextTrophy->min_cups;
$currentCups = Auth::user()->cups;
$totalSegment = $targetCups - $prevTrophyCups;
$currentSegment = max(0, $currentCups - $prevTrophyCups);
$percent = $totalSegment > 0 ? min(100, round(($currentSegment / $totalSegment) * 100)) : 0;
} else {
$percent = 100;
$targetCups = Auth::user()->cups;
$currentCups = Auth::user()->cups;
}
@endphp
๐ฏ
Next Milestone
@if($nextTrophy)
{{ $nextTrophy->name }}
@else
Ultimate Mode Active
@endif
{{ $currentCups }} / {{ $targetCups }} Cups
@if($nextTrophy)
๐
Earn {{ $targetCups - $currentCups }} more cups to unlock!
@else
๐
All Trophies Unlocked!
@endif
@else
No trophies available yet
@endif
๐ Practice Quizzes
@php
$userId = Auth::id();
$completedQuizIds = \App\Models\QuizAttempt::where('user_id', $userId)
->whereNotNull('completed_at')
->pluck('quiz_id')
->toArray();
$allPendingQuizzes = \App\Models\Quiz::whereNotIn('quizzes.id', $completedQuizIds)
->select('quizzes.*', 'sub_lessons.lesson_id', 'sub_lessons.order as sub_lesson_order', 'sub_lessons.title as sub_lesson_title', 'lessons.title as lesson_title', 'lessons.icon_path as lesson_icon_path')
->join('sub_lessons', 'quizzes.sub_lesson_id', '=', 'sub_lessons.id')
->join('lessons', 'sub_lessons.lesson_id', '=', 'lessons.id')
->withCount('questions')
->orderBy('lessons.id', 'asc')
->orderBy('sub_lessons.order', 'asc')
->orderBy('quizzes.id', 'asc')
->get();
$nextQuizzes = collect();
$seenLessons = [];
foreach ($allPendingQuizzes as $quiz) {
if (!in_array($quiz->lesson_id, $seenLessons)) {
$seenLessons[] = $quiz->lesson_id;
$nextQuizzes->push($quiz);
if ($nextQuizzes->count() >= 4) {
break;
}
}
}
$styles = [
[
'icon' => '๐ฌ',
'bg' => 'bg-green-100/80',
'border' => 'border-green-200/50',
'text' => 'text-green-600',
'badge' => 'bg-green-500/90',
'glow' => 'bg-green-200/30',
'hover_text' => 'group-hover:text-green-700'
],
[
'icon' => '๐งฌ',
'bg' => 'bg-blue-100/80',
'border' => 'border-blue-200/50',
'text' => 'text-blue-600',
'badge' => 'bg-blue-500/90',
'glow' => 'bg-blue-200/30',
'hover_text' => 'group-hover:text-blue-700'
],
[
'icon' => '๐ญ',
'bg' => 'bg-purple-100/80',
'border' => 'border-purple-200/50',
'text' => 'text-purple-600',
'badge' => 'bg-purple-500/90',
'glow' => 'bg-purple-200/30',
'hover_text' => 'group-hover:text-purple-700'
],
[
'icon' => '๐งช',
'bg' => 'bg-rose-100/80',
'border' => 'border-rose-200/50',
'text' => 'text-rose-600',
'badge' => 'bg-rose-500/90',
'glow' => 'bg-rose-200/30',
'hover_text' => 'group-hover:text-rose-700'
],
];
@endphp