Skip to content

Commit 20df3ad

Browse files
committed
Fixes
1 parent aec7ac7 commit 20df3ad

File tree

6 files changed

+69
-42
lines changed

6 files changed

+69
-42
lines changed

packages/app/src/app/components/CreateNewSandbox/CreateSandbox/Create/Create.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
22
import { Scrollable } from '@codesandbox/common/lib/components/Scrollable';
33
import { useOvermind } from 'app/overmind';
44
import { LinkButton } from 'app/components/LinkButton';
5+
import track from '@codesandbox/common/lib/utils/analytics';
56
import { Header } from '../elements';
67
import { CenteredMessage } from './elements';
78

@@ -14,6 +15,10 @@ export const Create = () => {
1415
const [filter, setFilter] = React.useState('');
1516
const [officialTemplateInfos, setOfficialTemplates] = React.useState([]);
1617

18+
useEffect(() => {
19+
track('Create Sandbox Tab Open', { tab: 'create' });
20+
}, []);
21+
1722
useEffect(() => {
1823
getTemplateInfosFromAPI('/api/v1/sandboxes/templates/official').then(x => {
1924
setOfficialTemplates(x);

packages/app/src/app/components/CreateNewSandbox/CreateSandbox/Explore/Explore.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState, useEffect } from 'react';
22
import { Scrollable } from '@codesandbox/common/lib/components/Scrollable';
3+
import track from '@codesandbox/common/lib/utils/analytics';
34
import { Header } from '../elements';
45
import { SearchBox } from '../SearchBox';
56
import { SearchResults } from './SearchResults';
@@ -13,6 +14,10 @@ export const Explore = () => {
1314
const [exploreTemplates, setExploreTemplates] = useState<ITemplateInfo[]>([]);
1415
const [loading, setLoading] = useState(false);
1516

17+
useEffect(() => {
18+
track('Create Sandbox Tab Open', { tab: 'explore' });
19+
}, []);
20+
1621
useEffect(() => {
1722
let loaded = false;
1823
const timeout = window.setTimeout(() => {

packages/app/src/app/components/CreateNewSandbox/CreateSandbox/Import/Import.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useCallback } from 'react';
1+
import React, { useState, useCallback, useEffect } from 'react';
22
import {
33
gitHubToSandboxUrl,
44
protocolAndHost,
@@ -7,6 +7,7 @@ import {
77
import { Button } from '@codesandbox/common/lib/components/Button';
88
import { useOvermind } from 'app/overmind';
99
import { SignInButton } from 'app/pages/common/SignInButton';
10+
import track from '@codesandbox/common/lib/utils/analytics';
1011
import { TerminalIcon } from '../Icons/TerminalIcon';
1112
import { DownloadIcon } from '../Icons/DownloadIcon';
1213
import { GitHubIcon, StackbitIcon } from '../Icons';
@@ -48,6 +49,10 @@ export const Import = () => {
4849
const [transformedUrl, setTransformedUrl] = useState('');
4950
const [url, setUrl] = useState('');
5051

52+
useEffect(() => {
53+
track('Create Sandbox Tab Open', { tab: 'import' });
54+
}, []);
55+
5156
const updateUrl = useCallback(({ target: { value: newUrl } }) => {
5257
if (!newUrl) {
5358
setError(null);
Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,53 @@
1-
import React from 'react';
1+
import React, { useEffect } from 'react';
22
import { Button } from '@codesandbox/common/lib/components/Button';
3+
import track from '@codesandbox/common/lib/utils/analytics';
34
import { CodeAnywhere } from './CodeAnywhere';
45
import { StartQuickly } from './StartQuickly';
56
import { PrototypeRapidly } from './PrototypeRapidly';
67
import { Header } from '../elements';
78
import { Features, FeatureName, FeatureText, Actions } from './elements';
89

9-
export const Welcome = ({ goToTab }: { goToTab: (event: any) => void }) => (
10-
<>
11-
<Header>
12-
<span>Welcome to CodeSandbox</span>
13-
</Header>
14-
<Features>
15-
<li>
16-
<CodeAnywhere />
17-
<FeatureName>Code Anywhere</FeatureName>
18-
<FeatureText>
19-
An instantly ready, full-featured online IDE for web development on
20-
any device with a browser.
21-
</FeatureText>
22-
</li>
23-
<li>
24-
<StartQuickly />
25-
<FeatureName>Start Quickly</FeatureName>
26-
<FeatureText>
27-
With no setup, and templates for all popular frameworks to get you
28-
started quickly.
29-
</FeatureText>
30-
</li>
31-
<li>
32-
<PrototypeRapidly />
33-
<FeatureName>Prototype Rapidly</FeatureName>
34-
<FeatureText>
35-
You can create web apps, experiment with code, test ideas, and share
36-
creations easily.
37-
</FeatureText>
38-
</li>
39-
</Features>
40-
<Actions>
41-
<Button small style={{ fontSize: 12, width: 200 }} onClick={goToTab}>
42-
Create Sandbox
43-
</Button>
44-
</Actions>
45-
</>
46-
);
10+
export const Welcome = ({ goToTab }: { goToTab: (event: any) => void }) => {
11+
useEffect(() => {
12+
track('Create Sandbox Tab Open', { tab: 'welcome' });
13+
}, []);
14+
15+
return (
16+
<>
17+
<Header>
18+
<span>Welcome to CodeSandbox</span>
19+
</Header>
20+
<Features>
21+
<li>
22+
<CodeAnywhere />
23+
<FeatureName>Code Anywhere</FeatureName>
24+
<FeatureText>
25+
An instantly ready, full-featured online IDE for web development on
26+
any device with a browser.
27+
</FeatureText>
28+
</li>
29+
<li>
30+
<StartQuickly />
31+
<FeatureName>Start Quickly</FeatureName>
32+
<FeatureText>
33+
With no setup, and templates for all popular frameworks to get you
34+
started quickly.
35+
</FeatureText>
36+
</li>
37+
<li>
38+
<PrototypeRapidly />
39+
<FeatureName>Prototype Rapidly</FeatureName>
40+
<FeatureText>
41+
You can create web apps, experiment with code, test ideas, and share
42+
creations easily.
43+
</FeatureText>
44+
</li>
45+
</Features>
46+
<Actions>
47+
<Button small style={{ fontSize: 12, width: 200 }} onClick={goToTab}>
48+
Create Sandbox
49+
</Button>
50+
</Actions>
51+
</>
52+
);
53+
};

packages/app/src/app/overmind/effects/vscode/initializers.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ export function installCustomTheme(id: string, name: string, theme: string) {
9393
// @ts-ignore
9494
const fs = window.BrowserFS.BFSRequire('fs');
9595
const extName = `${id}-theme`;
96-
fs.mkdirSync(`/extensions/${extName}`);
96+
97+
const folder = `/extensions/${extName}`;
98+
const folderExists = fs.existsSync(folder);
99+
if (!folderExists) {
100+
fs.mkdirSync(folder);
101+
}
97102
fs.writeFileSync(
98103
`/extensions/${extName}/package.json`,
99104
JSON.stringify(packageJSON)

packages/common/src/components/Preference/PreferenceText/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export const PreferenceText: FunctionComponent<Props> = ({
2727
};
2828

2929
return createElement(isTextArea ? TextArea : Input, {
30+
...props,
3031
onChange: handleChange,
3132
placeholder,
3233
value,
33-
...props,
3434
});
3535
};

0 commit comments

Comments
 (0)