Skip to content

Commit 7723f8e

Browse files
merge
2 parents 935a52b + 4534009 commit 7723f8e

File tree

36 files changed

+1833
-820
lines changed

36 files changed

+1833
-820
lines changed

.circleci/config.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ aliases:
2525

2626
- &restore_deps_cache
2727
keys:
28-
- v28-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
29-
- v28-dependency-cache-{{ .Branch }}
30-
- v28-dependency-cache
28+
- v29-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
29+
- v29-dependency-cache-{{ .Branch }}
30+
- v29-dependency-cache
3131

3232
- &save_deps_cache
33-
key: v28-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
33+
key: v29-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
3434
paths:
3535
- node_modules
3636
- packages/app/node_modules
@@ -49,51 +49,51 @@ aliases:
4949

5050
- &restore_standalone_deps_cache
5151
keys:
52-
- v28-standalone-dependency-cache-{{ .Branch }}-{{ checksum
52+
- v29-standalone-dependency-cache-{{ .Branch }}-{{ checksum
5353
"standalone-packages/codesandbox-browserfs/yarn.lock" }}
54-
- v28-standalone-dependency-cache-{{ .Branch }}
55-
- v28-standalone-dependency-cache
54+
- v29-standalone-dependency-cache-{{ .Branch }}
55+
- v29-standalone-dependency-cache
5656

5757
- &save_standalone_deps_cache
5858
key:
59-
v28-standalone-dependency-cache-{{ .Branch }}-{{ checksum
59+
v29-standalone-dependency-cache-{{ .Branch }}-{{ checksum
6060
"standalone-packages/codesandbox-browserfs/yarn.lock" }}
6161
paths:
6262
- standalone-packages/codesandbox-browserfs/node_modules
6363

6464
- &restore_prod_homepage_cache
65-
key: v28-prod-homepage-build-cache-master
65+
key: v29-prod-homepage-build-cache-master
6666

6767
- &restore_prod_result
6868
key:
69-
v28-prod-build-result-{{ .Environment.CIRCLE_BRANCH
69+
v29-prod-build-result-{{ .Environment.CIRCLE_BRANCH
7070
}}-{{.Environment.CIRCLE_SHA1 }}
7171

7272
- &save_prod_build_cache
7373
key:
74-
v28-prod-build-cache-{{ .Environment.CIRCLE_BRANCH
74+
v29-prod-build-cache-{{ .Environment.CIRCLE_BRANCH
7575
}}-{{.Environment.CIRCLE_SHA1 }}
7676
paths:
7777
- packages/app/node_modules/.cache
7878

7979
- &restore_prod_build_cache
8080
keys:
81-
- v28-prod-build-cache-{{ .Environment.CIRCLE_BRANCH
81+
- v29-prod-build-cache-{{ .Environment.CIRCLE_BRANCH
8282
}}-{{.Environment.CIRCLE_SHA1 }}
83-
- v28-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-
84-
- v28-prod-build-cache-master-
83+
- v29-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-
84+
- v29-prod-build-cache-master-
8585

8686
# To persist the images built by sharp
8787
- &save_prod_homepage_cache
8888
key:
89-
v28-prod-homepage-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{
89+
v29-prod-homepage-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{
9090
.Environment.CIRCLE_SHA1 }}
9191
paths:
9292
- ./packages/homepage/public
9393

9494
- &save_prod_result
9595
key:
96-
v28-prod-build-result-{{ .Environment.CIRCLE_BRANCH }}-{{
96+
v29-prod-build-result-{{ .Environment.CIRCLE_BRANCH }}-{{
9797
.Environment.CIRCLE_SHA1 }}
9898
paths:
9999
- ./www
@@ -134,14 +134,14 @@ commands:
134134
steps:
135135
- restore_cache:
136136
keys:
137-
- v28-source-cache-{{ .Branch }}-{{ .Revision }}
138-
- v28-source-cache-{{ .Branch }}-
139-
- v28-source-cache-
137+
- v29-source-cache-{{ .Branch }}-{{ .Revision }}
138+
- v29-source-cache-{{ .Branch }}-
139+
- v29-source-cache-
140140

141141
- checkout
142142

143143
- save_cache:
144-
key: v28-source-cache-{{ .Branch }}-{{ .Revision }}
144+
key: v29-source-cache-{{ .Branch }}-{{ .Revision }}
145145
paths:
146146
- '.git'
147147
build_deps:

packages/app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
"@codesandbox/executors": "^0.1.0",
7272
"@codesandbox/template-icons": "^1.0.1",
7373
"@emmetio/codemirror-plugin": "^0.3.5",
74-
"@samuelmeuli/font-manager": "^1.2.0",
7574
"@sentry/webpack-plugin": "^1.8.0",
7675
"@styled-system/css": "^5.0.23",
7776
"@svgr/core": "^2.4.1",

packages/app/src/app/components/Overlay/Overlay.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ interface IOverlayProps {
1313
noHeightAnimation?: boolean;
1414
}
1515

16+
const noop = () => undefined;
1617
export const Overlay: React.FC<IOverlayProps> = ({
1718
event,
1819
isOpen,
19-
onOpen = () => {},
20-
onClose = () => {},
20+
onOpen = noop,
21+
onClose = noop,
2122
children,
2223
content: Content,
2324
noHeightAnimation = true,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type ModalName =
7474
| 'searchDependencies'
7575
| 'signInForTemplates'
7676
| 'userSurvey';
77+
7778
export const modalOpened: Action<{ modal: ModalName; message?: string }> = (
7879
{ state, effects },
7980
{ modal, message }

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import * as internalActions from './internalActions';
55

66
export const internal = internalActions;
77

8-
export const notificationsOpened: AsyncAction = async ({ state, effects }) => {
8+
export const notificationsOpened: AsyncAction = async ({ state }) => {
99
state.userNotifications.notificationsOpened = true;
1010
state.userNotifications.unreadCount = 0;
11-
client.mutate({
11+
12+
await client.mutate({
1213
mutation: gql`
1314
mutation ClearNotificationCount {
1415
clearNotificationCount {

packages/app/src/app/overmind/utils/pushToAirtable.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
export default async ({ feedback, emoji, sandboxId, username, email }) => {
1+
export default async ({
2+
feedback,
3+
emoji,
4+
sandboxId,
5+
username,
6+
email,
7+
version,
8+
}) => {
29
const Airtable = await import(
310
/* webpackChunkName: 'airtable' */ './setAirtable'
411
);
@@ -13,6 +20,7 @@ export default async ({ feedback, emoji, sandboxId, username, email }) => {
1320
username,
1421
email,
1522
url: window.location.pathname,
23+
version,
1624
},
1725
err => {
1826
if (err) {

packages/app/src/app/pages/Dashboard/Content/Sandboxes/index.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,26 @@ import { Filters } from './Filters';
66
import { DashboardActions } from './Actions';
77
import { ITemplate } from './types';
88

9-
interface Props {
9+
interface IContentProps {
1010
sandboxes: any[];
11-
Header: React.ComponentType;
12-
SubHeader: React.ComponentType;
13-
ExtraElement: React.ComponentType;
11+
Header: React.ComponentType | string;
12+
SubHeader?: React.ComponentType;
13+
ExtraElement: React.ComponentType<IExtraElementProps>;
1414

15-
possibleTemplates: ITemplate[];
15+
possibleTemplates?: ITemplate[];
1616
isLoading?: boolean;
1717
hideOrder?: boolean;
1818
hideFilters?: boolean;
19-
page?: number;
19+
page?: number | string;
2020
actions?: any[];
2121
}
2222

23+
interface IExtraElementProps {
24+
style: React.CSSProperties;
25+
}
26+
2327
// eslint-disable-next-line react/prefer-stateless-function
24-
export class Content extends React.Component<Props> {
28+
export class Content extends React.Component<IContentProps> {
2529
render() {
2630
const {
2731
sandboxes,
@@ -40,7 +44,7 @@ export class Content extends React.Component<Props> {
4044
<Container>
4145
<HeaderContainer>
4246
<HeaderTitle>
43-
{Header}{' '}
47+
{Header}
4448
{sandboxes && !isLoading && (
4549
<span
4650
style={{

packages/app/src/app/pages/Dashboard/Content/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { Route, Switch, Redirect, withRouter } from 'react-router-dom';
33

4-
import RecentSandboxes from './routes/RecentSandboxes';
4+
import { RecentSandboxes } from './routes/RecentSandboxes';
55
import PathedSandboxes from './routes/PathedSandboxes';
66
import { Templates } from './routes/Templates';
77
import DeletedSandboxes from './routes/DeletedSandboxes';

packages/app/src/app/pages/Dashboard/Content/routes/RecentSandboxes/index.js

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React from 'react';
2+
import { Helmet } from 'react-helmet';
3+
import { useQuery } from '@apollo/react-hooks';
4+
5+
import { useOvermind } from 'app/overmind';
6+
import getMostUsedTemplate from '../../../utils/get-most-used-template';
7+
import { Content as Sandboxes } from '../../Sandboxes';
8+
import CreateNewSandbox from '../../CreateNewSandbox';
9+
import { RECENT_SANDBOXES_CONTENT_QUERY } from '../../../queries';
10+
11+
export const RecentSandboxes = () => {
12+
const { state } = useOvermind();
13+
const { loading, error, data } = useQuery(RECENT_SANDBOXES_CONTENT_QUERY, {
14+
variables: {
15+
orderField: state.dashboard.orderBy.field,
16+
orderDirection: state.dashboard.orderBy.order.toUpperCase(),
17+
},
18+
});
19+
20+
if (error) {
21+
return <div>Error!</div>;
22+
}
23+
24+
const sandboxes = loading ? [] : (data && data.me && data.me.sandboxes) || [];
25+
26+
let mostUsedTemplate = null;
27+
try {
28+
mostUsedTemplate = getMostUsedTemplate(sandboxes);
29+
} catch (e) {
30+
// Not critical
31+
}
32+
33+
// We want to hide all templates
34+
// TODO: make this a query variable for graphql and move the logic to the server
35+
const noTemplateSandboxes = sandboxes.filter(s => !s.customTemplate);
36+
return (
37+
<>
38+
<Helmet>
39+
<title>Recent Sandboxes - CodeSandbox</title>
40+
</Helmet>
41+
<Sandboxes
42+
isLoading={loading}
43+
Header="Recent Sandboxes"
44+
ExtraElement={({ style }) => (
45+
<CreateNewSandbox
46+
mostUsedSandboxTemplate={mostUsedTemplate}
47+
style={style}
48+
/>
49+
)}
50+
hideFilters
51+
sandboxes={noTemplateSandboxes}
52+
page="recent"
53+
/>
54+
</>
55+
);
56+
};

0 commit comments

Comments
 (0)