From 79bda740497233c467b00ec9b71e47172e50fe91 Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Tue, 23 Jul 2024 13:19:08 +0200 Subject: [PATCH] add setting for board name, implement saving settings --- dist/index.js | 22 ++++++++++++++-------- src/View/Modals/boardSettingsModal.tsx | 17 +++++++++++++---- src/ViewModel/Pages/boardViewModel.ts | 15 ++++++++++++++- src/ViewModel/Pages/taskPageViewModel.ts | 4 ++++ 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/dist/index.js b/dist/index.js index cf3641b1..cb4ee6f8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1408,8 +1408,18 @@ this.isPresentingSettingsModal.value = true; }; hideSettings = () => { + this.saveSettings(); this.isPresentingSettingsModal.value = false; }; + // methods + saveSettings = () => { + const newBoardInfoFileContent = TaskModel.createBoardInfoFileContent( + this.boardInfo.fileId, + this.name.value, + this.color.value + ); + this.taskPageViewModel.updateBoard(newBoardInfoFileContent); + }; // load loadListRelevantData = () => { this.name.value = this.boardInfo.name; @@ -1456,6 +1466,9 @@ this.newBoardNameInput.value = ""; this.showBoardInList(boardInfoFileContent); }; + updateBoard = (boardInfoFileContent) => { + this.taskModel.updateBoard(boardInfoFileContent); + }; // view showBoardInList = (boardInfo) => { const boardViewModel = new BoardViewModel(this, boardInfo); @@ -2018,14 +2031,7 @@ // src/View/Modals/boardSettingsModal.tsx function BoardSettingsModal(boardViewModel) { - return /* @__PURE__ */ createElement("div", { class: "modal", "toggle:open": boardViewModel.isPresentingSettingsModal }, /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("main", null, /* @__PURE__ */ createElement("h2", null, translations.chatPage.message.messageInfoHeadline)), /* @__PURE__ */ createElement( - "button", - { - "on:click": boardViewModel.hideSettings - }, - translations.general.closeButton, - /* @__PURE__ */ createElement("span", { class: "icon" }, "close") - ))); + return /* @__PURE__ */ createElement("div", { class: "modal", "toggle:open": boardViewModel.isPresentingSettingsModal }, /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("main", null, /* @__PURE__ */ createElement("h2", null, translations.chatPage.task.boardSettingsHeadline), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "label"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, translations.chatPage.task.boardNameInputLabel), /* @__PURE__ */ createElement("input", { "bind:value": boardViewModel.name })))), /* @__PURE__ */ createElement("button", { "on:click": boardViewModel.hideSettings }, translations.general.closeButton, /* @__PURE__ */ createElement("span", { class: "icon" }, "close")))); } // src/View/ChatPages/boardPage.tsx diff --git a/src/View/Modals/boardSettingsModal.tsx b/src/View/Modals/boardSettingsModal.tsx index 2ad3ad20..9330f487 100644 --- a/src/View/Modals/boardSettingsModal.tsx +++ b/src/View/Modals/boardSettingsModal.tsx @@ -8,11 +8,20 @@ export function BoardSettingsModal(boardViewModel: BoardViewModel) {