From 3d48595ee9c1ed9d0f23d24cbf32a40a1a32116a Mon Sep 17 00:00:00 2001 From: PBBFA24AAL Date: Sun, 9 Aug 2026 02:33:02 +0200 Subject: [PATCH] Show reminders on dashboard --- app/Controllers/HabitController.php | 10 +++- app/Views/habits/dashboard.php | 54 ++++++++++++++++++ public/assets/css/style.css | 88 ++++++++++++++++++++++++++++- 3 files changed, 150 insertions(+), 2 deletions(-) diff --git a/app/Controllers/HabitController.php b/app/Controllers/HabitController.php index 5991b3f..9b488a0 100644 --- a/app/Controllers/HabitController.php +++ b/app/Controllers/HabitController.php @@ -6,15 +6,23 @@ class HabitController { require_login(); + $userId = (int) current_user_id(); + $filters = [ 'category_id' => $_GET['category_id'] ?? '', 'status' => $_GET['status'] ?? '', ]; + $remindersByHabit = []; + foreach (Reminder::allForUser($userId) as $reminder) { + $remindersByHabit[(int) $reminder['habit_id']][] = $reminder; + } + View::render('habits/dashboard', [ - 'habits' => Habit::allForUser(current_user_id(), $filters), + 'habits' => Habit::allForUser($userId, $filters), 'categories' => Category::all(), 'filters' => $filters, + 'remindersByHabit' => $remindersByHabit, ]); } diff --git a/app/Views/habits/dashboard.php b/app/Views/habits/dashboard.php index 15c6df5..0547996 100644 --- a/app/Views/habits/dashboard.php +++ b/app/Views/habits/dashboard.php @@ -1,3 +1,16 @@ + 'Montag', + 2 => 'Dienstag', + 3 => 'Mittwoch', + 4 => 'Donnerstag', + 5 => 'Freitag', + 6 => 'Samstag', + 7 => 'Sonntag', +]; +?> +

Heute

@@ -35,6 +48,7 @@
+
@@ -61,6 +75,46 @@
+ +
+
+

Erinnerungen

+ Erinnerung hinzufuegen +
+ + +

Noch keine Erinnerung eingerichtet.

+ +
    + + +
  • + + + +
    +
    + + + +
    + Bearbeiten +
    + + + +
    +
    +
  • + +
+ +
diff --git a/public/assets/css/style.css b/public/assets/css/style.css index 167d24c..d411060 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -114,7 +114,8 @@ a { } h1, -h2 { +h2, +h3 { line-height: 1.2; margin: 0; } @@ -127,6 +128,10 @@ h2 { font-size: 20px; } +h3 { + font-size: 16px; +} + .button, button { background: var(--primary); @@ -212,6 +217,7 @@ input.input-error { border: 1px solid var(--line); border-radius: 8px; display: flex; + flex-wrap: wrap; gap: 18px; justify-content: space-between; padding: 18px; @@ -223,6 +229,7 @@ input.input-error { .habit-main { display: flex; + flex: 1 1 480px; gap: 14px; } @@ -247,6 +254,71 @@ input.input-error { justify-content: flex-end; } +.habit-reminders { + border-top: 1px solid var(--line); + flex-basis: 100%; + margin-top: 2px; + padding-top: 14px; +} + +.reminder-heading { + align-items: center; + display: flex; + gap: 12px; + justify-content: space-between; +} + +.reminder-empty, +.form-help, +.form small { + color: var(--muted); +} + +.reminder-list { + display: grid; + gap: 8px; + list-style: none; + margin: 12px 0 0; + padding: 0; +} + +.reminder-item { + align-items: center; + background: var(--bg); + border-radius: 6px; + display: grid; + gap: 12px; + grid-template-columns: 72px minmax(100px, 1fr) auto auto; + padding: 10px 12px; +} + +.reminder-item.paused { + opacity: 0.68; +} + +.reminder-time { + font-variant-numeric: tabular-nums; +} + +.reminder-status { + color: var(--muted); + font-size: 14px; + font-weight: 700; +} + +.reminder-actions { + align-items: center; + display: flex; + flex-wrap: wrap; + gap: 10px; + justify-content: flex-end; +} + +.reminder-actions button { + min-height: 36px; + padding: 6px 10px; +} + @media (max-width: 720px) { .topbar, .dashboard-head, @@ -271,5 +343,19 @@ input.input-error { .habit-actions { justify-content: flex-start; } + + .reminder-item { + align-items: start; + grid-template-columns: 72px 1fr; + } + + .reminder-status, + .reminder-actions { + grid-column: 1 / -1; + } + + .reminder-actions { + justify-content: flex-start; + } }