2024-07-07 22:11:18 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2024-07-09 14:11:20 +02:00
|
|
|
import { Chat } from "../Model/chatModel";
|
|
|
|
|
import { selectedChat } from "../Model/model";
|
2024-07-07 22:11:18 +02:00
|
|
|
import { translation } from "../translations";
|
|
|
|
|
|
|
|
|
|
export function MessageComposer() {
|
2024-07-09 14:11:20 +02:00
|
|
|
const composerContent = React.createProxyState([selectedChat], () => {
|
|
|
|
|
if (selectedChat.value == undefined) return <div></div>;
|
|
|
|
|
|
|
|
|
|
const chat = selectedChat.value;
|
|
|
|
|
return (
|
|
|
|
|
<div class="flex-row width-100">
|
|
|
|
|
{" "}
|
|
|
|
|
<input
|
|
|
|
|
class="width-100 flex-1"
|
|
|
|
|
style="max-width: unset"
|
|
|
|
|
placeholder={translation.composerPlaceholder}
|
|
|
|
|
bind:value={chat.composingMessage}
|
|
|
|
|
on:enter={chat.sendMessage}
|
|
|
|
|
></input>
|
|
|
|
|
<button
|
|
|
|
|
class="primary"
|
|
|
|
|
on:click={chat.sendMessage}
|
|
|
|
|
toggle:disabled={chat.cannotSendMessage}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">send</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return <div children:set={composerContent}></div>;
|
2024-07-07 22:11:18 +02:00
|
|
|
}
|