Ui changes, remove unused buttons

This commit is contained in:
Vyn 2024-10-15 11:55:39 +02:00
parent 36a2fe9220
commit e28ba796cd
53 changed files with 133 additions and 27125 deletions

View file

@ -73,6 +73,7 @@ struct OpenNewTaskFormParams {
export global Backend {
in-out property<[Source]> sources-selected;
in-out property<int> default-source-index;
in-out property<[string]> sources;
in-out property<bool> no-source-selected;
in-out property<[string]> tags;

View file

@ -30,22 +30,6 @@ export component MainView inherits Rectangle {
horizontal-stretch: 1;
alignment: start;
spacing: 8px;
VButton {
text: "New task";
clicked => { Backend.open_new_task_form({
eventSourceId: -1,
eventId: -1,
})}
icon-source: @image-url("./images/add.png");
icon-colorize: Colors.greenyellow;
}
VButton {
text: "New event";
clicked => { Backend.open_new_event_form() }
icon-source: @image-url("./images/add.png");
icon-colorize: Colors.greenyellow;
}
VButton {
text: "Show/Hide completed tasks";
clicked => {
@ -71,9 +55,10 @@ export component MainView inherits Rectangle {
VerticalLayout {
alignment: start;
spacing: 16px;
if Backend.visible_tasks.length == 0 : VText {
if Backend.visible_tasks.length == 0 && Backend.unscheduled-tasks.length == 0 : VText {
text: "There is no task to show";
horizontal-alignment: center;
vertical-alignment: center;
}
for day[dayIndex] in Backend.visible_tasks: VerticalLayout {
Rectangle {

View file

@ -19,6 +19,32 @@ export component CreateTaskOrEvent inherits Rectangle {
animate padding {
duration: 250ms;
}
newTaskTitleInput := VTextInput {
placeholder: "Add new Task / Event";
started-writting() => {
sourceInput.current-index = Backend.default-source-index;
}
accepted => {
if (task-or-event == 1) {
Backend.createTask({
sourceId: sourceInput.current-index,
eventId: -1,
title: newTaskTitleInput.text,
scheduled: taskDateInput.date.year != 0,
date: taskDateInput.date
})
} else {
Backend.createEvent({
sourceId: sourceInput.current-index,
title: newTaskTitleInput.text,
date: taskDateInput.date,
startsAt: eventStartTimeInput.time,
endsAt: eventEndTimeInput.time,
});
}
newTaskTitleInput.edit-text("");
}
}
Rectangle {
min-height: 0px;
max-height: newTaskTitleInput.text != "" ? 512px : 0px;
@ -43,11 +69,11 @@ export component CreateTaskOrEvent inherits Rectangle {
alignment: end;
sourceInput := ComboBox {
model: Backend.sources;
}
}
VText { text: "on"; vertical-alignment: bottom;}
taskDateInput := VDatePicker {
label: "Date";
enabled: true;
}
HorizontalLayout {
@ -55,41 +81,14 @@ export component CreateTaskOrEvent inherits Rectangle {
HorizontalLayout {
spacing: 4px;
VText { text: "between"; vertical-alignment: bottom; }
eventStartTimeInput := VTimePicker {
label: "Starts at";
}
eventStartTimeInput := VTimePicker { }
VText { text: "and"; vertical-alignment: bottom; }
eventEndTimeInput := VTimePicker {
label: "Ends at";
}
eventEndTimeInput := VTimePicker { }
}
}
}
}
newTaskTitleInput := VTextInput {
placeholder: "Add new Task / Event";
accepted => {
if (task-or-event == 1) {
Backend.createTask({
sourceId: sourceInput.current-index,
eventId: -1,
title: newTaskTitleInput.text,
scheduled: taskDateInput.date.year != 0,
date: taskDateInput.date
})
} else {
Backend.createEvent({
sourceId: sourceInput.current-index,
title: newTaskTitleInput.text,
date: taskDateInput.date,
startsAt: eventStartTimeInput.time,
endsAt: eventEndTimeInput.time,
});
}
newTaskTitleInput.text = "";
}
}
}
}
}