prepare taskPage

This commit is contained in:
marlon-erler
2024-07-22 13:17:21 +02:00
parent 3304949d1a
commit e8ab217be3
5 changed files with 118 additions and 71 deletions
+65 -27
View File
@@ -511,6 +511,9 @@
getTaskPath = (boardName, fileId) => { getTaskPath = (boardName, fileId) => {
return [...this.getBoardPath(boardName), fileId]; return [...this.getBoardPath(boardName), fileId];
}; };
getTaskContentPath = (boardName, fileId, contentName) => {
return [...this.getTaskPath(boardName, fileId), contentName];
};
// handler // handler
handleTaskFileContent = (file, fileContent) => { handleTaskFileContent = (file, fileContent) => {
if (checkMatchesObjectStructure(fileContent, TaskFileContentReference) == false) if (checkMatchesObjectStructure(fileContent, TaskFileContentReference) == false)
@@ -535,14 +538,46 @@
const locationOrNull = this.storageModel.readStringifiable(locationPath, TaskLocationReference); const locationOrNull = this.storageModel.readStringifiable(locationPath, TaskLocationReference);
return locationOrNull; return locationOrNull;
}; };
storeTaskLocation = (file, taskFileContent) => { storeTaskLocation = (file, taskLocation) => {
const locationPath = this.getTaskLocationPath(file.id); const locationPath = this.getTaskLocationPath(file.id);
this.storageModel.writeStringifiable(locationPath, taskFileContent); this.storageModel.writeStringifiable(locationPath, taskLocation);
}; };
updateTaskLocation = (file, newTaskFileContent) => { updateTaskLocation = (file, newLocation) => {
const previousLocation = this.getTaskLocation(file); const previousLocation = this.getTaskLocation(file);
if (previousLocation != null) { if (previousLocation == null) return false;
} const oldBoardName = previousLocation.board;
const sourcePath = this.getTaskPath(oldBoardName, file.id);
const newBoardName = newLocation.board;
const destinationPath = this.getTaskPath(newBoardName, file.id);
return this.storageModel.rename(sourcePath, destinationPath);
};
// storage
listBoardsNames = () => {
const boardDirPath = this.getBoardDirPath();
const boardNames = this.storageModel.list(boardDirPath);
return boardNames;
};
listFileIdsOfBoard = (boardName) => {
const boardPath = this.getBoardPath(boardName);
const fileIds = this.storageModel.list(boardPath);
return fileIds;
};
getTaskVersionNames = (boardName, fileId) => {
const fileDirectoryPath = this.getTaskPath(boardName, fileId);
const versionNames = this.storageModel.list(fileDirectoryPath);
return versionNames;
};
getTaskFileContent = (boardName, fileId, versionName) => {
const fileContentPath = this.getTaskContentPath(
boardName,
fileId,
versionName
);
const taskFileContentOrNull = this.storageModel.readStringifiable(
fileContentPath,
TaskFileContentReference
);
return taskFileContentOrNull;
}; };
// init // init
constructor(storageModel2, chatModel, fileModel) { constructor(storageModel2, chatModel, fileModel) {
@@ -649,7 +684,7 @@
}; };
getFileContent = (file, fileContentName) => { getFileContent = (file, fileContentName) => {
const filePath = this.getFileContentPath(file, fileContentName); const filePath = this.getFileContentPath(file, fileContentName);
const fileContentOrNull = this.storageModel.readStringifiable(filePath, FileContentReference); const fileContentOrNull = this.storageModel.readStringifiable(filePath, FileContentReference2);
return fileContentOrNull; return fileContentOrNull;
}; };
// init // init
@@ -678,7 +713,7 @@
}; };
}; };
}; };
var FileContentReference = { var FileContentReference2 = {
dataVersion: DATA_VERSION, dataVersion: DATA_VERSION,
id: "", id: "",
creationDate: "", creationDate: "",
@@ -687,7 +722,7 @@
var FileReference = { var FileReference = {
dataVersion: DATA_VERSION, dataVersion: DATA_VERSION,
id: "", id: "",
contentVersions: /* @__PURE__ */ new Set([FileContentReference]) contentVersions: /* @__PURE__ */ new Set([FileContentReference2])
}; };
// src/Model/Utility/crypto.ts // src/Model/Utility/crypto.ts
@@ -1440,10 +1475,8 @@
pages: { pages: {
settings: "Settings", settings: "Settings",
messages: "Messages", messages: "Messages",
allObjects: "All objects", tasks: "Tasks",
kanban: "Kanban", calendar: "Calendar"
calendar: "Calendar",
progress: "Progress"
}, },
settings: { settings: {
settingsHeadline: "Settings", settingsHeadline: "Settings",
@@ -1734,6 +1767,11 @@
)))); ))));
} }
// src/View/ChatPages/taskPage.tsx
function TaskPage(chatViewModel) {
return /* @__PURE__ */ createElement("div", { id: "task-page" }, /* @__PURE__ */ createElement("div", { class: "toolbar" }, /* @__PURE__ */ createElement("span", { "subscribe:innerText": chatViewModel.primaryChannel })), /* @__PURE__ */ createElement("div", { class: "content" }));
}
// src/View/chatPage.tsx // src/View/chatPage.tsx
function ChatPage(chatViewModel) { function ChatPage(chatViewModel) {
const mainContent = new State(/* @__PURE__ */ createElement("div", null)); const mainContent = new State(/* @__PURE__ */ createElement("div", null));
@@ -1741,11 +1779,20 @@
switch (selectedPage) { switch (selectedPage) {
case "settings" /* Settings */: case "settings" /* Settings */:
return mainContent.value = SettingsPage(chatViewModel); return mainContent.value = SettingsPage(chatViewModel);
case "tasks" /* Tasks */:
return mainContent.value = TaskPage(chatViewModel);
default: default:
return mainContent.value = MessagePage(chatViewModel); return mainContent.value = MessagePage(chatViewModel);
} }
}); });
return /* @__PURE__ */ createElement("article", { id: "chat-page", "set:color": chatViewModel.color, class: "subtle-background" }, /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("div", { id: "ribbon" }, /* @__PURE__ */ createElement( return /* @__PURE__ */ createElement(
"article",
{
id: "chat-page",
"set:color": chatViewModel.color,
class: "subtle-background"
},
/* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("div", { id: "ribbon" }, /* @__PURE__ */ createElement(
"button", "button",
{ {
class: "ghost", class: "ghost",
@@ -1759,19 +1806,9 @@
"calendar" /* Calendar */, "calendar" /* Calendar */,
chatViewModel chatViewModel
), ChatViewToggleButton( ), ChatViewToggleButton(
translations.chatPage.pages.progress, translations.chatPage.pages.tasks,
"window", "task_alt",
"progress" /* Progress */, "tasks" /* Tasks */,
chatViewModel
), ChatViewToggleButton(
translations.chatPage.pages.kanban,
"view_kanban",
"kanban" /* Kanban */,
chatViewModel
), ChatViewToggleButton(
translations.chatPage.pages.allObjects,
"deployed_code",
"all" /* AllObjects */,
chatViewModel chatViewModel
), ChatViewToggleButton( ), ChatViewToggleButton(
translations.chatPage.pages.messages, translations.chatPage.pages.messages,
@@ -1783,7 +1820,8 @@
"settings", "settings",
"settings" /* Settings */, "settings" /* Settings */,
chatViewModel chatViewModel
))), /* @__PURE__ */ createElement("div", { id: "main", "children:set": mainContent }))); ))), /* @__PURE__ */ createElement("div", { id: "main", "children:set": mainContent }))
);
} }
// src/View/chatPageWrapper.tsx // src/View/chatPageWrapper.tsx
+18
View File
@@ -0,0 +1,18 @@
import * as React from "bloatless-react";
import { ChatMessageViewModelToView } from "../Components/chatMessage";
import ChatViewModel from "../../ViewModel/chatViewModel";
import { translations } from "../translations";
export function TaskPage(chatViewModel: ChatViewModel) {
return (
<div id="task-page">
<div class="toolbar">
<span subscribe:innerText={chatViewModel.primaryChannel}></span>
</div>
<div class="content">
</div>
</div>
);
}
+11 -16
View File
@@ -7,6 +7,7 @@ import ChatViewModel, { ChatPageType } from "../ViewModel/chatViewModel";
import { ChatViewToggleButton } from "./Components/chatViewToggleButton"; import { ChatViewToggleButton } from "./Components/chatViewToggleButton";
import { MessagePage } from "./ChatPages/messagePage"; import { MessagePage } from "./ChatPages/messagePage";
import { SettingsPage } from "./ChatPages/settingsPage"; import { SettingsPage } from "./ChatPages/settingsPage";
import { TaskPage } from "./ChatPages/taskPage";
import { translations } from "./translations"; import { translations } from "./translations";
export function ChatPage(chatViewModel: ChatViewModel) { export function ChatPage(chatViewModel: ChatViewModel) {
@@ -16,13 +17,19 @@ export function ChatPage(chatViewModel: ChatViewModel) {
switch (selectedPage) { switch (selectedPage) {
case ChatPageType.Settings: case ChatPageType.Settings:
return (mainContent.value = SettingsPage(chatViewModel)); return (mainContent.value = SettingsPage(chatViewModel));
case ChatPageType.Tasks:
return (mainContent.value = TaskPage(chatViewModel));
default: default:
return (mainContent.value = MessagePage(chatViewModel)); return (mainContent.value = MessagePage(chatViewModel));
} }
}); });
return ( return (
<article id="chat-page" set:color={chatViewModel.color} class="subtle-background"> <article
id="chat-page"
set:color={chatViewModel.color}
class="subtle-background"
>
<div> <div>
<div id="ribbon"> <div id="ribbon">
<button <button
@@ -41,21 +48,9 @@ export function ChatPage(chatViewModel: ChatViewModel) {
chatViewModel chatViewModel
)} )}
{ChatViewToggleButton( {ChatViewToggleButton(
translations.chatPage.pages.progress, translations.chatPage.pages.tasks,
"window", "task_alt",
ChatPageType.Progress, ChatPageType.Tasks,
chatViewModel
)}
{ChatViewToggleButton(
translations.chatPage.pages.kanban,
"view_kanban",
ChatPageType.Kanban,
chatViewModel
)}
{ChatViewToggleButton(
translations.chatPage.pages.allObjects,
"deployed_code",
ChatPageType.AllObjects,
chatViewModel chatViewModel
)} )}
{ChatViewToggleButton( {ChatViewToggleButton(
+1 -3
View File
@@ -82,10 +82,8 @@ const englishTranslations = {
pages: { pages: {
settings: "Settings", settings: "Settings",
messages: "Messages", messages: "Messages",
allObjects: "All objects", tasks: "Tasks",
kanban: "Kanban",
calendar: "Calendar", calendar: "Calendar",
progress: "Progress",
}, },
settings: { settings: {
+1 -3
View File
@@ -231,8 +231,6 @@ export default class ChatViewModel {
export enum ChatPageType { export enum ChatPageType {
Settings = "settings", Settings = "settings",
Messages = "messages", Messages = "messages",
AllObjects = "all", Tasks = "tasks",
Kanban = "kanban",
Calendar = "calendar", Calendar = "calendar",
Progress = "progress",
} }