Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
99a43cc9
Unverified
Commit
99a43cc9
authored
Apr 27, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Apr 27, 2024
Browse files
Merge pull request #1792 from insoutt/hide-sidebar-on-resize
Hide the sidebar when resizing the window
parents
f8f9f27a
0c79ac04
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+12
-5
No files found.
src/lib/components/layout/Sidebar.svelte
View file @
99a43cc9
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
import ArchiveBox from '../icons/ArchiveBox.svelte';
import ArchiveBox from '../icons/ArchiveBox.svelte';
import ArchivedChatsModal from './Sidebar/ArchivedChatsModal.svelte';
import ArchivedChatsModal from './Sidebar/ArchivedChatsModal.svelte';
const BREAKPOINT = 1024;
let show = false;
let show = false;
let navElement;
let navElement;
...
@@ -49,9 +50,7 @@
...
@@ -49,9 +50,7 @@
let isEditing = false;
let isEditing = false;
onMount(async () => {
onMount(async () => {
if (window.innerWidth > 1024) {
show = window.innerWidth > BREAKPOINT;
show = true;
}
await chats.set(await getChatList(localStorage.token));
await chats.set(await getChatList(localStorage.token));
let touchstartX = 0;
let touchstartX = 0;
...
@@ -79,12 +78,20 @@
...
@@ -79,12 +78,20 @@
checkDirection();
checkDirection();
};
};
const onResize = () => {
if(show && window.innerWidth < BREAKPOINT) {
show = false;
}
}
document.addEventListener('touchstart', onTouchStart);
document.addEventListener('touchstart', onTouchStart);
document.addEventListener('touchend', onTouchEnd);
document.addEventListener('touchend', onTouchEnd);
window.addEventListener('resize', onResize);
return () => {
return () => {
document.removeEventListener('touchstart', onTouchStart);
document.removeEventListener('touchstart', onTouchStart);
document.removeEventListener('touchend', onTouchEnd);
document.removeEventListener('touchend', onTouchEnd);
document.removeEventListener('resize', onResize);
};
};
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment