Add iOS mobile polish
This commit is contained in:
@@ -221,31 +221,22 @@ $formatBalanceValue = static function (?array $entry) use ($settings): string {
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($eventType === 'sleep' && $sleepActualTotal > 0): ?>
|
||||
<div class="sleep-phase-bar" aria-label="Schlafphasen" style="--sleep-optimal-left: <?= e((string) $sleepOptimalPercent) ?>%; --sleep-actual-width: <?= e((string) $sleepActualPercent) ?>%; background: linear-gradient(90deg, rgba(90, 188, 242, 0.88) 0%, rgba(44, 126, 190, 0.88) <?= e((string) $sleepActualPercent) ?>%, rgba(255, 255, 255, 0.08) <?= e((string) $sleepActualPercent) ?>%, rgba(255, 255, 255, 0.08) 100%)">
|
||||
<div class="sleep-phase-bar__fill" style="width: <?= e((string) $sleepActualPercent) ?>%">
|
||||
<?php if ($sleepPhaseTotal > 0): ?>
|
||||
<?php foreach (['deep' => ['Tief', 'deep'], 'rem' => ['REM', 'rem'], 'core' => ['Kern', 'core']] as $phase => [$label, $class]): ?>
|
||||
<?php $phaseHours = max(0.0, (float) ($sleepPhases[$phase] ?? 0)); ?>
|
||||
<?php if ($phaseHours <= 0) { continue; } ?>
|
||||
<?php $phasePercent = $sleepActualTotal > 0 ? max(0.5, min(100, ($phaseHours / $sleepActualTotal) * 100)) : 0; ?>
|
||||
<span class="sleep-phase-bar__segment sleep-phase-bar__segment--<?= e($class) ?><?= $phasePercent < 13 ? ' is-compact' : '' ?>" style="width: <?= e((string) $phasePercent) ?>%; flex-basis: <?= e((string) $phasePercent) ?>%" title="<?= e($label) ?>: <?= e(format_duration_hours($phaseHours)) ?>" data-tooltip="<?= e($label) ?>: <?= e(format_duration_hours($phaseHours)) ?>">
|
||||
<strong><?= e($label) ?></strong> <?= e(format_duration_hours($phaseHours)) ?>
|
||||
</span>
|
||||
<?php $sleepPhaseLeft += $phaseHours; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($sleepUnclassified > 0): ?>
|
||||
<?php $unclassifiedPercent = $sleepActualTotal > 0 ? max(0.5, min(100, ($sleepUnclassified / $sleepActualTotal) * 100)) : 0; ?>
|
||||
<span class="sleep-phase-bar__segment sleep-phase-bar__segment--total<?= $sleepPhaseTotal > 0 ? ' is-after-phase' : '' ?><?= $unclassifiedPercent < 13 ? ' is-compact' : '' ?>" style="width: <?= e((string) $unclassifiedPercent) ?>%; flex-basis: <?= e((string) $unclassifiedPercent) ?>%" title="Schlaf: <?= e(format_duration_hours($sleepUnclassified)) ?>" data-tooltip="Schlaf: <?= e(format_duration_hours($sleepUnclassified)) ?>">
|
||||
<strong>Schlaf</strong> <?= e(format_duration_hours($sleepUnclassified)) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="sleep-phase-bar" aria-label="Schlafdauer" style="--sleep-optimal-left: <?= e((string) $sleepOptimalPercent) ?>%; --sleep-actual-width: <?= e((string) $sleepActualPercent) ?>%">
|
||||
<span class="sleep-phase-bar__fill" aria-hidden="true"></span>
|
||||
<span class="sleep-phase-bar__target"><span><?= e(format_duration_hours($optimalSleepHours)) ?></span></span>
|
||||
<?php if ($sleepPhaseRemainder > 0): ?>
|
||||
<span class="sleep-phase-bar__rest-label">noch <?= e(format_duration_hours($sleepPhaseRemainder)) ?> bis Skalenende</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($sleepPhaseTotal > 0): ?>
|
||||
<div class="sleep-phase-legend" aria-label="Schlafphasen">
|
||||
<?php foreach (['deep' => ['Tief', 'deep'], 'rem' => ['REM', 'rem'], 'core' => ['Kern', 'core']] as $phase => [$label, $class]): ?>
|
||||
<?php $phaseHours = max(0.0, (float) ($sleepPhases[$phase] ?? 0)); ?>
|
||||
<?php if ($phaseHours <= 0) { continue; } ?>
|
||||
<span class="sleep-phase-legend__item sleep-phase-legend__item--<?= e($class) ?>"><strong><?= e($label) ?></strong> <?= e(format_duration_hours($phaseHours)) ?></span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($eventStats !== []): ?>
|
||||
@@ -589,24 +580,30 @@ $formatBalanceValue = static function (?array $entry) use ($settings): string {
|
||||
$sportType = $eventType === 'sport' ? find_sport_type($settings, (string) ($event['sport_type_id'] ?? '')) : null;
|
||||
$eventValue = (float) ($event['value'] ?? 0);
|
||||
$eventValueText = $eventValue > 0 ? ($eventType === 'sleep' ? format_duration_hours($eventValue) : rtrim(rtrim(number_format($eventValue, 2, ',', '.'), '0'), ',') . ' ' . (string) ($event['unit'] ?? '')) : '';
|
||||
$eventTitle = trim((string) ($event['comment'] ?? '')) !== '' ? trim((string) $event['comment']) : day_event_type_label($eventType);
|
||||
$eventDetail = $eventValueText;
|
||||
$eventComment = trim((string) ($event['comment'] ?? ''));
|
||||
if (preg_match('/^\s*-\s*(?:Stimmung|Energie|Stress)\s*:\s*[+-]?\d+\s*$/u', $eventComment) === 1) {
|
||||
$eventComment = '';
|
||||
}
|
||||
$eventTitle = day_event_type_label($eventType);
|
||||
$eventDetails = array_values(array_filter([$eventValueText, $eventComment], static fn (string $value): bool => trim($value) !== ''));
|
||||
|
||||
if ($eventType === 'sport') {
|
||||
$eventTitle = (string) ($sportType['label'] ?? 'Sport');
|
||||
}
|
||||
|
||||
if ($eventType === 'sleep' && trim((string) ($event['comment'] ?? '')) === '') {
|
||||
if ($eventType === 'sleep') {
|
||||
$eventTitle = 'Schlaf';
|
||||
} elseif ($eventType === 'walk') {
|
||||
$eventTitle = 'Spaziergang';
|
||||
}
|
||||
?>
|
||||
<li class="range-moment-list__item range-moment-list__item--<?= e($eventTone) ?>">
|
||||
<span class="range-moment-list__bullet" aria-hidden="true"></span>
|
||||
<span>
|
||||
<strong><?= e($eventTitle) ?></strong>
|
||||
<?php if ($eventDetail !== ''): ?>
|
||||
<?php foreach ($eventDetails as $eventDetail): ?>
|
||||
<span><?= e($eventDetail) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Reference in New Issue
Block a user