Skip to content

Commit 28df042

Browse files
merge
2 parents 86a7822 + 9a54f3a commit 28df042

File tree

65 files changed

+1167
-362
lines changed

Some content is hidden

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

65 files changed

+1167
-362
lines changed

contributor-docs/adding-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ preset.
148148

149149
We call a template configuration for the bundler in CodeSandbox a 'Preset'. All
150150
currently installed presets are defined in the
151-
[index.ts](https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/sandbox/eval/index.js)
151+
[index.ts](https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/sandbox/eval/index.ts)
152152
file under `codesandbox-client/packages/app/src/sandbox/eval/presets`.
153153

154154
In order to understand how this configuration works, we recommend you to take a

packages/app/config/webpack.common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ module.exports = {
138138
path.join(paths.sandboxSrc, 'index.js'),
139139
],
140140
'sandbox-startup': path.join(paths.sandboxSrc, 'startup.js'),
141+
'watermark-button': path.join(paths.src, 'watermark-button.js'),
141142
embed: [
142143
require.resolve('./polyfills'),
143144
path.join(paths.embedSrc, 'index.js'),

packages/app/src/app/components/CodeEditor/VSCode/workbench-theme.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,8 @@
234234
.context-view.monaco-menu-container {
235235
font-size: 0.75rem;
236236
}
237+
238+
/* Fixes https://github.com/codesandbox/codesandbox-client/issues/3882 */
239+
.monaco-editor .parameter-hints-widget {
240+
overflow-y: scroll;
241+
}

packages/app/src/app/graphql/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# source: https://codesandbox.stream/api/graphql
2-
# timestamp: Thu Apr 16 2020 12:44:25 GMT+0200 (Central European Summer Time)
2+
# timestamp: Thu Apr 16 2020 14:09:56 GMT+0200 (Central European Summer Time)
33

44
schema {
55
query: RootQuery

packages/app/src/app/graphql/types.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,16 @@ export type CommentRemovedSubscription = {
10161016
} & CommentFragment;
10171017
};
10181018

1019+
export type TeamsQueryVariables = {};
1020+
1021+
export type TeamsQuery = { __typename?: 'RootQueryType' } & {
1022+
me: Maybe<
1023+
{ __typename?: 'CurrentUser' } & {
1024+
teams: Array<{ __typename?: 'Team' } & Pick<Team, 'id' | 'name'>>;
1025+
}
1026+
>;
1027+
};
1028+
10191029
export type UnbookmarkTemplateFromDashboardMutationVariables = {
10201030
template: Scalars['ID'];
10211031
teamId: Maybe<Scalars['ID']>;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,10 @@ export const refetchSandboxInfo: AsyncAction = async ({
247247
export const acceptTeamInvitation: Action<{
248248
teamName: string;
249249
teamId: string;
250-
}> = ({ effects }, { teamName, teamId }) => {
250+
}> = ({ effects, actions }, { teamName }) => {
251251
effects.analytics.track('Team - Invitation Accepted', {});
252252

253-
effects.analytics.setGroup('teamName', teamName);
254-
effects.analytics.setGroup('teamId', teamId);
253+
actions.internal.trackCurrentTeams();
255254

256255
effects.notificationToast.success(`Accepted invitation to ${teamName}`);
257256
};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as collaboratorsSubscriptions from './collaborators/subscriptions';
66
import * as commentsMutations from './comments/mutations';
77
import * as commentsQueries from './comments/queries';
88
import * as commentSubscriptions from './comments/subscriptions';
9+
import * as teamsQueries from './teams/queries';
910

1011
export default graphql({
1112
subscriptions: {
@@ -15,6 +16,7 @@ export default graphql({
1516
queries: {
1617
...collaboratorsQueries,
1718
...commentsQueries,
19+
...teamsQueries,
1820
},
1921
mutations: {
2022
...collaboratorsMutations,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { TeamsQuery, TeamsQueryVariables } from 'app/graphql/types';
2+
import gql from 'graphql-tag';
3+
import { Query } from 'overmind-graphql';
4+
5+
export const teams: Query<TeamsQuery, TeamsQueryVariables> = gql`
6+
query Teams {
7+
me {
8+
teams {
9+
id
10+
name
11+
}
12+
}
13+
}
14+
`;

packages/app/src/app/overmind/effects/vscode/SandboxFsSync/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { appendFile, mkdir, rename, rmdir, unlink, writeFile } from './utils';
2121

2222
const global = getGlobal() as Window & { BrowserFS: any };
2323

24-
const SERVICE_URL = 'https://ata-fetcher.cloud/api/v5/typings';
24+
const SERVICE_URL = 'https://ata.codesandbox.io/api/v8';
2525

2626
declare global {
2727
interface Window {
@@ -395,7 +395,8 @@ class SandboxFsSync {
395395
}
396396

397397
private async fetchDependencyTypingFiles(name: string, version: string) {
398-
const fetchRequest = await fetch(`${SERVICE_URL}/${name}@${version}.json`);
398+
const dependencyQuery = encodeURIComponent(`${name}@${version}`);
399+
const fetchRequest = await fetch(`${SERVICE_URL}/${dependencyQuery}.json`);
399400

400401
if (!fetchRequest.ok) {
401402
throw new Error('Fetch error');

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import JSON5 from 'json5';
22
import codeSandboxTheme from '@codesandbox/common/lib/themes/codesandbox.json';
33
import codeSandboxBlackTheme from '@codesandbox/common/lib/themes/codesandbox-black';
4+
import { notificationState } from '@codesandbox/common/lib/utils/notifications';
5+
import { NotificationStatus } from '@codesandbox/notifications';
46

57
export function initializeThemeCache() {
68
try {
@@ -174,7 +176,25 @@ export function initializeCustomTheme() {
174176
const customTheme = localStorage.getItem('settings.manualCustomVSCodeTheme');
175177

176178
if (customTheme) {
177-
installCustomTheme('custom', 'Custom Theme', customTheme);
179+
try {
180+
installCustomTheme('custom', 'Custom Theme', JSON.parse(customTheme));
181+
} catch (e) {
182+
notificationState.addNotification({
183+
title: 'Something went wrong while installing the custom extension',
184+
message: e.message,
185+
status: NotificationStatus.ERROR,
186+
actions: {
187+
primary: [
188+
{
189+
label: 'Clear Custom Theme',
190+
run: () => {
191+
localStorage.removeItem('settings.manualCustomVSCodeTheme');
192+
},
193+
},
194+
],
195+
},
196+
});
197+
}
178198
}
179199
}
180200

0 commit comments

Comments
 (0)