mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 18:23:19 +00:00
Add Source creation/edition + Add missing edit forms for tasks and events
This commit is contained in:
parent
f1ac8a42d1
commit
a15c23bb21
24 changed files with 358 additions and 205 deletions
|
@ -50,7 +50,7 @@ export component Calendar inherits Rectangle {
|
|||
VText {
|
||||
vertical-alignment: center;
|
||||
horizontal-alignment: right;
|
||||
text: "\{index}h";
|
||||
text: "\{index}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import { Backend, TaskData, Event } from "../Backend.slint";
|
||||
import { ScrollView } from "std-widgets.slint";
|
||||
import { VCheckBox, VButton, VActionButton, Svg, VTag, VPopupIconMenu, VText, Palette } from "@selenite";
|
||||
import { VCheckBox, VTextInput, VButton, VActionButton, Svg, VTag, VPopupIconMenu, VText, Palette } from "@selenite";
|
||||
import { TaskLine } from "./TaskLine.slint";
|
||||
import { Utils } from "../Utils.slint";
|
||||
|
||||
export component EventGroup {
|
||||
in property<Event> event;
|
||||
private property <bool> show-add-task: false;
|
||||
private property <bool> edit-name: false;
|
||||
|
||||
eventPopup := VPopupIconMenu {
|
||||
VActionButton {
|
||||
|
@ -13,17 +15,16 @@ export component EventGroup {
|
|||
icon-colorize: Colors.greenyellow;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => { Backend.open-new-task-form({
|
||||
eventSourceId: event.sourceId,
|
||||
eventId: event.id,
|
||||
})}
|
||||
clicked => {
|
||||
root.show-add-task = true;
|
||||
}
|
||||
}
|
||||
VActionButton {
|
||||
icon-svg: Svg.pen;
|
||||
icon-colorize: Colors.grey;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => { Backend.open-edit-event-form(event.sourceId, event.id) }
|
||||
clicked => { edit-name = true; }
|
||||
}
|
||||
|
||||
VActionButton {
|
||||
|
@ -48,15 +49,14 @@ export component EventGroup {
|
|||
spacing: 4px;
|
||||
VText {
|
||||
text: Utils.time-to-string(event.startsAt);
|
||||
horizontal-alignment: center;
|
||||
color: Palette.accent;
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
Rectangle {
|
||||
width: 4px;
|
||||
width: 2px;
|
||||
background: Palette.accent;
|
||||
border-radius: 8px;
|
||||
|
||||
}
|
||||
}
|
||||
VText {
|
||||
|
@ -72,10 +72,24 @@ export component EventGroup {
|
|||
padding-top: 32px;
|
||||
padding-bottom: 32px;
|
||||
padding-right: 0px;
|
||||
VText {
|
||||
if !edit-name : VText {
|
||||
text: event.title;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
if edit-name : title := VTextInput {
|
||||
text: event.title;
|
||||
accepted => {
|
||||
Backend.save-event({
|
||||
sourceId: event.sourceId,
|
||||
id: event.id,
|
||||
title: title.text,
|
||||
//date: event.date,
|
||||
startsAt: event.startsAt,
|
||||
endsAt: event.endsAt,
|
||||
});
|
||||
root.edit-name = false;
|
||||
}
|
||||
}
|
||||
for task[taskIndex] in event.tasks: VerticalLayout {
|
||||
padding-top: taskIndex == 0 ? 16px : 0px;
|
||||
padding-bottom: 8px;
|
||||
|
@ -85,6 +99,16 @@ export component EventGroup {
|
|||
task-index: task.id;
|
||||
}
|
||||
}
|
||||
if show-add-task : taskInput := VTextInput {
|
||||
accepted => {
|
||||
Backend.create-task({
|
||||
sourceId: event.sourceId,
|
||||
eventId: event.id,
|
||||
title: taskInput.text,
|
||||
});
|
||||
root.show-add-task = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Backend } from "../Backend.slint";
|
||||
import { VButton, ToggleButton, VText, Svg, Palette } from "@selenite";
|
||||
import { VButton, ToggleButton, VActionButton, VText, Svg, Palette } from "@selenite";
|
||||
|
||||
export component SideBar inherits Rectangle {
|
||||
background: Palette.pane;
|
||||
|
@ -8,9 +8,20 @@ export component SideBar inherits Rectangle {
|
|||
height: parent.height;
|
||||
padding: 16px;
|
||||
spacing: 16px;
|
||||
VText {
|
||||
text: "Sources";
|
||||
font-size: 1.5rem;
|
||||
HorizontalLayout {
|
||||
alignment: space-between;
|
||||
spacing: 64px;
|
||||
VText {
|
||||
text: "Sources";
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
VActionButton {
|
||||
icon-svg: Svg.plus;
|
||||
icon-colorize: Palette.green;
|
||||
background: transparent;
|
||||
clicked => { Backend.add-source-clicked() }
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: space-between;
|
||||
|
@ -23,23 +34,31 @@ export component SideBar inherits Rectangle {
|
|||
text-alignment: left;
|
||||
active: Backend.no-source-selected;
|
||||
clicked => { Backend.source-clicked(-1) }
|
||||
|
||||
|
||||
}
|
||||
for item[index] in Backend.sources-selected: ToggleButton {
|
||||
text: item.name;
|
||||
text-alignment: left;
|
||||
active: item.selected;
|
||||
clicked => { Backend.source-clicked(index) }
|
||||
VActionButton {
|
||||
visible: parent.active;
|
||||
icon-svg: Svg.cog;
|
||||
background: transparent;
|
||||
clicked => { Backend.edit-source-clicked(item.id) }
|
||||
}
|
||||
}
|
||||
}
|
||||
/*VerticalLayout {
|
||||
VerticalLayout {
|
||||
spacing: 4px;
|
||||
VButton {
|
||||
/*VButton {
|
||||
icon-svg: Svg.cog;
|
||||
text: "Settings";
|
||||
background: transparent;
|
||||
clicked => { Backend.settings-clicked() }
|
||||
}
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
import { Backend, TaskData } from "../Backend.slint";
|
||||
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
||||
import { Button, VerticalBox, CheckBox, Date, ScrollView, ComboBox } from "std-widgets.slint";
|
||||
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VTag, VText, VTextInput, Svg, Palette } from "@selenite";
|
||||
import { NewTaskData, SaveTaskData } from "../Backend.slint";
|
||||
|
||||
export component TaskEdit inherits VerticalLayout {
|
||||
in-out property <SaveTaskData> task;
|
||||
in-out property <TaskData> task;
|
||||
out property <bool> should-show;
|
||||
|
||||
public function show(task: SaveTaskData) {
|
||||
private property <Date> newDate: task.date;
|
||||
|
||||
public function show(task: TaskData) {
|
||||
root.task = task;
|
||||
should-show = true;
|
||||
}
|
||||
|
@ -16,8 +18,6 @@ export component TaskEdit inherits VerticalLayout {
|
|||
}
|
||||
callback accepted(SaveTaskData);
|
||||
|
||||
|
||||
|
||||
if !should-show : Rectangle {}
|
||||
|
||||
if should-show : Rectangle {
|
||||
|
@ -26,8 +26,8 @@ export component TaskEdit inherits VerticalLayout {
|
|||
id: task.id,
|
||||
sourceId: task.sourceId,
|
||||
title: newTaskTitleInput.text,
|
||||
scheduled: taskDateInput.date.year != 0,
|
||||
date: taskDateInput.date
|
||||
scheduled: newDate.year != 0,
|
||||
date: newDate
|
||||
});
|
||||
}
|
||||
background: Palette.background;
|
||||
|
@ -43,9 +43,10 @@ export component TaskEdit inherits VerticalLayout {
|
|||
HorizontalLayout {
|
||||
alignment: start;
|
||||
spacing: 8px;
|
||||
taskDateInput := VDatePicker {
|
||||
if root.task.eventId == -1 : taskDateInput := VDatePicker {
|
||||
date: task.date;
|
||||
enabled: true;
|
||||
edited(date) => { newDate = date; }
|
||||
}
|
||||
VButton {
|
||||
text: "Modify";
|
||||
|
|
|
@ -44,8 +44,10 @@ export component TaskLine inherits VerticalLayout {
|
|||
taskEdit.show({
|
||||
sourceId: task.sourceId,
|
||||
id: task.id,
|
||||
eventId: task.eventId,
|
||||
title: task.title,
|
||||
scheduled: root.date.year != 0,
|
||||
checked: task.checked,
|
||||
date: date,
|
||||
});
|
||||
}
|
||||
|
@ -87,10 +89,10 @@ export component TaskLine inherits VerticalLayout {
|
|||
Backend.task-clicked(source-index, task-index)
|
||||
}
|
||||
}
|
||||
for tag[tag-index] in task.tags: VTag {
|
||||
/*for tag[tag-index] in task.tags: VTag {
|
||||
text: tag;
|
||||
size: 0.8rem;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue