mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-04 18:53:19 +00:00
Move Calendar to its own view
This commit is contained in:
parent
a03e71890c
commit
d26f2f5a9f
19 changed files with 407 additions and 137 deletions
|
@ -8,38 +8,18 @@ export struct CreateTaskData {
|
|||
date: Date
|
||||
}
|
||||
|
||||
export struct CreateEventData {
|
||||
sourceId: int,
|
||||
title: string,
|
||||
date: Date,
|
||||
startsAt: Time,
|
||||
endsAt: Time
|
||||
}
|
||||
|
||||
export component CreateTaskOrEvent inherits Rectangle {
|
||||
|
||||
in property <[string]> sources;
|
||||
private property <int> task-or-event: 1;
|
||||
|
||||
callback create-task(CreateTaskData);
|
||||
callback create-event(CreateEventData);
|
||||
|
||||
function accepted() {
|
||||
if (task-or-event == 1) {
|
||||
root.create-task({
|
||||
sourceId: AppWindowModels.get-source-id-from-name(sourceInput.current-value),
|
||||
title: newTaskTitleInput.text,
|
||||
date: taskDateInput.date
|
||||
})
|
||||
} else {
|
||||
root.create-event({
|
||||
sourceId: AppWindowModels.get-source-id-from-name(sourceInput.current-value),
|
||||
title: newTaskTitleInput.text,
|
||||
date: taskDateInput.date,
|
||||
startsAt: eventStartTimeInput.time,
|
||||
endsAt: eventEndTimeInput.time
|
||||
})
|
||||
}
|
||||
root.create-task({
|
||||
sourceId: AppWindowModels.get-source-id-from-name(sourceInput.current-value),
|
||||
title: newTaskTitleInput.text,
|
||||
date: taskDateInput.date
|
||||
});
|
||||
newTaskTitleInput.edit-text("");
|
||||
}
|
||||
|
||||
|
@ -75,13 +55,6 @@ export component CreateTaskOrEvent inherits Rectangle {
|
|||
HorizontalLayout {
|
||||
alignment: start;
|
||||
spacing: 8px;
|
||||
VerticalLayout {
|
||||
alignment: end;
|
||||
VButton {
|
||||
text: task-or-event == 1 ? "Task" : "Event";
|
||||
clicked => { task-or-event = task-or-event == 1 ? 0 : 1 }
|
||||
}
|
||||
}
|
||||
VText { text: "for"; vertical-alignment: bottom;}
|
||||
VerticalLayout {
|
||||
alignment: end;
|
||||
|
@ -94,22 +67,6 @@ export component CreateTaskOrEvent inherits Rectangle {
|
|||
taskDateInput := VDatePicker {
|
||||
enabled: true;
|
||||
}
|
||||
Rectangle {
|
||||
min-width: 0;
|
||||
max-width: task-or-event == 0 ? 9999px : 0px;
|
||||
opacity: task-or-event == 0 ? 1 : 0;
|
||||
clip: true;
|
||||
animate max-width, opacity {
|
||||
duration: 250ms;
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: 4px;
|
||||
VText { text: "between"; vertical-alignment: bottom; }
|
||||
eventStartTimeInput := VTimePicker { }
|
||||
VText { text: "and"; vertical-alignment: bottom; }
|
||||
eventEndTimeInput := VTimePicker { }
|
||||
}
|
||||
}
|
||||
VButton {
|
||||
text: "Create";
|
||||
icon-svg: Svg.correct;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue