diff --git a/src/View/ChatPages/taskPage.tsx b/src/View/ChatPages/taskPage.tsx index 0a8617e5..6505db3d 100644 --- a/src/View/ChatPages/taskPage.tsx +++ b/src/View/ChatPages/taskPage.tsx @@ -1,15 +1,17 @@ import * as React from "bloatless-react"; -import ChatViewModel from "../../ViewModel/Chat/chatViewModel"; +import TaskViewModel from "../../ViewModel/Files/taskViewModel"; import { translations } from "../translations"; -export function TaskPage(chatViewModel: ChatViewModel) { +export function TaskPage(taskViewModel: TaskViewModel) { return (
@@ -26,9 +30,7 @@ export function TaskPage(chatViewModel: ChatViewModel) {
-
- -
+
diff --git a/src/View/Components/chatEntry.tsx b/src/View/Components/chatEntry.tsx index 5701b19c..fdb2b928 100644 --- a/src/View/Components/chatEntry.tsx +++ b/src/View/Components/chatEntry.tsx @@ -2,7 +2,7 @@ import "./chatEntry.css"; import * as React from "bloatless-react"; -import ChatViewModel from "../../ViewModel/chatViewModel"; +import ChatViewModel from "../../ViewModel/Chat/chatViewModel"; export function ChatEntry(chatViewModel: ChatViewModel) { const view = ( diff --git a/src/View/chatPage.tsx b/src/View/chatPage.tsx index e8d16a35..65e4ea11 100644 --- a/src/View/chatPage.tsx +++ b/src/View/chatPage.tsx @@ -2,7 +2,7 @@ import "./homePage.css"; import * as React from "bloatless-react"; -import ChatViewModel, { ChatPageType } from "../ViewModel/chatViewModel"; +import ChatViewModel, { ChatPageType } from "../ViewModel/Chat/chatViewModel"; import { ChatViewToggleButton } from "./Components/chatViewToggleButton"; import { MessagePage } from "./ChatPages/messagePage"; diff --git a/src/ViewModel/Files/taskViewModel.ts b/src/ViewModel/Files/taskViewModel.ts index c1b0bab6..de250cfa 100644 --- a/src/ViewModel/Files/taskViewModel.ts +++ b/src/ViewModel/Files/taskViewModel.ts @@ -1,3 +1,38 @@ import * as React from "bloatless-react"; -export default class TaskViewModel {} +import TaskModel, { + BoardInfoFileContent, + TaskFileContent, +} from "../../Model/Files/taskModel"; + +import StorageModel from "../../Model/Global/storageModel"; + +export default class TaskViewModel { + taskModel: TaskModel; + storageModel: StorageModel; + + // state + newBoardNameInput: React.State = new React.State(""); + + boards: React.ListState = new React.ListState(); + + // guards + cannotCreateBoard: React.State = React.createProxyState( + [this.newBoardNameInput], + () => this.newBoardNameInput.value == "" + ); + + // methods + createBoard = (): void => { + if (this.cannotCreateBoard.value == true) return; + + this.taskModel.createBoard(this.newBoardNameInput.value); + this.newBoardNameInput.value = ""; + }; + + // init + constructor(taskModel: TaskModel, storageModel: StorageModel) { + this.taskModel = taskModel; + this.storageModel = storageModel; + } +}