From ddf4c45ccd1212eed69afd2c4f21a233aa095287 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 6 May 2025 17:03:36 +0200 Subject: [PATCH 1/2] timeline.less: Fix css issues - Add proper minmax value for grid area calculation - Use strict specifier for last.ticks .midnight style --- public/css/timeline.less | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/public/css/timeline.less b/public/css/timeline.less index f64f54ead..b1ab710a8 100644 --- a/public/css/timeline.less +++ b/public/css/timeline.less @@ -74,7 +74,11 @@ .timescale { display: grid; - grid-template-columns: repeat(~"calc(var(--primaryColumns) * var(--timestampsPerDay))", minmax(0,1fr)); + grid-template-columns: repeat( + ~"calc(var(--primaryColumns) * var(--timestampsPerDay))", + minmax(~"calc(var(--minimumPrimaryColumnWidth) / var(--timestampsPerDay))", 1fr) + ); + border-left: 1px solid @gray-lighter; // this is required to maintain the grid layout grid-area: ~"4 / 2 / 4 / 3"; @@ -114,21 +118,21 @@ } } - span:nth-last-of-type(2), // last .ticks before .midnight - .midnight { + > span.ticks:nth-last-of-type(2), // last .ticks and .midnight + > .timestamp.midnight { grid-area: ~"1 / -2 / 1 / -1"; } } .clock { display: grid; - grid-template-columns: repeat(var(--primaryColumns), 1fr); + grid-template-columns: repeat(var(--primaryColumns), minmax(var(--minimumPrimaryColumnWidth), 1fr)); grid-area: ~"3 / 2 / 4 / 3"; border-top: 1px solid transparent; // left not required, otherwise the .time-hand is not aligned properly .current-day { display: grid; - grid-template-columns: repeat(var(--columnsPerStep), 1fr); + grid-template-columns: repeat(var(--columnsPerStep), minmax(var(--minimumStepColumnWidth), 1fr)); grid-area: ~"1 / 1 / 2 / 2"; .time-hand { From 98255d7de39150a59957f297c0b3e60460329fa2 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 6 May 2025 17:20:42 +0200 Subject: [PATCH 2/2] Timescale: Use array_map to create child elements for timestamp - timeline.less: increase the font size of .timestamp --- .../Notifications/Widget/TimeGrid/Timescale.php | 14 +++++++------- public/css/timeline.less | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/library/Notifications/Widget/TimeGrid/Timescale.php b/library/Notifications/Widget/TimeGrid/Timescale.php index 4f2565aec..c8881f9fe 100644 --- a/library/Notifications/Widget/TimeGrid/Timescale.php +++ b/library/Notifications/Widget/TimeGrid/Timescale.php @@ -66,13 +66,13 @@ public function assemble(): void $time = new DateTime(); $dayTimestamps = []; for ($i = 0; $i < $timestampPerDay; $i++) { - // am-pm is separated by non-breaking whitespace - $parts = preg_split('/\s/u', $dateFormatter->format($time->setTime($i * $timeIntervals, 0))); - - $stamp = [new HtmlElement('span', null, new Text($parts[0]))]; - if (isset($parts[1])) { - $stamp[] = new HtmlElement('span', null, new Text($parts[1])); - } + $stamp = array_map( + function ($part) { + return new HtmlElement('span', null, new Text($part)); + }, + // am-pm is separated by non-breaking whitespace + preg_split('/\s/u', $dateFormatter->format($time->setTime($i * $timeIntervals, 0))) + ); $dayTimestamps[] = new HtmlElement('span', new Attributes(['class' => 'timestamp']), ...$stamp); $dayTimestamps[] = new HtmlElement('span', new Attributes(['class' => 'ticks'])); diff --git a/public/css/timeline.less b/public/css/timeline.less index b1ab710a8..8f3de51d6 100644 --- a/public/css/timeline.less +++ b/public/css/timeline.less @@ -104,7 +104,7 @@ align-items: center; margin-top: 0.5em; padding-top: 0.5em; - font-size: .5em; + font-size: .75em; position: relative; left: -50%; line-height: 1;