From 3142112cb83e6d8154b939e78d4d78172a49dd6c Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Tue, 23 Jul 2024 14:31:50 +0200 Subject: [PATCH] add button to delete board --- dist/index.js | 18 ++++++++++++++++-- src/View/Modals/boardSettingsModal.tsx | 13 +++++++++++++ src/View/translations.ts | 2 ++ src/ViewModel/Pages/boardViewModel.ts | 5 +++++ src/ViewModel/Pages/taskPageViewModel.ts | 6 ++++++ 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 027ad3c6..43d8d3db 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1454,6 +1454,10 @@ applyColor = () => { this.taskPageViewModel.chatViewModel.setDisplayedColor(this.color.value); }; + deleteBoard = () => { + this.taskPageViewModel.deleteBoard(this.boardInfo); + this.close(); + }; // load loadListRelevantData = () => { this.name.value = this.boardInfo.name; @@ -1513,6 +1517,11 @@ this.taskModel.updateBoard(boardInfoFileContent); this.updateIndices(); }; + deleteBoard = (boardInfoFileContent) => { + this.taskModel.deleteBoard(boardInfoFileContent.fileId); + this.boardViewModels.remove(boardInfoFileContent.fileId); + this.updateIndices(); + }; // view showBoardInList = (boardInfo) => { const boardViewModel = new BoardViewModel(this, boardInfo); @@ -1835,7 +1844,8 @@ showBoardSettingsButtonAudioLabel: "show board settigns", /// boardSettingsHeadline: "Board Settings", - boardNameInputLabel: "Board name" + boardNameInputLabel: "Board name", + deleteBoardButton: "Delete board and all tasks" } } }; @@ -2124,7 +2134,11 @@ "on:enter": boardViewModel.saveSettings, "bind:value": boardViewModel.name } - ))), ColorPicker(boardViewModel.color)), /* @__PURE__ */ createElement("button", { "on:click": boardViewModel.hideSettings }, translations.general.closeButton, /* @__PURE__ */ createElement("span", { class: "icon" }, "close")))); + ))), /* @__PURE__ */ createElement("hr", null), ColorPicker(boardViewModel.color), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("div", { class: "width-input" }, DangerousActionButton( + translations.chatPage.task.deleteBoardButton, + "delete_forever", + boardViewModel.deleteBoard + ))), /* @__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 5a1d9998..26a2ec60 100644 --- a/src/View/Modals/boardSettingsModal.tsx +++ b/src/View/Modals/boardSettingsModal.tsx @@ -2,6 +2,7 @@ import * as React from "bloatless-react"; import BoardViewModel from "../../ViewModel/Pages/boardViewModel"; import { ColorPicker } from "../Components/colorPicker"; +import { DangerousActionButton } from "../Components/dangerousActionButton"; import { translations } from "../translations"; export function BoardSettingsModal(boardViewModel: BoardViewModel) { @@ -22,7 +23,19 @@ export function BoardSettingsModal(boardViewModel: BoardViewModel) { +
+ {ColorPicker(boardViewModel.color)} + +
+ +
+ {DangerousActionButton( + translations.chatPage.task.deleteBoardButton, + "delete_forever", + boardViewModel.deleteBoard + )} +