🐛 fix: fixed when windows withd low the protal will resize (#11738)

fix: fixed when windows withd low the protal will resize
This commit is contained in:
Shinji-Li
2026-01-24 16:40:09 +08:00
committed by GitHub
parent 3a66a69f55
commit 96f7862e3c

View File

@@ -1,7 +1,7 @@
'use client';
import { DraggablePanel, type DraggablePanelProps } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
import { createStaticStyles, useResponsive } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { Activity, type PropsWithChildren, memo, useState } from 'react';
@@ -52,6 +52,8 @@ const PortalPanel = memo(({ children }: PropsWithChildren) => {
const [tmpWidth, setWidth] = useState(portalWidth);
if (tmpWidth !== portalWidth) setWidth(portalWidth);
const { lg } = useResponsive();
const handleSizeChange: DraggablePanelProps['onSizeChange'] = (_, size) => {
if (!size) return;
const nextWidth = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
@@ -75,6 +77,7 @@ const PortalPanel = memo(({ children }: PropsWithChildren) => {
minWidth={
showArtifactUI || showToolUI || showThread ? CHAT_PORTAL_TOOL_UI_WIDTH : CHAT_PORTAL_WIDTH
}
mode={lg ? 'fixed' : 'float'}
onSizeChange={handleSizeChange}
placement={'right'}
showHandleWhenCollapsed={false}