Files
CT/src/View/Components/chatEntry.tsx
T

36 lines
941 B
TypeScript
Raw Normal View History

2024-07-20 05:10:50 +02:00
import * as React from "bloatless-react";
2024-07-22 20:02:13 +02:00
import ChatViewModel from "../../ViewModel/Chat/chatViewModel";
2024-07-20 05:10:50 +02:00
2024-07-20 14:16:26 +02:00
export function ChatEntry(chatViewModel: ChatViewModel) {
2024-07-20 16:49:01 +02:00
const view = (
2024-07-22 21:07:44 +02:00
<button
2024-07-27 15:24:50 +02:00
class="tile colored-tile chat-entry"
2024-07-25 16:20:43 +02:00
set:color={chatViewModel.settingsPageViewModel.color}
2024-07-23 00:09:39 +02:00
style="height: 8rem"
2024-07-22 21:07:44 +02:00
on:click={chatViewModel.open}
2024-07-27 15:24:50 +02:00
toggle:unread={chatViewModel.hasUnreadMessages}
2024-07-22 21:07:44 +02:00
>
2024-07-20 14:16:26 +02:00
<span
class="shadow"
2024-07-22 21:07:44 +02:00
subscribe:innerText={chatViewModel.settingsPageViewModel.primaryChannel}
2024-07-20 14:16:26 +02:00
></span>
2024-07-22 21:07:44 +02:00
<h2
subscribe:innerText={chatViewModel.settingsPageViewModel.primaryChannel}
></h2>
2024-07-20 13:30:01 +02:00
</button>
2024-07-20 05:10:50 +02:00
);
2024-07-20 16:49:01 +02:00
chatViewModel.index.subscribe((newIndex) => {
view.style.order = newIndex;
});
return view;
2024-07-20 05:10:50 +02:00
}
2024-07-20 14:16:26 +02:00
export const ChatViewModelToChatEntry: React.StateItemConverter<
ChatViewModel
> = (chatViewModel: ChatViewModel) => {
return ChatEntry(chatViewModel);
2024-07-20 05:10:50 +02:00
};