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) => {
return [...this.getBoardPath(boardName), fileId];
};
getTaskContentPath = (boardName, fileId, contentName) => {
return [...this.getTaskPath(boardName, fileId), contentName];
};
// handler
handleTaskFileContent = (file, fileContent) => {
if (checkMatchesObjectStructure(fileContent, TaskFileContentReference) == false)
@@ -535,14 +538,46 @@
const locationOrNull = this.storageModel.readStringifiable(locationPath, TaskLocationReference);
return locationOrNull;
};
storeTaskLocation = (file, taskFileContent) => {
storeTaskLocation = (file, taskLocation) => {
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);
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
constructor(storageModel2, chatModel, fileModel) {
@@ -649,7 +684,7 @@
};
getFileContent = (file, fileContentName) => {
const filePath = this.getFileContentPath(file, fileContentName);
const fileContentOrNull = this.storageModel.readStringifiable(filePath, FileContentReference);
const fileContentOrNull = this.storageModel.readStringifiable(filePath, FileContentReference2);
return fileContentOrNull;
};
// init
@@ -678,7 +713,7 @@
};
};
};
var FileContentReference = {
var FileContentReference2 = {
dataVersion: DATA_VERSION,
id: "",
creationDate: "",
@@ -687,7 +722,7 @@
var FileReference = {
dataVersion: DATA_VERSION,
id: "",
contentVersions: /* @__PURE__ */ new Set([FileContentReference])
contentVersions: /* @__PURE__ */ new Set([FileContentReference2])
};
// src/Model/Utility/crypto.ts
@@ -1440,10 +1475,8 @@
pages: {
settings: "Settings",
messages: "Messages",
allObjects: "All objects",
kanban: "Kanban",
calendar: "Calendar",
progress: "Progress"
tasks: "Tasks",
calendar: "Calendar"
},
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
function ChatPage(chatViewModel) {
const mainContent = new State(/* @__PURE__ */ createElement("div", null));
@@ -1741,11 +1779,20 @@
switch (selectedPage) {
case "settings" /* Settings */:
return mainContent.value = SettingsPage(chatViewModel);
case "tasks" /* Tasks */:
return mainContent.value = TaskPage(chatViewModel);
default:
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",
{
class: "ghost",
@@ -1759,19 +1806,9 @@
"calendar" /* Calendar */,
chatViewModel
), ChatViewToggleButton(
translations.chatPage.pages.progress,
"window",
"progress" /* Progress */,
chatViewModel
), ChatViewToggleButton(
translations.chatPage.pages.kanban,
"view_kanban",
"kanban" /* Kanban */,
chatViewModel
), ChatViewToggleButton(
translations.chatPage.pages.allObjects,
"deployed_code",
"all" /* AllObjects */,
translations.chatPage.pages.tasks,
"task_alt",
"tasks" /* Tasks */,
chatViewModel
), ChatViewToggleButton(
translations.chatPage.pages.messages,
@@ -1783,7 +1820,8 @@
"settings",
"settings" /* Settings */,
chatViewModel
))), /* @__PURE__ */ createElement("div", { id: "main", "children:set": mainContent })));
))), /* @__PURE__ */ createElement("div", { id: "main", "children:set": mainContent }))
);
}
// 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 { MessagePage } from "./ChatPages/messagePage";
import { SettingsPage } from "./ChatPages/settingsPage";
import { TaskPage } from "./ChatPages/taskPage";
import { translations } from "./translations";
export function ChatPage(chatViewModel: ChatViewModel) {
@@ -16,13 +17,19 @@ export function ChatPage(chatViewModel: ChatViewModel) {
switch (selectedPage) {
case ChatPageType.Settings:
return (mainContent.value = SettingsPage(chatViewModel));
case ChatPageType.Tasks:
return (mainContent.value = TaskPage(chatViewModel));
default:
return (mainContent.value = MessagePage(chatViewModel));
}
});
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 id="ribbon">
<button
@@ -41,21 +48,9 @@ export function ChatPage(chatViewModel: ChatViewModel) {
chatViewModel
)}
{ChatViewToggleButton(
translations.chatPage.pages.progress,
"window",
ChatPageType.Progress,
chatViewModel
)}
{ChatViewToggleButton(
translations.chatPage.pages.kanban,
"view_kanban",
ChatPageType.Kanban,
chatViewModel
)}
{ChatViewToggleButton(
translations.chatPage.pages.allObjects,
"deployed_code",
ChatPageType.AllObjects,
translations.chatPage.pages.tasks,
"task_alt",
ChatPageType.Tasks,
chatViewModel
)}
{ChatViewToggleButton(
+1 -3
View File
@@ -82,10 +82,8 @@ const englishTranslations = {
pages: {
settings: "Settings",
messages: "Messages",
allObjects: "All objects",
kanban: "Kanban",
tasks: "Tasks",
calendar: "Calendar",
progress: "Progress",
},
settings: {
+1 -3
View File
@@ -231,8 +231,6 @@ export default class ChatViewModel {
export enum ChatPageType {
Settings = "settings",
Messages = "messages",
AllObjects = "all",
Kanban = "kanban",
Tasks = "tasks",
Calendar = "calendar",
Progress = "progress",
}