|
1 | | -import css from '@styled-system/css'; |
2 | | - |
3 | | -import Tooltip from '@codesandbox/common/lib/components/Tooltip'; |
4 | 1 | import getTemplateDefinition from '@codesandbox/common/lib/templates'; |
5 | 2 | import { BACKTICK } from '@codesandbox/common/lib/utils/keycodes'; |
6 | | -import { Icons } from 'app/components/CodeEditor/elements'; |
7 | 3 | import { VSCode as CodeEditor } from 'app/components/CodeEditor/VSCode'; |
8 | 4 | import { DevTools } from 'app/components/Preview/DevTools'; |
9 | 5 | import { useOvermind } from 'app/overmind'; |
10 | 6 | import useKey from 'react-use/lib/useKey'; |
11 | 7 | import React, { useCallback, useEffect, useRef, useState } from 'react'; |
12 | | -import QuestionIcon from 'react-icons/lib/go/question'; |
13 | 8 | import SplitPane from 'react-split-pane'; |
14 | 9 | import { ThemeProvider } from 'styled-components'; |
15 | 10 |
|
16 | | -import { LiveUser } from '@codesandbox/common/lib/types'; |
17 | | -import { Stack } from '@codesandbox/components'; |
18 | 11 | import preventGestureScroll, { removeListener } from './prevent-gesture-scroll'; |
19 | 12 | import { Preview } from './Preview'; |
| 13 | +import { EditorToast } from './EditorToast'; |
20 | 14 |
|
21 | 15 | export const MainWorkspace: React.FC<{ theme: any }> = ({ theme }) => { |
22 | 16 | const { state, actions, effects, reaction } = useOvermind(); |
@@ -87,23 +81,11 @@ export const MainWorkspace: React.FC<{ theme: any }> = ({ theme }) => { |
87 | 81 | [] |
88 | 82 | ); |
89 | 83 |
|
90 | | - const { currentModule } = state.editor; |
91 | 84 | const sandbox = state.editor.currentSandbox; |
92 | 85 | const { preferences } = state; |
93 | 86 | const windowVisible = state.editor.previewWindowVisible; |
94 | 87 | const template = sandbox && getTemplateDefinition(sandbox.template); |
95 | 88 | const currentPosition = state.editor.currentDevToolsPosition; |
96 | | - const modulePath = currentModule.path; |
97 | | - const config = template && template.configurationFiles[modulePath]; |
98 | | - |
99 | | - const followingUserId = state.live.followingUserId; |
100 | | - let followingUser: LiveUser | undefined; |
101 | | - |
102 | | - if (followingUserId && state.live.roomInfo && state.live.isLive) { |
103 | | - followingUser = state.live.roomInfo.users.find( |
104 | | - u => u.id === followingUserId |
105 | | - ); |
106 | | - } |
107 | 89 |
|
108 | 90 | const browserConfig = { |
109 | 91 | id: 'codesandbox.browser', |
@@ -204,66 +186,7 @@ export const MainWorkspace: React.FC<{ theme: any }> = ({ theme }) => { |
204 | 186 | bottom: 0, |
205 | 187 | }} |
206 | 188 | > |
207 | | - <Stack |
208 | | - css={css({ |
209 | | - position: 'absolute', |
210 | | - top: 34, |
211 | | - zIndex: 45, |
212 | | - right: 0, |
213 | | - })} |
214 | | - gap={1} |
215 | | - direction="vertical" |
216 | | - align="flex-end" |
217 | | - > |
218 | | - {followingUser && ( |
219 | | - <div |
220 | | - css={{ |
221 | | - transition: '0.3s ease opacity', |
222 | | - background: `rgb(${followingUser.color.join(',')})`, |
223 | | - padding: '2px 8px', |
224 | | - fontSize: '12px', |
225 | | - float: 'right', |
226 | | - width: 'max-content', |
227 | | - borderBottomLeftRadius: 2, |
228 | | - color: |
229 | | - (followingUser.color[0] * 299 + |
230 | | - followingUser.color[1] * 587 + |
231 | | - followingUser.color[2] * 114) / |
232 | | - 1000 > |
233 | | - 128 |
234 | | - ? 'rgba(0, 0, 0, 0.8)' |
235 | | - : 'white', |
236 | | - |
237 | | - ':hover': { |
238 | | - opacity: 0.5, |
239 | | - }, |
240 | | - }} |
241 | | - > |
242 | | - Following {followingUser.username} |
243 | | - </div> |
244 | | - )} |
245 | | - |
246 | | - {config ? ( |
247 | | - <Icons> |
248 | | - {config.partialSupportDisclaimer ? ( |
249 | | - <Tooltip |
250 | | - placement="bottom" |
251 | | - content={config.partialSupportDisclaimer} |
252 | | - style={{ |
253 | | - display: 'flex', |
254 | | - 'align-items': 'center', |
255 | | - }} |
256 | | - > |
257 | | - Partially Supported Config{' '} |
258 | | - <QuestionIcon style={{ marginLeft: '.5rem' }} /> |
259 | | - </Tooltip> |
260 | | - ) : ( |
261 | | - <div>Supported Configuration</div> |
262 | | - )} |
263 | | - </Icons> |
264 | | - ) : null} |
265 | | - </Stack> |
266 | | - |
| 189 | + <EditorToast /> |
267 | 190 | {state.editor.isLoading ? null : <CodeEditor />} |
268 | 191 | </div> |
269 | 192 | </div> |
|
0 commit comments