Skip to content

Commit f983813

Browse files
Merge branch 'fix-saving-code' of https://github.com/codesandbox/codesandbox-client into fix-saving-code
2 parents bfdac36 + 42c4d89 commit f983813

File tree

45 files changed

+1423
-314
lines changed

Some content is hidden

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

45 files changed

+1423
-314
lines changed

packages/app/src/app/components/CodeEditor/VSCode/Configuration/index.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { ConfigurationFile } from '@codesandbox/common/lib/templates/configuration/types';
2+
import { withTheme } from 'styled-components';
3+
import { ThemeProvider } from '@codesandbox/components';
24
import getUI from '@codesandbox/common/lib/templates/configuration/ui';
35
import theme from '@codesandbox/common/lib/theme';
46
import { Module } from '@codesandbox/common/lib/types';
@@ -23,9 +25,10 @@ type Props = EditorProps & {
2325
onChangeVSCode: (val: string) => void;
2426
onDispose: (cb: () => void) => void;
2527
openText: () => void;
28+
theme: any;
2629
};
2730

28-
export class Configuration extends React.PureComponent<Props>
31+
export class ConfigurationComponent extends React.PureComponent<Props>
2932
implements Editor {
3033
disposeInitializer: Function;
3134
currentModule: Module;
@@ -147,13 +150,16 @@ export class Configuration extends React.PureComponent<Props>
147150
More info...
148151
</a>
149152
</Description>
150-
151-
<ConfigWizard
152-
sandbox={sandbox}
153-
updateFile={this.updateFile}
154-
file={this.props.getCode()}
155-
/>
153+
<ThemeProvider theme={this.props.theme.vscodeTheme}>
154+
<ConfigWizard
155+
sandbox={sandbox}
156+
updateFile={this.updateFile}
157+
file={this.props.getCode()}
158+
/>
159+
</ThemeProvider>
156160
</Container>
157161
);
158162
}
159163
}
164+
165+
export const Configuration = withTheme(ConfigurationComponent);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ export type PathedSandboxesQuery = { __typename?: 'RootQueryType' } & {
12431243
export type RecentSandboxesQueryVariables = {
12441244
orderField: Scalars['String'];
12451245
orderDirection: Direction;
1246+
limit: Number;
12461247
};
12471248

12481249
export type RecentSandboxesQuery = { __typename?: 'RootQueryType' } & {
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import gql from 'graphql-tag';
2+
3+
export const sandboxFragment = gql`
4+
fragment Sandbox on Sandbox {
5+
id
6+
alias
7+
title
8+
description
9+
insertedAt
10+
updatedAt
11+
removedAt
12+
privacy
13+
screenshotUrl
14+
screenshotOutdated
15+
16+
source {
17+
template
18+
}
19+
20+
customTemplate {
21+
id
22+
}
23+
24+
forkedTemplate {
25+
id
26+
color
27+
}
28+
29+
collection {
30+
path
31+
teamId
32+
}
33+
}
34+
`;
35+
36+
export const sidebarCollection = gql`
37+
fragment SidebarCollection on Collection {
38+
id
39+
path
40+
}
41+
`;
42+
43+
export const templateFragment = gql`
44+
fragment Template on Template {
45+
id
46+
color
47+
iconUrl
48+
published
49+
sandbox {
50+
id
51+
alias
52+
title
53+
description
54+
insertedAt
55+
updatedAt
56+
57+
collection {
58+
team {
59+
name
60+
}
61+
}
62+
63+
author {
64+
username
65+
}
66+
67+
source {
68+
template
69+
}
70+
}
71+
}
72+
`;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// import {
2+
// CreateCommentMutation,
3+
// CreateCommentMutationVariables,
4+
// DeleteCommentMutation,
5+
// DeleteCommentMutationVariables,
6+
// ResolveCommentMutation,
7+
// ResolveCommentMutationVariables,
8+
// UnresolveCommentMutation,
9+
// UnresolveCommentMutationVariables,
10+
// UpdateCommentMutation,
11+
// UpdateCommentMutationVariables,
12+
// } from 'app/graphql/types';
13+
// import gql from 'graphql-tag';
14+
// import { Query } from 'overmind-graphql';
15+
16+
// import { commentFragment } from './fragments';
17+
18+
// export const unresolveComment: Query<
19+
// UnresolveCommentMutation,
20+
// UnresolveCommentMutationVariables
21+
// > = gql`
22+
// mutation UnresolveComment($commentId: ID!, $sandboxId: ID!) {
23+
// unresolveComment(commentId: $commentId, sandboxId: $sandboxId) {
24+
// id
25+
// }
26+
// }
27+
// `;
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
import {
2+
RecentSandboxesQuery,
3+
RecentSandboxesQueryVariables,
4+
PathedSandboxesQuery,
5+
PathedSandboxesQueryVariables,
6+
DeletedSandboxesQuery,
7+
DeletedSandboxesQueryVariables,
8+
ListTemplatesQuery,
9+
ListTemplatesQueryVariables,
10+
ListPersonalTemplatesQuery,
11+
ListPersonalTemplatesQueryVariables,
12+
TeamsQueryVariables,
13+
TeamsQuery,
14+
} from 'app/graphql/types';
15+
import gql from 'graphql-tag';
16+
import { Query } from 'overmind-graphql';
17+
18+
import {
19+
sandboxFragment,
20+
sidebarCollection,
21+
templateFragment,
22+
} from './fragments';
23+
24+
export const deletedSandboxes: Query<
25+
DeletedSandboxesQuery,
26+
DeletedSandboxesQueryVariables
27+
> = gql`
28+
query DeletedSandboxes {
29+
me {
30+
sandboxes(
31+
showDeleted: true
32+
orderBy: { field: "updated_at", direction: DESC }
33+
) {
34+
...Sandbox
35+
}
36+
}
37+
}
38+
${sandboxFragment}
39+
`;
40+
41+
export const sandboxesByPath: Query<
42+
PathedSandboxesQuery,
43+
PathedSandboxesQueryVariables
44+
> = gql`
45+
query PathedSandboxes($path: String!, $teamId: ID) {
46+
me {
47+
collections(teamId: $teamId) {
48+
...SidebarCollection
49+
}
50+
collection(path: $path, teamId: $teamId) {
51+
id
52+
path
53+
sandboxes {
54+
...Sandbox
55+
}
56+
}
57+
}
58+
}
59+
${sandboxFragment}
60+
${sidebarCollection}
61+
`;
62+
63+
export const ownedTemplates: Query<
64+
ListTemplatesQuery,
65+
ListTemplatesQueryVariables
66+
> = gql`
67+
query ListTemplates($showAll: Boolean) {
68+
me {
69+
templates(showAll: $showAll) {
70+
...Template
71+
}
72+
73+
teams {
74+
id
75+
name
76+
templates {
77+
...Template
78+
}
79+
}
80+
}
81+
}
82+
83+
${templateFragment}
84+
`;
85+
86+
export const getTeams: Query<TeamsQuery, TeamsQueryVariables> = gql`
87+
query Teams {
88+
me {
89+
teams {
90+
id
91+
name
92+
}
93+
}
94+
}
95+
`;
96+
97+
export const listPersonalTemplates: Query<
98+
ListPersonalTemplatesQuery,
99+
ListPersonalTemplatesQueryVariables
100+
> = gql`
101+
query ListPersonalTemplates {
102+
me {
103+
templates {
104+
...Template
105+
}
106+
107+
recentlyUsedTemplates {
108+
...Template
109+
110+
sandbox {
111+
git {
112+
id
113+
username
114+
commitSha
115+
path
116+
repo
117+
branch
118+
}
119+
}
120+
}
121+
122+
bookmarkedTemplates {
123+
...Template
124+
}
125+
126+
teams {
127+
id
128+
name
129+
bookmarkedTemplates {
130+
...Template
131+
}
132+
templates {
133+
...Template
134+
}
135+
}
136+
}
137+
}
138+
139+
${templateFragment}
140+
`;
141+
142+
export const recentSandboxes: Query<
143+
RecentSandboxesQuery,
144+
RecentSandboxesQueryVariables
145+
> = gql`
146+
query RecentSandboxes(
147+
$limit: Int!
148+
$orderField: String!
149+
$orderDirection: Direction!
150+
) {
151+
me {
152+
sandboxes(
153+
limit: $limit
154+
orderBy: { field: $orderField, direction: $orderDirection }
155+
) {
156+
...Sandbox
157+
}
158+
}
159+
}
160+
${sandboxFragment}
161+
`;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import * as commentsQueries from './comments/queries';
88
import * as commentSubscriptions from './comments/subscriptions';
99
import * as teamsQueries from './teams/queries';
1010

11+
import * as dashboardQueries from './dashboard/queries';
12+
1113
export default graphql({
1214
subscriptions: {
1315
...collaboratorsSubscriptions,
@@ -17,6 +19,7 @@ export default graphql({
1719
...collaboratorsQueries,
1820
...commentsQueries,
1921
...teamsQueries,
22+
...dashboardQueries,
2023
},
2124
mutations: {
2225
...collaboratorsMutations,

0 commit comments

Comments
 (0)