feat(api,userbot,frontend): search peers without chats and start tracking them
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { goto } from "$app/navigation";
|
||||
import { page } from "$app/state";
|
||||
import ChatListItem from "$lib/components/ChatListItem.svelte";
|
||||
import DiscoverResultItem from "$lib/components/search/DiscoverResultItem.svelte";
|
||||
import SearchMessageItem from "$lib/components/search/SearchMessageItem.svelte";
|
||||
import EmptyState from "$lib/components/ui/EmptyState.svelte";
|
||||
import Spinner from "$lib/components/ui/Spinner.svelte";
|
||||
@@ -13,8 +14,11 @@
|
||||
);
|
||||
|
||||
const hasChats = $derived(search.chatHits.length > 0);
|
||||
const hasPeers = $derived(search.peerHits.length > 0);
|
||||
const hasMessages = $derived(search.messageHits.length > 0);
|
||||
const empty = $derived(!(search.loading || hasChats || hasMessages));
|
||||
const empty = $derived(
|
||||
!(search.loading || hasChats || hasPeers || hasMessages)
|
||||
);
|
||||
|
||||
function openChat(chatId: number) {
|
||||
search.close();
|
||||
@@ -40,6 +44,13 @@
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#if hasPeers}
|
||||
<div class="section-label">Контакты и каналы</div>
|
||||
{#each search.peerHits as item (item.chat_id)}
|
||||
<DiscoverResultItem {item} onclick={() => openChat(item.chat_id)} />
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#if search.loading && !hasMessages}
|
||||
<div class="loading"><Spinner /></div>
|
||||
{:else if hasMessages}
|
||||
|
||||
Reference in New Issue
Block a user