This commit is contained in:
Timothy Jaeryang Baek 2025-05-19 01:52:40 +04:00
parent e895c33baa
commit 96c7a0ac3c

View File

@ -49,7 +49,6 @@
import Spinner from '../common/Spinner.svelte'; import Spinner from '../common/Spinner.svelte';
import Loader from '../common/Loader.svelte'; import Loader from '../common/Loader.svelte';
import AddFilesPlaceholder from '../AddFilesPlaceholder.svelte'; import AddFilesPlaceholder from '../AddFilesPlaceholder.svelte';
import SearchInput from './Sidebar/SearchInput.svelte';
import Folder from '../common/Folder.svelte'; import Folder from '../common/Folder.svelte';
import Plus from '../icons/Plus.svelte'; import Plus from '../icons/Plus.svelte';
import Tooltip from '../common/Tooltip.svelte'; import Tooltip from '../common/Tooltip.svelte';
@ -65,8 +64,6 @@
const BREAKPOINT = 768; const BREAKPOINT = 768;
let navElement; let navElement;
let search = '';
let shiftKey = false; let shiftKey = false;
let selectedChatId = null; let selectedChatId = null;
@ -177,11 +174,7 @@
currentChatPage.set(1); currentChatPage.set(1);
allChatsLoaded = false; allChatsLoaded = false;
if (search) { await chats.set(await getChatList(localStorage.token, $currentChatPage));
await chats.set(await getChatListBySearchText(localStorage.token, search, $currentChatPage));
} else {
await chats.set(await getChatList(localStorage.token, $currentChatPage));
}
// Enable pagination // Enable pagination
scrollPaginationEnabled.set(true); scrollPaginationEnabled.set(true);
@ -194,11 +187,7 @@
let newChatList = []; let newChatList = [];
if (search) { newChatList = await getChatList(localStorage.token, $currentChatPage);
newChatList = await getChatListBySearchText(localStorage.token, search, $currentChatPage);
} else {
newChatList = await getChatList(localStorage.token, $currentChatPage);
}
// once the bottom of the list has been reached (no results) there is no need to continue querying // once the bottom of the list has been reached (no results) there is no need to continue querying
allChatsLoaded = newChatList.length === 0; allChatsLoaded = newChatList.length === 0;
@ -632,7 +621,7 @@
<div class="px-1.5 flex justify-center text-gray-800 dark:text-gray-200"> <div class="px-1.5 flex justify-center text-gray-800 dark:text-gray-200">
<button <button
class="grow flex items-center space-x-3 rounded-lg px-2 py-[7px] hover:bg-gray-100 dark:hover:bg-gray-900 transition" class="grow flex items-center space-x-3 rounded-lg px-2 py-[7px] hover:bg-gray-100 dark:hover:bg-gray-900 transition outline-none"
on:click={() => { on:click={() => {
showSearch.set(true); showSearch.set(true);
}} }}
@ -653,7 +642,7 @@
? 'opacity-20' ? 'opacity-20'
: ''}" : ''}"
> >
{#if $config?.features?.enable_channels && ($user?.role === 'admin' || $channels.length > 0) && !search} {#if $config?.features?.enable_channels && ($user?.role === 'admin' || $channels.length > 0)}
<Folder <Folder
className="px-2 mt-0.5" className="px-2 mt-0.5"
name={$i18n.t('Channels')} name={$i18n.t('Channels')}
@ -681,7 +670,6 @@
{/if} {/if}
<Folder <Folder
collapsible={!search}
className="px-2 mt-0.5" className="px-2 mt-0.5"
name={$i18n.t('Chats')} name={$i18n.t('Chats')}
onAdd={() => { onAdd={() => {
@ -741,7 +729,7 @@
<div class="absolute z-40 w-full h-full flex justify-center"></div> <div class="absolute z-40 w-full h-full flex justify-center"></div>
{/if} {/if}
{#if !search && $pinnedChats.length > 0} {#if $pinnedChats.length > 0}
<div class="flex flex-col space-y-1 rounded-xl"> <div class="flex flex-col space-y-1 rounded-xl">
<Folder <Folder
className="" className=""
@ -817,7 +805,7 @@
</div> </div>
{/if} {/if}
{#if !search && folders} {#if folders}
<Folders <Folders
{folders} {folders}
on:import={(e) => { on:import={(e) => {