fix: Fix RTL direction spacing errors and sidebar dragging functionality errors.

This commit is contained in:
Yaowei Zou
2025-02-21 11:51:53 +08:00
parent f5f3ce94f6
commit 4c0daf40c0
2 changed files with 15 additions and 24 deletions

View File

@@ -13,7 +13,7 @@ import McpIcon from "../icons/mcp.svg";
import DragIcon from "../icons/drag.svg";
import DiscoveryIcon from "../icons/discovery.svg";
import Locale from "../locales";
import Locale, { getLang } from "../locales";
import { useAppConfig, useChatStore } from "../store";
@@ -91,7 +91,11 @@ export function useDragSideBar() {
return;
}
lastUpdateTime.current = Date.now();
const d = e.clientX - startX.current;
let d = e.clientX - startX.current;
// If text and other elements go from right to left
if (getLang() === "ar") {
d = -1 * d;
}
const nextWidth = limit(startDragWidth.current + d);
config.update((config) => {
if (nextWidth < MIN_SIDEBAR_WIDTH) {