@extends('layouts.student_dashboard') @section('title', 'Student Dashboard') @push('styles') @endpush @section('content') @php use App\Helpers\StudentHelper; use Carbon\Carbon; use Illuminate\Support\Str; $fullName = $studentProfile['name'] ?? StudentHelper::name() ?? 'Student'; $firstName = explode(' ', trim($fullName))[0] ?: 'Student'; $regNo = $studentProfile['regno'] ?? StudentHelper::regno() ?? '-'; $batchLabel = $studentProfile['batch'] ?? '-'; $deptLabel = StudentHelper::deptName(); // Initials for avatar fallback $nameParts = preg_split('/\s+/', trim($fullName)); $initials = strtoupper(substr($nameParts[0] ?? 'S', 0, 1) . (isset($nameParts[1]) ? substr($nameParts[1], 0, 1) : '')); // Time-aware greeting (Asia/Kolkata) $hour = Carbon::now('Asia/Kolkata')->hour; if ($hour < 12) { $greeting = 'Good Morning'; $greetIcon = 'fa-sun'; } elseif ($hour < 17) { $greeting = 'Good Afternoon'; $greetIcon = 'fa-cloud-sun'; } else { $greeting = 'Good Evening'; $greetIcon = 'fa-moon'; } // Aggregate coding totals across all tracked courses $totalEasy = 0; $totalMedium = 0; $totalHard = 0; $courseCount = is_array($courseStats) ? count($courseStats) : 0; if (!empty($courseStats)) { foreach ($courseStats as $cs) { $totalEasy += (int) ($cs['easy']['solved'] ?? 0); $totalMedium += (int) ($cs['medium']['solved'] ?? 0); $totalHard += (int) ($cs['hard']['solved'] ?? 0); } } $totalSolved = $totalEasy + $totalMedium + $totalHard; $analyticsCount = !empty($aiAnalyticsData) ? count($aiAnalyticsData) : 0; $notifCount = isset($notifications) ? $notifications->count() : 0; // Fun Gamified Coder Rank & Level Progress based on solved puzzles $coderLevel = intdiv($totalSolved, 5) + 1; $levelProgress = ($totalSolved % 5) * 20; if ($levelProgress === 0 && $totalSolved > 0) { $levelProgress = 100; } elseif ($levelProgress === 0) { $levelProgress = 12; } if ($totalSolved >= 50) { $coderRank = 'Code Wizard'; } elseif ($totalSolved >= 25) { $coderRank = 'Super Coder'; } elseif ($totalSolved >= 10) { $coderRank = 'Star Builder'; } elseif ($totalSolved >= 3) { $coderRank = 'Code Explorer'; } else { $coderRank = 'Little Bud Coder'; } $formatSeconds = function ($seconds) { $sec = (int) $seconds; if ($sec >= 3600) { $h = floor($sec / 3600); $m = floor(($sec % 3600) / 60); return "{$h}h {$m}m"; } if ($sec >= 60) { $m = floor($sec / 60); $s = $sec % 60; return $s > 0 ? "{$m}m {$s}s" : "{$m}m"; } return "{$sec}s"; }; @endphp
{{-- ================================================================ 1. LITTLE BUDS CODING — GAMIFIED HERO BANNER (DAY & SPACE MODES) ================================================================ --}}
{{-- DAYTIME LAYER (Light Mode: Sun, Clouds, Rolling Green Hills) --}} {{-- NIGHTTIME SPACE LAYER (Dark Mode: Stars, Glowing Moon, Ringed Planet) --}} {{-- Gently Floating Code Symbols --}}
{{ $fullName }}
LITTLE BUDS CODING Lvl {{ $coderLevel }} · {{ $coderRank }}

{{ $greeting }}, {{ $firstName }}!

{{ $regNo }} Batch {{ $batchLabel }} @if(!empty($deptLabel) && $deptLabel !== 'Unknown Department') {{ $deptLabel }} @endif
Coder XP Progress {{ $totalSolved }} Puzzles Solved
{{-- Interactive Coding Owl Buddy (Click for Star Confetti!) --}}
Let's code something awesome!
Star Score {{ $studentScore ?? 0 }}
@if(!empty($calendarLink)) Academic Calendar @else @endif Ask Doubt / Help
{{-- ================================================================ 2. ARCADE 3D QUICK-LAUNCH QUEST CARDS ================================================================ --}}

Choose Your Coding Quest!

PLAY
My Courses Learn & code
GO
Coding Tests Fun challenges
QUIZ
MCQ Tests Quick quizzes
CODE
Playground Run code live
CHECK
Attendance Track presence
LIVE
Live Meets Join sessions
{{-- ================================================================ 3. SUMMARY KPI TREASURE CARDS ================================================================ --}}
Puzzles Solved {{ $totalSolved }} {{ $totalEasy }}E · {{ $totalMedium }}M · {{ $totalHard }}H
Active Courses {{ $courseCount }} With coding activity
Doubts Raised {{ $doubtCount ?? 0 }} Teacher Q&A thread
Recent Alerts {{ $notifCount }} Latest announcements
{{-- ================================================================ 4. MAIN BENTO ANALYTICS (CODING PROGRESS + LEARNING ANALYTICS) ================================================================ --}}
{{-- CARD A: CODING PROGRESS --}}

Coding Progress

Your stars & solved coding levels

@if($courseCount > 1) @endif
@if($courseCount > 1) @endif
{{-- CARD B: LEARNING ANALYTICS (TOPIC PERFORMANCE) --}}

Learning Analytics

AI-tracked topic time & super skills

@if($analyticsCount > 1) @endif
@if($analyticsCount > 1) @endif
{{-- ================================================================ 5. RECENT NOTIFICATIONS FEED ================================================================ --}}

Recent Notifications

Updates from your school, teachers & courses

View All
@if($notifCount > 0) @else
You're All Caught Up!

No new notifications right now. Any new announcements from your teachers will appear here.

@endif
@endsection