Skip to content

Commit e25db4a

Browse files
Merge branch 'master' into vscodeeffect
2 parents 192377f + 0464e2d commit e25db4a

File tree

53 files changed

+563
-460
lines changed

Some content is hidden

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

53 files changed

+563
-460
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,15 @@
14401440
"contributions": [
14411441
"code"
14421442
]
1443+
},
1444+
{
1445+
"login": "22PoojaGaur",
1446+
"name": "Pooja Gaur",
1447+
"avatar_url": "https://avatars2.githubusercontent.com/u/43316760?v=4",
1448+
"profile": "https://github.com/22PoojaGaur",
1449+
"contributions": [
1450+
"code"
1451+
]
14431452
}
14441453
],
14451454
"contributorsPerLine": 7,

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ Thanks goes to these wonderful people
240240
<td align="center"><a href="https://github.com/milap1296"><img src="https://avatars2.githubusercontent.com/u/19545730?v=4" width="100px;" alt="milap1296"/><br /><sub><b>milap1296</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=milap1296" title="Code">💻</a></td>
241241
<td align="center"><a href="http://yevhenorlov.com"><img src="https://avatars2.githubusercontent.com/u/17388747?v=4" width="100px;" alt="yevhen orlov"/><br /><sub><b>yevhen orlov</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=yevhenorlov" title="Code">💻</a></td>
242242
<td align="center"><a href="https://github.com/NileshPatel17"><img src="https://avatars2.githubusercontent.com/u/27020381?v=4" width="100px;" alt="Nilesh Patel"/><br /><sub><b>Nilesh Patel</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=NileshPatel17" title="Code">💻</a></td>
243+
<td align="center"><a href="https://github.com/22PoojaGaur"><img src="https://avatars2.githubusercontent.com/u/43316760?v=4" width="100px;" alt="Pooja Gaur"/><br /><sub><b>Pooja Gaur</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=22PoojaGaur" title="Code">💻</a></td>
243244
</tr>
244245
</table>
245246

246247
<!-- markdownlint-enable -->
247248
<!-- prettier-ignore-end -->
248-
249249
<!-- ALL-CONTRIBUTORS-LIST:END -->
250250

251251
## Backers

packages/app/scripts/deploy.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ fetch('https://deployment-api.lbogdan.ro/image', {
1515
})
1616
.then(x => {
1717
if (!x.ok) {
18-
throw new Error('Request failed');
18+
return x.json().then(res => {
19+
console.error(res);
20+
throw new Error('Request failed');
21+
});
1922
}
2023

2124
return x.json();

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,7 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
946946
),
947947
options: {
948948
inlineClassName: classification.type
949-
? `${classification.kind} ${classification.type}-of-${
950-
classification.parentKind
951-
}`
949+
? `${classification.kind} ${classification.type}-of-${classification.parentKind}`
952950
: classification.kind,
953951
},
954952
}));

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ type ModalName =
7676
| 'preferences'
7777
| 'share'
7878
| 'searchDependencies'
79-
| 'signInForTemplates';
79+
| 'signInForTemplates'
80+
| 'userSurvey';
8081
export const modalOpened: Action<{ modal: ModalName; message?: string }> = (
8182
{ state, effects },
8283
{ modal, message }

packages/app/src/app/overmind/effects/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ export default {
6868
getCurrentUser(): Promise<CurrentUser> {
6969
return api.get('/users/current');
7070
},
71+
markSurveySeen(): Promise<void> {
72+
return api.post('/users/survey-seen', {});
73+
},
7174
getDependency(name: string): Promise<Dependency> {
7275
return api.get(`/dependencies/${name}@latest`);
7376
},

packages/app/src/app/overmind/factories.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const withLoadApp = <T>(
3030
state.user = await effects.api.getCurrentUser();
3131
actions.internal.setPatronPrice();
3232
actions.internal.setSignedInCookie();
33+
actions.internal.showUserSurveyIfNeeded();
3334
effects.live.connect();
3435
actions.userNotifications.internal.initialize();
3536
effects.api.preloadTemplates();
@@ -112,7 +113,7 @@ export const createModals = <
112113
state?: {
113114
current: keyof T;
114115
} & {
115-
[K in keyof T]: T[K]['state'] & { isCurrent: IDerive<any, any, boolean> }
116+
[K in keyof T]: T[K]['state'] & { isCurrent: IDerive<any, any, boolean> };
116117
};
117118
actions?: {
118119
[K in keyof T]: {
@@ -121,7 +122,7 @@ export const createModals = <
121122
T[K]['result']
122123
>;
123124
close: AsyncAction<T[K]['result']>;
124-
}
125+
};
125126
};
126127
} => {
127128
function createModal(name, modal) {

packages/app/src/app/overmind/internalActions.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from '@codesandbox/common/lib/types';
1010
import { identify, setUserId } from '@codesandbox/common/lib/utils/analytics';
1111

12+
import { NotificationStatus } from '@codesandbox/notifications';
1213
import { createOptimisticModule } from './utils/common';
1314
import getItems from './utils/items';
1415
import { defaultOpenedModule, mainModule } from './utils/main-module';
@@ -68,6 +69,33 @@ export const setSignedInCookie: Action = ({ state }) => {
6869
setUserId(state.user.id);
6970
};
7071

72+
export const showUserSurveyIfNeeded: Action = ({ state, effects, actions }) => {
73+
if (state.user.sendSurvey) {
74+
// Let the server know that we've seen the survey
75+
effects.api.markSurveySeen();
76+
77+
effects.notificationToast.add({
78+
title: 'Help improve CodeSandbox',
79+
message:
80+
"We'd love to hear your thoughts, it's 7 questions and will only take 2 minutes.",
81+
status: NotificationStatus.NOTICE,
82+
sticky: true,
83+
actions: {
84+
primary: [
85+
{
86+
label: 'Open Survey',
87+
run: () => {
88+
actions.modalOpened({
89+
modal: 'userSurvey',
90+
});
91+
},
92+
},
93+
],
94+
},
95+
});
96+
}
97+
};
98+
7199
export const addNotification: Action<{
72100
title: string;
73101
type: 'notice' | 'success' | 'warning' | 'error';

packages/app/src/app/pages/Dashboard/Sidebar/SandboxesItem/FolderEntry/index.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import TrashIcon from 'react-icons/lib/md/delete';
77
import { Mutation } from 'react-apollo';
88
import { DropTarget, DragSource } from 'react-dnd';
99
import track from '@codesandbox/common/lib/utils/analytics';
10+
import { withRouter } from 'react-router-dom';
11+
import { History } from 'history';
1012
import { client } from 'app/graphql/client';
1113

1214
import { Animate as ReactShow } from 'react-show';
@@ -60,6 +62,8 @@ type Props = {
6062
isDragging?: boolean;
6163
connectDropTarget?: any;
6264
connectDragSource?: any;
65+
66+
history?: History;
6367
};
6468

6569
type State = {
@@ -138,6 +142,7 @@ class FolderEntry extends React.Component<Props, State> {
138142
onSelect,
139143
currentPath,
140144
currentTeamId,
145+
history,
141146
} = this.props;
142147

143148
const children = getDirectChildren(path, folders);
@@ -283,6 +288,14 @@ class FolderEntry extends React.Component<Props, State> {
283288
},
284289
variables,
285290
});
291+
const modifiedPath = path
292+
.split('/')
293+
.slice(0, -1)
294+
.join('/');
295+
296+
history.replace(
297+
`${basePath}${modifiedPath}/${input.value}`
298+
);
286299
},
287300
});
288301

@@ -392,8 +405,11 @@ const collectSource = (connect, monitor) => ({
392405
isDragging: monitor.isDragging(),
393406
});
394407

395-
DropFolderEntry = DropTarget(['SANDBOX', 'FOLDER'], entryTarget, collectTarget)(
396-
DragSource('FOLDER', entrySource, collectSource)(FolderEntry)
397-
) as any;
408+
DropFolderEntry = (withRouter(
409+
// @ts-ignore Don't know how to mix dnd and react-router with right typings
410+
DropTarget(['SANDBOX', 'FOLDER'], entryTarget, collectTarget)(
411+
DragSource('FOLDER', entrySource, collectSource)(FolderEntry)
412+
)
413+
) as unknown) as React.ComponentClass<Props, State>;
398414

399415
export { DropFolderEntry };

packages/app/src/app/pages/Profile/Showcase/SandboxInfo/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ import {
1313
PlayButtonContainer,
1414
} from './elements';
1515

16-
function SandboxInfo({ sandbox }) {
16+
function SandboxInfo({ sandbox, isLoggedIn }) {
1717
return (
1818
<Container>
1919
<Row alignItems="center">
2020
<Title>
21-
{getSandboxName(sandbox)} <Like sandbox={sandbox} />
21+
{getSandboxName(sandbox)}{' '}
22+
{isLoggedIn ? <Like sandbox={sandbox} /> : null}
2223
</Title>
2324
</Row>
2425
<Row alignItems="flex-start">

0 commit comments

Comments
 (0)