Add color for events and source tags

This commit is contained in:
Vyn 2025-06-26 10:12:23 +02:00
parent d208fc6ca4
commit 4bca7fac3e
Signed by: vyn
GPG key ID: E1B2BE34E7A971E7
12 changed files with 95 additions and 39 deletions

View file

@ -1,25 +1,7 @@
import { ScrollView, Date, Time } from "std-widgets.slint";
import { VCheckBox, VButton, VActionButton, Svg, VTag, VPopupIconMenu, VText, Palette } from "@selenite";
import { Utils } from "../shared/Utils.slint";
export struct CalendarDayEvent {
sourceId: int,
id: int,
title: string,
startsAt: Time,
endsAt: Time
}
export struct CalendarDay {
events: [CalendarDayEvent],
date: Date,
header: string,
}
export enum CalendarDateDisplayFormat {
Relative,
Normal
}
import { AppModels, CalendarDay, CalendarDateDisplayFormat } from "../shared/Models.slint";
export component Calendar inherits Rectangle {
in property<[CalendarDay]> days;
@ -65,7 +47,7 @@ export component Calendar inherits Rectangle {
}
Rectangle {
Rectangle {
Rectangle { // Last bar delimiting days
x: parent.width - 1px;
y: header-height - 32px;
width: 1px;
@ -76,7 +58,7 @@ export component Calendar inherits Rectangle {
//background: green;
HorizontalLayout {
for day[day-index] in root.days: Rectangle {
Rectangle {
Rectangle { // Bar delimiting days
x: 0;
y: header-height - 32px;
width: 1px;
@ -103,11 +85,18 @@ export component Calendar inherits Rectangle {
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);
width: parent.width;
height: 1px;
z: 100;
}
for event[event-index] in day.events : Rectangle {
Rectangle {
width: 100%;
height: 100%;
background: AppModels.get-source-color-from-id-as-color(event.sourceId);
opacity: 0.05;
}
background: Palette.card-background;
border-radius: 4px;
x: 8px;
@ -118,7 +107,7 @@ export component Calendar inherits Rectangle {
HorizontalLayout {
Rectangle {
width: 4px;
background: Palette.accent;
background: AppModels.get-source-color-from-id-as-color(event.sourceId);
}
VerticalLayout {
padding: 16px;