mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 01:13:19 +00:00
[WIP] full views rework
This commit is contained in:
parent
9de3972630
commit
15bd0f58a7
30 changed files with 812 additions and 1175 deletions
|
@ -1,8 +1,7 @@
|
|||
import { AppModels, TaskData } from "../../../shared/Models.slint";
|
||||
import { AppModels } from "../../../shared/Models.slint";
|
||||
import { AppActions, NewTaskData, SaveTaskData } from "../../../shared/Actions.slint";
|
||||
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
||||
import { TaskLine } from "../../../components/TaskLine.slint";
|
||||
import { EventGroup } from "../../../components/EventGroup.slint";
|
||||
import { Calendar } from "../../../components/Calendar.slint";
|
||||
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VTag, VText, VTextInput, Svg, Palette } from "@selenite";
|
||||
import { CreateTaskOrEvent } from "../../../components/CreateTaskOrEvent.slint";
|
||||
|
@ -37,7 +36,7 @@ export component MainView inherits Rectangle {
|
|||
}
|
||||
|
||||
CreateTaskOrEvent {
|
||||
sources: AppModels.sources;
|
||||
sources: AppModels.tasks-view.sources;
|
||||
create-task(data) => {
|
||||
AppActions.create-task({
|
||||
sourceId: data.sourceId,
|
||||
|
@ -54,106 +53,66 @@ export component MainView inherits Rectangle {
|
|||
horizontal-stretch: 1;
|
||||
VerticalLayout {
|
||||
alignment: start;
|
||||
if AppModels.days.length == 0 && AppModels.unscheduled-tasks.length == 0 : VText {
|
||||
if AppModels.tasks-view.dates.length == 0 : VText {
|
||||
text: "There is no task to show";
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
for day[dayIndex] in AppModels.days: VerticalLayout {
|
||||
spacing: day.tasks.length > 0 ? 16px : 0px;
|
||||
for day[dayIndex] in AppModels.tasks-view.dates: VerticalLayout {
|
||||
spacing: day.sources.length > 0 ? 16px : 0px;
|
||||
padding-bottom: 32px;
|
||||
|
||||
if day.tasks.length > 0 : Rectangle {
|
||||
border-radius: 8px;
|
||||
VerticalLayout {
|
||||
HorizontalLayout {
|
||||
alignment: start;
|
||||
VText {
|
||||
text: Utils.format-date(day.date);
|
||||
color: day.isLate ? Palette.orange : Palette.foreground;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
VText {
|
||||
text: day.relativeDaysDiff == 0 ? " - today" :
|
||||
day.relativeDaysDiff == 1 ? " - tomorrow" :
|
||||
day.relativeDaysDiff == -1 ? " - yesterday" :
|
||||
day.relativeDaysDiff > 0 ? " - in \{day.relativeDaysDiff} days" :
|
||||
" - \{-day.relativeDaysDiff} days ago";
|
||||
color: Palette.foreground-hint;
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for task[taskIndex] in day.tasks: VerticalLayout {
|
||||
padding-top: taskIndex == 0 ? 16px : 0px;
|
||||
padding-bottom: 8px;
|
||||
TaskLine {
|
||||
title: task.title;
|
||||
source-name: AppModels.get-source-name-from-id(task.sourceId);
|
||||
source-color: AppModels.get-source-color-from-id-as-color(task.sourceId);
|
||||
scheduled: task.date.year != 0;
|
||||
date: day.date;
|
||||
checked: task.checked;
|
||||
allow-edit-date: true;
|
||||
delete => {
|
||||
AppActions.delete-task-clicked(task.sourceId, task.id)
|
||||
}
|
||||
toggle-check => {
|
||||
AppActions.task-clicked(task.sourceId, task.id);
|
||||
}
|
||||
edited(data) => {
|
||||
AppActions.save-task({
|
||||
id: task.id,
|
||||
sourceId: task.sourceId,
|
||||
title: data.title,
|
||||
scheduled: data.scheduled,
|
||||
date: data.date
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HorizontalLayout {
|
||||
alignment: start;
|
||||
VText {
|
||||
text: day.no-date ? "Unscheduled" : Utils.format-date(day.due-date);
|
||||
color: day.is-late ? Palette.orange : Palette.foreground;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
//VerticalLayout {
|
||||
//alignment: center;
|
||||
//VText {
|
||||
//text: day.relativeDaysDiff == 0 ? " - today" :
|
||||
//day.relativeDaysDiff == 1 ? " - tomorrow" :
|
||||
//day.relativeDaysDiff == -1 ? " - yesterday" :
|
||||
//day.relativeDaysDiff > 0 ? " - in \{day.relativeDaysDiff} days" :
|
||||
//" - \{-day.relativeDaysDiff} days ago";
|
||||
//color: Palette.foreground-hint;
|
||||
//font-size: 1rem;
|
||||
//}
|
||||
//}
|
||||
}
|
||||
}
|
||||
if AppModels.unscheduled-tasks.length > 0 : VerticalLayout {
|
||||
Rectangle {
|
||||
//background: Palette.card-background;
|
||||
border-radius: 8px;
|
||||
VerticalLayout {
|
||||
HorizontalLayout {
|
||||
alignment: start;
|
||||
VText {
|
||||
text: "Unscheduled";
|
||||
color: Palette.foreground;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
for task[taskIndex] in AppModels.unscheduled-tasks: VerticalLayout {
|
||||
padding-top: taskIndex == 0 ? 16px : 0px;
|
||||
padding-bottom: 8px;
|
||||
TaskLine {
|
||||
title: task.title;
|
||||
source-name: AppModels.get-source-name-from-id(task.sourceId);
|
||||
source-color: AppModels.get-source-color-from-id-as-color(task.sourceId);
|
||||
checked: task.checked;
|
||||
allow-edit-date: true;
|
||||
delete => {
|
||||
AppActions.delete-task-clicked(task.sourceId, task.id)
|
||||
}
|
||||
toggle-check => {
|
||||
AppActions.task-clicked(task.sourceId, task.id);
|
||||
}
|
||||
edited(data) => {
|
||||
AppActions.save-task({
|
||||
id: task.id,
|
||||
sourceId: task.sourceId,
|
||||
title: data.title,
|
||||
scheduled: data.scheduled,
|
||||
date: data.date
|
||||
})
|
||||
|
||||
for source[source-index] in day.sources: VerticalLayout {
|
||||
VText {
|
||||
text: source.name;
|
||||
}
|
||||
if source.tasks.length > 0 : Rectangle {
|
||||
VerticalLayout {
|
||||
for task[taskIndex] in source.tasks: VerticalLayout {
|
||||
padding-top: taskIndex == 0 ? 16px : 0px;
|
||||
padding-bottom: 8px;
|
||||
TaskLine {
|
||||
title: task.title;
|
||||
source-name: AppModels.get-source-name-from-id(task.source-id);
|
||||
source-color: AppModels.get-source-color-from-id-as-color(task.source-id);
|
||||
checked: task.checked;
|
||||
allow-edit-date: true;
|
||||
delete => {
|
||||
AppActions.delete-task-clicked(task.source-id, task.id)
|
||||
}
|
||||
toggle-check => {
|
||||
AppActions.task-clicked(task.source-id, task.id);
|
||||
}
|
||||
edited(data) => {
|
||||
AppActions.save-task({
|
||||
id: task.id,
|
||||
sourceId: task.source-id,
|
||||
title: data.title,
|
||||
scheduled: data.scheduled,
|
||||
date: data.date
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue