From 6b3be4bb5b2093e3c1425f6057a5a303dd5ef261 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 2 Jan 2025 20:53:30 -0800 Subject: [PATCH] refac: sidebar styling --- src/lib/components/layout/Sidebar.svelte | 184 +++++++++++------------ 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 8af114795..4482268f2 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -578,82 +578,6 @@ ? 'opacity-20' : ''}" > - {#if !search && $pinnedChats.length > 0} -
- { - localStorage.setItem('showPinnedChat', e.detail); - console.log(e.detail); - }} - on:import={(e) => { - importChatHandler(e.detail, true); - }} - on:drop={async (e) => { - const { type, id, item } = e.detail; - - if (type === 'chat') { - let chat = await getChatById(localStorage.token, id).catch((error) => { - return null; - }); - if (!chat && item) { - chat = await importChat(localStorage.token, item.chat, item?.meta ?? {}); - } - - if (chat) { - console.log(chat); - if (chat.folder_id) { - const res = await updateChatFolderIdById( - localStorage.token, - chat.id, - null - ).catch((error) => { - toast.error(error); - return null; - }); - } - - if (!chat.pinned) { - const res = await toggleChatPinnedStatusById(localStorage.token, chat.id); - } - - initChatList(); - } - } - }} - name={$i18n.t('Pinned')} - > -
- {#each $pinnedChats as chat, idx} - { - selectedChatId = chat.id; - }} - on:unselect={() => { - selectedChatId = null; - }} - on:change={async () => { - initChatList(); - }} - on:tag={(e) => { - const { type, name } = e.detail; - tagEventHandler(type, name, chat.id); - }} - /> - {/each} -
-
-
- {/if} - {#if $config?.features?.enable_channels && ($user.role === 'admin' || $channels.length > 0) && !search} {/if} - {#if !search && folders} - { - const { folderId, items } = e.detail; - importChatHandler(items, false, folderId); - }} - on:update={async (e) => { - initChatList(); - }} - on:change={async () => { - initChatList(); - }} - /> - {/if} - {/if} + {#if !search && $pinnedChats.length > 0} +
+ { + localStorage.setItem('showPinnedChat', e.detail); + console.log(e.detail); + }} + on:import={(e) => { + importChatHandler(e.detail, true); + }} + on:drop={async (e) => { + const { type, id, item } = e.detail; + + if (type === 'chat') { + let chat = await getChatById(localStorage.token, id).catch((error) => { + return null; + }); + if (!chat && item) { + chat = await importChat(localStorage.token, item.chat, item?.meta ?? {}); + } + + if (chat) { + console.log(chat); + if (chat.folder_id) { + const res = await updateChatFolderIdById( + localStorage.token, + chat.id, + null + ).catch((error) => { + toast.error(error); + return null; + }); + } + + if (!chat.pinned) { + const res = await toggleChatPinnedStatusById(localStorage.token, chat.id); + } + + initChatList(); + } + } + }} + name={$i18n.t('Pinned')} + > +
+ {#each $pinnedChats as chat, idx} + { + selectedChatId = chat.id; + }} + on:unselect={() => { + selectedChatId = null; + }} + on:change={async () => { + initChatList(); + }} + on:tag={(e) => { + const { type, name } = e.detail; + tagEventHandler(type, name, chat.id); + }} + /> + {/each} +
+
+
+ {/if} + + {#if !search && folders} + { + const { folderId, items } = e.detail; + importChatHandler(items, false, folderId); + }} + on:update={async (e) => { + initChatList(); + }} + on:change={async () => { + initChatList(); + }} + /> + {/if} +
{#if $chats}