restructure, allow changing board of task through settings modal

This commit is contained in:
marlon-erler
2024-07-28 17:09:27 +02:00
parent eb4a8f04c8
commit f0f6213201
12 changed files with 126 additions and 43 deletions
+55 -21
View File
@@ -841,6 +841,11 @@
); );
return boardInfoFileContentOrNull; return boardInfoFileContentOrNull;
}; };
getBoardName = (boardId) => {
const boardInfo = this.getBoardInfo(boardId);
if (boardInfo == null) return "";
return boardInfo.name;
};
//tasks //tasks
createTask = (boardId) => { createTask = (boardId) => {
const taskFileContent = _BoardsAndTasksModel.createTaskFileContent(v4_default(), "", boardId); const taskFileContent = _BoardsAndTasksModel.createTaskFileContent(v4_default(), "", boardId);
@@ -1483,8 +1488,9 @@
// src/ViewModel/Pages/taskViewModel.ts // src/ViewModel/Pages/taskViewModel.ts
var TaskViewModel = class { var TaskViewModel = class {
// init // init
constructor(coreViewModel, boardsAndTasksModel, containingModel, taskFileContent) { constructor(coreViewModel, chatViewModel, boardsAndTasksModel, containingModel, taskFileContent) {
this.coreViewModel = coreViewModel; this.coreViewModel = coreViewModel;
this.chatViewModel = chatViewModel;
this.boardsAndTasksModel = boardsAndTasksModel; this.boardsAndTasksModel = boardsAndTasksModel;
this.containingModel = containingModel; this.containingModel = containingModel;
this.task = taskFileContent; this.task = taskFileContent;
@@ -1642,7 +1648,12 @@
// src/ViewModel/Pages/taskContainingPageViewModel.ts // src/ViewModel/Pages/taskContainingPageViewModel.ts
var TaskContainingPageViewModel = class { var TaskContainingPageViewModel = class {
coreViewModel; // init
constructor(coreViewModel, chatViewModel, boardsAndTasksModel) {
this.coreViewModel = coreViewModel;
this.chatViewModel = chatViewModel;
this.boardsAndTasksModel = boardsAndTasksModel;
}
boardsAndTasksModel; boardsAndTasksModel;
// state // state
taskIndexManager = new IndexManager( taskIndexManager = new IndexManager(
@@ -1655,6 +1666,7 @@
const taskFileContent = this.boardsAndTasksModel.createTask(boardId); const taskFileContent = this.boardsAndTasksModel.createTask(boardId);
const taskViewModel = new TaskViewModel( const taskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -1679,19 +1691,15 @@
boardViewModel.updateIndex(); boardViewModel.updateIndex();
} }
}; };
// init
constructor(coreViewModel, boardsAndTasksModel) {
this.coreViewModel = coreViewModel;
this.boardsAndTasksModel = boardsAndTasksModel;
}
}; };
// src/ViewModel/Pages/calendarPageViewModel.ts // src/ViewModel/Pages/calendarPageViewModel.ts
var CalendarPageViewModel = class extends TaskContainingPageViewModel { var CalendarPageViewModel = class extends TaskContainingPageViewModel {
// init // init
constructor(coreViewModel, storageModel2, calendarModel, boardsAndTasksModel, chatViewModel) { constructor(coreViewModel, chatViewModel, storageModel2, calendarModel, boardsAndTasksModel) {
super(coreViewModel, boardsAndTasksModel); super(coreViewModel, chatViewModel, boardsAndTasksModel);
this.coreViewModel = coreViewModel; this.coreViewModel = coreViewModel;
this.chatViewModel = chatViewModel;
this.storageModel = storageModel2; this.storageModel = storageModel2;
this.calendarModel = calendarModel; this.calendarModel = calendarModel;
this.boardsAndTasksModel = boardsAndTasksModel; this.boardsAndTasksModel = boardsAndTasksModel;
@@ -1708,7 +1716,6 @@
storageModel; storageModel;
calendarModel; calendarModel;
boardsAndTasksModel; boardsAndTasksModel;
chatViewModel;
// data // data
get monthString() { get monthString() {
return CalendarModel.getMonthString( return CalendarModel.getMonthString(
@@ -1735,6 +1742,7 @@
); );
const taskViewModel = new TaskViewModel( const taskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -1773,6 +1781,7 @@
} }
const taskViewModel = new TaskViewModel( const taskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -2095,9 +2104,10 @@
// src/ViewModel/Pages/boardViewModel.ts // src/ViewModel/Pages/boardViewModel.ts
var BoardViewModel = class extends TaskContainingPageViewModel { var BoardViewModel = class extends TaskContainingPageViewModel {
// init // init
constructor(coreViewModel, storageModel2, boardsAndTasksModel, taskPageViewModel, boardInfo) { constructor(coreViewModel, chatViewModel, storageModel2, boardsAndTasksModel, taskPageViewModel, boardInfo) {
super(coreViewModel, boardsAndTasksModel); super(coreViewModel, chatViewModel, boardsAndTasksModel);
this.coreViewModel = coreViewModel; this.coreViewModel = coreViewModel;
this.chatViewModel = chatViewModel;
this.storageModel = storageModel2; this.storageModel = storageModel2;
this.boardsAndTasksModel = boardsAndTasksModel; this.boardsAndTasksModel = boardsAndTasksModel;
this.taskPageViewModel = taskPageViewModel; this.taskPageViewModel = taskPageViewModel;
@@ -2228,6 +2238,7 @@
} }
const taskViewModel = new TaskViewModel( const taskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -2277,6 +2288,7 @@
if (taskFileContent == null) continue; if (taskFileContent == null) continue;
const taskViewModel = new TaskViewModel( const taskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -2307,8 +2319,9 @@
// src/ViewModel/Pages/taskPageViewModel.ts // src/ViewModel/Pages/taskPageViewModel.ts
var TaskPageViewModel = class { var TaskPageViewModel = class {
// init // init
constructor(coreViewModel, storageModel2, boardModel, chatViewModel) { constructor(coreViewModel, chatViewModel, storageModel2, boardModel) {
this.coreViewModel = coreViewModel; this.coreViewModel = coreViewModel;
this.chatViewModel = chatViewModel;
this.storageModel = storageModel2; this.storageModel = storageModel2;
this.boardsAndTasksModel = boardModel; this.boardsAndTasksModel = boardModel;
this.chatViewModel = chatViewModel; this.chatViewModel = chatViewModel;
@@ -2321,7 +2334,6 @@
} }
storageModel; storageModel;
boardsAndTasksModel; boardsAndTasksModel;
chatViewModel;
// data // data
boardIndexManager = new IndexManager( boardIndexManager = new IndexManager(
(boardViewModel) => boardViewModel.name.value (boardViewModel) => boardViewModel.name.value
@@ -2369,12 +2381,17 @@
showBoardInList = (boardInfo) => { showBoardInList = (boardInfo) => {
const boardViewModel = new BoardViewModel( const boardViewModel = new BoardViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.storageModel, this.storageModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
boardInfo boardInfo
); );
this.boardViewModels.set(boardInfo.fileId, boardViewModel); this.boardViewModels.set(boardInfo.fileId, boardViewModel);
this.chatViewModel.taskBoardSuggestions.set(boardInfo.fileId, [
boardInfo.fileId,
this.boardsAndTasksModel.getBoardName(boardInfo.fileId)
]);
}; };
selectBoard = (boardViewModel) => { selectBoard = (boardViewModel) => {
this.selectedBoardId.value = boardViewModel.boardInfo.fileId; this.selectedBoardId.value = boardViewModel.boardInfo.fileId;
@@ -2431,16 +2448,16 @@
this.chatListViewModel = chatListViewModel2; this.chatListViewModel = chatListViewModel2;
this.calendarViewModel = new CalendarPageViewModel( this.calendarViewModel = new CalendarPageViewModel(
coreViewModel, coreViewModel,
this,
this.storageModel, this.storageModel,
this.chatModel.fileModel.boardsAndTasksModel.calendarModel, this.chatModel.fileModel.boardsAndTasksModel.calendarModel,
this.chatModel.fileModel.boardsAndTasksModel, this.chatModel.fileModel.boardsAndTasksModel
this
); );
this.taskPageViewModel = new TaskPageViewModel( this.taskPageViewModel = new TaskPageViewModel(
this.coreViewModel, this.coreViewModel,
this,
this.storageModel, this.storageModel,
this.chatModel.fileModel.boardsAndTasksModel, this.chatModel.fileModel.boardsAndTasksModel
this
); );
this.messagePageViewModel = new MessagePageViewModel( this.messagePageViewModel = new MessagePageViewModel(
this.coreViewModel, this.coreViewModel,
@@ -2475,6 +2492,7 @@
); );
index = new State(0); index = new State(0);
hasUnreadMessages = new State(false); hasUnreadMessages = new State(false);
taskBoardSuggestions = new MapState();
// view // view
open = () => { open = () => {
this.chatListViewModel.openChat(this); this.chatListViewModel.openChat(this);
@@ -2754,6 +2772,7 @@
/// ///
taskSettingsHeadline: "Edit Task", taskSettingsHeadline: "Edit Task",
taskNameLabel: "Title", taskNameLabel: "Title",
taskBoardLabel: "Board",
taskCategoryLabel: "Category", taskCategoryLabel: "Category",
taskStatusLabel: "Status", taskStatusLabel: "Status",
taskPriorityLabel: "Priority", taskPriorityLabel: "Priority",
@@ -2923,6 +2942,7 @@
deleteBoardButton: "Board und alle Aufgaben l\xF6schen", deleteBoardButton: "Board und alle Aufgaben l\xF6schen",
taskSettingsHeadline: "Aufgabe bearbeiten", taskSettingsHeadline: "Aufgabe bearbeiten",
taskNameLabel: "Titel", taskNameLabel: "Titel",
taskBoardLabel: "Board",
taskCategoryLabel: "Kategorie", taskCategoryLabel: "Kategorie",
taskStatusLabel: "Status", taskStatusLabel: "Status",
taskPriorityLabel: "Priorit\xE4t", taskPriorityLabel: "Priorit\xE4t",
@@ -3086,6 +3106,7 @@
deleteBoardButton: "Eliminar tablero y todas las tareas", deleteBoardButton: "Eliminar tablero y todas las tareas",
taskSettingsHeadline: "Editar Tarea", taskSettingsHeadline: "Editar Tarea",
taskNameLabel: "T\xEDtulo", taskNameLabel: "T\xEDtulo",
taskBoardLabel: "Tablero",
taskCategoryLabel: "Categor\xEDa", taskCategoryLabel: "Categor\xEDa",
taskStatusLabel: "Estado", taskStatusLabel: "Estado",
taskPriorityLabel: "Prioridad", taskPriorityLabel: "Prioridad",
@@ -3177,6 +3198,9 @@
var StringToOption = (string) => { var StringToOption = (string) => {
return Option(string, string, false); return Option(string, string, false);
}; };
var EntryToOption = (entry) => {
return Option(entry[1], entry[0], false);
};
var VersionIdToOption = (versionId) => { var VersionIdToOption = (versionId) => {
const [date, rest] = versionId.split("T"); const [date, rest] = versionId.split("T");
const [time] = rest.split("."); const [time] = rest.split(".");
@@ -3228,7 +3252,16 @@
"bind:value": taskViewModel.selectedVersionId, "bind:value": taskViewModel.selectedVersionId,
"children:append": [taskViewModel.versionIds, VersionIdToOption] "children:append": [taskViewModel.versionIds, VersionIdToOption]
} }
), /* @__PURE__ */ createElement("span", { class: "icon" }, "arrow_drop_down"))), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "label"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, translations.chatPage.task.taskNameLabel), /* @__PURE__ */ createElement("input", { "bind:value": taskViewModel.name }))), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "description"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, translations.chatPage.task.taskDescriptionLabel), /* @__PURE__ */ createElement( ), /* @__PURE__ */ createElement("span", { class: "icon" }, "arrow_drop_down"))), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "label"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, translations.chatPage.task.taskNameLabel), /* @__PURE__ */ createElement("input", { "bind:value": taskViewModel.name }))), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "category"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, translations.chatPage.task.taskBoardLabel), /* @__PURE__ */ createElement(
"select",
{
"bind:value": taskViewModel.boardId,
"children:append": [
taskViewModel.chatViewModel.taskBoardSuggestions,
EntryToOption
]
}
), /* @__PURE__ */ createElement("span", { class: "icon" }, "arrow_drop_down"))), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "description"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, translations.chatPage.task.taskDescriptionLabel), /* @__PURE__ */ createElement(
"textarea", "textarea",
{ {
rows: "10", rows: "10",
@@ -4776,9 +4809,10 @@
// src/ViewModel/Global/coreViewModel.ts // src/ViewModel/Global/coreViewModel.ts
var CoreViewModel = class { var CoreViewModel = class {
// drag&drop // DRAG & DROP
draggedObject = new State(void 0); draggedObject = new State(void 0);
// suggestions // SUGGESTIONS
// boards & tasks
boardSearchSuggestions = new ListState(); boardSearchSuggestions = new ListState();
taskCategorySuggestions = new ListState(); taskCategorySuggestions = new ListState();
taskStatusSuggestions = new ListState(); taskStatusSuggestions = new ListState();
+6
View File
@@ -140,6 +140,12 @@ export default class BoardsAndTasksModel {
return boardInfoFileContentOrNull; return boardInfoFileContentOrNull;
}; };
getBoardName = (boardId: string): string => {
const boardInfo: BoardInfoFileContent|null = this.getBoardInfo(boardId);
if (boardInfo == null) return "";
return boardInfo.name;
}
//tasks //tasks
createTask = (boardId: string): TaskFileContent => { createTask = (boardId: string): TaskFileContent => {
const taskFileContent: TaskFileContent = const taskFileContent: TaskFileContent =
+8
View File
@@ -14,6 +14,12 @@ export const StringToOption: React.StateItemConverter<string> = (
return Option(string, string, false); return Option(string, string, false);
}; };
export const EntryToOption: React.StateItemConverter<Entry> = (
entry: Entry
) => {
return Option(entry[1], entry[0], false);
};
export const VersionIdToOption: React.StateItemConverter<string> = ( export const VersionIdToOption: React.StateItemConverter<string> = (
versionId: string versionId: string
) => { ) => {
@@ -22,3 +28,5 @@ export const VersionIdToOption: React.StateItemConverter<string> = (
const readableName = `${date} ${time}`; const readableName = `${date} ${time}`;
return Option(readableName, versionId, false); return Option(readableName, versionId, false);
}; };
export type Entry = [string, string];
+20 -1
View File
@@ -1,6 +1,10 @@
import * as React from "bloatless-react"; import * as React from "bloatless-react";
import { StringToOption, VersionIdToOption } from "../Components/option"; import {
EntryToOption,
StringToOption,
VersionIdToOption,
} from "../Components/option";
import { DangerousActionButton } from "../Components/dangerousActionButton"; import { DangerousActionButton } from "../Components/dangerousActionButton";
import TaskViewModel from "../../ViewModel/Pages/taskViewModel"; import TaskViewModel from "../../ViewModel/Pages/taskViewModel";
@@ -39,6 +43,21 @@ export function TaskSettingsModal(taskViewModel: TaskViewModel) {
</div> </div>
</label> </label>
<label class="tile flex-no">
<span class="icon">category</span>
<div>
<span>{translations.chatPage.task.taskBoardLabel}</span>
<select
bind:value={taskViewModel.boardId}
children:append={[
taskViewModel.chatViewModel.taskBoardSuggestions,
EntryToOption,
]}
></select>
<span class="icon">arrow_drop_down</span>
</div>
</label>
<label class="tile flex-no"> <label class="tile flex-no">
<span class="icon">description</span> <span class="icon">description</span>
<div> <div>
+3
View File
@@ -214,6 +214,7 @@ const englishTranslations = {
taskSettingsHeadline: "Edit Task", taskSettingsHeadline: "Edit Task",
taskNameLabel: "Title", taskNameLabel: "Title",
taskBoardLabel: "Board",
taskCategoryLabel: "Category", taskCategoryLabel: "Category",
taskStatusLabel: "Status", taskStatusLabel: "Status",
@@ -456,6 +457,7 @@ const allTranslations: { [language: string]: typeof englishTranslations } = {
taskSettingsHeadline: "Aufgabe bearbeiten", taskSettingsHeadline: "Aufgabe bearbeiten",
taskNameLabel: "Titel", taskNameLabel: "Titel",
taskBoardLabel: "Board",
taskCategoryLabel: "Kategorie", taskCategoryLabel: "Kategorie",
taskStatusLabel: "Status", taskStatusLabel: "Status",
@@ -683,6 +685,7 @@ const allTranslations: { [language: string]: typeof englishTranslations } = {
taskSettingsHeadline: "Editar Tarea", taskSettingsHeadline: "Editar Tarea",
taskNameLabel: "Título", taskNameLabel: "Título",
taskBoardLabel: "Tablero",
taskCategoryLabel: "Categoría", taskCategoryLabel: "Categoría",
taskStatusLabel: "Estado", taskStatusLabel: "Estado",
+7 -4
View File
@@ -10,6 +10,7 @@ import CalendarPageViewModel from "../Pages/calendarPageViewModel";
import ChatListViewModel from "./chatListViewModel"; import ChatListViewModel from "./chatListViewModel";
import { Color } from "../../colors"; import { Color } from "../../colors";
import CoreViewModel from "../Global/coreViewModel"; import CoreViewModel from "../Global/coreViewModel";
import { Entry } from "../../View/Components/option";
import MessagePageViewModel from "../Pages/messagePageViewModel"; import MessagePageViewModel from "../Pages/messagePageViewModel";
import SettingsPageViewModel from "../Pages/settingsPageViewModel"; import SettingsPageViewModel from "../Pages/settingsPageViewModel";
import SettingsViewModel from "../Global/settingsViewModel"; import SettingsViewModel from "../Global/settingsViewModel";
@@ -35,6 +36,8 @@ export default class ChatViewModel {
index: React.State<number> = new React.State(0); index: React.State<number> = new React.State(0);
hasUnreadMessages: React.State<boolean> = new React.State(false); hasUnreadMessages: React.State<boolean> = new React.State(false);
taskBoardSuggestions: React.MapState<Entry> = new React.MapState();
// view // view
open = (): void => { open = (): void => {
this.chatListViewModel.openChat(this); this.chatListViewModel.openChat(this);
@@ -109,16 +112,16 @@ export default class ChatViewModel {
// page viewModels // page viewModels
this.calendarViewModel = new CalendarPageViewModel( this.calendarViewModel = new CalendarPageViewModel(
coreViewModel, coreViewModel,
this,
this.storageModel, this.storageModel,
this.chatModel.fileModel.boardsAndTasksModel.calendarModel, this.chatModel.fileModel.boardsAndTasksModel.calendarModel,
this.chatModel.fileModel.boardsAndTasksModel, this.chatModel.fileModel.boardsAndTasksModel
this
); );
this.taskPageViewModel = new TaskPageViewModel( this.taskPageViewModel = new TaskPageViewModel(
this.coreViewModel, this.coreViewModel,
this,
this.storageModel, this.storageModel,
this.chatModel.fileModel.boardsAndTasksModel, this.chatModel.fileModel.boardsAndTasksModel
this
); );
this.messagePageViewModel = new MessagePageViewModel( this.messagePageViewModel = new MessagePageViewModel(
this.coreViewModel, this.coreViewModel,
+3 -2
View File
@@ -1,10 +1,11 @@
import * as React from "bloatless-react"; import * as React from "bloatless-react";
export default class CoreViewModel { export default class CoreViewModel {
// drag&drop // DRAG & DROP
draggedObject: React.State<any> = new React.State<any>(undefined); draggedObject: React.State<any> = new React.State<any>(undefined);
// suggestions // SUGGESTIONS
// boards & tasks
boardSearchSuggestions: React.ListState<string> = new React.ListState(); boardSearchSuggestions: React.ListState<string> = new React.ListState();
taskCategorySuggestions: React.ListState<string> = new React.ListState(); taskCategorySuggestions: React.ListState<string> = new React.ListState();
+5 -1
View File
@@ -5,6 +5,7 @@ import BoardsAndTasksModel, {
TaskFileContent, TaskFileContent,
} from "../../Model/Files/boardsAndTasksModel"; } from "../../Model/Files/boardsAndTasksModel";
import ChatViewModel from "../Chat/chatViewModel";
import { Color } from "../../colors"; import { Color } from "../../colors";
import CoreViewModel from "../Global/coreViewModel"; import CoreViewModel from "../Global/coreViewModel";
import SearchViewModel from "../Utility/searchViewModel"; import SearchViewModel from "../Utility/searchViewModel";
@@ -137,6 +138,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
const taskViewModel: TaskViewModel = new TaskViewModel( const taskViewModel: TaskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -200,6 +202,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
const taskViewModel: TaskViewModel = new TaskViewModel( const taskViewModel: TaskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -233,12 +236,13 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
// init // init
constructor( constructor(
public coreViewModel: CoreViewModel, public coreViewModel: CoreViewModel,
public chatViewModel: ChatViewModel,
storageModel: StorageModel, storageModel: StorageModel,
boardsAndTasksModel: BoardsAndTasksModel, boardsAndTasksModel: BoardsAndTasksModel,
taskPageViewModel: TaskPageViewModel, taskPageViewModel: TaskPageViewModel,
boardInfo: BoardInfoFileContent boardInfo: BoardInfoFileContent
) { ) {
super(coreViewModel, boardsAndTasksModel); super(coreViewModel, chatViewModel, boardsAndTasksModel);
// set // set
this.storageModel = storageModel; this.storageModel = storageModel;
+4 -4
View File
@@ -16,8 +16,6 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
calendarModel: CalendarModel; calendarModel: CalendarModel;
boardsAndTasksModel: BoardsAndTasksModel; boardsAndTasksModel: BoardsAndTasksModel;
chatViewModel: ChatViewModel;
// data // data
get monthString(): string { get monthString(): string {
return CalendarModel.getMonthString( return CalendarModel.getMonthString(
@@ -51,6 +49,7 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
const taskViewModel: TaskViewModel = new TaskViewModel( const taskViewModel: TaskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -99,6 +98,7 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
const taskViewModel: TaskViewModel = new TaskViewModel( const taskViewModel: TaskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -181,12 +181,12 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
// init // init
constructor( constructor(
public coreViewModel: CoreViewModel, public coreViewModel: CoreViewModel,
public chatViewModel: ChatViewModel,
storageModel: StorageModel, storageModel: StorageModel,
calendarModel: CalendarModel, calendarModel: CalendarModel,
boardsAndTasksModel: BoardsAndTasksModel, boardsAndTasksModel: BoardsAndTasksModel,
chatViewModel: ChatViewModel
) { ) {
super(coreViewModel, boardsAndTasksModel); super(coreViewModel, chatViewModel, boardsAndTasksModel);
this.storageModel = storageModel; this.storageModel = storageModel;
this.calendarModel = calendarModel; this.calendarModel = calendarModel;
@@ -4,14 +4,12 @@ import BoardsAndTasksModel, {
TaskFileContent, TaskFileContent,
} from "../../Model/Files/boardsAndTasksModel"; } from "../../Model/Files/boardsAndTasksModel";
import BoardViewModel from "./boardViewModel"; import ChatViewModel from "../Chat/chatViewModel";
import CalendarPageViewModel from "./calendarPageViewModel";
import CoreViewModel from "../Global/coreViewModel"; import CoreViewModel from "../Global/coreViewModel";
import { IndexManager } from "../../Model/Utility/utility"; import { IndexManager } from "../../Model/Utility/utility";
import TaskViewModel from "./taskViewModel"; import TaskViewModel from "./taskViewModel";
export default class TaskContainingPageViewModel { export default class TaskContainingPageViewModel {
coreViewModel: CoreViewModel;
boardsAndTasksModel: BoardsAndTasksModel; boardsAndTasksModel: BoardsAndTasksModel;
// state // state
@@ -30,6 +28,7 @@ export default class TaskContainingPageViewModel {
this.boardsAndTasksModel.createTask(boardId); this.boardsAndTasksModel.createTask(boardId);
const taskViewModel: TaskViewModel = new TaskViewModel( const taskViewModel: TaskViewModel = new TaskViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
taskFileContent taskFileContent
@@ -59,10 +58,10 @@ export default class TaskContainingPageViewModel {
// init // init
constructor( constructor(
coreViewModel: CoreViewModel, public coreViewModel: CoreViewModel,
public chatViewModel: ChatViewModel,
boardsAndTasksModel: BoardsAndTasksModel boardsAndTasksModel: BoardsAndTasksModel
) { ) {
this.coreViewModel = coreViewModel;
this.boardsAndTasksModel = boardsAndTasksModel; this.boardsAndTasksModel = boardsAndTasksModel;
} }
} }
+8 -4
View File
@@ -14,8 +14,6 @@ export default class TaskPageViewModel {
storageModel: StorageModel; storageModel: StorageModel;
boardsAndTasksModel: BoardsAndTasksModel; boardsAndTasksModel: BoardsAndTasksModel;
chatViewModel: ChatViewModel;
// data // data
boardIndexManager: IndexManager<BoardViewModel> = new IndexManager( boardIndexManager: IndexManager<BoardViewModel> = new IndexManager(
(boardViewModel: BoardViewModel) => boardViewModel.name.value (boardViewModel: BoardViewModel) => boardViewModel.name.value
@@ -77,12 +75,18 @@ export default class TaskPageViewModel {
showBoardInList = (boardInfo: BoardInfoFileContent): void => { showBoardInList = (boardInfo: BoardInfoFileContent): void => {
const boardViewModel: BoardViewModel = new BoardViewModel( const boardViewModel: BoardViewModel = new BoardViewModel(
this.coreViewModel, this.coreViewModel,
this.chatViewModel,
this.storageModel, this.storageModel,
this.boardsAndTasksModel, this.boardsAndTasksModel,
this, this,
boardInfo boardInfo
); );
this.boardViewModels.set(boardInfo.fileId, boardViewModel); this.boardViewModels.set(boardInfo.fileId, boardViewModel);
this.chatViewModel.taskBoardSuggestions.set(boardInfo.fileId, [
boardInfo.fileId,
this.boardsAndTasksModel.getBoardName(boardInfo.fileId),
]);
}; };
selectBoard = (boardViewModel: BoardViewModel): void => { selectBoard = (boardViewModel: BoardViewModel): void => {
@@ -145,9 +149,9 @@ export default class TaskPageViewModel {
// init // init
constructor( constructor(
public coreViewModel: CoreViewModel, public coreViewModel: CoreViewModel,
public chatViewModel: ChatViewModel,
storageModel: StorageModel, storageModel: StorageModel,
boardModel: BoardsAndTasksModel, boardModel: BoardsAndTasksModel
chatViewModel: ChatViewModel
) { ) {
this.storageModel = storageModel; this.storageModel = storageModel;
this.boardsAndTasksModel = boardModel; this.boardsAndTasksModel = boardModel;
+2
View File
@@ -5,6 +5,7 @@ import BoardsAndTasksModel, {
} from "../../Model/Files/boardsAndTasksModel"; } from "../../Model/Files/boardsAndTasksModel";
import { localeCompare, padZero } from "../../Model/Utility/utility"; import { localeCompare, padZero } from "../../Model/Utility/utility";
import ChatViewModel from "../Chat/chatViewModel";
import CoreViewModel from "../Global/coreViewModel"; import CoreViewModel from "../Global/coreViewModel";
import TaskContainingPageViewModel from "./taskContainingPageViewModel"; import TaskContainingPageViewModel from "./taskContainingPageViewModel";
import { allowDrag } from "../../View/utility"; import { allowDrag } from "../../View/utility";
@@ -195,6 +196,7 @@ export default class TaskViewModel {
// init // init
constructor( constructor(
public coreViewModel: CoreViewModel, public coreViewModel: CoreViewModel,
public chatViewModel: ChatViewModel,
boardsAndTasksModel: BoardsAndTasksModel, boardsAndTasksModel: BoardsAndTasksModel,
containingModel: TaskContainingPageViewModel, containingModel: TaskContainingPageViewModel,
taskFileContent: TaskFileContent taskFileContent: TaskFileContent