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
27ff3861
"test/ut/tools/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "85c0d841a6a15d64f32d8237e29616227fd03425"
Commit
27ff3861
authored
Apr 30, 2024
by
Timothy J. Baek
Browse files
fix: horizontal scroll issue on mobile
#1854
parent
35437fb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
17 deletions
+18
-17
src/lib/components/chat/MessageInput/Suggestions.svelte
src/lib/components/chat/MessageInput/Suggestions.svelte
+4
-4
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+14
-13
No files found.
src/lib/components/chat/MessageInput/Suggestions.svelte
View file @
27ff3861
...
@@ -4,10 +4,10 @@
...
@@ -4,10 +4,10 @@
let prompts = [];
let prompts = [];
$: prompts =
$: prompts =
suggestionPrompts;
suggestionPrompts.length <= 4
//
suggestionPrompts.length <= 4
? suggestionPrompts
//
? suggestionPrompts
: suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4);
//
: suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4);
</script>
</script>
<div class="w-full">
<div class="w-full">
...
...
src/lib/components/layout/Sidebar.svelte
View file @
27ff3861
...
@@ -53,28 +53,29 @@
...
@@ -53,28 +53,29 @@
show = window.innerWidth > BREAKPOINT;
show = window.innerWidth > BREAKPOINT;
await chats.set(await getChatList(localStorage.token));
await chats.set(await getChatList(localStorage.token));
let touchstart
X = 0
;
let touchstart;
let touchend
X = 0
;
let touchend;
function checkDirection() {
function checkDirection() {
const screenWidth = window.innerWidth;
const screenWidth = window.innerWidth;
const swipeDistance = Math.abs(touchendX - touchstartX);
const swipeDistance = Math.abs(touchend
.screen
X - touchstart
.screen
X);
if (swipeDistance >= screenWidth / 4) {
if (
touchstart.clientX < 40 &&
swipeDistance >= screenWidth / 4) {
if (touchendX < touchstartX) {
if (touchend
.screen
X < touchstart
.screen
X) {
show = false;
show = false;
}
}
if (touchendX > touchstartX) {
if (touchend
.screen
X > touchstart
.screen
X) {
show = true;
show = true;
}
}
}
}
}
}
const onTouchStart = (e) => {
const onTouchStart = (e) => {
touchstartX = e.changedTouches[0].screenX;
touchstart = e.changedTouches[0];
console.log(touchstart.clientX);
};
};
const onTouchEnd = (e) => {
const onTouchEnd = (e) => {
touchend
X
= e.changedTouches[0]
.screenX
;
touchend = e.changedTouches[0];
checkDirection();
checkDirection();
};
};
...
@@ -84,14 +85,14 @@
...
@@ -84,14 +85,14 @@
}
}
};
};
document
.addEventListener('touchstart', onTouchStart);
window
.addEventListener('touchstart', onTouchStart);
document
.addEventListener('touchend', onTouchEnd);
window
.addEventListener('touchend', onTouchEnd);
window.addEventListener('resize', onResize);
window.addEventListener('resize', onResize);
return () => {
return () => {
document
.removeEventListener('touchstart', onTouchStart);
window
.removeEventListener('touchstart', onTouchStart);
document
.removeEventListener('touchend', onTouchEnd);
window
.removeEventListener('touchend', onTouchEnd);
document
.removeEventListener('resize', onResize);
window
.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