mirror of
https://github.com/Blah-IM/Weblah.git
synced 2025-07-08 23:15:33 +00:00
refactor: chatServerConnection.chat -> useChat
This commit is contained in:
parent
c65ff6c892
commit
48c5ed4687
3 changed files with 74 additions and 54 deletions
|
@ -1,18 +1,11 @@
|
|||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import BgPattern from '$lib/components/BgPattern.svelte';
|
||||
import { messageFromBlah, type Chat, type Message } from '$lib/types';
|
||||
import { onDestroy } from 'svelte';
|
||||
import ChatHeader from './ChatHeader.svelte';
|
||||
import ChatHistory from './ChatHistory.svelte';
|
||||
import ChatInput from './ChatInput.svelte';
|
||||
import { BlahChatServerConnection } from '$lib/blah/connection/chatServer';
|
||||
import { currentKeyPair } from '$lib/keystore';
|
||||
import { BlahKeyPair, type EncodedBlahKeyPair } from '$lib/blah/crypto';
|
||||
import { browser } from '$app/environment';
|
||||
import { chatServerConnectionPool } from '$lib/chatServers';
|
||||
import ServiceMessage from '$lib/components/ServiceMessage.svelte';
|
||||
import ChatPage from './ChatPage.svelte';
|
||||
import { useChat } from '$lib/chat';
|
||||
|
||||
$: roomId = $page.params.chatId;
|
||||
|
||||
|
@ -34,7 +27,7 @@
|
|||
|
||||
<div class="flex h-full w-full flex-col items-center justify-center">
|
||||
{#if server}
|
||||
{@const { info, messages, sendMessage } = server.chat(roomId)}
|
||||
{@const { info, messages, sendMessage } = useChat(server, roomId)}
|
||||
<ChatPage {info} {messages} on:sendMessage={sendMessage} />
|
||||
{:else}
|
||||
<ServiceMessage>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue