Add current time indicator of the current day on the Calendar

This commit is contained in:
Vyn 2024-11-06 18:38:42 +01:00
parent ab2200ecc1
commit e2cd994026
9 changed files with 54 additions and 8 deletions

View file

@ -22,6 +22,8 @@ export enum CalendarDateDisplayFormat {
export component Calendar inherits Rectangle {
in property<[CalendarDay]> days;
in property <CalendarDateDisplayFormat> format;
in property <Date> current-date;
in property <Time> current-time;
private property <length> header-height: 64px;
private property <length> available-day-space: self.height - header-height;
private property <length> day-start-y: header-height;
@ -83,6 +85,13 @@ export component Calendar inherits Rectangle {
y: day-start-y + hour-spacing * hour-index;
height: 1px;
}
if day.date == root.current-date : Rectangle {
background: Palette.red;
x: 0px;
width: parent.width;
y: day-start-y + hour-spacing * root.current-time.hour + (root.current-time.minute / 60 * hour-spacing);
height: 1px;
}
for event[event-index] in day.events : Rectangle {
background: Palette.card-background;
border-radius: 4px;