fix bug with creating tasks

This commit is contained in:
marlon-erler
2024-07-26 06:56:34 +02:00
parent 1afea509f3
commit 43363a4ed1
7 changed files with 70 additions and 7 deletions
+22 -1
View File
@@ -39,6 +39,27 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
monthGrid: React.State<MonthGrid<React.MapState<TaskViewModel>> | undefined> =
new React.State<any>(undefined);
// methods
createEvent = (): void => {
const taskFileContent: TaskFileContent =
this.boardsAndTasksModel.createTask("events");
taskFileContent.date = CalendarModel.getISODateString(
this.selectedYear.value.toString(),
this.selectedMonth.value.toString(),
this.selectedDate.value.toString()
);
const taskViewModel: TaskViewModel = new TaskViewModel(
this.coreViewModel,
this.boardsAndTasksModel,
this,
taskFileContent
);
this.selectTask(taskViewModel);
this.updateTaskIndices();
};
// view
getTaskMapState = (
taskFileContent: TaskFileContent
@@ -70,7 +91,7 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
const mapState: React.MapState<TaskViewModel> | null =
this.getTaskMapState(taskFileContent);
mapState?.set(taskFileContent.fileId, taskViewModel);
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
};