mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 01:13:19 +00:00
Fix tasks view resizing for no reason + Wrap text correctly
This commit is contained in:
parent
e4b03ca418
commit
f8ff4eb3c4
5 changed files with 141 additions and 176 deletions
2
external/selenite
vendored
2
external/selenite
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit b549a6a47c543ca83d7d37027e55ecd782781e11
|
Subproject commit acbd56205d758bf74d7f121ce8085898acbacc9f
|
|
@ -37,7 +37,7 @@ export component CreateTaskOrEvent inherits Rectangle {
|
||||||
duration: 250ms;
|
duration: 250ms;
|
||||||
}
|
}
|
||||||
newTaskTitleInput := VTextInput {
|
newTaskTitleInput := VTextInput {
|
||||||
placeholder: "Add new Task / Event";
|
placeholder: "Enter new task";
|
||||||
started-writting() => {
|
started-writting() => {
|
||||||
sourceInput.current-index = AppWindowModels.default-source-index;
|
sourceInput.current-index = AppWindowModels.default-source-index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,15 +12,15 @@ import { VButton } from "../../../external/selenite/components/Button.slint";
|
||||||
export component AppWindow inherits Window {
|
export component AppWindow inherits Window {
|
||||||
|
|
||||||
title: "Mirai";
|
title: "Mirai";
|
||||||
min-height: 100px;
|
//min-height: 100px;
|
||||||
max-height: 4000px; // needed, otherwise the window wants to fit the content (on Swaywm)
|
//max-height: 4000px; // needed, otherwise the window wants to fit the content (on Swaywm)
|
||||||
background: Palette.pane;
|
background: Palette.pane;
|
||||||
|
|
||||||
private property<bool> show-tasks: false;
|
private property<bool> show-tasks: false;
|
||||||
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
HorizontalLayout {
|
VerticalLayout {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
alignment: LayoutAlignment.stretch;
|
alignment: LayoutAlignment.stretch;
|
||||||
spacing: 8px;
|
spacing: 8px;
|
||||||
|
@ -37,6 +37,7 @@ export component AppWindow inherits Window {
|
||||||
SideBar {}
|
SideBar {}
|
||||||
}
|
}
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
|
|
||||||
|
|
||||||
if show-tasks : MainView {
|
if show-tasks : MainView {
|
||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
|
|
|
@ -64,12 +64,11 @@ export component CalendarView inherits Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
|
padding: 16px;
|
||||||
|
spacing: 16px;
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
padding: 16px;
|
|
||||||
VButton {
|
VButton {
|
||||||
text: "New event";
|
text: "New event";
|
||||||
icon-svg: Svg.plus;
|
icon-svg: Svg.plus;
|
||||||
|
@ -79,6 +78,11 @@ export component CalendarView inherits Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
horizontal-stretch: 1;
|
||||||
|
background: Palette.background.brighter(0.2);
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
Calendar {
|
Calendar {
|
||||||
delete-event-request(source-id, event-id) => { debug("DEELTE", source-id);AppWindowActions.delete-event(source-id, event-id) }
|
delete-event-request(source-id, event-id) => { debug("DEELTE", source-id);AppWindowActions.delete-event(source-id, event-id) }
|
||||||
init => { debug("cal len", AppWindowModels.calendar.length) }
|
init => { debug("cal len", AppWindowModels.calendar.length) }
|
||||||
|
|
|
@ -15,187 +15,148 @@ export component MainView inherits Rectangle {
|
||||||
private property<string> icon-not-visible: Svg.not-visible;
|
private property<string> icon-not-visible: Svg.not-visible;
|
||||||
private property<bool> completed-tasks-visible: false;
|
private property<bool> completed-tasks-visible: false;
|
||||||
|
|
||||||
HorizontalLayout {
|
VerticalLayout {
|
||||||
|
padding: 16px;
|
||||||
VerticalLayout {
|
spacing: 16px;
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: start;
|
||||||
|
spacing: 8px;
|
||||||
|
VButton {
|
||||||
|
text: "Show/Hide completed tasks";
|
||||||
|
clicked => {
|
||||||
|
AppWindowActions.toggle-show-completed-tasks();
|
||||||
|
completed-tasks-visible = !completed-tasks-visible;
|
||||||
|
}
|
||||||
|
icon-svg: completed-tasks-visible ? icon-visible : icon-not-visible;
|
||||||
|
icon-colorize: Palette.control-foreground;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
padding: 16px;
|
background: Palette.background.brighter(0.2);
|
||||||
spacing: 16px;
|
height: 1px;
|
||||||
HorizontalLayout {
|
}
|
||||||
horizontal-stretch: 1;
|
|
||||||
alignment: start;
|
|
||||||
spacing: 8px;
|
|
||||||
VButton {
|
|
||||||
text: "Show/Hide completed tasks";
|
|
||||||
clicked => {
|
|
||||||
AppWindowActions.toggle-show-completed-tasks();
|
|
||||||
completed-tasks-visible = !completed-tasks-visible;
|
|
||||||
}
|
|
||||||
icon-svg: completed-tasks-visible ? icon-visible : icon-not-visible;
|
|
||||||
icon-colorize: Palette.control-foreground;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
horizontal-stretch: 1;
|
|
||||||
background: Palette.background.brighter(0.2);
|
|
||||||
height: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateTaskOrEvent {
|
CreateTaskOrEvent {
|
||||||
sources: AppWindowModels.sources;
|
sources: AppWindowModels.sources;
|
||||||
create-task(data) => {
|
create-task(data) => {
|
||||||
AppWindowActions.create-task({
|
AppWindowActions.create-task({
|
||||||
sourceId: data.sourceId,
|
sourceId: data.sourceId,
|
||||||
eventId: -1,
|
eventId: -1,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
scheduled: data.date.year != 0,
|
scheduled: data.date.year != 0,
|
||||||
date: data.date
|
date: data.date
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Flickable {
|
|
||||||
horizontal-stretch: 1;
|
Flickable {
|
||||||
VerticalLayout {
|
max-width: 9999px; // The window keeps resizing down if we don't set the max width
|
||||||
alignment: start;
|
horizontal-stretch: 1;
|
||||||
spacing: 16px;
|
VerticalLayout {
|
||||||
if AppWindowModels.days.length == 0 && AppWindowModels.unscheduled-tasks.length == 0 : VText {
|
alignment: start;
|
||||||
text: "There is no task to show";
|
if AppWindowModels.days.length == 0 && AppWindowModels.unscheduled-tasks.length == 0 : VText {
|
||||||
horizontal-alignment: center;
|
text: "There is no task to show";
|
||||||
vertical-alignment: center;
|
horizontal-alignment: center;
|
||||||
}
|
vertical-alignment: center;
|
||||||
for day[dayIndex] in AppWindowModels.days: VerticalLayout {
|
}
|
||||||
Rectangle {
|
for day[dayIndex] in AppWindowModels.days: VerticalLayout {
|
||||||
|
spacing: day.tasks.length > 0 ? 16px : 0px;
|
||||||
|
if day.tasks.length > 0 : Rectangle {
|
||||||
|
|
||||||
|
if dayIndex != 0 : Rectangle {
|
||||||
|
height: 1px;
|
||||||
background: Palette.card-background;
|
background: Palette.card-background;
|
||||||
border-radius: 8px;
|
}
|
||||||
VerticalLayout {
|
//background: Palette.card-background;
|
||||||
padding: 16px;
|
border-radius: 8px;
|
||||||
HorizontalLayout {
|
VerticalLayout {
|
||||||
alignment: start;
|
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 {
|
VText {
|
||||||
text: Utils.format-date(day.date);
|
text: day.relativeDaysDiff == 0 ? " - today" :
|
||||||
color: day.isLate ? Palette.orange : Palette.foreground;
|
day.relativeDaysDiff == 1 ? " - tomorrow" :
|
||||||
font-size: 1.2rem;
|
day.relativeDaysDiff == -1 ? " - yesterday" :
|
||||||
}
|
day.relativeDaysDiff > 0 ? " - in \{day.relativeDaysDiff} days" :
|
||||||
VerticalLayout {
|
" - \{-day.relativeDaysDiff} days ago";
|
||||||
alignment: center;
|
color: Palette.foreground-hint;
|
||||||
VText {
|
font-size: 1rem;
|
||||||
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 event[eventIndex] in day.events: VerticalLayout {
|
}
|
||||||
padding-top: 16px;
|
|
||||||
EventGroup {
|
for task[taskIndex] in day.tasks: VerticalLayout {
|
||||||
event: event;
|
padding-top: taskIndex == 0 ? 16px : 0px;
|
||||||
add-task(data) => {
|
padding-bottom: 8px;
|
||||||
AppWindowActions.create-task({
|
TaskLine {
|
||||||
sourceId: event.sourceId,
|
title: task.title;
|
||||||
eventId: event.id,
|
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
|
||||||
title: data.title,
|
scheduled: task.date.year != 0;
|
||||||
});
|
date: day.date;
|
||||||
}
|
checked: task.checked;
|
||||||
edit-task(taskId, data) => {
|
allow-edit-date: true;
|
||||||
AppWindowActions.save-task({
|
delete => {
|
||||||
id: taskId,
|
AppWindowActions.delete-task-clicked(task.sourceId, task.id)
|
||||||
sourceId: event.sourceId,
|
|
||||||
title: data.title,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
delete-task(taskId) => {
|
|
||||||
AppWindowActions.delete-task-clicked(event.sourceId, taskId)
|
|
||||||
}
|
|
||||||
toggle-check-task(taskId) => {
|
|
||||||
AppWindowActions.task-clicked(event.sourceId, taskId);
|
|
||||||
}
|
|
||||||
delete => {
|
|
||||||
//AppWindowActions.delete-event-clicked(event.sourceId, event.id)
|
|
||||||
}
|
|
||||||
edit(data) => {
|
|
||||||
//AppWindowActions.save-event({
|
|
||||||
//sourceId: event.sourceId,
|
|
||||||
//id: event.id,
|
|
||||||
//title: data.title,
|
|
||||||
////date: event.date,
|
|
||||||
//startsAt: event.startsAt,
|
|
||||||
//endsAt: event.endsAt,
|
|
||||||
//});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
toggle-check => {
|
||||||
for task[taskIndex] in day.tasks: VerticalLayout {
|
AppWindowActions.task-clicked(task.sourceId, task.id);
|
||||||
padding-top: taskIndex == 0 ? 16px : 0px;
|
}
|
||||||
padding-bottom: 8px;
|
edited(data) => {
|
||||||
TaskLine {
|
AppWindowActions.save-task({
|
||||||
title: task.title;
|
id: task.id,
|
||||||
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
|
sourceId: task.sourceId,
|
||||||
scheduled: task.date.year != 0;
|
title: data.title,
|
||||||
date: day.date;
|
scheduled: data.scheduled,
|
||||||
checked: task.checked;
|
date: data.date
|
||||||
allow-edit-date: true;
|
})
|
||||||
delete => {
|
|
||||||
AppWindowActions.delete-task-clicked(task.sourceId, task.id)
|
|
||||||
}
|
|
||||||
toggle-check => {
|
|
||||||
AppWindowActions.task-clicked(task.sourceId, task.id);
|
|
||||||
}
|
|
||||||
edited(data) => {
|
|
||||||
AppWindowActions.save-task({
|
|
||||||
id: task.id,
|
|
||||||
sourceId: task.sourceId,
|
|
||||||
title: data.title,
|
|
||||||
scheduled: data.scheduled,
|
|
||||||
date: data.date
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if AppWindowModels.unscheduled-tasks.length > 0 : VerticalLayout {
|
}
|
||||||
Rectangle {
|
if AppWindowModels.unscheduled-tasks.length > 0 : VerticalLayout {
|
||||||
background: Palette.card-background;
|
Rectangle {
|
||||||
border-radius: 8px;
|
//background: Palette.card-background;
|
||||||
VerticalLayout {
|
border-radius: 8px;
|
||||||
padding: 16px;
|
VerticalLayout {
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
VText {
|
VText {
|
||||||
text: "Unscheduled";
|
text: "Unscheduled";
|
||||||
color: Palette.foreground;
|
color: Palette.foreground;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for task[taskIndex] in AppWindowModels.unscheduled-tasks: VerticalLayout {
|
}
|
||||||
padding-top: taskIndex == 0 ? 16px : 0px;
|
for task[taskIndex] in AppWindowModels.unscheduled-tasks: VerticalLayout {
|
||||||
padding-bottom: 8px;
|
padding-top: taskIndex == 0 ? 16px : 0px;
|
||||||
TaskLine {
|
padding-bottom: 8px;
|
||||||
title: task.title;
|
TaskLine {
|
||||||
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
|
title: task.title;
|
||||||
checked: task.checked;
|
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
|
||||||
allow-edit-date: true;
|
checked: task.checked;
|
||||||
delete => {
|
allow-edit-date: true;
|
||||||
AppWindowActions.delete-task-clicked(task.sourceId, task.id)
|
delete => {
|
||||||
}
|
AppWindowActions.delete-task-clicked(task.sourceId, task.id)
|
||||||
toggle-check => {
|
}
|
||||||
AppWindowActions.task-clicked(task.sourceId, task.id);
|
toggle-check => {
|
||||||
}
|
AppWindowActions.task-clicked(task.sourceId, task.id);
|
||||||
edited(data) => {
|
}
|
||||||
AppWindowActions.save-task({
|
edited(data) => {
|
||||||
id: task.id,
|
AppWindowActions.save-task({
|
||||||
sourceId: task.sourceId,
|
id: task.id,
|
||||||
title: data.title,
|
sourceId: task.sourceId,
|
||||||
scheduled: data.scheduled,
|
title: data.title,
|
||||||
date: data.date
|
scheduled: data.scheduled,
|
||||||
})
|
date: data.date
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,5 +166,4 @@ export component MainView inherits Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue