2024-07-07 22:11:18 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2024-07-09 15:15:17 +02:00
|
|
|
import { closeChatView, selectedChat } from "../Model/model";
|
2024-07-09 14:28:13 +02:00
|
|
|
|
2024-07-09 17:23:29 +02:00
|
|
|
import { ChatOptionModal } from "../Views/chatOptionModal";
|
2024-07-07 22:11:18 +02:00
|
|
|
import { MessageComposer } from "../Views/messageComposer";
|
|
|
|
|
import { ThreadView } from "../Views/threadView";
|
|
|
|
|
import { translation } from "../translations";
|
|
|
|
|
|
|
|
|
|
export function MessageTab() {
|
2024-07-09 14:28:13 +02:00
|
|
|
const messageTabContent = React.createProxyState([selectedChat], () => {
|
|
|
|
|
if (selectedChat.value == undefined)
|
|
|
|
|
return (
|
|
|
|
|
<div class="width-100 height-100 flex-column align-center justify-center">
|
|
|
|
|
<span class="secondary">{translation.noChatSelected}</span>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const chat = selectedChat.value;
|
2024-07-09 17:23:29 +02:00
|
|
|
const isShowingOptions = new React.State(false);
|
2024-07-09 14:28:13 +02:00
|
|
|
|
2024-07-09 17:23:29 +02:00
|
|
|
function showOptions() {
|
|
|
|
|
isShowingOptions.value = true;
|
|
|
|
|
}
|
2024-07-09 14:28:13 +02:00
|
|
|
|
2024-07-09 18:21:28 +02:00
|
|
|
return [
|
|
|
|
|
<header class="padding-0">
|
|
|
|
|
<span class="flex-row align-center">
|
|
|
|
|
<button aria-label={translation.back} on:click={closeChatView}>
|
|
|
|
|
<span class="icon">arrow_back</span>
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<span subscribe:innerText={chat.primaryChannel}></span>
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
<button
|
|
|
|
|
aria-label={translation.showChatOptions}
|
|
|
|
|
on:click={showOptions}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">tune</span>
|
|
|
|
|
</button>
|
|
|
|
|
</span>
|
|
|
|
|
</header>,
|
|
|
|
|
|
|
|
|
|
ThreadView(chat),
|
|
|
|
|
|
|
|
|
|
<footer>{MessageComposer(chat)}</footer>,
|
|
|
|
|
|
|
|
|
|
ChatOptionModal(chat, isShowingOptions),
|
|
|
|
|
];
|
2024-07-09 14:28:13 +02:00
|
|
|
});
|
|
|
|
|
|
2024-07-09 17:35:32 +02:00
|
|
|
return <article id="message-tab" children:set={messageTabContent}></article>;
|
2024-07-07 22:11:18 +02:00
|
|
|
}
|