From 78d30020c3aa4d08b729d806b5ed12d9dd037ff7 Mon Sep 17 00:00:00 2001 From: Shibo Lyu Date: Wed, 11 Sep 2024 03:02:04 +0800 Subject: [PATCH] fix: various fixes around discover --- src/lib/chat.ts | 1 - src/lib/chatList.ts | 1 - src/lib/globalSearch.ts | 3 --- src/routes/(app)/ChatList.svelte | 2 +- src/routes/(app)/ChatListHeader.svelte | 30 ++++++++++++++++---------- src/routes/(app)/ChatListItem.svelte | 2 +- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/lib/chat.ts b/src/lib/chat.ts index 4994e95..9528698 100644 --- a/src/lib/chat.ts +++ b/src/lib/chat.ts @@ -75,7 +75,6 @@ export function useChat( sections.push(currentSection); - console.log(sections); return sections; }); diff --git a/src/lib/chatList.ts b/src/lib/chatList.ts index 1eff0ef..f565d1b 100644 --- a/src/lib/chatList.ts +++ b/src/lib/chatList.ts @@ -29,7 +29,6 @@ export class ChatListManager { existing.lastMessage = newChat.lastMessage ?? existing.lastMessage; } else { chatList.push(newChat); - console.log('new chat added to list', newChat); } } diff --git a/src/lib/globalSearch.ts b/src/lib/globalSearch.ts index 02fe468..101e777 100644 --- a/src/lib/globalSearch.ts +++ b/src/lib/globalSearch.ts @@ -25,12 +25,9 @@ export class GlobalSearchManager { } const results = await Promise.allSettled(jobs); - console.log(results); const chats: { joined: Chat[]; public: Chat[] } = { joined: [], public: [] }; for (const result of results) { - console.log(result); - if (result.status === 'rejected') continue; const [type, chatList] = result.value; diff --git a/src/routes/(app)/ChatList.svelte b/src/routes/(app)/ChatList.svelte index a1e9a84..3515bc3 100644 --- a/src/routes/(app)/ChatList.svelte +++ b/src/routes/(app)/ChatList.svelte @@ -23,7 +23,7 @@ {/each} {/if} - {#if isSearchFocused} + {#if isSearchFocused || searchQuery}
- + (isSearchFocused = true)} + on:focus={() => { + isSearchFocused = true; + }} on:blur={(e) => { // If the related target is an anchor element, trigger the click as the user is trying to navigate - if (e.relatedTarget instanceof HTMLAnchorElement) { - console.log('relatedTarget is an anchor element'); + if ( + e.relatedTarget instanceof HTMLAnchorElement || + e.relatedTarget instanceof HTMLButtonElement + ) { e.relatedTarget.click(); } isSearchFocused = false; }} /> diff --git a/src/routes/(app)/ChatListItem.svelte b/src/routes/(app)/ChatListItem.svelte index 16e3d11..083af76 100644 --- a/src/routes/(app)/ChatListItem.svelte +++ b/src/routes/(app)/ChatListItem.svelte @@ -26,7 +26,7 @@ )} >