Add Unscheduled tasks

This commit is contained in:
Vyn 2024-10-08 16:36:01 +02:00
parent 07081bb27b
commit 53b1280115
13 changed files with 134 additions and 12 deletions

View file

@ -38,6 +38,7 @@ export global Backend {
in-out property<[string]> sources;
in-out property<[string]> tags;
in-out property<[Day]> visible_tasks;
in-out property<[TaskData]> unscheduled-tasks;
callback task_clicked(int, int);
callback source_clicked(int);

View file

@ -107,6 +107,32 @@ export component MainView inherits Rectangle {
}
}
}
if Backend.unscheduled-tasks.length > 0 : VerticalLayout {
Rectangle {
background: Palette.card-background;
border-radius: 8px;
VerticalLayout {
padding: 16px;
HorizontalLayout {
alignment: start;
VText {
text: "Unscheduled";
color: Palette.foreground;
font-size: 1.2rem;
}
}
for task[taskIndex] in Backend.unscheduled-tasks: VerticalLayout {
padding-top: taskIndex == 0 ? 16px : 0px;
padding-bottom: 8px;
TaskLine {
task: task;
source-index: task.sourceId;
task-index: task.id;
}
}
}
}
}
}
}
}

View file

@ -1,11 +1,12 @@
import { Date, ComboBox } from "std-widgets.slint";
import { VTextInput, VButton, VDatePicker, VText, Palette } from "@vynui";
import { VTextInput, VButton, VDatePicker, VText, VCheckBox, Palette } from "@vynui";
import { Backend } from "../Backend.slint";
export struct NewTaskData {
sourceId: int,
eventId: int,
title: string,
scheduled: bool,
date: Date
}
@ -13,6 +14,7 @@ export struct SaveTaskData {
sourceId: int,
id: int,
title: string,
scheduled: bool,
date: Date,
}
@ -28,6 +30,7 @@ export component TaskWindow inherits Window {
in-out property<int> taskId: -1;
in-out property<int> eventId: -1;
in-out property<bool> scheduled <=> scheduledInput.checked;
in-out property<Date> taskDate <=> taskDateInput.date;
in-out property<string> taskTitle <=> taskTitleInput.text;
in-out property<int> taskSourceIndex <=> sourceInput.current-index;
@ -53,9 +56,13 @@ export component TaskWindow inherits Window {
accepted => { button.clicked() }
}
scheduledInput := VCheckBox {
text: "Scheduled";
}
taskDateInput := VDatePicker {
label: "Date";
enabled: eventId == -1;
enabled: eventId == -1 && scheduledInput.checked;
}
button := VButton {
@ -66,6 +73,7 @@ export component TaskWindow inherits Window {
sourceId: taskSourceIndex,
eventId: eventId,
title: taskTitle,
scheduled: scheduled,
date: taskDate,
});
} else {
@ -73,6 +81,7 @@ export component TaskWindow inherits Window {
sourceId: taskSourceIndex,
id: taskId,
title: taskTitle,
scheduled: scheduled,
date: taskDate,
});
}