Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ee69e2

Browse files
sudhir9297open-pascal
authored andcommitted
Organize door panel controls by door family
1 parent 4a40275 commit 2ee69e2

1 file changed

Lines changed: 41 additions & 23 deletions

File tree

packages/nodes/src/door/panel.tsx

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -390,21 +390,37 @@ export default function DoorPanel() {
390390
const openingRevealRadius = node.openingRevealRadius ?? 0.025
391391
const maxRoundedRadius = Math.max(0.01, Math.min(node.width / 2, node.height))
392392
const doorType = node.doorType ?? 'hinged'
393+
const isGarageDoor = node.doorCategory === 'garage' || doorType.startsWith('garage-')
393394
const isSwingDoor = doorType === 'hinged' || doorType === 'double' || doorType === 'french'
395+
const isSlideFoldDoor =
396+
doorType === 'folding' ||
397+
doorType === 'pocket' ||
398+
doorType === 'barn' ||
399+
doorType === 'sliding'
394400
const isSlidingDoor = doorType === 'pocket' || doorType === 'barn' || doorType === 'sliding'
395-
const isGarageDoor = node.doorCategory === 'garage' || doorType.startsWith('garage-')
401+
const isFoldingDoor = doorType === 'folding'
396402
const isSectionalGarageDoor = doorType === 'garage-sectional'
397403
const isRollupGarageDoor = doorType === 'garage-rollup'
398404
const isTiltupGarageDoor = doorType === 'garage-tiltup'
399-
const typeMode = isOpening ? 'opening' : isGarageDoor ? 'garage' : 'door'
405+
const isCutoutOnly = isOpening
406+
const typeMode = isCutoutOnly ? 'opening' : isGarageDoor ? 'garage' : 'door'
400407
const supportsHingeSide = doorType === 'hinged'
401408
const supportsHandleSide = doorType === 'hinged'
402-
const supportsTopShape =
403-
!isGarageDoor &&
404-
doorType !== 'folding' &&
405-
doorType !== 'pocket' &&
406-
doorType !== 'barn' &&
407-
doorType !== 'sliding'
409+
const supportsTopShape = isSwingDoor
410+
const showFlipSide = !isCutoutOnly
411+
const showFoldSection = isFoldingDoor && !isCutoutOnly
412+
const showSlideSection = isSlidingDoor && !isCutoutOnly
413+
const showGarageSection =
414+
(isSectionalGarageDoor || isRollupGarageDoor || isTiltupGarageDoor) && !isCutoutOnly
415+
const showOpeningShapeSection = isCutoutOnly
416+
const showDoorShapeSection = !isCutoutOnly && supportsTopShape
417+
const showFrameSection = !isCutoutOnly
418+
const showContentPaddingSection = !isCutoutOnly && !isGarageDoor
419+
const showSwingSection = isSwingDoor
420+
const showThresholdSection = isSwingDoor
421+
const showHandleSection = isSwingDoor
422+
const showHardwareSection = isSwingDoor
423+
const showSegmentsSection = !isCutoutOnly && !isGarageDoor
408424
const maxDoorWidth = isGarageDoor ? 6 : 3
409425

410426
const setOpeningTopRadius = (index: number, value: number, commit = false) => {
@@ -679,7 +695,7 @@ export default function DoorPanel() {
679695
unit="m"
680696
value={Math.round(node.position[0] * 100) / 100}
681697
/>
682-
{!isOpening && (
698+
{showFlipSide && (
683699
<div className="px-1 pt-2 pb-1">
684700
<ActionButton
685701
className="w-full"
@@ -691,7 +707,7 @@ export default function DoorPanel() {
691707
)}
692708
</PanelSection>
693709

694-
{doorType === 'folding' && !isOpening && (
710+
{showFoldSection && (
695711
<PanelSection title="Fold">
696712
<div className="flex flex-col gap-2 px-1 pb-1">
697713
<div className="space-y-1">
@@ -722,7 +738,7 @@ export default function DoorPanel() {
722738
</PanelSection>
723739
)}
724740

725-
{isSlidingDoor && !isOpening && (
741+
{showSlideSection && (
726742
<PanelSection title="Slide">
727743
<div className="flex flex-col gap-2 px-1 pb-1">
728744
<div className="space-y-1">
@@ -753,7 +769,7 @@ export default function DoorPanel() {
753769
</PanelSection>
754770
)}
755771

756-
{(isSectionalGarageDoor || isRollupGarageDoor || isTiltupGarageDoor) && !isOpening && (
772+
{showGarageSection && (
757773
<PanelSection title="Garage">
758774
<SliderControl
759775
label="Open"
@@ -808,7 +824,7 @@ export default function DoorPanel() {
808824
/>
809825
</PanelSection>
810826

811-
{!isOpening && supportsTopShape && (
827+
{showDoorShapeSection && (
812828
<PanelSection title="Top Shape">
813829
<div className="flex flex-col gap-2 px-1 pb-1">
814830
<SegmentedControl
@@ -910,7 +926,7 @@ export default function DoorPanel() {
910926
</PanelSection>
911927
)}
912928

913-
{isOpening && (
929+
{showOpeningShapeSection && (
914930
<PanelSection title="Opening Shape">
915931
<div className="flex flex-col gap-2 px-1 pb-1">
916932
<SegmentedControl
@@ -1007,9 +1023,10 @@ export default function DoorPanel() {
10071023
</PanelSection>
10081024
)}
10091025

1010-
{!isOpening && (
1026+
{!isCutoutOnly && (
10111027
<>
1012-
<PanelSection title="Frame">
1028+
{showFrameSection && (
1029+
<PanelSection title="Frame">
10131030
<SliderControl
10141031
label="Thickness"
10151032
max={0.2}
@@ -1030,9 +1047,10 @@ export default function DoorPanel() {
10301047
unit="m"
10311048
value={Math.round(node.frameDepth * 1000) / 1000}
10321049
/>
1033-
</PanelSection>
1050+
</PanelSection>
1051+
)}
10341052

1035-
{!isGarageDoor && (
1053+
{showContentPaddingSection && (
10361054
<PanelSection title="Content Padding">
10371055
<SliderControl
10381056
label="Horizontal"
@@ -1057,7 +1075,7 @@ export default function DoorPanel() {
10571075
</PanelSection>
10581076
)}
10591077

1060-
{isSwingDoor && (
1078+
{showSwingSection && (
10611079
<PanelSection title="Swing">
10621080
<div className="flex flex-col gap-2 px-1 pb-1">
10631081
{supportsHingeSide && (
@@ -1092,7 +1110,7 @@ export default function DoorPanel() {
10921110
</PanelSection>
10931111
)}
10941112

1095-
{isSwingDoor && (
1113+
{showThresholdSection && (
10961114
<PanelSection title="Threshold">
10971115
<ToggleControl
10981116
checked={node.threshold}
@@ -1116,7 +1134,7 @@ export default function DoorPanel() {
11161134
</PanelSection>
11171135
)}
11181136

1119-
{!isGarageDoor && (
1137+
{showHandleSection && (
11201138
<PanelSection title="Handle">
11211139
{isSwingDoor && (
11221140
<ToggleControl
@@ -1157,7 +1175,7 @@ export default function DoorPanel() {
11571175
</PanelSection>
11581176
)}
11591177

1160-
{isSwingDoor && (
1178+
{showHardwareSection && (
11611179
<PanelSection title="Hardware">
11621180
<ToggleControl
11631181
checked={node.doorCloser}
@@ -1186,7 +1204,7 @@ export default function DoorPanel() {
11861204
</PanelSection>
11871205
)}
11881206

1189-
{!isGarageDoor && (
1207+
{showSegmentsSection && (
11901208
<PanelSection title="Segments">
11911209
{node.segments.map((seg, i) => {
11921210
const numCols = seg.columnRatios.length

0 commit comments

Comments
 (0)