add setting for board name, implement saving settings

This commit is contained in:
marlon-erler
2024-07-23 13:19:08 +02:00
parent 3eb823c305
commit 79bda74049
4 changed files with 45 additions and 13 deletions
+13 -4
View File
@@ -8,11 +8,20 @@ export function BoardSettingsModal(boardViewModel: BoardViewModel) {
<div class="modal" toggle:open={boardViewModel.isPresentingSettingsModal}>
<div>
<main>
<h2>{translations.chatPage.message.messageInfoHeadline}</h2>
<h2>{translations.chatPage.task.boardSettingsHeadline}</h2>
<label class="tile flex-no">
<span class="icon">label</span>
<div>
<span>{translations.chatPage.task.boardNameInputLabel}</span>
<input
on:enter={boardViewModel.saveSettings}
bind:value={boardViewModel.name}
></input>
</div>
</label>
</main>
<button
on:click={boardViewModel.hideSettings}
>
<button on:click={boardViewModel.hideSettings}>
{translations.general.closeButton}
<span class="icon">close</span>
</button>
+14 -1
View File
@@ -1,6 +1,7 @@
import * as React from "bloatless-react";
import { BoardInfoFileContent } from "../../Model/Files/taskModel";
import TaskModel, { BoardInfoFileContent } from "../../Model/Files/taskModel";
import { Color } from "../../colors";
import TaskPageViewModel from "./taskPageViewModel";
@@ -30,9 +31,21 @@ export default class BoardViewModel {
};
hideSettings = (): void => {
this.saveSettings();
this.isPresentingSettingsModal.value = false;
};
// methods
saveSettings = (): void => {
const newBoardInfoFileContent: BoardInfoFileContent =
TaskModel.createBoardInfoFileContent(
this.boardInfo.fileId,
this.name.value,
this.color.value
);
this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
};
// load
loadListRelevantData = (): void => {
this.name.value = this.boardInfo.name;
+4
View File
@@ -53,6 +53,10 @@ export default class TaskPageViewModel {
this.showBoardInList(boardInfoFileContent);
};
updateBoard = (boardInfoFileContent: BoardInfoFileContent): void => {
this.taskModel.updateBoard(boardInfoFileContent);
};
// view
showBoardInList = (boardInfo: BoardInfoFileContent): void => {
const boardViewModel: BoardViewModel = new BoardViewModel(this, boardInfo);