fix bug with creating tasks
This commit is contained in:
Vendored
+31
-3
@@ -689,6 +689,11 @@
|
|||||||
const paddedMonth = month.padStart(2, "0");
|
const paddedMonth = month.padStart(2, "0");
|
||||||
return `${paddedYear}-${paddedMonth}`;
|
return `${paddedYear}-${paddedMonth}`;
|
||||||
};
|
};
|
||||||
|
static getISODateString = (year, month, date) => {
|
||||||
|
const monthString = _CalendarModel.getMonthString(year, month);
|
||||||
|
const paddedDate = date.padStart(2, "0");
|
||||||
|
return `${monthString}-${paddedDate}`;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// src/colors.ts
|
// src/colors.ts
|
||||||
@@ -1582,7 +1587,7 @@
|
|||||||
selectedTaskViewModel = new State(void 0);
|
selectedTaskViewModel = new State(void 0);
|
||||||
taskViewModels = new MapState();
|
taskViewModels = new MapState();
|
||||||
// methods
|
// methods
|
||||||
createTask = (boardId) => {
|
createTaskFromBoardId = (boardId) => {
|
||||||
const taskFileContent = this.boardsAndTasksModel.createTask(boardId);
|
const taskFileContent = this.boardsAndTasksModel.createTask(boardId);
|
||||||
const taskViewModel = new TaskViewModel(
|
const taskViewModel = new TaskViewModel(
|
||||||
this.coreViewModel,
|
this.coreViewModel,
|
||||||
@@ -1656,6 +1661,23 @@
|
|||||||
selectedMonth = new State(0);
|
selectedMonth = new State(0);
|
||||||
selectedDate = new State(0);
|
selectedDate = new State(0);
|
||||||
monthGrid = new State(void 0);
|
monthGrid = new State(void 0);
|
||||||
|
// methods
|
||||||
|
createEvent = () => {
|
||||||
|
const taskFileContent = this.boardsAndTasksModel.createTask("events");
|
||||||
|
taskFileContent.date = CalendarModel.getISODateString(
|
||||||
|
this.selectedYear.value.toString(),
|
||||||
|
this.selectedMonth.value.toString(),
|
||||||
|
this.selectedDate.value.toString()
|
||||||
|
);
|
||||||
|
const taskViewModel = new TaskViewModel(
|
||||||
|
this.coreViewModel,
|
||||||
|
this.boardsAndTasksModel,
|
||||||
|
this,
|
||||||
|
taskFileContent
|
||||||
|
);
|
||||||
|
this.selectTask(taskViewModel);
|
||||||
|
this.updateTaskIndices();
|
||||||
|
};
|
||||||
// view
|
// view
|
||||||
getTaskMapState = (taskFileContent) => {
|
getTaskMapState = (taskFileContent) => {
|
||||||
if (this.monthGrid.value == null) return null;
|
if (this.monthGrid.value == null) return null;
|
||||||
@@ -1997,6 +2019,9 @@
|
|||||||
this.close();
|
this.close();
|
||||||
};
|
};
|
||||||
// methods
|
// methods
|
||||||
|
createTask = () => {
|
||||||
|
this.createTaskFromBoardId(this.boardInfo.fileId);
|
||||||
|
};
|
||||||
handleDropWithinBoard = (category, status) => {
|
handleDropWithinBoard = (category, status) => {
|
||||||
const draggedObject = this.coreViewModel.draggedObject.value;
|
const draggedObject = this.coreViewModel.draggedObject.value;
|
||||||
if (draggedObject instanceof TaskViewModel == false) return;
|
if (draggedObject instanceof TaskViewModel == false) return;
|
||||||
@@ -2522,7 +2547,9 @@
|
|||||||
yearInputPlaceholder: "2000",
|
yearInputPlaceholder: "2000",
|
||||||
monthInputPlaceholder: "01",
|
monthInputPlaceholder: "01",
|
||||||
///
|
///
|
||||||
searchEventsHeadline: "Search Events"
|
searchEventsHeadline: "Search Events",
|
||||||
|
///
|
||||||
|
events: "Events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2792,7 +2819,8 @@
|
|||||||
"button",
|
"button",
|
||||||
{
|
{
|
||||||
class: "ghost",
|
class: "ghost",
|
||||||
"aria-label": translations.chatPage.task.createTaskButtonAudioLabel
|
"aria-label": translations.chatPage.task.createTaskButtonAudioLabel,
|
||||||
|
"on:click": calendarPageViewModel.createEvent
|
||||||
},
|
},
|
||||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "add")
|
/* @__PURE__ */ createElement("span", { class: "icon" }, "add")
|
||||||
))), /* @__PURE__ */ createElement("div", { class: "content", "children:set": mainContent }))), /* @__PURE__ */ createElement(
|
))), /* @__PURE__ */ createElement("div", { class: "content", "children:set": mainContent }))), /* @__PURE__ */ createElement(
|
||||||
|
|||||||
@@ -112,6 +112,12 @@ export default class CalendarModel {
|
|||||||
const paddedMonth: string = month.padStart(2, "0");
|
const paddedMonth: string = month.padStart(2, "0");
|
||||||
return `${paddedYear}-${paddedMonth}`;
|
return `${paddedYear}-${paddedMonth}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static getISODateString = (year: string, month: string, date: string): string => {
|
||||||
|
const monthString: string = CalendarModel.getMonthString(year, month);
|
||||||
|
const paddedDate: string = date.padStart(2, "0");
|
||||||
|
return `${monthString}-${paddedDate}`;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CalendarModelSubPaths {
|
export enum CalendarModelSubPaths {
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ export function CalendarPage(calendarPageViewModel: CalendarPageViewModel) {
|
|||||||
aria-label={
|
aria-label={
|
||||||
translations.chatPage.task.createTaskButtonAudioLabel
|
translations.chatPage.task.createTaskButtonAudioLabel
|
||||||
}
|
}
|
||||||
|
on:click={calendarPageViewModel.createEvent}
|
||||||
>
|
>
|
||||||
<span class="icon">add</span>
|
<span class="icon">add</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -200,7 +200,11 @@ const englishTranslations = {
|
|||||||
|
|
||||||
///
|
///
|
||||||
|
|
||||||
searchEventsHeadline: "Search Events"
|
searchEventsHeadline: "Search Events",
|
||||||
|
|
||||||
|
///
|
||||||
|
|
||||||
|
events: "Events",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import BoardsAndTasksModel, {
|
|||||||
|
|
||||||
import { Color } from "../../colors";
|
import { Color } from "../../colors";
|
||||||
import CoreViewModel from "../Global/coreViewModel";
|
import CoreViewModel from "../Global/coreViewModel";
|
||||||
import { IndexManager } from "../../Model/Utility/utility";
|
|
||||||
import StorageModel from "../../Model/Global/storageModel";
|
import StorageModel from "../../Model/Global/storageModel";
|
||||||
import TaskContainingPageViewModel from "./taskContainingPageViewModel";
|
import TaskContainingPageViewModel from "./taskContainingPageViewModel";
|
||||||
import TaskPageViewModel from "./taskPageViewModel";
|
import TaskPageViewModel from "./taskPageViewModel";
|
||||||
@@ -69,6 +68,10 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
|
createTask = (): void => {
|
||||||
|
this.createTaskFromBoardId(this.boardInfo.fileId);
|
||||||
|
}
|
||||||
|
|
||||||
handleDropWithinBoard = (category?: string, status?: string): void => {
|
handleDropWithinBoard = (category?: string, status?: string): void => {
|
||||||
const draggedObject: any = this.coreViewModel.draggedObject.value;
|
const draggedObject: any = this.coreViewModel.draggedObject.value;
|
||||||
if (draggedObject instanceof TaskViewModel == false) return;
|
if (draggedObject instanceof TaskViewModel == false) return;
|
||||||
|
|||||||
@@ -39,6 +39,27 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
|
|||||||
monthGrid: React.State<MonthGrid<React.MapState<TaskViewModel>> | undefined> =
|
monthGrid: React.State<MonthGrid<React.MapState<TaskViewModel>> | undefined> =
|
||||||
new React.State<any>(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
|
// view
|
||||||
getTaskMapState = (
|
getTaskMapState = (
|
||||||
taskFileContent: TaskFileContent
|
taskFileContent: TaskFileContent
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default class TaskContainingPageViewModel {
|
|||||||
taskViewModels: React.MapState<TaskViewModel> = new React.MapState();
|
taskViewModels: React.MapState<TaskViewModel> = new React.MapState();
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
createTask = (boardId: string): void => {
|
createTaskFromBoardId = (boardId: string): void => {
|
||||||
const taskFileContent: TaskFileContent =
|
const taskFileContent: TaskFileContent =
|
||||||
this.boardsAndTasksModel.createTask(boardId);
|
this.boardsAndTasksModel.createTask(boardId);
|
||||||
const taskViewModel: TaskViewModel = new TaskViewModel(
|
const taskViewModel: TaskViewModel = new TaskViewModel(
|
||||||
|
|||||||
Reference in New Issue
Block a user