From 1273a3624f1b7099cd3bab4b35e66ab9eb427c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 20 Aug 2021 18:20:00 +0200 Subject: Make zero-length events be part of day flow. Since not all zero-length events are at midnight/doesn't have a time component, they are now placed on the correct position of each day, with a dummy-length of 1 hour. --- module/calp/html/view/calendar/week.scm | 13 +++++++++++-- static/style.scss | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index fb28923e..556c3d85 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -71,11 +71,17 @@ (define (lay-out-day day) (let* (((day-date . events) day) (time-obj (datetime date: day-date)) + (short-events (stream->list events)) + #; (zero-length-events short-events (partition event-zero-length? (stream->list events)))) - (fix-event-widths! short-events event-length-key: - (lambda (e) (event-length/day day-date e))) + (fix-event-widths! + short-events + event-length-key: (lambda (e) + (if (event-zero-length? e) + (time hour: 1) + (event-length/day day-date e)))) `(div (@ (class "events event-container") (id ,(date-link day-date)) (data-start ,(date->string day-date)) @@ -83,6 +89,7 @@ ,@(map (lambda (time) `(div (@ (class "clock clock-" ,time)))) (iota 12 0 2)) + #; (div (@ (class "zero-width-events")) ,(map make-block zero-length-events)) ,@(map (lambda (e) (create-block day-date e)) short-events)))) @@ -117,6 +124,8 @@ (make-block ev `((class + ,(when (event-zero-length? ev) + " zero-length") ,(when (date