add chat list section

This commit is contained in:
marlon-erler
2024-07-09 15:15:17 +02:00
parent f48ea3d5d1
commit dae32fa6e7
9 changed files with 389 additions and 222 deletions
+62
View File
@@ -0,0 +1,62 @@
import * as React from "bloatless-react";
import { Chat, chats, removeChat } from "../Model/chatModel";
import { cannotCreateChat, createChat, newChatName } from "../Model/model";
import { translation } from "../translations";
const chatConverter: React.ListItemConverter<Chat> = (chat) => {
function remove() {
removeChat(chat);
}
return (
<div class="tile padding-0">
<div class="flex-row width-100 justify-apart align-center">
<span class="padding-h ellipsis" subscribe:innerText={chat.currentChannel}></span>
<button
class="danger"
aria-label={translation.removeChat}
on:click={remove}
>
<span class="icon">delete</span>
</button>
</div>
</div>
);
};
export function ChatListSection() {
return (
<div class="flex-column">
<h2>{translation.chats}</h2>
<label class="tile">
<span class="icon">forum</span>
<div>
<span>{translation.newChatPrimaryChannel}</span>
<input
bind:value={newChatName}
placeholder={translation.newChatNamePlaceholder}
on:enter={createChat}
></input>
</div>
</label>
<div class="flex-row justify-end">
<button
class="primary width-50"
toggle:disabled={cannotCreateChat}
on:click={createChat}
>
{translation.addChat}
<span class="icon">add</span>
</button>
</div>
<hr></hr>
<div class="flex-column gap" children:append={[chats, chatConverter]}></div>
</div>
);
}
+2
View File
@@ -19,6 +19,8 @@ import { translation } from "../translations";
export function ConnectionSection() {
return (
<div class="flex-column">
<h2>{translation.connection}</h2>
<label class="tile">
<span class="icon">cell_tower</span>
<div>