implement updating task list

This commit is contained in:
marlon-erler
2024-07-24 13:40:17 +02:00
parent 20b27d1a57
commit b1f28cd5ad
4 changed files with 59 additions and 11 deletions
+20
View File
@@ -99,6 +99,15 @@ export default class BoardViewModel {
};
// view
showTaskInList = (taskFileContent: TaskFileContent): void => {
const taskViewModel: TaskViewModel = new TaskViewModel(
this.boardModel,
this,
taskFileContent
);
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
};
select = (): void => {
this.taskPageViewModel.selectBoard(this);
};
@@ -176,13 +185,16 @@ export default class BoardViewModel {
taskPageViewModel: TaskPageViewModel,
boardInfo: BoardInfoFileContent
) {
// set
this.storageModel = storageModel;
this.boardModel = boardModel;
this.taskPageViewModel = taskPageViewModel;
this.boardInfo = boardInfo;
// load
this.loadListRelevantData();
// subscriptions
this.isSelected = React.createProxyState(
[this.taskPageViewModel.selectedBoardId],
() =>
@@ -193,9 +205,17 @@ export default class BoardViewModel {
if (this.isSelected.value == false) return;
this.applyColor();
});
this.selectedPage.subscribeSilent(() => {
this.storeLastUsedView();
});
// handlers
boardModel.taskHandlerManager.addHandler(
(taskFileContent: TaskFileContent) => {
this.showTaskInList(taskFileContent);
}
);
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ export default class TaskViewModel {
newTaskFileContent.date = this.date.value;
newTaskFileContent.time = this.time.value;
this.boardModel.updateTask(newTaskFileContent);
this.boardModel.updateTaskAndSend(newTaskFileContent);
this.boardViewModel.trackTask(this);
};