2024-07-10 19:07:58 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2024-07-11 01:24:06 +02:00
|
|
|
import { Chat, Item } from "../../Model/chatModel";
|
2024-07-11 00:56:06 +02:00
|
|
|
|
2024-07-11 01:24:06 +02:00
|
|
|
import { translation } from "../../translations";
|
2024-07-10 19:07:58 +02:00
|
|
|
|
|
|
|
|
export function ChatToolView(chat: Chat) {
|
2024-07-11 00:47:58 +02:00
|
|
|
function createItem() {
|
|
|
|
|
chat.createItem({
|
|
|
|
|
id: React.UUID(),
|
|
|
|
|
title: "new item",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-11 00:56:06 +02:00
|
|
|
const itemConverter: React.StateItemConverter<Item> = (item) => {
|
|
|
|
|
return <span>{item.title}</span>;
|
|
|
|
|
};
|
|
|
|
|
|
2024-07-10 19:07:58 +02:00
|
|
|
return (
|
|
|
|
|
<div class="chat-tool-view">
|
2024-07-11 00:47:58 +02:00
|
|
|
<button on:click={createItem}>+</button>
|
|
|
|
|
<hr></hr>
|
2024-07-11 00:56:06 +02:00
|
|
|
<div children:append={[chat.items, itemConverter]}></div>
|
2024-07-10 19:07:58 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|