add button to delete board
This commit is contained in:
@@ -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) {
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<hr></hr>
|
||||
|
||||
{ColorPicker(boardViewModel.color)}
|
||||
|
||||
<hr></hr>
|
||||
|
||||
<div class="width-input">
|
||||
{DangerousActionButton(
|
||||
translations.chatPage.task.deleteBoardButton,
|
||||
"delete_forever",
|
||||
boardViewModel.deleteBoard
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
<button on:click={boardViewModel.hideSettings}>
|
||||
{translations.general.closeButton}
|
||||
|
||||
@@ -146,6 +146,8 @@ const englishTranslations = {
|
||||
boardSettingsHeadline: "Board Settings",
|
||||
|
||||
boardNameInputLabel: "Board name",
|
||||
|
||||
deleteBoardButton: "Delete board and all tasks",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -58,6 +58,11 @@ export default class BoardViewModel {
|
||||
this.taskPageViewModel.chatViewModel.setDisplayedColor(this.color.value);
|
||||
};
|
||||
|
||||
deleteBoard = (): void => {
|
||||
this.taskPageViewModel.deleteBoard(this.boardInfo);
|
||||
this.close();
|
||||
};
|
||||
|
||||
// load
|
||||
loadListRelevantData = (): void => {
|
||||
this.name.value = this.boardInfo.name;
|
||||
|
||||
@@ -65,6 +65,12 @@ export default class TaskPageViewModel {
|
||||
this.updateIndices();
|
||||
};
|
||||
|
||||
deleteBoard = (boardInfoFileContent: BoardInfoFileContent): void => {
|
||||
this.taskModel.deleteBoard(boardInfoFileContent.fileId);
|
||||
this.boardViewModels.remove(boardInfoFileContent.fileId);
|
||||
this.updateIndices();
|
||||
};
|
||||
|
||||
// view
|
||||
showBoardInList = (boardInfo: BoardInfoFileContent): void => {
|
||||
const boardViewModel: BoardViewModel = new BoardViewModel(this, boardInfo);
|
||||
|
||||
Reference in New Issue
Block a user