add list to BoardPage
This commit is contained in:
Vendored
+40
-15
@@ -260,9 +260,9 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
throw `error: cannot process subscribe:children directive.
|
throw `error: cannot process subscribe:children directive.
|
||||||
Error: ${error}
|
Usage: "children:append={[list, converter]}"; you can find a more detailed example in the documentation.`;
|
||||||
Usage: "subscribe:children={[list, converter]}"; you can find a more detailed example in the documentation.`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1276,12 +1276,6 @@
|
|||||||
};
|
};
|
||||||
// load
|
// load
|
||||||
loadData = () => {
|
loadData = () => {
|
||||||
this.cannotSendMessage = createProxyState(
|
|
||||||
[this.chatViewModel.settingsViewModel.username, this.composingMessage],
|
|
||||||
() => this.chatViewModel.settingsViewModel.username.value == "" || this.composingMessage.value == ""
|
|
||||||
);
|
|
||||||
};
|
|
||||||
loadMessages = () => {
|
|
||||||
for (const chatMessage of this.chatViewModel.chatModel.messages) {
|
for (const chatMessage of this.chatViewModel.chatModel.messages) {
|
||||||
this.addChatMessage(chatMessage);
|
this.addChatMessage(chatMessage);
|
||||||
}
|
}
|
||||||
@@ -1289,7 +1283,10 @@
|
|||||||
// init
|
// init
|
||||||
constructor(chatViewModel) {
|
constructor(chatViewModel) {
|
||||||
this.chatViewModel = chatViewModel;
|
this.chatViewModel = chatViewModel;
|
||||||
this.loadData();
|
this.cannotSendMessage = createProxyState(
|
||||||
|
[this.chatViewModel.settingsViewModel.username, this.composingMessage],
|
||||||
|
() => this.chatViewModel.settingsViewModel.username.value == "" || this.composingMessage.value == ""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1360,10 +1357,6 @@
|
|||||||
loadListRelevantData = () => {
|
loadListRelevantData = () => {
|
||||||
this.primaryChannel.value = this.chatViewModel.chatModel.info.primaryChannel;
|
this.primaryChannel.value = this.chatViewModel.chatModel.info.primaryChannel;
|
||||||
this.color.value = this.chatViewModel.chatModel.color;
|
this.color.value = this.chatViewModel.chatModel.color;
|
||||||
this.cannotSetEncryptionKey = createProxyState(
|
|
||||||
[this.encryptionKeyInput],
|
|
||||||
() => this.encryptionKeyInput.value == this.chatViewModel.chatModel.info.encryptionKey
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
loadData = () => {
|
loadData = () => {
|
||||||
this.primaryChannelInput.value = this.chatViewModel.chatModel.info.primaryChannel;
|
this.primaryChannelInput.value = this.chatViewModel.chatModel.info.primaryChannel;
|
||||||
@@ -1380,6 +1373,10 @@
|
|||||||
constructor(chatViewModel) {
|
constructor(chatViewModel) {
|
||||||
this.chatViewModel = chatViewModel;
|
this.chatViewModel = chatViewModel;
|
||||||
this.loadListRelevantData();
|
this.loadListRelevantData();
|
||||||
|
this.cannotSetEncryptionKey = createProxyState(
|
||||||
|
[this.encryptionKeyInput],
|
||||||
|
() => this.encryptionKeyInput.value == this.chatViewModel.chatModel.info.encryptionKey
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1399,6 +1396,17 @@
|
|||||||
if (this.cannotCreateBoard.value == true) return;
|
if (this.cannotCreateBoard.value == true) return;
|
||||||
this.taskModel.createBoard(this.newBoardNameInput.value);
|
this.taskModel.createBoard(this.newBoardNameInput.value);
|
||||||
this.newBoardNameInput.value = "";
|
this.newBoardNameInput.value = "";
|
||||||
|
this.loadData();
|
||||||
|
};
|
||||||
|
// load
|
||||||
|
loadData = () => {
|
||||||
|
this.boards.clear();
|
||||||
|
const boardIds = this.taskModel.listBoardIds();
|
||||||
|
for (const boardId of boardIds) {
|
||||||
|
const boardInfo = this.taskModel.getBoardInfo(boardId);
|
||||||
|
if (boardInfo == null) continue;
|
||||||
|
this.boards.add(boardInfo);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// init
|
// init
|
||||||
constructor(taskModel, storageModel2) {
|
constructor(taskModel, storageModel2) {
|
||||||
@@ -1730,7 +1738,7 @@
|
|||||||
|
|
||||||
// src/View/ChatPages/messagePage.tsx
|
// src/View/ChatPages/messagePage.tsx
|
||||||
function MessagePage(messagePageViewModel) {
|
function MessagePage(messagePageViewModel) {
|
||||||
messagePageViewModel.loadMessages();
|
messagePageViewModel.loadData();
|
||||||
const messageContainer = /* @__PURE__ */ createElement(
|
const messageContainer = /* @__PURE__ */ createElement(
|
||||||
"div",
|
"div",
|
||||||
{
|
{
|
||||||
@@ -1917,8 +1925,18 @@
|
|||||||
)))));
|
)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// src/View/Components/boardEntry.tsx
|
||||||
|
function BoardEntry(boardInfo) {
|
||||||
|
const view = /* @__PURE__ */ createElement("button", { color: boardInfo.color, class: "tile" }, /* @__PURE__ */ createElement("b", null, boardInfo.name));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
var BoardInfoToEntry = (boardInfo) => {
|
||||||
|
return BoardEntry(boardInfo);
|
||||||
|
};
|
||||||
|
|
||||||
// src/View/ChatPages/taskPage.tsx
|
// src/View/ChatPages/taskPage.tsx
|
||||||
function TaskPage(taskPageViewModel) {
|
function TaskPage(taskPageViewModel) {
|
||||||
|
taskPageViewModel.loadData();
|
||||||
return /* @__PURE__ */ createElement("div", { id: "task-page" }, /* @__PURE__ */ createElement("div", { class: "pane side" }, /* @__PURE__ */ createElement("div", { class: "content" }, /* @__PURE__ */ createElement("div", { class: "flex-row width-input" }, /* @__PURE__ */ createElement(
|
return /* @__PURE__ */ createElement("div", { id: "task-page" }, /* @__PURE__ */ createElement("div", { class: "pane side" }, /* @__PURE__ */ createElement("div", { class: "content" }, /* @__PURE__ */ createElement("div", { class: "flex-row width-input" }, /* @__PURE__ */ createElement(
|
||||||
"input",
|
"input",
|
||||||
{
|
{
|
||||||
@@ -1935,7 +1953,14 @@
|
|||||||
"toggle:disabled": taskPageViewModel.cannotCreateBoard
|
"toggle:disabled": taskPageViewModel.cannotCreateBoard
|
||||||
},
|
},
|
||||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "add")
|
/* @__PURE__ */ createElement("span", { class: "icon" }, "add")
|
||||||
)), /* @__PURE__ */ createElement("div", { class: "flex-row gap" }))), /* @__PURE__ */ createElement("div", { class: "pane" }, /* @__PURE__ */ createElement("div", { class: "toolbar" }), /* @__PURE__ */ createElement("div", { class: "content" })));
|
)), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement(
|
||||||
|
"div",
|
||||||
|
{
|
||||||
|
class: "grid gap",
|
||||||
|
style: "grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr))",
|
||||||
|
"children:append": [taskPageViewModel.boards, BoardInfoToEntry]
|
||||||
|
}
|
||||||
|
))), /* @__PURE__ */ createElement("div", { class: "pane" }, /* @__PURE__ */ createElement("div", { class: "toolbar" }), /* @__PURE__ */ createElement("div", { class: "content" })));
|
||||||
}
|
}
|
||||||
|
|
||||||
// src/View/chatPage.tsx
|
// src/View/chatPage.tsx
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
"bloatless-react": "^1.3.9",
|
"bloatless-react": "^1.3.10",
|
||||||
"esbuild": "^0.23.0",
|
"esbuild": "^0.23.0",
|
||||||
"udn-frontend": "^1.0.8",
|
"udn-frontend": "^1.0.8",
|
||||||
"uuid": "^10.0.0"
|
"uuid": "^10.0.0"
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import * as React from "bloatless-react";
|
import * as React from "bloatless-react";
|
||||||
|
|
||||||
|
import { BoardInfoToEntry } from "../Components/boardEntry";
|
||||||
import TaskPageViewModel from "../../ViewModel/Pages/taskPageViewModel";
|
import TaskPageViewModel from "../../ViewModel/Pages/taskPageViewModel";
|
||||||
import { translations } from "../translations";
|
import { translations } from "../translations";
|
||||||
|
|
||||||
export function TaskPage(taskPageViewModel: TaskPageViewModel) {
|
export function TaskPage(taskPageViewModel: TaskPageViewModel) {
|
||||||
|
taskPageViewModel.loadData();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="task-page">
|
<div id="task-page">
|
||||||
<div class="pane side">
|
<div class="pane side">
|
||||||
@@ -26,7 +29,13 @@ export function TaskPage(taskPageViewModel: TaskPageViewModel) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-row gap"></div>
|
<hr></hr>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="grid gap"
|
||||||
|
style="grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr))"
|
||||||
|
children:append={[taskPageViewModel.boards, BoardInfoToEntry]}
|
||||||
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pane">
|
<div class="pane">
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import "./chatEntry.css";
|
||||||
|
|
||||||
|
import * as React from "bloatless-react";
|
||||||
|
|
||||||
|
import { BoardInfoFileContent } from "../../Model/Files/taskModel";
|
||||||
|
|
||||||
|
export function BoardEntry(boardInfo: BoardInfoFileContent) {
|
||||||
|
const view = (
|
||||||
|
<button color={boardInfo.color} class="tile">
|
||||||
|
<b>{boardInfo.name}</b>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const BoardInfoToEntry: React.StateItemConverter<
|
||||||
|
BoardInfoFileContent
|
||||||
|
> = (boardInfo: BoardInfoFileContent) => {
|
||||||
|
return BoardEntry(boardInfo);
|
||||||
|
};
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
import * as React from "bloatless-react";
|
import * as React from "bloatless-react";
|
||||||
|
|
||||||
import TaskModel, {
|
import TaskModel, { BoardInfoFileContent } from "../../Model/Files/taskModel";
|
||||||
BoardInfoFileContent,
|
|
||||||
} from "../../Model/Files/taskModel";
|
|
||||||
|
|
||||||
import StorageModel from "../../Model/Global/storageModel";
|
import StorageModel from "../../Model/Global/storageModel";
|
||||||
|
|
||||||
@@ -26,6 +24,22 @@ export default class TaskPageViewModel {
|
|||||||
|
|
||||||
this.taskModel.createBoard(this.newBoardNameInput.value);
|
this.taskModel.createBoard(this.newBoardNameInput.value);
|
||||||
this.newBoardNameInput.value = "";
|
this.newBoardNameInput.value = "";
|
||||||
|
|
||||||
|
this.loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// load
|
||||||
|
loadData = (): void => {
|
||||||
|
this.boards.clear();
|
||||||
|
|
||||||
|
const boardIds: string[] = this.taskModel.listBoardIds();
|
||||||
|
for (const boardId of boardIds) {
|
||||||
|
const boardInfo: BoardInfoFileContent | null =
|
||||||
|
this.taskModel.getBoardInfo(boardId);
|
||||||
|
if (boardInfo == null) continue;
|
||||||
|
|
||||||
|
this.boards.add(boardInfo);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// init
|
// init
|
||||||
|
|||||||
Reference in New Issue
Block a user