Skip to content

Commit 18cc7a2

Browse files
committed
Cleanup dashboard skeleton
1 parent f27c926 commit 18cc7a2

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import React from 'react';
1+
import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name';
22
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator';
33
import { Element, Link } from '@codesandbox/components';
4+
import React from 'react';
45

56
export const SandboxCard = ({ sandbox }) => (
67
<Element>
78
<Link href={sandboxUrl({ id: sandbox.id, alias: sandbox.alias })}>
8-
{sandbox.title || sandbox.alias || sandbox.id}
9+
{getSandboxName(sandbox)}
910
</Link>
1011
</Element>
1112
);

packages/app/src/app/pages/NewDashboard/Content/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react';
2-
import { Route, Switch, Redirect, withRouter } from 'react-router-dom';
1+
import React, { FunctionComponent } from 'react';
2+
import { Redirect, Route, Switch } from 'react-router-dom';
33

44
// import { RecentSandboxes } from './routes/RecentSandboxes';
55
// import PathedSandboxes from './routes/PathedSandboxes';
@@ -12,7 +12,7 @@ import { Element } from '@codesandbox/components';
1212
import { StartSandboxes } from './routes/StartSandboxes';
1313
import { Templates } from './routes/Templates';
1414

15-
const ContentComponent = () => (
15+
export const Content: FunctionComponent = () => (
1616
<Element style={{ width: 960, margin: '40px auto' }}>
1717
<Switch>
1818
<Route path="/new-dashboard/start" component={StartSandboxes} />
@@ -36,5 +36,3 @@ const ContentComponent = () => (
3636
</Switch>
3737
</Element>
3838
);
39-
40-
export const Content = withRouter(ContentComponent);

packages/app/src/app/pages/NewDashboard/Content/routes/StartSandboxes/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React from 'react';
1+
import React, { FunctionComponent } from 'react';
22
import css from '@styled-system/css';
33
import { Element, Text, Button } from '@codesandbox/components';
44
import { useQuery } from '@apollo/react-hooks';
5+
56
import { useOvermind } from 'app/overmind';
67
import {
78
RecentSandboxesQuery,
@@ -13,7 +14,7 @@ import { LIST_PERSONAL_TEMPLATES } from 'app/components/CreateNewSandbox/queries
1314
import { RECENT_SANDBOXES_CONTENT_QUERY } from '../../../queries';
1415
import { SandboxCard } from '../../../Components/SandboxCard';
1516

16-
export const StartSandboxes = () => {
17+
export const StartSandboxes: FunctionComponent = () => {
1718
const {
1819
state,
1920
actions: { modalOpened },
@@ -49,11 +50,8 @@ export const StartSandboxes = () => {
4950
return <Text>loading</Text>;
5051
}
5152

52-
const sandboxes = data && data.me && data.me.sandboxes;
53-
const templates =
54-
templatesData &&
55-
templatesData.me &&
56-
templatesData.me.recentlyUsedTemplates.slice(0, 4);
53+
const sandboxes = data.me.sandboxes;
54+
const templates = templatesData.me.recentlyUsedTemplates.slice(0, 4);
5755

5856
return (
5957
<Element>

packages/app/src/app/pages/NewDashboard/Content/routes/Templates/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { FunctionComponent } from 'react';
22
import css from '@styled-system/css';
33
import { Element, Text } from '@codesandbox/components';
44
import { useQuery } from '@apollo/react-hooks';
@@ -9,7 +9,7 @@ import {
99
import { LIST_OWNED_TEMPLATES } from 'app/components/CreateNewSandbox/queries';
1010
import { SandboxCard } from '../../../Components/SandboxCard';
1111

12-
export const Templates = () => {
12+
export const Templates: FunctionComponent = () => {
1313
const { loading, error, data } = useQuery<
1414
ListTemplatesQuery,
1515
ListTemplatesQueryVariables
@@ -25,7 +25,7 @@ export const Templates = () => {
2525
return <Text>loading</Text>;
2626
}
2727

28-
const templates = data && data.me && data.me.templates;
28+
const templates = data.me.templates;
2929

3030
return (
3131
<Element>

0 commit comments

Comments
 (0)