Skip to content

Commit 1044e8d

Browse files
fix quickopen, remove store and fix linting and typechecks
1 parent e25db4a commit 1044e8d

File tree

139 files changed

+180
-12040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+180
-12040
lines changed

packages/app/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767
"@apollo/react-hooks": "^0.1.0-beta.2",
6868
"@babel/plugin-transform-destructuring": "^7.5.0",
6969
"@babel/preset-env": "^7.5.5",
70-
"@cerebral/http": "^4.0.0",
71-
"@cerebral/mobx-state-tree": "^3.0.0",
7270
"@codesandbox/executors": "^0.1.0",
7371
"@codesandbox/template-icons": "^1.0.1",
7472
"@emmetio/codemirror-plugin": "^0.3.5",
@@ -96,7 +94,6 @@
9694
"base64-loader": "^1.0.0",
9795
"browser-detect": "^0.2.28",
9896
"browser-resolve": "CompuIves/node-browser-resolve",
99-
"cerebral": "^4.0.0",
10097
"circular-json": "^0.4.0",
10198
"codemirror": "^5.27.4",
10299
"codesandbox-api": "^0.0.22",

packages/app/src/app/components/CodeEditor/Monaco/MonacoReactComponent.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ class MonacoEditor extends React.PureComponent {
3535
}
3636

3737
// eslint-disable-next-line global-require
38-
require('app/overmind/effects/vscode/manager/dev-bootstrap').default(
39-
false,
40-
['vs/editor/editor.main']
41-
)(() => {
38+
require('app/overmind/effects/vscode/vscode-script-loader').default(false, [
39+
'vs/editor/editor.main',
40+
])(() => {
4241
this.initMonaco();
4342
});
4443
};

packages/app/src/app/components/CodeEditor/VSCode/Configuration/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@ import { ConfigurationFile } from '@codesandbox/common/lib/templates/configurati
22
import getUI from '@codesandbox/common/lib/templates/configuration/ui';
33
import theme from '@codesandbox/common/lib/theme';
44
import { Module } from '@codesandbox/common/lib/types';
5-
import { TextOperation } from 'ot';
6-
import React from 'react';
7-
85
import EntryIcons from 'app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons';
96
import getType from 'app/utils/get-type';
7+
import { TextOperation } from 'ot';
8+
import React from 'react';
109

11-
import { Props as EditorProps, Editor } from '../../types'; // eslint-disable-line
12-
13-
import { Container, Title, Description } from './elements';
10+
import { Editor, Props as EditorProps } from '../../types'; // eslint-disable-line
11+
import { Container, Description, Title } from './elements';
1412

1513
type Disposable = {
1614
dispose: () => void;
1715
};
1816

1917
type Props = EditorProps & {
2018
config: ConfigurationFile;
19+
onChange: (code: string, moduleShortid: string) => void;
2120
toggleConfigUI: () => void;
2221
onDidChangeDirty: (cb: () => void) => Disposable;
2322
getCode: () => string;

packages/app/src/app/components/CodeEditor/VSCode/MonacoReactComponent.js

Lines changed: 0 additions & 207 deletions
This file was deleted.

packages/app/src/app/components/CodeEditor/VSCode/index.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import getTemplate from '@codesandbox/common/lib/templates';
22
import getUI from '@codesandbox/common/lib/templates/configuration/ui';
33
import theme from '@codesandbox/common/lib/theme';
44
import { useOvermind } from 'app/overmind';
5+
import { json } from 'overmind';
56
import React, { useEffect, useRef } from 'react';
67
import { render } from 'react-dom';
78
import { ThemeProvider } from 'styled-components';
@@ -10,7 +11,7 @@ import { Configuration } from './Configuration';
1011
import { Container, GlobalStyles } from './elements';
1112

1213
export const VSCode: React.FunctionComponent = () => {
13-
const { state, effects } = useOvermind();
14+
const { state, actions, effects } = useOvermind();
1415
const containerEl = useRef(null);
1516

1617
useEffect(() => {
@@ -28,14 +29,14 @@ export const VSCode: React.FunctionComponent = () => {
2829
render(
2930
<ThemeProvider theme={theme}>
3031
<Configuration
31-
/*
32-
onChange={this.props.onChange}
33-
// Copy the object, we don't want mutations in the component
34-
currentModule={json(state.editor.currentModule)}
35-
config={config}
36-
sandbox={this.sandbox}
37-
{...extraProps}
38-
*/
32+
onChange={(code, moduleShortid) =>
33+
actions.editor.codeChanged({ code, moduleShortid })
34+
}
35+
// Copy the object, we don't want mutations in the component
36+
currentModule={json(state.editor.currentModule)}
37+
config={config}
38+
sandbox={state.editor.currentSandbox}
39+
{...(extraProps as any)}
3940
/>
4041
</ThemeProvider>,
4142
container
@@ -48,14 +49,18 @@ export const VSCode: React.FunctionComponent = () => {
4849
const { width, height } = rootEl.getBoundingClientRect();
4950
effects.vscode.updateLayout(width, height);
5051

52+
document.getElementById('root').classList.add('monaco-shell');
53+
5154
return () => {
52-
document.getElementById('root').className = document
53-
.getElementById('root')
54-
.className.split(' ')
55-
.filter(x => !['monaco-shell', 'vs-dark'].includes(x))
56-
.join(' ');
55+
document.getElementById('root').classList.remove('monaco-shell');
5756
};
58-
}, [effects.vscode, state.editor.currentSandbox.template]);
57+
}, [
58+
actions.editor,
59+
effects.vscode,
60+
state.editor.currentModule,
61+
state.editor.currentSandbox,
62+
state.editor.currentSandbox.template,
63+
]);
5964

6065
return (
6166
<Container ref={containerEl}>

0 commit comments

Comments
 (0)