2024-07-07 22:11:18 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
|
|
|
|
import { MessageComposer } from "../Views/messageComposer";
|
|
|
|
|
import { ThreadView } from "../Views/threadView";
|
2024-07-09 14:11:20 +02:00
|
|
|
import { selectedChat } from "../Model/model";
|
2024-07-07 22:11:18 +02:00
|
|
|
import { translation } from "../translations";
|
|
|
|
|
|
|
|
|
|
export function MessageTab() {
|
2024-07-09 14:11:20 +02:00
|
|
|
function clearMessageHistory() {
|
|
|
|
|
selectedChat.value?.clearMessages();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const headerText = React.createProxyState([selectedChat], () =>
|
|
|
|
|
selectedChat.value != undefined
|
|
|
|
|
? selectedChat.value.currentChannel
|
|
|
|
|
: translation.messages
|
|
|
|
|
);
|
|
|
|
|
|
2024-07-07 22:11:18 +02:00
|
|
|
return (
|
|
|
|
|
<article id="message-tab">
|
2024-07-08 00:39:22 +02:00
|
|
|
<header>
|
2024-07-09 14:11:20 +02:00
|
|
|
<span subscribe:innerText={headerText}>
|
|
|
|
|
</span>
|
2024-07-08 00:39:22 +02:00
|
|
|
<span>
|
|
|
|
|
<button
|
|
|
|
|
aria-label={translation.clearHistory}
|
|
|
|
|
on:click={clearMessageHistory}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">delete_sweep</span>
|
|
|
|
|
</button>
|
|
|
|
|
</span>
|
|
|
|
|
</header>
|
2024-07-07 22:11:18 +02:00
|
|
|
{ThreadView()}
|
|
|
|
|
<footer>{MessageComposer()}</footer>
|
|
|
|
|
</article>
|
|
|
|
|
);
|
|
|
|
|
}
|