Skip to content

Commit 83506a9

Browse files
committed
Remove editorWidth from CSE side content
1 parent bdc8db1 commit 83506a9

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/commons/sideContent/content/SideContentCseMachine.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import { getLocation } from '../SideContentHelper';
3333
import { NonStoryWorkspaceLocation, SideContentTab, SideContentType } from '../SideContentTypes';
3434

3535
type StateProps = {
36-
editorWidth?: string;
3736
sideContentHeight?: number;
3837
stepsTotal: number;
3938
currentStep: number;
@@ -61,15 +60,7 @@ type DispatchProps = {
6160
const calculateWidth = (editorWidth?: string) => {
6261
const horizontalPadding = 50;
6362
const maxWidth = 5000; // limit for visible diagram width for huge screens
64-
let width;
65-
if (editorWidth === undefined) {
66-
width = window.innerWidth - horizontalPadding;
67-
} else {
68-
width = Math.min(
69-
maxWidth,
70-
(window.innerWidth * (100 - parseFloat(editorWidth))) / 100 - horizontalPadding
71-
);
72-
}
63+
const width = window.innerWidth - horizontalPadding;
7364
return Math.min(width, maxWidth);
7465
};
7566

@@ -91,6 +82,7 @@ const calculateHeight = (sideContentHeight?: number) => {
9182
type Props = OwnProps & StateProps & DispatchProps;
9283

9384
const SideContentCseMachineBase: React.FC<Props> = ({
85+
// DispatchProps
9486
handleStepUpdate,
9587
handleEditorEval,
9688
setEditorHighlightedLines,
@@ -99,7 +91,7 @@ const SideContentCseMachineBase: React.FC<Props> = ({
9991
}) => {
10092
const [visualization, setVisualization] = useState<React.ReactNode>(null);
10193
const [value, setValue] = useState(-1);
102-
const [width, setWidth] = useState(calculateWidth(props.editorWidth));
94+
const [width, setWidth] = useState(calculateWidth());
10395
const [height, setHeight] = useState(calculateHeight(props.sideContentHeight));
10496
const [, setLastStep] = useState(false);
10597
const [stepLimitExceeded, setStepLimitExceeded] = useState(false);
@@ -109,15 +101,15 @@ const SideContentCseMachineBase: React.FC<Props> = ({
109101
const handleResize = useMemo(
110102
() =>
111103
debounce(() => {
112-
const newWidth = calculateWidth(props.editorWidth);
104+
const newWidth = calculateWidth();
113105
const newHeight = calculateHeight(props.sideContentHeight);
114106
if (newWidth !== width || newHeight !== height) {
115107
setWidth(newWidth);
116108
setHeight(newHeight);
117109
CseMachine.updateDimensions(newWidth, newHeight);
118110
}
119111
}, 300),
120-
[props.editorWidth, props.sideContentHeight, width, height]
112+
[props.sideContentHeight, width, height]
121113
);
122114

123115
useEffect(() => {

0 commit comments

Comments
 (0)