mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 09:23:18 +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;
|
||||||
|
@ -38,6 +38,7 @@ export component AppWindow inherits Window {
|
||||||
}
|
}
|
||||||
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,14 +15,10 @@ 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 {
|
VerticalLayout {
|
||||||
horizontal-stretch: 1;
|
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
spacing: 16px;
|
spacing: 16px;
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
horizontal-stretch: 1;
|
|
||||||
alignment: start;
|
alignment: start;
|
||||||
spacing: 8px;
|
spacing: 8px;
|
||||||
VButton {
|
VButton {
|
||||||
|
@ -55,21 +51,26 @@ export component MainView inherits Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
|
max-width: 9999px; // The window keeps resizing down if we don't set the max width
|
||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
spacing: 16px;
|
|
||||||
if AppWindowModels.days.length == 0 && AppWindowModels.unscheduled-tasks.length == 0 : VText {
|
if AppWindowModels.days.length == 0 && AppWindowModels.unscheduled-tasks.length == 0 : VText {
|
||||||
text: "There is no task to show";
|
text: "There is no task to show";
|
||||||
horizontal-alignment: center;
|
horizontal-alignment: center;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
for day[dayIndex] in AppWindowModels.days: VerticalLayout {
|
for day[dayIndex] in AppWindowModels.days: VerticalLayout {
|
||||||
Rectangle {
|
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;
|
||||||
|
}
|
||||||
|
//background: Palette.card-background;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
padding: 16px;
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
VText {
|
VText {
|
||||||
|
@ -90,45 +91,7 @@ export component MainView inherits Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for event[eventIndex] in day.events: VerticalLayout {
|
|
||||||
padding-top: 16px;
|
|
||||||
EventGroup {
|
|
||||||
event: event;
|
|
||||||
add-task(data) => {
|
|
||||||
AppWindowActions.create-task({
|
|
||||||
sourceId: event.sourceId,
|
|
||||||
eventId: event.id,
|
|
||||||
title: data.title,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
edit-task(taskId, data) => {
|
|
||||||
AppWindowActions.save-task({
|
|
||||||
id: taskId,
|
|
||||||
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,
|
|
||||||
//});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for task[taskIndex] in day.tasks: VerticalLayout {
|
for task[taskIndex] in day.tasks: VerticalLayout {
|
||||||
padding-top: taskIndex == 0 ? 16px : 0px;
|
padding-top: taskIndex == 0 ? 16px : 0px;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
|
@ -161,10 +124,9 @@ export component MainView inherits Rectangle {
|
||||||
}
|
}
|
||||||
if AppWindowModels.unscheduled-tasks.length > 0 : VerticalLayout {
|
if AppWindowModels.unscheduled-tasks.length > 0 : VerticalLayout {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
background: Palette.card-background;
|
//background: Palette.card-background;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
padding: 16px;
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
VText {
|
VText {
|
||||||
|
@ -204,6 +166,4 @@ export component MainView inherits Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue