From 2b100ed60be9376f531a6f4a7501d214b468b7a6 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Wed, 26 Feb 2025 23:40:49 -0700 Subject: [PATCH] splitter updates --- .../AppSplitter/AppSplitter.stories.tsx | 10 ++++++- .../ui/layout/AppSplitter/AppSplitter.tsx | 30 +++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/web/src/components/ui/layout/AppSplitter/AppSplitter.stories.tsx b/web/src/components/ui/layout/AppSplitter/AppSplitter.stories.tsx index 2f03ba628..bde00292d 100644 --- a/web/src/components/ui/layout/AppSplitter/AppSplitter.stories.tsx +++ b/web/src/components/ui/layout/AppSplitter/AppSplitter.stories.tsx @@ -28,7 +28,7 @@ const LeftContent = () => ( ); const RightContent = () => ( -
+

Right Panel

This is the right panel content

@@ -106,3 +106,11 @@ export const HiddenLeft: Story = { leftHidden: true } }; + +export const HideSplitter: Story = { + args: { + ...Default.args, + autoSaveId: 'hide-splitter', + hideSplitter: true + } +}; diff --git a/web/src/components/ui/layout/AppSplitter/AppSplitter.tsx b/web/src/components/ui/layout/AppSplitter/AppSplitter.tsx index eeff7d584..9ec2de95a 100644 --- a/web/src/components/ui/layout/AppSplitter/AppSplitter.tsx +++ b/web/src/components/ui/layout/AppSplitter/AppSplitter.tsx @@ -20,6 +20,7 @@ import { } from './helper'; import Cookies from 'js-cookie'; import { createStyles } from 'antd-style'; +import { cn } from '@/lib/classMerge'; // First, define the ref type export interface AppSplitterRef { @@ -77,7 +78,6 @@ export const AppSplitter = React.memo( ref ) => { const containerRef = useRef(null); - const [isDragging, setIsDragging] = useState(false); const [sizes, setSizes] = useState<(number | string)[]>(defaultLayout); const hasHidden = useMemo(() => leftHidden || rightHidden, [leftHidden, rightHidden]); const _allowResize = useMemo( @@ -121,16 +121,8 @@ export const AppSplitter = React.memo( /> )); - const onDragEnd = useMemoizedFn(() => { - setIsDragging(false); - }); - - const onDragStart = useMemoizedFn(() => { - setIsDragging(true); - }); - const onChangePanels = useMemoizedFn((sizes: number[]) => { - if (!isDragging) return; + // if (!isDragging) return; setSizes(sizes); const key = createAutoSaveId(autoSaveId); const sizesString = preserveSide === 'left' ? [sizes[0], 'auto'] : ['auto', sizes[1]]; @@ -253,8 +245,8 @@ export const AppSplitter = React.memo( style={style} allowResize={_allowResize} onChange={onChangePanels} - onDragStart={onDragStart} - onDragEnd={onDragEnd} + // onDragStart={onDragStart} + // onDragEnd={onDragEnd} resizerSize={3} sashRender={sashRender}> = React.memo( ({ active, splitterClassName = '', hideSplitter = false, splitDirection = 'vertical' }) => { - const { styles, cx } = useStyles(); - return (
);