Skip to content

Commit 06b083d

Browse files
committed
Merge branch 'refs/heads/main' into forman-refactorings_2
2 parents cd840f1 + 423130a commit 06b083d

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

dashi/src/app/PanelsRow.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from "react";
12
import useAppStore from "../store/appStore";
23
import applyPropertyChange from "../actions/applyPropertyChange";
34
import { PropertyChangeEvent } from "../model/event";
@@ -29,19 +30,23 @@ function PanelsRow() {
2930
) => {
3031
applyPropertyChange(contribPoint, panelIndex, panelEvent);
3132
};
32-
33+
const visiblePanels: React.JSX.Element[] = [];
34+
panelStates.forEach((panelState, panelIndex) => {
35+
if (panelState.visible) {
36+
visiblePanels.push(
37+
<Panel
38+
key={panelIndex}
39+
panelState={panelState}
40+
panelModel={panelModels[panelIndex]}
41+
onPropertyChange={(e) => handlePropertyChange(panelIndex, e)}
42+
/>,
43+
);
44+
}
45+
});
46+
const panelElements = <>{visiblePanels}</>;
3347
return (
3448
<div style={{ display: "flex", gap: 5, paddingTop: 10 }}>
35-
{panelStates
36-
.filter((panelState) => panelState.visible)
37-
.map((panelState, panelIndex) => (
38-
<Panel
39-
key={panelIndex}
40-
panelModel={panelModels[panelIndex]}
41-
panelState={panelState}
42-
onPropertyChange={(e) => handlePropertyChange(panelIndex, e)}
43-
/>
44-
))}
49+
{panelElements}
4550
</div>
4651
);
4752
}

0 commit comments

Comments
 (0)