diff --git a/src/lib/components/chat/Messages/UserMessage.svelte b/src/lib/components/chat/Messages/UserMessage.svelte index 5b9638ad5..689008e22 100644 --- a/src/lib/components/chat/Messages/UserMessage.svelte +++ b/src/lib/components/chat/Messages/UserMessage.svelte @@ -60,7 +60,7 @@ class="prose chat-{message.role} w-full max-w-full flex flex-col justify-end dark:prose-invert prose-headings:my-0 prose-p:my-0 prose-p:-mb-4 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-img:my-0 prose-ul:-my-4 prose-ol:-my-4 prose-li:-my-3 prose-ul:-mb-6 prose-ol:-mb-6 prose-li:-mb-4 whitespace-pre-line" > {#if message.files} -
+
{#each message.files as file}
{#if file.type === 'image'} diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index c4f4d2543..576929ed0 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -76,7 +76,26 @@ } }); + mobile; + const onResize = () => { + if ($showSidebar && window.innerWidth < BREAKPOINT) { + showSidebar.set(false); + } + }; + onMount(async () => { + mobile.subscribe((e) => { + console.log(e); + + if ($showSidebar && e) { + showSidebar.set(false); + } + + if (!$showSidebar && !e) { + showSidebar.set(true); + } + }); + showSidebar.set(window.innerWidth > BREAKPOINT); await chats.set(await getChatList(localStorage.token)); @@ -106,20 +125,12 @@ checkDirection(); }; - const onResize = () => { - if ($showSidebar && window.innerWidth < BREAKPOINT) { - showSidebar.set(false); - } - }; - window.addEventListener('touchstart', onTouchStart); window.addEventListener('touchend', onTouchEnd); - window.addEventListener('resize', onResize); return () => { window.removeEventListener('touchstart', onTouchStart); window.removeEventListener('touchend', onTouchEnd); - window.removeEventListener('resize', onResize); }; }); @@ -207,7 +218,7 @@ bind:this={navElement} id="sidebar" class="h-screen max-h-[100dvh] min-h-screen select-none {$showSidebar - ? 'lg:relative w-[260px]' + ? 'md:relative w-[260px]' : '-translate-x-[260px] w-[0px]'} bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 top-0 left-0 rounded-r-2xl " data-state={$showSidebar}