From adaff226510603a2736d254ff72b7511a4df3a9d Mon Sep 17 00:00:00 2001 From: Florian Heinz Date: Tue, 19 May 2026 16:34:25 +0200 Subject: [PATCH] Polish mobile media and sleep bars --- assets/css/app.css | 19 ++++++++++++------- assets/js/app.js | 6 +++--- templates/pages/dashboard.php | 15 ++++++++------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/assets/css/app.css b/assets/css/app.css index 30d4617..3b92ccf 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -929,6 +929,8 @@ body.page-dashboard .content { color: rgba(255, 255, 255, 0.94); font-size: 0.82rem; white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } .sleep-phase-bar__segment--deep { @@ -2180,7 +2182,9 @@ body.page-dashboard .content { .dashboard-shell { padding-inline: 0; - padding-top: max(0.35rem, env(safe-area-inset-top)); + margin-top: calc(-1 * env(safe-area-inset-top)); + min-height: calc(100dvh + env(safe-area-inset-top)); + padding-top: calc(env(safe-area-inset-top) + 0.35rem); padding-bottom: calc(0.9rem + env(safe-area-inset-bottom)); } @@ -2259,14 +2263,15 @@ body.page-dashboard .content { .timeline-media-button { min-height: 0; - height: auto; + height: 18rem; max-height: none; - margin: 0 0 0.7rem; + margin: -2.65rem 0 0.7rem; } .timeline-media-button .timeline-card__image { - height: auto; - max-height: 24rem; + height: 100%; + max-height: none; + object-fit: cover; } .timeline-card__time-chip { @@ -2292,7 +2297,7 @@ body.page-dashboard .content { .timeline-card--with-image .timeline-card__time-chip, .timeline-card--with-image .timeline-card__delete { - top: 2.05rem; + top: 0.75rem; } .timeline-card--with-image .timeline-card__time-chip { @@ -2305,7 +2310,7 @@ body.page-dashboard .content { } .timeline-card--with-image .timeline-card__delete { - right: 1.6rem; + right: 0.75rem; } .timeline-card__delete .ghost-button { diff --git a/assets/js/app.js b/assets/js/app.js index bcbd9d8..59a65d4 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -1440,10 +1440,10 @@ return; } - if (deltaX < 0 && swipeContainer.dataset.nextDate) { - window.location.href = dashboardDayPath(swipeContainer.dataset.nextDate); - } else if (deltaX > 0 && swipeContainer.dataset.prevDate) { + if (deltaX < 0 && swipeContainer.dataset.prevDate) { window.location.href = dashboardDayPath(swipeContainer.dataset.prevDate); + } else if (deltaX > 0 && swipeContainer.dataset.nextDate) { + window.location.href = dashboardDayPath(swipeContainer.dataset.nextDate); } }; diff --git a/templates/pages/dashboard.php b/templates/pages/dashboard.php index b45e5f3..77e64b9 100644 --- a/templates/pages/dashboard.php +++ b/templates/pages/dashboard.php @@ -102,14 +102,15 @@ $optimalSleepHours = max(1.0, min(16.0, (float) ($settings['sleep']['optimal_hou (float) ($item['sleep_deep'] ?? 0), 'rem' => (float) ($item['sleep_rem'] ?? 0), 'core' => (float) ($item['sleep_core'] ?? 0)]; - if ($eventType === 'sleep' && array_sum($sleepPhases) <= 0 && $eventComment !== '') { - if (preg_match('/Tief\s+([0-9]+(?:[,.][0-9]+)?)/u', $eventComment, $match) === 1) { + $sleepPhaseSource = trim($eventComment . ' ' . (string) ($item['duration_label'] ?? '') . ' ' . (string) ($item['distance_label'] ?? '') . ' ' . (string) ($item['energy_label'] ?? '') . ' ' . (string) ($item['heart_rate_label'] ?? '')); + if ($eventType === 'sleep' && array_sum($sleepPhases) <= 0 && $sleepPhaseSource !== '') { + if (preg_match('/(?:Tief|Tiefschlaf)\s*:?[\s]+([0-9]+(?:[,.][0-9]+)?)/u', $sleepPhaseSource, $match) === 1) { $sleepPhases['deep'] = (float) str_replace(',', '.', $match[1]); } - if (preg_match('/REM\s+([0-9]+(?:[,.][0-9]+)?)/u', $eventComment, $match) === 1) { + if (preg_match('/REM(?:-Schlaf)?\s*:?[\s]+([0-9]+(?:[,.][0-9]+)?)/u', $sleepPhaseSource, $match) === 1) { $sleepPhases['rem'] = (float) str_replace(',', '.', $match[1]); } - if (preg_match('/Kern\s+([0-9]+(?:[,.][0-9]+)?)/u', $eventComment, $match) === 1) { + if (preg_match('/(?:Kern|Kernschlaf)\s*:?[\s]+([0-9]+(?:[,.][0-9]+)?)/u', $sleepPhaseSource, $match) === 1) { $sleepPhases['core'] = (float) str_replace(',', '.', $match[1]); } } @@ -125,7 +126,7 @@ $optimalSleepHours = max(1.0, min(16.0, (float) ($settings['sleep']['optimal_hou (string) ($item['heart_rate_label'] ?? ''), ], static function (string $value): bool { $value = trim($value); - return $value !== '' && !preg_match('/^-\s*(Distanz|Energie|Puls|Route)(?:-?Label)?:?$/u', $value); + return $value !== '' && !preg_match('/^-\s*(Distanz|Energie|Puls|Route|Tief|Tiefschlaf|REM|REM-Schlaf|Kern|Kernschlaf)(?:-?Label)?:?(?:\s*[0-9]+(?:[,.][0-9]+)?)?$/u', $value); })); ?> (string) ($item['id'] ?? ''), @@ -190,12 +191,12 @@ $optimalSleepHours = max(1.0, min(16.0, (float) ($settings['sleep']['optimal_hou ['Tief', 'deep'], 'rem' => ['REM', 'rem'], 'core' => ['Kern', 'core']] as $phase => [$label, $class]): ?> - + h 0): ?> - + h