add button to delete board

This commit is contained in:
marlon-erler
2024-07-23 14:31:50 +02:00
parent 4d55a4974a
commit 3142112cb8
5 changed files with 42 additions and 2 deletions
+16 -2
View File
@@ -1454,6 +1454,10 @@
applyColor = () => { applyColor = () => {
this.taskPageViewModel.chatViewModel.setDisplayedColor(this.color.value); this.taskPageViewModel.chatViewModel.setDisplayedColor(this.color.value);
}; };
deleteBoard = () => {
this.taskPageViewModel.deleteBoard(this.boardInfo);
this.close();
};
// load // load
loadListRelevantData = () => { loadListRelevantData = () => {
this.name.value = this.boardInfo.name; this.name.value = this.boardInfo.name;
@@ -1513,6 +1517,11 @@
this.taskModel.updateBoard(boardInfoFileContent); this.taskModel.updateBoard(boardInfoFileContent);
this.updateIndices(); this.updateIndices();
}; };
deleteBoard = (boardInfoFileContent) => {
this.taskModel.deleteBoard(boardInfoFileContent.fileId);
this.boardViewModels.remove(boardInfoFileContent.fileId);
this.updateIndices();
};
// view // view
showBoardInList = (boardInfo) => { showBoardInList = (boardInfo) => {
const boardViewModel = new BoardViewModel(this, boardInfo); const boardViewModel = new BoardViewModel(this, boardInfo);
@@ -1835,7 +1844,8 @@
showBoardSettingsButtonAudioLabel: "show board settigns", showBoardSettingsButtonAudioLabel: "show board settigns",
/// ///
boardSettingsHeadline: "Board Settings", boardSettingsHeadline: "Board Settings",
boardNameInputLabel: "Board name" boardNameInputLabel: "Board name",
deleteBoardButton: "Delete board and all tasks"
} }
} }
}; };
@@ -2124,7 +2134,11 @@
"on:enter": boardViewModel.saveSettings, "on:enter": boardViewModel.saveSettings,
"bind:value": boardViewModel.name "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 // src/View/ChatPages/boardPage.tsx
+13
View File
@@ -2,6 +2,7 @@ import * as React from "bloatless-react";
import BoardViewModel from "../../ViewModel/Pages/boardViewModel"; import BoardViewModel from "../../ViewModel/Pages/boardViewModel";
import { ColorPicker } from "../Components/colorPicker"; import { ColorPicker } from "../Components/colorPicker";
import { DangerousActionButton } from "../Components/dangerousActionButton";
import { translations } from "../translations"; import { translations } from "../translations";
export function BoardSettingsModal(boardViewModel: BoardViewModel) { export function BoardSettingsModal(boardViewModel: BoardViewModel) {
@@ -22,7 +23,19 @@ export function BoardSettingsModal(boardViewModel: BoardViewModel) {
</div> </div>
</label> </label>
<hr></hr>
{ColorPicker(boardViewModel.color)} {ColorPicker(boardViewModel.color)}
<hr></hr>
<div class="width-input">
{DangerousActionButton(
translations.chatPage.task.deleteBoardButton,
"delete_forever",
boardViewModel.deleteBoard
)}
</div>
</main> </main>
<button on:click={boardViewModel.hideSettings}> <button on:click={boardViewModel.hideSettings}>
{translations.general.closeButton} {translations.general.closeButton}
+2
View File
@@ -146,6 +146,8 @@ const englishTranslations = {
boardSettingsHeadline: "Board Settings", boardSettingsHeadline: "Board Settings",
boardNameInputLabel: "Board name", boardNameInputLabel: "Board name",
deleteBoardButton: "Delete board and all tasks",
}, },
}, },
}; };
+5
View File
@@ -58,6 +58,11 @@ export default class BoardViewModel {
this.taskPageViewModel.chatViewModel.setDisplayedColor(this.color.value); this.taskPageViewModel.chatViewModel.setDisplayedColor(this.color.value);
}; };
deleteBoard = (): void => {
this.taskPageViewModel.deleteBoard(this.boardInfo);
this.close();
};
// load // load
loadListRelevantData = (): void => { loadListRelevantData = (): void => {
this.name.value = this.boardInfo.name; this.name.value = this.boardInfo.name;
+6
View File
@@ -65,6 +65,12 @@ export default class TaskPageViewModel {
this.updateIndices(); this.updateIndices();
}; };
deleteBoard = (boardInfoFileContent: BoardInfoFileContent): void => {
this.taskModel.deleteBoard(boardInfoFileContent.fileId);
this.boardViewModels.remove(boardInfoFileContent.fileId);
this.updateIndices();
};
// view // view
showBoardInList = (boardInfo: BoardInfoFileContent): void => { showBoardInList = (boardInfo: BoardInfoFileContent): void => {
const boardViewModel: BoardViewModel = new BoardViewModel(this, boardInfo); const boardViewModel: BoardViewModel = new BoardViewModel(this, boardInfo);