mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-09-05 15:06:53 +08:00
feat: optiminize message&img display
This commit is contained in:
@@ -3,8 +3,9 @@ import {
|
||||
MAX_SIDEBAR_WIDTH,
|
||||
MIN_SIDEBAR_WIDTH,
|
||||
} from "@/app/constant";
|
||||
import { useAppConfig } from "../store/config";
|
||||
import { useAppConfig } from "@/app/store/config";
|
||||
import { useRef } from "react";
|
||||
import { updateGlobalCSSVars } from "@/app/utils/client";
|
||||
|
||||
export default function useDragSideBar() {
|
||||
const limit = (x: number) =>
|
||||
@@ -35,9 +36,11 @@ export default function useDragSideBar() {
|
||||
const d = e.clientX - startX.current;
|
||||
const nextWidth = limit(startDragWidth.current + d);
|
||||
|
||||
const { menuWidth } = updateGlobalCSSVars(nextWidth);
|
||||
|
||||
document.documentElement.style.setProperty(
|
||||
"--sidebar-width",
|
||||
`${nextWidth}px`,
|
||||
"--menu-width",
|
||||
`${menuWidth}px`,
|
||||
);
|
||||
config.update((config) => {
|
||||
config.sidebarWidth = nextWidth;
|
||||
@@ -62,7 +65,7 @@ export default function useDragSideBar() {
|
||||
|
||||
// useLayoutEffect(() => {
|
||||
// const barWidth = limit(config.sidebarWidth ?? DEFAULT_SIDEBAR_WIDTH);
|
||||
// document.documentElement.style.setProperty("--sidebar-width", `${barWidth}px`);
|
||||
// document.documentElement.style.setProperty("--menu-width", `${barWidth}px`);
|
||||
// }, [config.sidebarWidth]);
|
||||
|
||||
return {
|
||||
|
@@ -8,8 +8,10 @@ import {
|
||||
DEFAULT_SIDEBAR_WIDTH,
|
||||
MAX_SIDEBAR_WIDTH,
|
||||
MIN_SIDEBAR_WIDTH,
|
||||
SIDEBAR_ID,
|
||||
} from "@/app/constant";
|
||||
import { useAppConfig } from "../store/config";
|
||||
import { useAppConfig } from "@/app/store/config";
|
||||
import { updateGlobalCSSVars } from "@/app/utils/client";
|
||||
|
||||
export const MOBILE_MAX_WIDTH = 768;
|
||||
|
||||
@@ -42,16 +44,10 @@ export default function useListenWinResize() {
|
||||
}
|
||||
}
|
||||
|
||||
nextSidebar = Math.max(
|
||||
MIN_SIDEBAR_WIDTH,
|
||||
Math.min(MAX_SIDEBAR_WIDTH, nextSidebar),
|
||||
);
|
||||
document.documentElement.style.setProperty(
|
||||
"--sidebar-width",
|
||||
`${nextSidebar}px`,
|
||||
);
|
||||
const { menuWidth } = updateGlobalCSSVars(nextSidebar);
|
||||
|
||||
config.update((config) => {
|
||||
config.sidebarWidth = nextSidebar;
|
||||
config.sidebarWidth = menuWidth;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user