Skip to content

Commit 1032301

Browse files
authored
feat: Automatically resize info panel sidebar width when adding or removing panels (#3025)
1 parent 5d32944 commit 1032301

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/dashboard/Data/Browser/DataBrowser.react.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,10 +1063,14 @@ export default class DataBrowser extends React.Component {
10631063
}
10641064

10651065
// Update state with all available data
1066+
const newWidth = (this.state.panelWidth / this.state.panelCount) * newPanelCount;
1067+
const limitedWidth = Math.min(newWidth, this.state.maxWidth);
1068+
10661069
this.setState({
10671070
panelCount: newPanelCount,
10681071
displayedObjectIds: newDisplayedObjectIds,
1069-
multiPanelData: currentObjectData
1072+
multiPanelData: currentObjectData,
1073+
panelWidth: limitedWidth,
10701074
});
10711075

10721076
// Fetch missing data asynchronously
@@ -1086,9 +1090,13 @@ export default class DataBrowser extends React.Component {
10861090
const newPanelCount = prevState.panelCount - 1;
10871091
// Remove the last displayed object
10881092
const newDisplayedObjectIds = prevState.displayedObjectIds.slice(0, -1);
1093+
1094+
const newWidth = (prevState.panelWidth / prevState.panelCount) * newPanelCount;
1095+
10891096
return {
10901097
panelCount: newPanelCount,
1091-
displayedObjectIds: newDisplayedObjectIds
1098+
displayedObjectIds: newDisplayedObjectIds,
1099+
panelWidth: newWidth,
10921100
};
10931101
});
10941102
}

0 commit comments

Comments
 (0)