Files
CT/src/ViewModel/Pages/boardViewModel.ts
T

51 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-07-23 00:57:40 +02:00
import * as React from "bloatless-react";
import { BoardInfoFileContent } from "../../Model/Files/taskModel";
import { Color } from "../../colors";
import TaskPageViewModel from "./taskPageViewModel";
export default class BoardViewModel {
taskPageViewModel: TaskPageViewModel;
// data
boardInfo: BoardInfoFileContent;
name: React.State<string> = new React.State("");
color: React.State<Color> = new React.State<Color>(Color.Standard);
2024-07-23 02:40:11 +02:00
isSelected: React.State<boolean>;
// view
select = (): void => {
this.taskPageViewModel.selectBoard(this);
};
close = (): void => {
this.taskPageViewModel.closeBoard();
};
2024-07-23 00:57:40 +02:00
// load
loadListRelevantData = (): void => {
this.name.value = this.boardInfo.name;
this.color.value = this.boardInfo.color;
2024-07-23 02:40:11 +02:00
};
2024-07-23 00:57:40 +02:00
2024-07-23 02:40:11 +02:00
loadData = (): void => {};
2024-07-23 00:57:40 +02:00
// init
2024-07-23 02:40:11 +02:00
constructor(
taskPageViewModel: TaskPageViewModel,
boardInfo: BoardInfoFileContent
) {
2024-07-23 00:57:40 +02:00
this.taskPageViewModel = taskPageViewModel;
this.boardInfo = boardInfo;
this.loadListRelevantData();
2024-07-23 02:40:11 +02:00
this.isSelected = React.createProxyState(
[this.taskPageViewModel.selectedBoard],
() => this.taskPageViewModel.selectedBoard.value == this
);
2024-07-23 00:57:40 +02:00
}
}