From 89c62800a382d0ae2f6c3363cf20a076a93702d7 Mon Sep 17 00:00:00 2001 From: sudhir Date: Thu, 14 May 2026 23:49:28 +0530 Subject: [PATCH] Refine window panel by family --- packages/nodes/src/window/panel.tsx | 67 +++++++++++++++++++---------- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/packages/nodes/src/window/panel.tsx b/packages/nodes/src/window/panel.tsx index cdc5feed..7520a2c6 100644 --- a/packages/nodes/src/window/panel.tsx +++ b/packages/nodes/src/window/panel.tsx @@ -328,17 +328,38 @@ export default function WindowPanel() { const maxRoundedRadius = Math.max(0.01, getMaxSharedWindowRadius(node.width, node.height)) const displayedWindowType = node.windowType === 'hopper' ? 'awning' : (node.windowType ?? 'fixed') const awningDirection = node.windowType === 'hopper' ? 'down' : (node.awningDirection ?? 'up') - const isOperableWindow = - node.windowType === 'sliding' || - node.windowType === 'casement' || - node.windowType === 'awning' || - node.windowType === 'hopper' || - node.windowType === 'single-hung' || - node.windowType === 'double-hung' || - node.windowType === 'louvered' + const windowType = node.windowType ?? 'fixed' + const isFixedWindow = windowType === 'fixed' + const isTrackSashWindow = + windowType === 'sliding' || windowType === 'single-hung' || windowType === 'double-hung' + const isOperableSashWindow = + windowType === 'casement' || + windowType === 'awning' || + windowType === 'hopper' || + windowType === 'louvered' + const isOperableWindow = isTrackSashWindow || isOperableSashWindow const supportsWindowShape = shapedWindowTypes.has(node.windowType ?? 'fixed') - const supportsGrid = node.windowType === 'fixed' + const supportsGrid = isFixedWindow const supportsSill = !silllessWindowTypes.has(node.windowType) + const showWindowTypeSection = !isOpening + const showWindowShapeSection = !isOpening && supportsWindowShape + const showOpeningShapeSection = isOpening + const showFrameSection = !isOpening + const showGridSection = !isOpening && supportsGrid + const showSillSection = !isOpening && supportsSill + const showOperationSection = !isOpening && isOperableWindow + const showAwningDirectionSection = !isOpening && displayedWindowType === 'awning' + const showCasementSection = !isOpening && windowType === 'casement' + const showFlipSide = !isOpening + const operationLabel = isTrackSashWindow + ? windowType === 'sliding' + ? 'Slide' + : 'Raise' + : windowType === 'casement' + ? 'Swing' + : windowType === 'louvered' + ? 'Slats' + : 'Tilt' const setOperationState = (value: number) => { useInteractive.getState().cancelWindowAnimation(node.id) @@ -472,7 +493,7 @@ export default function WindowPanel() { /> - {!isOpening && ( + {showWindowTypeSection && (
{windowTypeOptions.map((option) => { @@ -503,7 +524,7 @@ export default function WindowPanel() { ) })}
- {displayedWindowType === 'awning' && ( + {showAwningDirectionSection && (
@@ -520,7 +541,7 @@ export default function WindowPanel() { />
)} - {node.windowType === 'casement' && ( + {showCasementSection && (
@@ -546,10 +567,10 @@ export default function WindowPanel() { )}
)} - {isOperableWindow && ( + {showOperationSection && (
- {!isOpening && ( + {showFlipSide && (
- {!isOpening && supportsWindowShape && ( - + {showWindowShapeSection && ( + handleUpdate({ @@ -726,7 +747,7 @@ export default function WindowPanel() { )} - {isOpening && ( + {showOpeningShapeSection && ( @@ -819,7 +840,8 @@ export default function WindowPanel() { {!isOpening && ( <> - + {showFrameSection && ( + - + + )} - {supportsGrid && ( + {showGridSection && ( )} - {supportsSill && ( + {showSillSection && (