Skip to content

Commit 18c910a

Browse files
authored
Merge pull request #2640 from PiyushChandra17/piyush/fix-mweb-console-resize
Fix mweb console
2 parents d932a1b + 048bc31 commit 18c910a

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

client/modules/IDE/components/FloatingActionButton.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,20 @@ const Button = styled.button`
3838
}
3939
`;
4040

41-
const FloatingActionButton = (props) => {
41+
const FloatingActionButton = ({ syncFileContent, offsetBottom }) => {
4242
const isPlaying = useSelector((state) => state.ide.isPlaying);
4343
const dispatch = useDispatch();
4444

4545
return (
4646
<Button
4747
className={classNames({ stop: isPlaying })}
48-
style={{ paddingLeft: isPlaying ? 0 : remSize(5) }}
48+
style={{
49+
paddingLeft: isPlaying ? 0 : remSize(5),
50+
marginBottom: offsetBottom
51+
}}
4952
onClick={() => {
5053
if (!isPlaying) {
51-
props.syncFileContent();
54+
syncFileContent();
5255
dispatch(startSketch());
5356
} else dispatch(stopSketch());
5457
}}
@@ -59,7 +62,8 @@ const FloatingActionButton = (props) => {
5962
};
6063

6164
FloatingActionButton.propTypes = {
62-
syncFileContent: PropTypes.func.isRequired
65+
syncFileContent: PropTypes.func.isRequired,
66+
offsetBottom: PropTypes.number.isRequired
6367
};
6468

6569
export default FloatingActionButton;

client/modules/IDE/pages/IDEView.jsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ const IDEView = () => {
127127
};
128128
}, [shouldAutosave, dispatch]);
129129

130+
const consoleCollapsedSize = 29;
131+
const currentConsoleSize = ide.consoleIsExpanded
132+
? consoleSize
133+
: consoleCollapsedSize;
134+
130135
return (
131136
<RootPage>
132137
<Helmet>
@@ -171,8 +176,8 @@ const IDEView = () => {
171176
<SplitPane
172177
split="horizontal"
173178
primary="second"
174-
size={ide.consoleIsExpanded ? consoleSize : 29}
175-
minSize={29}
179+
size={currentConsoleSize}
180+
minSize={consoleCollapsedSize}
176181
onChange={(size) => {
177182
setConsoleSize(size);
178183
}}
@@ -204,19 +209,26 @@ const IDEView = () => {
204209
</main>
205210
) : (
206211
<>
207-
<FloatingActionButton syncFileContent={syncFileContent} />
212+
<FloatingActionButton
213+
syncFileContent={syncFileContent}
214+
offsetBottom={ide.isPlaying ? currentConsoleSize : 0}
215+
/>
208216
<PreviewWrapper show={ide.isPlaying}>
209217
<SplitPane
210218
style={{ position: 'static' }}
211219
split="horizontal"
212220
primary="second"
213-
minSize={200}
214-
onChange={() => {
221+
size={currentConsoleSize}
222+
minSize={consoleCollapsedSize}
223+
onChange={(size) => {
224+
setConsoleSize(size);
215225
setIsOverlayVisible(true);
216226
}}
217227
onDragFinished={() => {
218228
setIsOverlayVisible(false);
219229
}}
230+
allowResize={ide.consoleIsExpanded}
231+
className="editor-preview-subpanel"
220232
>
221233
<PreviewFrame
222234
fullView

0 commit comments

Comments
 (0)