69 lines
2.9 KiB
PHP
69 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Dashboard;
|
|
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Support\Carbon;
|
|
use Livewire\Attributes\Lazy;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Component;
|
|
|
|
#[Layout('layouts.dashboard', ['active' => 'dashboard'])]
|
|
#[Lazy]
|
|
class Index extends Component
|
|
{
|
|
public static function placeholder(array $params = []): View
|
|
{
|
|
return view('livewire.dashboard.placeholder');
|
|
}
|
|
|
|
|
|
public int $totalPoints = 2480;
|
|
public int $streakDays = 7;
|
|
public int $weekMinutes = 86;
|
|
public string $testRatio = '18 / 24';
|
|
|
|
public function render(): View
|
|
{
|
|
$user = auth()->user();
|
|
$firstName = $user ? explode(' ', $user->name)[0] : 'Lina';
|
|
|
|
return view('livewire.dashboard.index', [
|
|
'firstName' => $firstName,
|
|
'today' => Carbon::now()->locale('de')->isoFormat('dddd · D. MMMM'),
|
|
'subjects' => $this->subjects(),
|
|
'tasks' => $this->tasks(),
|
|
'rewards' => $this->rewards(),
|
|
]);
|
|
}
|
|
|
|
protected function subjects(): array
|
|
{
|
|
return [
|
|
['name' => 'Mathematik', 'icon' => '∑', 'color' => 'primary', 'lessons' => '18 / 24', 'progress' => 75, 'next' => 'Schriftliches Multiplizieren'],
|
|
['name' => 'Deutsch', 'icon' => 'A', 'color' => 'rose', 'lessons' => '13 / 20', 'progress' => 65, 'next' => 'Wortarten erkennen'],
|
|
['name' => 'Englisch', 'icon' => 'E', 'color' => 'violet', 'lessons' => '8 / 16', 'progress' => 50, 'next' => 'Past Simple üben'],
|
|
['name' => 'Sachkunde', 'icon' => '🌱', 'color' => 'green', 'lessons' => '14 / 18', 'progress' => 78, 'next' => 'Wasserkreislauf'],
|
|
];
|
|
}
|
|
|
|
protected function tasks(): array
|
|
{
|
|
return [
|
|
['title' => 'Multiplikation bis 100', 'meta' => 'Mathematik · 12 Aufgaben · 15 Min.', 'icon' => '∑', 'color' => 'primary', 'points' => 120],
|
|
['title' => 'Wortarten: Nomen & Verben', 'meta' => 'Deutsch · Lese-Aufgabe · 10 Min.', 'icon' => 'A', 'color' => 'rose', 'points' => 80],
|
|
['title' => 'Vocab Review: Animals', 'meta' => 'Englisch · Karteikarten · 8 Min.', 'icon' => 'E', 'color' => 'violet', 'points' => 60],
|
|
['title' => 'Kreislauf des Wassers', 'meta' => 'Sachkunde · Video + Quiz · 12 Min.', 'icon' => '🌱', 'color' => 'green', 'points' => 100],
|
|
];
|
|
}
|
|
|
|
protected function rewards(): array
|
|
{
|
|
return [
|
|
['title' => 'Avatar-Brille (gold)', 'emoji' => '🎨', 'status' => 'Verfügbar', 'price' => 800, 'available' => true],
|
|
['title' => 'Einhorn-Begleiter', 'emoji' => '🦄', 'status' => 'Verfügbar', 'price' => 1500, 'available' => true],
|
|
['title' => 'Raketen-Theme', 'emoji' => '🚀', 'status' => 'Noch 720 Pkt. nötig', 'price' => 3200, 'available' => false],
|
|
];
|
|
}
|
|
}
|