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