@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
Your stars & solved coding levels
AI-tracked topic time & super skills
Updates from your school, teachers & courses
{{ Str::limit($notification->message, 120) }}
No new notifications right now. Any new announcements from your teachers will appear here.