mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-13 01:02:25 -06:00
refac
This commit is contained in:
@@ -96,7 +96,6 @@
|
|||||||
|
|
||||||
const BREAKPOINT = 768;
|
const BREAKPOINT = 768;
|
||||||
const DEFAULT_PINNED_ITEMS = ['notes', 'workspace'];
|
const DEFAULT_PINNED_ITEMS = ['notes', 'workspace'];
|
||||||
const MOBILE_SIDEBAR_SETTLE_MS = 210;
|
|
||||||
const sidebarMountTransition = (node: Element, params: Record<string, unknown>) =>
|
const sidebarMountTransition = (node: Element, params: Record<string, unknown>) =>
|
||||||
$mobile ? { duration: 0, css: () => '' } : slide(node, params);
|
$mobile ? { duration: 0, css: () => '' } : slide(node, params);
|
||||||
|
|
||||||
@@ -577,18 +576,9 @@
|
|||||||
selectedChatId = null;
|
selectedChatId = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const focusChatInputSoon = () => {
|
const closeMobileSidebar = () => {
|
||||||
setTimeout(() => {
|
|
||||||
document.getElementById('chat-input')?.focus({ preventScroll: true });
|
|
||||||
}, MOBILE_SIDEBAR_SETTLE_MS);
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeMobileSidebar = (focusChatInput = false) => {
|
|
||||||
if ($mobile) {
|
if ($mobile) {
|
||||||
showSidebar.set(false);
|
showSidebar.set(false);
|
||||||
if (focusChatInput) {
|
|
||||||
focusChatInputSoon();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -798,7 +788,7 @@
|
|||||||
const newChatHandler = async () => {
|
const newChatHandler = async () => {
|
||||||
selectedChatId = null;
|
selectedChatId = null;
|
||||||
selectedFolder.set(null);
|
selectedFolder.set(null);
|
||||||
closeMobileSidebar(true);
|
closeMobileSidebar();
|
||||||
|
|
||||||
if ($user?.role !== 'admin' && $user?.permissions?.chat?.temporary_enforced) {
|
if ($user?.role !== 'admin' && $user?.permissions?.chat?.temporary_enforced) {
|
||||||
await temporaryChatEnabled.set(true);
|
await temporaryChatEnabled.set(true);
|
||||||
|
|||||||
@@ -58,8 +58,6 @@
|
|||||||
import { createMessagesList } from '$lib/utils';
|
import { createMessagesList } from '$lib/utils';
|
||||||
import { getOutputText } from '$lib/components/chat/Messages/structuredOutput';
|
import { getOutputText } from '$lib/components/chat/Messages/structuredOutput';
|
||||||
|
|
||||||
const MOBILE_SIDEBAR_SETTLE_MS = 210;
|
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
@@ -113,12 +111,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const focusChatInputSoon = () => {
|
|
||||||
setTimeout(() => {
|
|
||||||
document.getElementById('chat-input')?.focus({ preventScroll: true });
|
|
||||||
}, MOBILE_SIDEBAR_SETTLE_MS);
|
|
||||||
};
|
|
||||||
|
|
||||||
$: if (openPreview && closeActiveHoverPreview !== closeHoverPreview) {
|
$: if (openPreview && closeActiveHoverPreview !== closeHoverPreview) {
|
||||||
closeActiveHoverPreview?.();
|
closeActiveHoverPreview?.();
|
||||||
closeActiveHoverPreview = closeHoverPreview;
|
closeActiveHoverPreview = closeHoverPreview;
|
||||||
@@ -577,7 +569,6 @@
|
|||||||
|
|
||||||
if ($mobile) {
|
if ($mobile) {
|
||||||
showSidebar.set(false);
|
showSidebar.set(false);
|
||||||
focusChatInputSoon();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optimistically mark as read in UI when clicked
|
// Optimistically mark as read in UI when clicked
|
||||||
|
|||||||
Reference in New Issue
Block a user