mirai/src/ui/modals/AddEventModal.slint

50 lines
1.2 KiB
Text
Raw Normal View History

2025-06-24 10:03:50 +02:00
import { Palette } from "@selenite";
import { VTextInput } from "@selenite";
import { VButton, VText, VDatePicker } from "@selenite";
import { AppActions } from "../Actions.slint";
import { Modal } from "@selenite";
import { VTimePicker } from "@selenite";
2025-06-30 20:26:54 +02:00
import { ComboBox } from "std-widgets.slint";
import { AppModels } from "../Models.slint";
2025-06-24 10:03:50 +02:00
export component AddEventModal inherits Modal {
public function open() {
root.show();
}
VerticalLayout {
padding: 16px;
spacing: 8px;
2025-06-30 20:26:54 +02:00
sourceInput := ComboBox {
model: AppModels.available-sources-strings;
}
2025-06-24 10:03:50 +02:00
titleInput := VTextInput {
label: "title";
}
VText { text: "on"; vertical-alignment: bottom;}
dateInput := VDatePicker {
enabled: true;
}
HorizontalLayout {
spacing: 4px;
VText { text: "between"; vertical-alignment: bottom; }
startTimeInput := VTimePicker { }
VText { text: "and"; vertical-alignment: bottom; }
endTimeInput := VTimePicker { }
}
VButton {
text: "Create";
clicked => {
AppActions.create-event({
2025-06-30 20:26:54 +02:00
source-id: AppModels.get-source-id-from-name(sourceInput.current-value),
2025-06-24 10:03:50 +02:00
title: titleInput.text,
date: dateInput.date,
2025-06-30 20:26:54 +02:00
starts-at: startTimeInput.time,
ends-at: endTimeInput.time
2025-06-24 10:03:50 +02:00
});
root.close();
}
}
}
}