prepare task settings modal

This commit is contained in:
marlon-erler
2024-07-24 03:36:21 +02:00
parent c9a2995842
commit 5164e891f6
4 changed files with 130 additions and 17 deletions
+3 -3
View File
@@ -243,12 +243,12 @@ export interface TaskFileContent extends FileContent<"task"> {
name: string; name: string;
boardId: string; boardId: string;
category?: string;
status?: string;
description?: string; description?: string;
category?: string;
status?: string;
priority?: string; priority?: string;
date?: string; date?: string;
time?: string; time?: string;
} }
+87
View File
@@ -0,0 +1,87 @@
import * as React from "bloatless-react";
import { DangerousActionButton } from "../Components/dangerousActionButton";
import TaskViewModel from "../../ViewModel/Pages/taskViewModel";
import { translations } from "../translations";
export function TaskSettingsModal(taskViewModal: TaskViewModel) {
return (
<div class="modal" toggle:open={taskViewModal.isPresentingSettingsModal}>
<div>
<main>
<h2>{translations.chatPage.task.boardSettingsHeadline}</h2>
<div class="tile flex-no">
<span class="icon">label</span>
<div>
<span>{translations.chatPage.task.taskNameLabel}</span>
<input bind:value={taskViewModal.name}></input>
</div>
</div>
<div class="tile flex-no">
<span class="icon">description</span>
<div>
<span>{translations.chatPage.task.taskDescriptionLabel}</span>
<input bind:value={taskViewModal.description}></input>
</div>
</div>
<hr></hr>
<div class="tile flex-no">
<span class="icon">category</span>
<div>
<span>{translations.chatPage.task.taskCategoryLabel}</span>
<input bind:value={taskViewModal.category}></input>
</div>
</div>
<div class="tile flex-no">
<span class="icon">clock_loader_40</span>
<div>
<span>{translations.chatPage.task.taskStatusLabel}</span>
<input bind:value={taskViewModal.status}></input>
</div>
</div>
<div class="tile flex-no">
<span class="icon">priority_high</span>
<div>
<span>{translations.chatPage.task.taskPriorityLabel}</span>
<input type="number" bind:value={taskViewModal.priority}></input>
</div>
</div>
<hr></hr>
<div class="tile flex-no">
<span class="icon">calendar_month</span>
<div>
<span>{translations.chatPage.task.taskDateLabel}</span>
<input type="date" bind:value={taskViewModal.date}></input>
</div>
</div>
<div class="tile flex-no">
<span class="icon">schedule</span>
<div>
<span>{translations.chatPage.task.taskTimeLabel}</span>
<input type="time" bind:value={taskViewModal.time}></input>
</div>
</div>
</main>
<div class="flex-row">
<button class="flex-1" on:click={taskViewModal.hideSettings}>
{translations.general.closeButton}
<span class="icon">close</span>
</button>
<button class="flex-1" on:click={taskViewModal.hideSettingsAndSave}>
{translations.general.saveButton}
<span class="icon">save</span>
</button>
</div>
</div>
</div>
);
}
+18 -5
View File
@@ -1,10 +1,12 @@
const englishTranslations = { const englishTranslations = {
general: { general: {
closeButton: "Close",
deleteItemButtonAudioLabel: "delete item", deleteItemButtonAudioLabel: "delete item",
abortButton: "Abort",
confirmButton: "Confirm",
abortButton: "Abort",
closeButton: "Close",
confirmButton: "Confirm",
saveButton: "Save",
setButton: "Set", setButton: "Set",
}, },
@@ -151,10 +153,21 @@ const englishTranslations = {
/// ///
boardSettingsHeadline: "Board Settings", boardSettingsHeadline: "Board Settings",
boardNameInputLabel: "Board name", boardNameInputLabel: "Board name",
deleteBoardButton: "Delete board and all tasks", deleteBoardButton: "Delete board and all tasks",
///
taskNameLabel: "Title",
taskCategoryLabel: "Category",
taskStatusLabel: "Status",
taskPriorityLabel: "Priority",
taskDescriptionLabel: "Description",
taskDateLabel: "Date",
taskTimeLabel: "Time",
}, },
}, },
}; };
+23 -10
View File
@@ -1,8 +1,6 @@
import * as React from "bloatless-react"; import * as React from "bloatless-react";
import BoardModel, { import BoardModel, { TaskFileContent } from "../../Model/Files/boardModel";
TaskFileContent,
} from "../../Model/Files/boardModel";
import BoardViewModel from "./boardViewModel"; import BoardViewModel from "./boardViewModel";
@@ -22,15 +20,31 @@ export default class TaskViewModel {
// state // state
name: React.State<string> = new React.State(""); name: React.State<string> = new React.State("");
category: React.State<string> = new React.State("");
status: React.State<string> = new React.State("");
description: React.State<string> = new React.State(""); description: React.State<string> = new React.State("");
category: React.State<string> = new React.State("");
status: React.State<string> = new React.State("");
priority: React.State<string> = new React.State(""); priority: React.State<string> = new React.State("");
date: React.State<string> = new React.State(""); date: React.State<string> = new React.State("");
time: React.State<string> = new React.State(""); time: React.State<string> = new React.State("");
isPresentingSettingsModal: React.State<boolean> = new React.State(false);
// view
showSettings = (): void => {
this.isPresentingSettingsModal.value = true;
};
hideSettings = (): void => {
this.isPresentingSettingsModal.value = false;
};
hideSettingsAndSave = (): void => {
this.hideSettings();
this.save();
};
// storage // storage
save = (): void => { save = (): void => {
const newTaskFileContent: TaskFileContent = const newTaskFileContent: TaskFileContent =
@@ -40,9 +54,9 @@ export default class TaskViewModel {
this.boardViewModel.boardInfo.fileId this.boardViewModel.boardInfo.fileId
); );
newTaskFileContent.description = this.description.value;
newTaskFileContent.status = this.status.value; newTaskFileContent.status = this.status.value;
newTaskFileContent.category = this.category.value; newTaskFileContent.category = this.category.value;
newTaskFileContent.description = this.description.value;
newTaskFileContent.priority = this.priority.value; newTaskFileContent.priority = this.priority.value;
newTaskFileContent.date = this.date.value; newTaskFileContent.date = this.date.value;
newTaskFileContent.time = this.time.value; newTaskFileContent.time = this.time.value;
@@ -54,13 +68,12 @@ export default class TaskViewModel {
// load // load
loadAllData = (): void => { loadAllData = (): void => {
this.name.value = this.task.name; this.name.value = this.task.name;
this.description.value = this.task.description ?? "";
this.category.value = this.task.category ?? ""; this.category.value = this.task.category ?? "";
this.status.value = this.task.status ?? ""; this.status.value = this.task.status ?? "";
this.description.value = this.task.description ?? "";
this.priority.value = this.task.priority ?? ""; this.priority.value = this.task.priority ?? "";
this.date.value = this.task.date ?? ""; this.date.value = this.task.date ?? "";
this.time.value = this.task.time ?? ""; this.time.value = this.task.time ?? "";
}; };