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
daed66f7
Commit
daed66f7
authored
Apr 16, 2024
by
Timothy J. Baek
Browse files
feat: sidebar swipe support
parent
b219906f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+26
-0
No files found.
src/lib/components/layout/Sidebar.svelte
View file @
daed66f7
...
@@ -45,6 +45,31 @@
...
@@ -45,6 +45,31 @@
show = true;
show = true;
}
}
await chats.set(await getChatList(localStorage.token));
await chats.set(await getChatList(localStorage.token));
let touchstartX = 0;
let touchendX = 0;
function checkDirection() {
const screenWidth = window.innerWidth;
const swipeDistance = Math.abs(touchendX - touchstartX);
if (swipeDistance >= screenWidth / 4) {
if (touchendX < touchstartX) {
show = false;
}
if (touchendX > touchstartX) {
show = true;
}
}
}
document.addEventListener('touchstart', (e) => {
touchstartX = e.changedTouches[0].screenX;
});
document.addEventListener('touchend', (e) => {
touchendX = e.changedTouches[0].screenX;
checkDirection();
});
});
});
// Helper function to fetch and add chat content to each chat
// Helper function to fetch and add chat content to each chat
...
@@ -706,6 +731,7 @@
...
@@ -706,6 +731,7 @@
</div>
</div>
<div
<div
id="sidebar-handle"
class="fixed left-0 top-[50dvh] -translate-y-1/2 transition-transform translate-x-[255px] md:translate-x-[260px] rotate-0"
class="fixed left-0 top-[50dvh] -translate-y-1/2 transition-transform translate-x-[255px] md:translate-x-[260px] rotate-0"
>
>
<Tooltip
<Tooltip
...
...
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