Skip to content

Fix mweb console #2640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions client/modules/IDE/components/FloatingActionButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,20 @@ const Button = styled.button`
}
`;

const FloatingActionButton = (props) => {
const FloatingActionButton = ({ syncFileContent, offsetBottom }) => {
const isPlaying = useSelector((state) => state.ide.isPlaying);
const dispatch = useDispatch();

return (
<Button
className={classNames({ stop: isPlaying })}
style={{ paddingLeft: isPlaying ? 0 : remSize(5) }}
style={{
paddingLeft: isPlaying ? 0 : remSize(5),
marginBottom: offsetBottom
}}
onClick={() => {
if (!isPlaying) {
props.syncFileContent();
syncFileContent();
dispatch(startSketch());
} else dispatch(stopSketch());
}}
Expand All @@ -59,7 +62,8 @@ const FloatingActionButton = (props) => {
};

FloatingActionButton.propTypes = {
syncFileContent: PropTypes.func.isRequired
syncFileContent: PropTypes.func.isRequired,
offsetBottom: PropTypes.number.isRequired
};

export default FloatingActionButton;
22 changes: 17 additions & 5 deletions client/modules/IDE/pages/IDEView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ const IDEView = () => {
};
}, [shouldAutosave, dispatch]);

const consoleCollapsedSize = 29;
const currentConsoleSize = ide.consoleIsExpanded
? consoleSize
: consoleCollapsedSize;

return (
<RootPage>
<Helmet>
Expand Down Expand Up @@ -171,8 +176,8 @@ const IDEView = () => {
<SplitPane
split="horizontal"
primary="second"
size={ide.consoleIsExpanded ? consoleSize : 29}
minSize={29}
size={currentConsoleSize}
minSize={consoleCollapsedSize}
onChange={(size) => {
setConsoleSize(size);
}}
Expand Down Expand Up @@ -204,19 +209,26 @@ const IDEView = () => {
</main>
) : (
<>
<FloatingActionButton syncFileContent={syncFileContent} />
<FloatingActionButton
syncFileContent={syncFileContent}
offsetBottom={ide.isPlaying ? currentConsoleSize : 0}
/>
<PreviewWrapper show={ide.isPlaying}>
<SplitPane
style={{ position: 'static' }}
split="horizontal"
primary="second"
minSize={200}
onChange={() => {
size={currentConsoleSize}
minSize={consoleCollapsedSize}
onChange={(size) => {
setConsoleSize(size);
setIsOverlayVisible(true);
}}
onDragFinished={() => {
setIsOverlayVisible(false);
}}
allowResize={ide.consoleIsExpanded}
className="editor-preview-subpanel"
>
<PreviewFrame
fullView
Expand Down