Skip to content

Commit 0607d44

Browse files
committed
Merge branch 'master' into vscodeeffect
2 parents d8dc613 + 6df5689 commit 0607d44

File tree

36 files changed

+529
-531
lines changed

36 files changed

+529
-531
lines changed

packages/app/src/app/overmind/actions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ type ModalName =
7070
| 'netlifyLogs'
7171
| 'newSandbox'
7272
| 'preferences'
73-
| 'share'
7473
| 'searchDependencies'
74+
| 'share'
7575
| 'signInForTemplates'
7676
| 'userSurvey';
77-
7877
export const modalOpened: Action<{ modal: ModalName; message?: string }> = (
7978
{ state, effects },
8079
{ modal, message }

packages/app/src/app/overmind/namespaces/dashboard/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const searchChanged: Action<{ search: string }> = (
6565
};
6666

6767
export const createSandboxClicked: AsyncAction<{
68+
body: { collectionId: string };
6869
sandboxId: string;
69-
body: { collectionId: string | undefined };
70-
}> = ({ actions }, { sandboxId, body }) =>
71-
actions.editor.internal.forkSandbox({ sandboxId, body });
70+
}> = ({ actions }, { body, sandboxId }) =>
71+
actions.editor.internal.forkSandbox({ body, sandboxId });

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ import * as internalActions from './internalActions';
2323

2424
export const internal = internalActions;
2525

26-
export const onNavigateAway: Action = () => { };
26+
export const onNavigateAway: Action = () => {};
2727

2828
export const addNpmDependency: AsyncAction<{
2929
name: string;
3030
version?: string;
3131
isDev?: boolean;
3232
}> = withOwnedSandbox(
33-
async ({ effects, actions, state }, { name, version, isDev }) => {
33+
async ({ actions, effects, state }, { name, version, isDev }) => {
3434
effects.analytics.track('Add NPM Dependency');
3535
state.currentModal = null;
3636
let newVersion = version;
@@ -465,7 +465,7 @@ export const quickActionsClosed: Action = ({ state }) => {
465465
state.editor.quickActionsOpen = false;
466466
};
467467

468-
export const setPreviewContent: Action = () => { };
468+
export const setPreviewContent: Action = () => {};
469469

470470
export const togglePreviewContent: Action = ({ state }) => {
471471
state.editor.previewWindowVisible = !state.editor.previewWindowVisible;

packages/app/src/app/overmind/namespaces/preferences/actions.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { Action, AsyncAction } from 'app/overmind';
1+
import { Badge } from '@codesandbox/common/lib/types';
22
import { json } from 'overmind';
33

4+
import { Action, AsyncAction } from 'app/overmind';
5+
46
export const viewModeChanged: Action<{
57
showEditor: boolean;
68
showPreview: boolean;
@@ -58,13 +60,11 @@ export const settingChanged: Action<{
5860
});
5961
};
6062

61-
export const setBadgeVisibility: AsyncAction<{
62-
id: string;
63-
visible: boolean;
64-
}> = async ({ state, effects }, { id, visible }) => {
65-
const { badges } = state.user;
66-
67-
badges.forEach((badge, index) => {
63+
export const setBadgeVisibility: AsyncAction<Pick<
64+
Badge,
65+
'id' | 'visible'
66+
>> = async ({ effects, state }, { id, visible }) => {
67+
state.user.badges.forEach((badge, index) => {
6868
if (badge.id === id) {
6969
state.user.badges[index].visible = visible;
7070
}

packages/app/src/app/overmind/namespaces/workspace/actions.ts

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -123,42 +123,48 @@ export const sandboxInfoUpdated: AsyncAction = withOwnedSandbox(
123123
}
124124
);
125125

126-
export const externalResourceAdded: AsyncAction<{
127-
resource: string;
128-
}> = withOwnedSandbox(async ({ state, effects, actions }, { resource }) => {
129-
const { externalResources } = state.editor.currentSandbox;
126+
export const externalResourceAdded: AsyncAction<string> = withOwnedSandbox(
127+
async ({ effects, state, actions }, resource) => {
128+
const { externalResources } = state.editor.currentSandbox;
130129

131-
externalResources.push(resource);
132-
actions.editor.internal.updatePreviewCode();
133-
134-
try {
135-
await effects.api.createResource(state.editor.currentSandbox.id, resource);
136-
} catch (error) {
137-
externalResources.splice(externalResources.indexOf(resource), 1);
138-
effects.notificationToast.error('Could not save external resource');
130+
externalResources.push(resource);
139131
actions.editor.internal.updatePreviewCode();
140-
}
141-
});
142132

143-
export const externalResourceRemoved: AsyncAction<{
144-
resource: string;
145-
}> = withOwnedSandbox(async ({ state, effects, actions }, { resource }) => {
146-
const { externalResources } = state.editor.currentSandbox;
147-
const resourceIndex = externalResources.indexOf(resource);
133+
try {
134+
await effects.api.createResource(
135+
state.editor.currentSandbox.id,
136+
resource
137+
);
138+
} catch (error) {
139+
externalResources.splice(externalResources.indexOf(resource), 1);
140+
effects.notificationToast.error('Could not save external resource');
141+
actions.editor.internal.updatePreviewCode();
142+
}
143+
}
144+
);
148145

149-
externalResources.splice(resourceIndex, 1);
150-
actions.editor.internal.updatePreviewCode();
146+
export const externalResourceRemoved: AsyncAction<string> = withOwnedSandbox(
147+
async ({ effects, state, actions }, resource) => {
148+
const { externalResources } = state.editor.currentSandbox;
149+
const resourceIndex = externalResources.indexOf(resource);
151150

152-
try {
153-
await effects.api.deleteResource(state.editor.currentSandbox.id, resource);
154-
} catch (error) {
155-
externalResources.splice(resourceIndex, 0, resource);
156-
effects.notificationToast.error(
157-
'Could not save removal of external resource'
158-
);
151+
externalResources.splice(resourceIndex, 1);
159152
actions.editor.internal.updatePreviewCode();
153+
154+
try {
155+
await effects.api.deleteResource(
156+
state.editor.currentSandbox.id,
157+
resource
158+
);
159+
} catch (error) {
160+
externalResources.splice(resourceIndex, 0, resource);
161+
effects.notificationToast.error(
162+
'Could not save removal of external resource'
163+
);
164+
actions.editor.internal.updatePreviewCode();
165+
}
160166
}
161-
});
167+
);
162168

163169
export const integrationsOpened: Action = ({ state }) => {
164170
state.preferences.itemId = 'integrations';

packages/app/src/app/pages/Dashboard/Content/CreateNewSandbox/elements.ts

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import styled, { css, keyframes } from 'styled-components';
21
import { Link } from 'react-router-dom';
32
import { animated } from 'react-spring/renderprops';
3+
import styled, { css, keyframes } from 'styled-components';
44

55
const fadeIn = keyframes`
66
0% { opacity: 0; }
@@ -17,6 +17,7 @@ export const DarkBG = styled.div<{ closing: boolean }>`
1717
background-color: black;
1818
opacity: 0;
1919
transition: 0.3s ease opacity;
20+
2021
${!closing &&
2122
css`
2223
animation: ${fadeIn} 0.3s;
@@ -52,7 +53,11 @@ export const Container = styled.div<{ hide?: boolean }>`
5253
cursor: pointer;
5354
user-select: none;
5455
transition: 0.3s ease background-color;
55-
${hide && 'opacity: 0'};
56+
57+
${hide &&
58+
css`
59+
opacity: 0;
60+
`};
5661
5762
&:first-child {
5863
border-bottom: 0;
@@ -79,24 +84,5 @@ export const AnimatedModalContainer = styled(animated.div)<{
7984
css`
8085
position: fixed;
8186
transition: 0.15s ease all;
82-
`}
83-
`;
84-
85-
export const FullsizeContainer = styled.div`
86-
position: fixed;
87-
top: 25vh;
88-
left: 0;
89-
bottom: 0;
90-
right: 0;
91-
opacity: 0;
92-
z-index: 0;
93-
width: 950px;
94-
height: auto;
95-
margin: 0 auto 15vh;
96-
pointer-events: none;
97-
`;
98-
99-
export const MeasureContainer = styled.div`
100-
width: 100%;
101-
height: 100%;
87+
`};
10288
`;

0 commit comments

Comments
 (0)