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
70efbef0
Unverified
Commit
70efbef0
authored
Jul 05, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jul 05, 2024
Browse files
Merge pull request #3636 from Peter-De-Ath/add-scroll-to-settings-tabs
fix: add scroll to admin/user settings tabs
parents
89e6044b
c3c15cbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
6 deletions
+50
-6
src/lib/components/admin/Settings.svelte
src/lib/components/admin/Settings.svelte
+15
-2
src/lib/components/chat/SettingsModal.svelte
src/lib/components/chat/SettingsModal.svelte
+35
-4
No files found.
src/lib/components/admin/Settings.svelte
View file @
70efbef0
<script>
<script>
import { getContext, tick } from 'svelte';
import { getContext, tick
, onMount
} from 'svelte';
import { toast } from 'svelte-sonner';
import { toast } from 'svelte-sonner';
import Database from './Settings/Database.svelte';
import Database from './Settings/Database.svelte';
...
@@ -21,11 +21,24 @@
...
@@ -21,11 +21,24 @@
const i18n = getContext('i18n');
const i18n = getContext('i18n');
let selectedTab = 'general';
let selectedTab = 'general';
onMount(() => {
const containerElement = document.getElementById('admin-settings-tabs-container');
if (containerElement) {
containerElement.addEventListener('wheel', function (event) {
if (event.deltaY !== 0) {
// Adjust horizontal scroll position based on vertical scroll
containerElement.scrollLeft += event.deltaY;
}
});
}
});
</script>
</script>
<div class="flex flex-col lg:flex-row w-full h-full py-2 lg:space-x-4">
<div class="flex flex-col lg:flex-row w-full h-full py-2 lg:space-x-4">
<div
<div
class="tabs flex flex-row overflow-x-auto space-x-1 max-w-full lg:space-x-0 lg:space-y-1 lg:flex-col lg:flex-none lg:w-44 dark:text-gray-200 text-xs text-left scrollbar-none"
id="admin-settings-tabs-container"
class="tabs flex flex-row overflow-x-auto space-x-1 max-w-full lg:space-x-0 lg:space-y-1 lg:flex-col lg:flex-none lg:w-44 dark:text-gray-200 text-xs text-left scrollbar-none"
>
>
<button
<button
class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 lg:flex-none flex text-right transition {selectedTab ===
class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 lg:flex-none flex text-right transition {selectedTab ===
...
...
src/lib/components/chat/SettingsModal.svelte
View file @
70efbef0
<script lang="ts">
<script lang="ts">
import { getContext } from 'svelte';
import { getContext
, tick
} from 'svelte';
import { toast } from 'svelte-sonner';
import { toast } from 'svelte-sonner';
import { models, settings, user } from '$lib/stores';
import { models, settings, user } from '$lib/stores';
import { updateUserSettings } from '$lib/apis/users';
import { getModels as _getModels } from '$lib/apis';
import { getModels as _getModels } from '$lib/apis';
import { goto } from '$app/navigation';
import Modal from '../common/Modal.svelte';
import Modal from '../common/Modal.svelte';
import Account from './Settings/Account.svelte';
import Account from './Settings/Account.svelte';
...
@@ -14,8 +15,6 @@
...
@@ -14,8 +15,6 @@
import Chats from './Settings/Chats.svelte';
import Chats from './Settings/Chats.svelte';
import User from '../icons/User.svelte';
import User from '../icons/User.svelte';
import Personalization from './Settings/Personalization.svelte';
import Personalization from './Settings/Personalization.svelte';
import { updateUserSettings } from '$lib/apis/users';
import { goto } from '$app/navigation';
import Valves from './Settings/Valves.svelte';
import Valves from './Settings/Valves.svelte';
const i18n = getContext('i18n');
const i18n = getContext('i18n');
...
@@ -34,6 +33,37 @@
...
@@ -34,6 +33,37 @@
};
};
let selectedTab = 'general';
let selectedTab = 'general';
// Function to handle sideways scrolling
const scrollHandler = (event) => {
const settingsTabsContainer = document.getElementById('settings-tabs-container');
if (settingsTabsContainer) {
event.preventDefault(); // Prevent default vertical scrolling
settingsTabsContainer.scrollLeft += event.deltaY; // Scroll sideways
}
};
const addScrollListener = async () => {
await tick();
const settingsTabsContainer = document.getElementById('settings-tabs-container');
if (settingsTabsContainer) {
settingsTabsContainer.addEventListener('wheel', scrollHandler);
}
};
const removeScrollListener = async () => {
await tick();
const settingsTabsContainer = document.getElementById('settings-tabs-container');
if (settingsTabsContainer) {
settingsTabsContainer.removeEventListener('wheel', scrollHandler);
}
};
$: if (show) {
addScrollListener();
} else {
removeScrollListener();
}
</script>
</script>
<Modal bind:show>
<Modal bind:show>
...
@@ -61,6 +91,7 @@
...
@@ -61,6 +91,7 @@
<div class="flex flex-col md:flex-row w-full p-4 md:space-x-4">
<div class="flex flex-col md:flex-row w-full p-4 md:space-x-4">
<div
<div
id="settings-tabs-container"
class="tabs flex flex-row overflow-x-auto space-x-1 md:space-x-0 md:space-y-1 md:flex-col flex-1 md:flex-none md:w-40 dark:text-gray-200 text-xs text-left mb-3 md:mb-0"
class="tabs flex flex-row overflow-x-auto space-x-1 md:space-x-0 md:space-y-1 md:flex-col flex-1 md:flex-none md:w-40 dark:text-gray-200 text-xs text-left mb-3 md:mb-0"
>
>
<button
<button
...
...
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