Skip to content

Commit 920238d

Browse files
author
Ives van Hoorne
committed
Merge branch 'master' into add/vue-eslint
2 parents 2ac6022 + d4963c4 commit 920238d

File tree

10 files changed

+1251
-795
lines changed

10 files changed

+1251
-795
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
]
3535
},
3636
"workspaces": [
37-
"packages/**"
37+
"packages/homepage",
38+
"packages/app",
39+
"packages/common",
40+
"packages/codesandbox-api"
3841
],
3942
"devDependencies": {
4043
"all-contributors-cli": "^4.3.0",

packages/app/src/app/components/Button/__snapshots__/Button.test.js.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ exports[`Button renders 1`] = `
2727
-moz-user-select: none;
2828
-ms-user-select: none;
2929
user-select: none;
30+
-webkit-text-decoration: none;
3031
text-decoration: none;
3132
cursor: pointer;
3233
}
@@ -93,6 +94,7 @@ exports[`Button renders disabled 1`] = `
9394
-moz-user-select: none;
9495
-ms-user-select: none;
9596
user-select: none;
97+
-webkit-text-decoration: none;
9698
text-decoration: none;
9799
}
98100
@@ -136,6 +138,7 @@ exports[`Button renders href 1`] = `
136138
-moz-user-select: none;
137139
-ms-user-select: none;
138140
user-select: none;
141+
-webkit-text-decoration: none;
139142
text-decoration: none;
140143
cursor: pointer;
141144
}
@@ -204,6 +207,7 @@ exports[`Button renders onClick 1`] = `
204207
-moz-user-select: none;
205208
-ms-user-select: none;
206209
user-select: none;
210+
-webkit-text-decoration: none;
207211
text-decoration: none;
208212
cursor: pointer;
209213
}
@@ -272,6 +276,7 @@ exports[`Button renders properties 1`] = `
272276
-moz-user-select: none;
273277
-ms-user-select: none;
274278
user-select: none;
279+
-webkit-text-decoration: none;
275280
text-decoration: none;
276281
cursor: pointer;
277282
}
@@ -340,6 +345,7 @@ exports[`Button renders secondary 1`] = `
340345
-moz-user-select: none;
341346
-ms-user-select: none;
342347
user-select: none;
348+
-webkit-text-decoration: none;
343349
text-decoration: none;
344350
cursor: pointer;
345351
}
@@ -407,6 +413,7 @@ exports[`Button renders to 1`] = `
407413
-moz-user-select: none;
408414
-ms-user-select: none;
409415
user-select: none;
416+
-webkit-text-decoration: none;
410417
text-decoration: none;
411418
cursor: pointer;
412419
}

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ const entrySource = {
174174
canDrag: props => !!props.id && !props.isMainModule,
175175
beginDrag: props => {
176176
if (props.closeTree) props.closeTree();
177-
return { id: props.id, directory: props.type === 'directory' };
177+
return {
178+
id: props.id,
179+
shortid: props.shortid,
180+
directory: props.type === 'directory' || props.type === 'directory-open',
181+
};
178182
},
179183
};
180184

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,12 @@ const entryTarget = {
314314

315315
if (sourceItem.directory) {
316316
props.signals.files.directoryMovedToDirectory({
317-
directoryId: sourceItem.id,
317+
shortid: sourceItem.shortid,
318318
directoryShortid: props.shortid,
319319
});
320320
} else {
321321
props.signals.files.moduleMovedToDirectory({
322-
moduleId: sourceItem.id,
322+
moduleShortid: sourceItem.shortid,
323323
directoryShortid: props.shortid,
324324
});
325325
}

packages/app/src/app/pages/Sandbox/Editor/Workspace/OpenedTabs/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ const OpenedTabs = ({ store, signals }) => {
2020
moduleObject[m.shortid] = m;
2121
});
2222

23-
const openModules = store.editor.tabs.map(t => moduleObject[t.moduleShortid]);
23+
const openModules = store.editor.tabs
24+
.map(t => moduleObject[t.moduleShortid])
25+
.filter(x => x);
2426

2527
return (
2628
<WorkspaceItem

packages/app/src/app/pages/Sandbox/SearchDependencies/DependencyHit/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ export default class DependencyHit extends React.PureComponent {
3434
}
3535

3636
makeSearchUrl(hitName: string) {
37-
return `https://codesandbox.io/search?refinementList%5Bnpm_dependencies.dependency%5D%5B0%5D=${
38-
hitName
39-
}&page=1`;
37+
return `https://codesandbox.io/search?refinementList%5Bnpm_dependencies.dependency%5D%5B0%5D=${hitName}&page=1`;
4038
}
4139

4240
stopPropagation(e) {
@@ -60,9 +58,13 @@ export default class DependencyHit extends React.PureComponent {
6058
}
6159
}
6260

63-
const versions = Object.keys(hit.versions).sort((a: string, b: string) =>
64-
compareVersions(b, a)
65-
);
61+
const versions = Object.keys(hit.versions).sort((a: string, b: string) => {
62+
try {
63+
return compareVersions(b, a);
64+
} catch (e) {
65+
return 0;
66+
}
67+
});
6668

6769
return (
6870
<Container highlighted={highlighted} onClick={onClick}>

packages/app/src/app/store/modules/files/actions.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ export function whenModuleIsSelected({ state, props, path }) {
1212

1313
export function saveNewDirectoryDirectoryShortid({ api, state, props, path }) {
1414
const sandboxId = state.get('editor.currentId');
15-
const sandbox = state.get('editor.currentSandbox');
16-
const shortid = sandbox.directories.find(
17-
directory => directory.id === props.directoryId
18-
).shortid;
15+
const shortid = props.shortid;
1916

2017
return api
2118
.put(`/sandboxes/${sandboxId}/directories/${shortid}`, {
@@ -27,9 +24,7 @@ export function saveNewDirectoryDirectoryShortid({ api, state, props, path }) {
2724

2825
export function saveNewModuleDirectoryShortid({ api, state, props, path }) {
2926
const sandboxId = state.get('editor.currentId');
30-
const sandbox = state.get('editor.currentSandbox');
31-
const shortid = sandbox.modules.find(module => module.id === props.moduleId)
32-
.shortid;
27+
const shortid = props.moduleShortid;
3328

3429
return api
3530
.put(`/sandboxes/${sandboxId}/modules/${shortid}`, {
@@ -124,54 +119,54 @@ export function removeOptimisticDirectory({ state, props }) {
124119
export function moveDirectoryToDirectory({ state, props }) {
125120
const sandbox = state.get('editor.currentSandbox');
126121
const directoryIndex = sandbox.directories.findIndex(
127-
directory => directory.id === props.directoryId
122+
directory => directory.shortid === props.shortid
128123
);
129-
const currentDirectortyShortid = state.get(
130-
`editor.sandboxes.${sandbox.id}.directories.${
131-
directoryIndex
132-
}.directoryShortid`
124+
const currentDirectoryShortid = state.get(
125+
`editor.sandboxes.${
126+
sandbox.id
127+
}.directories.${directoryIndex}.directoryShortid`
133128
);
134129

135130
state.set(
136-
`editor.sandboxes.${sandbox.id}.directories.${
137-
directoryIndex
138-
}.directoryShortid`,
131+
`editor.sandboxes.${
132+
sandbox.id
133+
}.directories.${directoryIndex}.directoryShortid`,
139134
props.directoryShortid
140135
);
141136

142-
return { currentDirectortyShortid };
137+
return { currentDirectoryShortid };
143138
}
144139

145140
export function revertMoveDirectoryToDirectory({ state, props }) {
146141
const sandbox = state.get('editor.currentSandbox');
147142
const directoryIndex = sandbox.directories.findIndex(
148-
directory => directory.id === props.directoryId
143+
directory => directory.shortid === props.shortid
149144
);
150145

151146
state.set(
152-
`editor.sandboxes.${sandbox.id}.directories.${
153-
directoryIndex
154-
}.directoryShortid`,
155-
props.currentDirectortyShortid
147+
`editor.sandboxes.${
148+
sandbox.id
149+
}.directories.${directoryIndex}.directoryShortid`,
150+
props.currentDirectoryShortid
156151
);
157152
}
158153

159154
export function revertMoveModuleToDirectory({ state, props }) {
160155
const sandbox = state.get('editor.currentSandbox');
161156
const moduleIndex = sandbox.modules.findIndex(
162-
module => module.id === props.moduleId
157+
module => module.shortid === props.moduleShortid
163158
);
164159

165160
state.set(
166161
`editor.sandboxes.${sandbox.id}.modules.${moduleIndex}.directoryShortid`,
167-
props.currentDirectortyShortid
162+
props.currentDirectoryShortid
168163
);
169164
}
170165

171166
export function moveModuleToDirectory({ state, props }) {
172167
const sandbox = state.get('editor.currentSandbox');
173168
const moduleIndex = sandbox.modules.findIndex(
174-
module => module.id === props.moduleId
169+
module => module.shortid === props.moduleShortid
175170
);
176171

177172
state.set(

packages/app/src/app/store/modules/files/sequences.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export const deleteDirectory = [
8888
];
8989

9090
export const moveDirectoryToDirectory = [
91+
ensureOwnedSandbox,
9192
actions.moveDirectoryToDirectory,
9293
actions.saveNewDirectoryDirectoryShortid,
9394
{
@@ -100,6 +101,7 @@ export const moveDirectoryToDirectory = [
100101
];
101102

102103
export const moveModuleToDirectory = [
104+
ensureOwnedSandbox,
103105
actions.moveModuleToDirectory,
104106
actions.saveNewModuleDirectoryShortid,
105107
{

packages/homepage/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"gatsby-plugin-google-tagmanager": "^1.0.8",
1212
"gatsby-plugin-nprogress": "^1.0.9",
1313
"gatsby-plugin-react-helmet": "^1.0.8",
14-
"gatsby-plugin-sharp": "^1.6.23",
1514
"gatsby-plugin-sitemap": "^1.2.7",
1615
"gatsby-plugin-styled-components": "^2.0.5",
1716
"gatsby-react-router-scroll": "^1.0.3",

0 commit comments

Comments
 (0)